UnfoldIterative.cxx
Go to the documentation of this file.
2 
3 #include <iostream>
4 
5 namespace ana
6 {
7  //----------------------------------------------------------------------
9  int nIterations)
10  : fRT(rt), fNIterations(nIterations)
11  {
12  assert(nIterations > 0);
13  }
14 
15  //----------------------------------------------------------------------
17  {
18  }
19 
20  //----------------------------------------------------------------------
22  {
23  // Leave the member variable as a record of how the matrix started and work
24  // with this copy.
26 
27  rt.ReweightToRecoSpectrum(reco);
28 
29  Spectrum truth = rt.WeightingVariable();
30 
31  for(int i = 2; i <= fNIterations; ++i){
32  rt = fRT; // put it back how it started
33  rt.ReweightToTrueSpectrum(truth); // project back the other way
34  rt.ReweightToRecoSpectrum(reco); // and then forward again
35  truth = rt.WeightingVariable();
36  }
37 
38  return truth.FakeData(reco.POT());
39  }
40 }
const ReweightableSpectrum & fRT
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
unsigned int nIterations
Definition: UnfoldXSec.C:132
Spectrum with the value of a second variable, allowing for reweighting
void ReweightToRecoSpectrum(const Spectrum &target)
Recale bins so that Unweighted will return target.
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
Spectrum FakeData(double pot) const
Synonymous with AsimovData(). Retained for compatibility.
Definition: Spectrum.cxx:350
double POT() const
Definition: Spectrum.h:227
virtual Spectrum Truth(const Spectrum &reco) override
assert(nhit_max >=nhit_nbins)
UnfoldIterative(const ReweightableSpectrum &rt, int nIterations)
void ReweightToTrueSpectrum(const Spectrum &target)
Rescale bins so that WeightingVariable will return target.