All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UnfoldIterative.cxx
Go to the documentation of this file.
2 
3 #include <cassert>
4 
5 namespace ana
6 {
7  //----------------------------------------------------------------------
9  const ReweightableSpectrum& recoVsTrue,
10  unsigned int nIterations)
11  {
12  assert(nIterations > 0);
13 
14  // Working copy
15  ReweightableSpectrum rt = recoVsTrue;
16 
17  rt.ReweightToRecoSpectrum(reco);
18 
19  // First result after one iteration
20  Spectrum truth = rt.WeightingVariable();
21 
22  for(unsigned int i = 2; i <= nIterations; ++i){
23  rt = recoVsTrue; // put it back how it started
24  rt.ReweightToTrueSpectrum(truth); // project back the other way
25  rt.ReweightToRecoSpectrum(reco); // and then forward again
26  truth = rt.WeightingVariable();
27  }
28 
29  return truth.FakeData(reco.POT());
30  }
31 }
Spectrum with the value of a second variable, allowing for reweighting
void ReweightToRecoSpectrum(const Spectrum &target)
Recale bins so that Unweighted will return target.
process_name opflashCryoW ana
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:30
process_name standard_reco_uboone reco
Spectrum FakeData(double pot) const
Fake data is a MC spectrum scaled to the POT expected in the data.
double POT() const
Definition: Spectrum.h:289
Spectrum UnfoldIterative(const Spectrum &reco, const ReweightableSpectrum &recoVsTrue, unsigned int nIterations)
void ReweightToTrueSpectrum(const Spectrum &target)
Rescale bins so that WeightingVariable will return target.