Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ana::MichelDecomp Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-28/3FlavorAna/Decomp/MichelDecomp.h"

Inheritance diagram for ana::MichelDecomp:
ana::IDecomp

Public Member Functions

 MichelDecomp (SpectrumLoaderBase &NDMCloader, SpectrumLoaderBase &NDdataloader, const HistAxis &axis, const Cut &cut, const IDecomp *nNueEstimate, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftData=kNoShift, const Var &wei=kUnweighted)
 
 MichelDecomp (SpectrumLoaderBase &NDMCloader, SpectrumLoaderBase &NDdataloader, std::string label, const Binning &bins, const Var &var, const Cut &cut, const IDecomp *nNueEstimate, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftData=kNoShift, const Var &wei=kUnweighted)
 
 MichelDecomp (Loaders &loaders, const HistAxis &axis, const Cut &cut, const IDecomp *nNueEstimate, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftData=kNoShift, const Var &wei=kUnweighted)
 
 ~MichelDecomp ()
 
virtual Spectrum NCTotalComponent () const override
 
virtual Spectrum NCComponent () const override
 
virtual Spectrum NCAntiComponent () const override
 
virtual Spectrum NumuComponent () const override
 
virtual Spectrum AntiNumuComponent () const override
 
virtual Spectrum NueComponent () const override
 
virtual Spectrum AntiNueComponent () const override
 
virtual Spectrum Data_Component () const override
 
virtual Spectrum MCTotal () const
 
Spectrum MC_NCTotalComponent () const override
 
Spectrum MC_NCComponent () const override
 
Spectrum MC_NCAntiComponent () const override
 
Spectrum MC_NumuComponent () const override
 
Spectrum MC_AntiNumuComponent () const override
 
Spectrum MC_NueComponent () const override
 
Spectrum MC_AntiNueComponent () const override
 
virtual Spectrum MC_MCTotal () const
 
void SavePlots (TDirectory *dir) const
 
virtual void SaveTo (TDirectory *dir, const std::string &name) const override
 
const IDecompGetNueEstimateDecomp () const
 

Static Public Member Functions

static std::unique_ptr< MichelDecompLoadFrom (TDirectory *dir, const std::string &name)
 

Protected Member Functions

 MichelDecomp (Spectrum nc, Spectrum antinc, Spectrum numu, Spectrum antinumu, Spectrum nue, Spectrum antinue, Spectrum data, ReweightableSpectrum michelnc, ReweightableSpectrum michelnumu, ReweightableSpectrum michelnue, ReweightableSpectrum micheldata, const IDecomp *nueestimate)
 
void Decompose () const
 Calls ComputeScaleFactor for every process / E Bin, saves scale factors. More...
 
void SplitByProp (MDCMPHelper hSums, std::vector< double > &numuScales, std::vector< double > &ncScales, std::vector< double > &nueScales) const
 
void SplitByNue (MDCMPHelper hSums, std::vector< double > &numuScales, std::vector< double > &ncScales, std::vector< double > &nueScales) const
 
void SplitByMichels (int EIdx, MDCMPHelper hSums, std::vector< double > &numuScales, std::vector< double > &ncScales, std::vector< double > &nueScales) const
 
double GetNueScale (int EIdx) const
 Nue scale from input decomp. More...
 
double GetNumuScale (int EIdx) const
 Numu scale from input decomp. More...
 
double GetNCScale (int EIdx) const
 NC scale from input decomp. More...
 
double GetNumuMCContent (int EIdx) const
 Getting numu relative MC content. More...
 
double GetNCMCContent (int EIdx) const
 
double ComputeScaleFactor (int EIdx, MDCMPHelper hSums) const
 Starting code to run through decomp algebra //////////////////////////////////////////////////////////////////////// Compute scale factors. More...
 
double CalculateMCMean (double h, double Numu, double NC, double Nue, MDCMPHelper hSums) const
 Calculates the expected MC events, for a given scale factor. More...
 
double MDCMPLogLikelihood (double h, int EIdx, MDCMPHelper hSums) const
 Calculates the LL for a given scale, based on the data. More...
 
double ComputeMaxScale (MDCMPHelper hSums) const
 
double GetSum (ReweightableSpectrum spect, int EIdx) const
 Sums given spectrum over NME bins, for a given E Bin. More...
 
double GetTemplateContent (ReweightableSpectrum spect, int EIdx, int mIdx) const
 Gets bin content in template histogram, for a given E / NME bin. More...
 
virtual Spectrum MCToDCMPComp (std::vector< double >, Spectrum) const
 Ending code to run through decomp algebra. More...
 
void SaveCompPlots (TDirectory *dir, std::string comp, Spectrum dcmp, Spectrum mc) const
 
void SaveTempPlots (TDirectory *dir) const
 

Protected Attributes

Spectrum fNC
 
Spectrum fAntiNC
 
Spectrum fNumu
 
Spectrum fAntiNumu
 
Spectrum fNue
 
Spectrum fAntiNue
 
Spectrum fData
 
ReweightableSpectrum fMichelNC
 
ReweightableSpectrum fMichelNumu
 
ReweightableSpectrum fMichelNue
 
ReweightableSpectrum fMichelData
 
const IDecompfNueEstimate
 
bool fOwnNueEstimate
 
bool isDecomposed
 
MDCMPFitResults fFitResult
 

Detailed Description

Definition at line 44 of file MichelDecomp.h.

Constructor & Destructor Documentation

ana::MichelDecomp::MichelDecomp ( SpectrumLoaderBase NDMCloader,
SpectrumLoaderBase NDdataloader,
const HistAxis axis,
const Cut cut,
const IDecomp nNueEstimate,
const SystShifts shiftMC = kNoShift,
const SystShifts shiftData = kNoShift,
const Var wei = kUnweighted 
)

Definition at line 40 of file MichelDecomp.cxx.

Referenced by LoadFrom().

48  : fNC (NDMCloader, EAxis,
49  cut && kIsNC && !kIsAntiNu, shiftMC, wei),
50  fAntiNC (NDMCloader, EAxis,
51  cut && kIsNC && kIsAntiNu, shiftMC, wei),
52  fNumu (NDMCloader, EAxis,
53  cut && kIsNumuCC && !kIsAntiNu, shiftMC, wei),
54  fAntiNumu (NDMCloader, EAxis,
55  cut && kIsNumuCC && kIsAntiNu, shiftMC, wei),
56  fNue (NDMCloader, EAxis,
57  cut && kIsBeamNue && !kIsAntiNu, shiftMC, wei),
58  fAntiNue (NDMCloader, EAxis,
59  cut && kIsBeamNue && kIsAntiNu, shiftMC, wei),
60  fData (NDDataloader, EAxis, cut, shiftData, wei),
61  fMichelNC (NDMCloader, EAxis, MEAxis,
62  cut && kIsNC, shiftMC, wei),
63  fMichelNumu (NDMCloader, EAxis, MEAxis,
64  cut && kIsNumuCC, shiftMC, wei),
65  fMichelNue (NDMCloader, EAxis, MEAxis,
66  cut && kIsBeamNue, shiftMC, wei),
67  fMichelData (NDDataloader, EAxis, MEAxis,
68  cut, shiftData, wei),
69  fNueEstimate(nueEstimate),
70  fOwnNueEstimate(false),
71  isDecomposed(false)
72  {}
const Cut kIsNumuCC(CCFlavSel(14, 14))
Select CC .
const Cut kIsAntiNu([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return sr->mc.nu[0].pdg< 0;})
Is this truly an antineutrino?
Definition: TruthCuts.h:53
const Cut kIsBeamNue(CCFlavSel(12, 12))
Select CC .
const IDecomp * fNueEstimate
Definition: MichelDecomp.h:195
ReweightableSpectrum fMichelNumu
Definition: MichelDecomp.h:191
const Cut kIsNC([](const caf::SRProxy *sr){if(sr->mc.nnu==0) return false;assert(sr->mc.nnu==1);return!sr->mc.nu[0].iscc;})
Is this a Neutral Current event?
Definition: TruthCuts.h:8
ReweightableSpectrum fMichelData
Definition: MichelDecomp.h:193
ReweightableSpectrum fMichelNue
Definition: MichelDecomp.h:192
const Cut cut
Definition: exporter_fd.C:30
const HistAxis MEAxis("N_{Michels}", MEBinning, kNMichels)
Definition: MichelDecomp.h:21
ReweightableSpectrum fMichelNC
Definition: MichelDecomp.h:190
ana::MichelDecomp::MichelDecomp ( SpectrumLoaderBase NDMCloader,
SpectrumLoaderBase NDdataloader,
std::string  label,
const Binning bins,
const Var var,
const Cut cut,
const IDecomp nNueEstimate,
const SystShifts shiftMC = kNoShift,
const SystShifts shiftData = kNoShift,
const Var wei = kUnweighted 
)

Definition at line 74 of file MichelDecomp.cxx.

84  : MichelDecomp(NDMCloader, NDDataloader,
86  cut, nueEstimate, shiftMC, shiftData, wei)
87  {}
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
const char * label
const Binning bins
Definition: NumuCC_CPiBin.h:8
const Cut cut
Definition: exporter_fd.C:30
MichelDecomp(SpectrumLoaderBase &NDMCloader, SpectrumLoaderBase &NDdataloader, const HistAxis &axis, const Cut &cut, const IDecomp *nNueEstimate, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftData=kNoShift, const Var &wei=kUnweighted)
ana::MichelDecomp::MichelDecomp ( Loaders loaders,
const HistAxis axis,
const Cut cut,
const IDecomp nNueEstimate,
const SystShifts shiftMC = kNoShift,
const SystShifts shiftData = kNoShift,
const Var wei = kUnweighted 
)

Definition at line 89 of file MichelDecomp.cxx.

98  axis, cut, nueEstimate, shiftMC, shiftData, wei)
99  {}
Near Detector underground.
Definition: SREnums.h:10
const Cut cut
Definition: exporter_fd.C:30
std::vector< Loaders * > loaders
Definition: syst_header.h:386
MichelDecomp(SpectrumLoaderBase &NDMCloader, SpectrumLoaderBase &NDdataloader, const HistAxis &axis, const Cut &cut, const IDecomp *nNueEstimate, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftData=kNoShift, const Var &wei=kUnweighted)
ana::MichelDecomp::~MichelDecomp ( )

Definition at line 101 of file MichelDecomp.cxx.

References fNueEstimate, and fOwnNueEstimate.

102  {
103  if(fOwnNueEstimate) delete fNueEstimate;
104  }
const IDecomp * fNueEstimate
Definition: MichelDecomp.h:195
ana::MichelDecomp::MichelDecomp ( Spectrum  nc,
Spectrum  antinc,
Spectrum  numu,
Spectrum  antinumu,
Spectrum  nue,
Spectrum  antinue,
Spectrum  data,
ReweightableSpectrum  michelnc,
ReweightableSpectrum  michelnumu,
ReweightableSpectrum  michelnue,
ReweightableSpectrum  micheldata,
const IDecomp nueestimate 
)
inlineprotected

Definition at line 110 of file MichelDecomp.h.

References make_syst_table_plots::h, mc, ana::NC, ana::MDCMPFitResults::ncScales, ana::MDCMPFitResults::nueScales, ana::MDCMPFitResults::numuScales, and string.

118  : fNC(nc),
119  fAntiNC(antinc),
120  fNumu(numu),
121  fAntiNumu(antinumu),
122  fNue(nue),
123  fAntiNue(antinue),
124  fData(data),
125  fMichelNC(michelnc),
126  fMichelNumu(michelnumu),
127  fMichelNue(michelnue),
128  fMichelData(micheldata),
129  fNueEstimate(nueestimate),
130  fOwnNueEstimate(false),
131  isDecomposed(false) {}
const IDecomp * fNueEstimate
Definition: MichelDecomp.h:195
const XML_Char const XML_Char * data
Definition: expat.h:268
ReweightableSpectrum fMichelNumu
Definition: MichelDecomp.h:191
ReweightableSpectrum fMichelData
Definition: MichelDecomp.h:193
ReweightableSpectrum fMichelNue
Definition: MichelDecomp.h:192
enum BeamMode nc
ReweightableSpectrum fMichelNC
Definition: MichelDecomp.h:190

Member Function Documentation

Spectrum ana::MichelDecomp::AntiNueComponent ( ) const
overridevirtual

Implements ana::IDecomp.

Definition at line 426 of file MichelDecomp.cxx.

References Decompose(), fAntiNue, fFitResult, isDecomposed, MCToDCMPComp(), and ana::MDCMPFitResults::nueScales.

Referenced by MakeResultPlot(), MichelDecompTest(), NDHists(), nue_decomp_scales(), nue_decomp_scales_for_make_decomp(), and SavePlots().

426  {
427  if (!isDecomposed)
428  Decompose();
430  }
virtual Spectrum MCToDCMPComp(std::vector< double >, Spectrum) const
Ending code to run through decomp algebra.
void Decompose() const
Calls ComputeScaleFactor for every process / E Bin, saves scale factors.
std::vector< double > nueScales
Definition: MichelDecomp.h:27
MDCMPFitResults fFitResult
Definition: MichelDecomp.h:199
Spectrum ana::MichelDecomp::AntiNumuComponent ( ) const
overridevirtual

Implements ana::IDecomp.

Definition at line 440 of file MichelDecomp.cxx.

References Decompose(), fAntiNumu, fFitResult, isDecomposed, MCToDCMPComp(), and ana::MDCMPFitResults::numuScales.

Referenced by MakeResultPlot(), MichelDecompTest(), NDHists(), nue_decomp_scales(), nue_decomp_scales_for_make_decomp(), and SavePlots().

440  {
441  if (!isDecomposed)
442  Decompose();
444  }
virtual Spectrum MCToDCMPComp(std::vector< double >, Spectrum) const
Ending code to run through decomp algebra.
void Decompose() const
Calls ComputeScaleFactor for every process / E Bin, saves scale factors.
std::vector< double > numuScales
Definition: MichelDecomp.h:25
MDCMPFitResults fFitResult
Definition: MichelDecomp.h:199
double ana::MichelDecomp::CalculateMCMean ( double  h,
double  Numu,
double  NC,
double  Nue,
MDCMPHelper  hSums 
) const
protected

Calculates the expected MC events, for a given scale factor.

Definition at line 280 of file MichelDecomp.cxx.

References ana::assert(), ana::MDCMPHelper::fNueScale, ana::MDCMPHelper::fSumData, ana::MDCMPHelper::fSumNC, ana::MDCMPHelper::fSumNue, ana::MDCMPHelper::fSumNumu, extractScale::mean, and ana::NC.

Referenced by MDCMPLogLikelihood().

284  {
285  assert(hSums.fSumNC > 0 && "Don't have enough stats. Bailing.");
286 
287  double mean =
288  h*(Numu - hSums.fSumNumu / hSums.fSumNC * NC) +
289  hSums.fSumData / hSums.fSumNC * NC -
290  hSums.fNueScale*hSums.fSumNue / hSums.fSumNC * NC + hSums.fNueScale*Nue;
291  return mean;
292  }
assert(nhit_max >=nhit_nbins)
double ana::MichelDecomp::ComputeMaxScale ( MDCMPHelper  hSums) const
protected

Definition at line 272 of file MichelDecomp.cxx.

References ana::assert(), ana::MDCMPHelper::fNueScale, ana::MDCMPHelper::fSumData, ana::MDCMPHelper::fSumNue, and ana::MDCMPHelper::fSumNumu.

Referenced by ComputeScaleFactor().

272  {
273  assert(hSums.fSumNumu > 0 && "Don't have enough stats. Bailing.");
274  double MaxScale = (hSums.fSumData - hSums.fNueScale*hSums.fSumNue) /
275  hSums.fSumNumu;
276  return MaxScale;
277  }
assert(nhit_max >=nhit_nbins)
double ana::MichelDecomp::ComputeScaleFactor ( int  EIdx,
MDCMPHelper  hSums 
) const
protected

Starting code to run through decomp algebra //////////////////////////////////////////////////////////////////////// Compute scale factors.

Definition at line 249 of file MichelDecomp.cxx.

References ComputeMaxScale(), dx, MDCMPLogLikelihood(), and scale.

Referenced by SplitByMichels().

249  {
250  double dx = 0.01;
251 
252  // Gives the bounds for the scale factor after each iteration
253  double MinScale = 0;
254  double MaxScale = ComputeMaxScale(hSums);
255  double scale = (MaxScale-MinScale) / 2;
256 
257  // Continue for 10 iterations
258  for (double N = 0; N < 10; N++){
259  // Adjust dx to be within the current allowed scale factors
260  if ((MaxScale - MinScale) < 2*dx)
261  dx = (MaxScale - MinScale)/4;
262  double likeplus = MDCMPLogLikelihood(scale+dx, EIdx, hSums);
263  double likeminus = MDCMPLogLikelihood(scale-dx, EIdx, hSums);
264  MaxScale = (likeplus > likeminus) ? MaxScale : scale;
265  MinScale = (likeplus > likeminus) ? scale : MinScale;
266  scale = (MaxScale+MinScale)/2;
267  }
268  return scale;
269  }
double MDCMPLogLikelihood(double h, int EIdx, MDCMPHelper hSums) const
Calculates the LL for a given scale, based on the data.
Double_t scale
Definition: plot.C:25
double dx[NP][NC]
double ComputeMaxScale(MDCMPHelper hSums) const
Spectrum ana::MichelDecomp::Data_Component ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 502 of file MichelDecomp.cxx.

References fData.

Referenced by nue_decomp_scales_for_make_decomp(), PlotNueDecompFourBins(), TableNueNDComponents(), and TableNueNDDataMC().

502  {
503  return fData;
504  }
void ana::MichelDecomp::Decompose ( ) const
protected

Calls ComputeScaleFactor for every process / E Bin, saves scale factors.

Definition at line 107 of file MichelDecomp.cxx.

References fFitResult, fMichelData, fMichelNC, fMichelNue, fMichelNumu, ana::MDCMPHelper::fNCScale, ana::MDCMPHelper::fNueScale, fNumu, ana::MDCMPHelper::fNumuScale, ana::MDCMPHelper::fSumData, ana::MDCMPHelper::fSumNC, ana::MDCMPHelper::fSumNue, ana::MDCMPHelper::fSumNumu, GetNCMCContent(), GetNCScale(), GetNueScale(), GetNumuMCContent(), GetNumuScale(), GetSum(), isDecomposed, ana::MDCMPFitResults::ncScales, ana::MDCMPFitResults::nueScales, ana::MDCMPFitResults::numuScales, SplitByMichels(), SplitByNue(), and ana::Spectrum::ToTH1().

Referenced by AntiNueComponent(), AntiNumuComponent(), NCAntiComponent(), NCComponent(), NCTotalComponent(), NueComponent(), and NumuComponent().

107  {
108  std::vector<double> numuScales;
109  std::vector<double> ncScales;
110  std::vector<double> nueScales;
111 
112  TH1* EIdxLimitHist = fNumu.ToTH1(1e20);
113  for (int EIdx = 1; EIdx <= EIdxLimitHist->GetNbinsX(); EIdx++){
114  // Get appropriate nuescale from input decomp
115 
116  // Stores sums of our histograms, to reduce computing in functions
117  MDCMPHelper hSums;
118  hSums.fSumData = GetSum(fMichelData, EIdx);
119  hSums.fSumNumu = GetSum(fMichelNumu, EIdx);
120  hSums.fSumNC = GetSum(fMichelNC, EIdx);
121  hSums.fSumNue = GetSum(fMichelNue, EIdx);
122  hSums.fNueScale = GetNueScale(EIdx);
123  hSums.fNumuScale = GetNumuScale(EIdx);
124  hSums.fNCScale = GetNCScale(EIdx);
125 
126  // Typical nue slices have about 1/8 SlcME's per slice
127  // So, if there are more than about 80 events in a bin, we have
128  // at least 10 SlcME's in that bin, which is enough to run MDCMP
129  // If we have fewer, proportionally split NC's and CC's
130 
131  // Instead of cheacking total number of events in a bin, look at
132  // number of data events seen, less the nue component predicted
133  /*if (EIdx == 1 || EIdx == 2 || EIdx == 8 || EIdx == 9 || EIdx == 10 ||
134  EIdx ==11 || EIdx ==16 || EIdx ==17 || EIdx ==18 || EIdx == 19 ||
135  EIdx ==20 || EIdx ==21 || EIdx > 23)*/
136  if ((GetNumuMCContent(EIdx) < .2) || (GetNCMCContent(EIdx) == .0))
137  //SplitByProp(hSums, numuScales, ncScales, nueScales);
138  SplitByNue(hSums, numuScales, ncScales, nueScales);
139  else
140  SplitByMichels(EIdx, hSums, numuScales, ncScales, nueScales);
141  }
142  delete EIdxLimitHist;
143 
144  fFitResult.numuScales = numuScales;
145  fFitResult.ncScales = ncScales;
146  fFitResult.nueScales = nueScales;
147  isDecomposed = true;
148  }
std::vector< double > ncScales
Definition: MichelDecomp.h:26
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
double GetNumuScale(int EIdx) const
Numu scale from input decomp.
double GetNumuMCContent(int EIdx) const
Getting numu relative MC content.
double GetNCMCContent(int EIdx) const
double GetNCScale(int EIdx) const
NC scale from input decomp.
ReweightableSpectrum fMichelNumu
Definition: MichelDecomp.h:191
void SplitByMichels(int EIdx, MDCMPHelper hSums, std::vector< double > &numuScales, std::vector< double > &ncScales, std::vector< double > &nueScales) const
ReweightableSpectrum fMichelData
Definition: MichelDecomp.h:193
std::vector< double > nueScales
Definition: MichelDecomp.h:27
std::vector< double > numuScales
Definition: MichelDecomp.h:25
ReweightableSpectrum fMichelNue
Definition: MichelDecomp.h:192
double GetSum(ReweightableSpectrum spect, int EIdx) const
Sums given spectrum over NME bins, for a given E Bin.
MDCMPFitResults fFitResult
Definition: MichelDecomp.h:199
double GetNueScale(int EIdx) const
Nue scale from input decomp.
ReweightableSpectrum fMichelNC
Definition: MichelDecomp.h:190
void SplitByNue(MDCMPHelper hSums, std::vector< double > &numuScales, std::vector< double > &ncScales, std::vector< double > &nueScales) const
double ana::MichelDecomp::GetNCMCContent ( int  EIdx) const
protected

Definition at line 236 of file MichelDecomp.cxx.

References fAntiNC, fAntiNue, fAntiNumu, fNC, fNue, fNumu, nc, and ana::Ratio::ToTH1().

Referenced by Decompose().

236  {
238  Ratio ncrat = nc / (nc+fNumu+fAntiNumu+fNue+fAntiNue);
239  TH1* hncrat = ncrat.ToTH1();
240  double nccont = hncrat->GetBinContent(EIdx);
241  delete hncrat;
242  return nccont;
243  }
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
std::vector< float > Spectrum
Definition: Constants.h:610
enum BeamMode nc
double ana::MichelDecomp::GetNCScale ( int  EIdx) const
protected

NC scale from input decomp.

Definition at line 217 of file MichelDecomp.cxx.

References fAntiNC, fNC, fNueEstimate, nc, ana::IDecomp::NCTotalComponent(), scale, and ana::Ratio::ToTH1().

Referenced by Decompose().

217  {
219  Ratio ncrat = nc / (fNC+fAntiNC);
220  TH1* hncrat = ncrat.ToTH1();
221  double scale = hncrat->GetBinContent(EIdx);
222  delete hncrat;
223  return scale;
224  }
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
const IDecomp * fNueEstimate
Definition: MichelDecomp.h:195
Double_t scale
Definition: plot.C:25
std::vector< float > Spectrum
Definition: Constants.h:610
virtual Spectrum NCTotalComponent() const
Definition: IDecomp.h:18
enum BeamMode nc
const IDecomp* ana::MichelDecomp::GetNueEstimateDecomp ( ) const
inline

Definition at line 108 of file MichelDecomp.h.

108 {return fNueEstimate;}
const IDecomp * fNueEstimate
Definition: MichelDecomp.h:195
double ana::MichelDecomp::GetNueScale ( int  EIdx) const
protected

Nue scale from input decomp.

Definition at line 195 of file MichelDecomp.cxx.

References ana::IDecomp::AntiNueComponent(), fAntiNue, fNue, fNueEstimate, ana::nue, ana::IDecomp::NueComponent(), scale, and ana::Ratio::ToTH1().

Referenced by Decompose().

195  {
198  Ratio nuerat = nue / (fNue+fAntiNue);
199  TH1* hnuerat = nuerat.ToTH1();
200  double scale = hnuerat->GetBinContent(EIdx);
201  delete hnuerat;
202  return scale;
203  }
virtual Spectrum AntiNueComponent() const =0
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
const IDecomp * fNueEstimate
Definition: MichelDecomp.h:195
Double_t scale
Definition: plot.C:25
std::vector< float > Spectrum
Definition: Constants.h:610
virtual Spectrum NueComponent() const =0
double ana::MichelDecomp::GetNumuMCContent ( int  EIdx) const
protected

Getting numu relative MC content.

Definition at line 227 of file MichelDecomp.cxx.

References fAntiNC, fAntiNue, fAntiNumu, fNC, fNue, fNumu, and ana::Ratio::ToTH1().

Referenced by Decompose().

227  {
229  Ratio numurat = numu / (numu+fNC+fAntiNC+fNue+fAntiNue);
230  TH1* hnumurat = numurat.ToTH1();
231  double numucont = hnumurat->GetBinContent(EIdx);
232  delete hnumurat;
233  return numucont;
234  }
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
std::vector< float > Spectrum
Definition: Constants.h:610
double ana::MichelDecomp::GetNumuScale ( int  EIdx) const
protected

Numu scale from input decomp.

Definition at line 206 of file MichelDecomp.cxx.

References ana::IDecomp::AntiNumuComponent(), fAntiNumu, fNueEstimate, fNumu, ana::IDecomp::NumuComponent(), scale, and ana::Ratio::ToTH1().

Referenced by Decompose().

206  {
209  Ratio numurat = numu / (fNumu+fAntiNumu);
210  TH1* hnumurat = numurat.ToTH1();
211  double scale = hnumurat->GetBinContent(EIdx);
212  delete hnumurat;
213  return scale;
214  }
TH1D * ToTH1(double exposure, Color_t col=kBlack, Style_t style=kSolid, EExposureType expotype=kPOT, EBinType bintype=kBinContent) const
Histogram made from this Spectrum, scaled to some exposure.
Definition: Spectrum.cxx:148
virtual Spectrum NumuComponent() const =0
const IDecomp * fNueEstimate
Definition: MichelDecomp.h:195
Double_t scale
Definition: plot.C:25
virtual Spectrum AntiNumuComponent() const =0
std::vector< float > Spectrum
Definition: Constants.h:610
double ana::MichelDecomp::GetSum ( ReweightableSpectrum  spect,
int  EIdx 
) const
protected

Sums given spectrum over NME bins, for a given E Bin.

Definition at line 322 of file MichelDecomp.cxx.

References fData, analysePickle::hist, ana::Spectrum::POT(), sum, and ana::ReweightableSpectrum::ToTH2().

Referenced by Decompose().

322  {
323  TH2* hist = spect.ToTH2(fData.POT());
324  double sum = hist->ProjectionX()->GetBinContent(EIdx);
325  delete hist;
326  return sum;
327  }
double POT() const
Definition: Spectrum.h:227
Double_t sum
Definition: plot.C:31
double ana::MichelDecomp::GetTemplateContent ( ReweightableSpectrum  spect,
int  EIdx,
int  mIdx 
) const
protected

Gets bin content in template histogram, for a given E / NME bin.

Definition at line 330 of file MichelDecomp.cxx.

References fData, analysePickle::hist, ana::Spectrum::POT(), and ana::ReweightableSpectrum::ToTH2().

Referenced by MDCMPLogLikelihood().

331  {
332  TH2* hist = spec.ToTH2(fData.POT());
333  double content = hist->GetBinContent(EIdx, mIdx);
334  delete hist;
335  return content;
336  }
double POT() const
Definition: Spectrum.h:227
std::unique_ptr< MichelDecomp > ana::MichelDecomp::LoadFrom ( TDirectory *  dir,
const std::string name 
)
static

Definition at line 534 of file MichelDecomp.cxx.

References ana::assert(), dir, fOwnNueEstimate, ana::LoadFrom< IDecomp >(), MichelDecomp(), nc, ana::nue, runNovaSAM::release, and runNovaSAM::ret.

Referenced by draw_decomp_plots(), nue_decomp_scales(), and plot_nominal_spectra().

534  {
535  dir = dir->GetDirectory(name.c_str()); // switch to subdir
536  assert(dir);
537 
538  Spectrum* nc = ana::LoadFrom<Spectrum>
539  (dir, "NC").release();
540  Spectrum* antinc = ana::LoadFrom<Spectrum>
541  (dir, "AntiNC").release();
542  Spectrum* numu = ana::LoadFrom<Spectrum>
543  (dir, "Numu").release();
544  Spectrum* antinumu = ana::LoadFrom<Spectrum>
545  (dir, "AntiNumu").release();
546  Spectrum* nue = ana::LoadFrom<Spectrum>
547  (dir, "Nue").release();
548  Spectrum* antinue = ana::LoadFrom<Spectrum>
549  (dir, "AntiNue").release();
550  Spectrum* data = ana::LoadFrom<Spectrum>
551  (dir, "Data").release();
552  ReweightableSpectrum* tempnc = ana::LoadFrom<ReweightableSpectrum>
553  (dir, "TempNC").release();
554  ReweightableSpectrum* tempnumu = ana::LoadFrom<ReweightableSpectrum>
555  (dir, "TempNumu").release();
556  ReweightableSpectrum* tempnue = ana::LoadFrom<ReweightableSpectrum>
557  (dir, "TempNue").release();
558  ReweightableSpectrum* tempdata = ana::LoadFrom<ReweightableSpectrum>
559  (dir, "TempData").release();
560  const IDecomp* nueEst = ana::LoadFrom<IDecomp>
561  (dir, "NueEstimate").release();
562 
563  MichelDecomp* ret =
564  new MichelDecomp(*nc, *antinc,
565  *numu, *antinumu, *nue, *antinue, *data,
566  *tempnc, *tempnumu, *tempnue, *tempdata, nueEst);
567 
568  ret->fOwnNueEstimate = true;
569 
570  delete dir;
571 
572  return std::unique_ptr<MichelDecomp>(ret);
573  }
const XML_Char * name
Definition: expat.h:151
const XML_Char const XML_Char * data
Definition: expat.h:268
std::vector< float > Spectrum
Definition: Constants.h:610
TDirectory * dir
Definition: macro.C:5
enum BeamMode nc
MichelDecomp(SpectrumLoaderBase &NDMCloader, SpectrumLoaderBase &NDdataloader, const HistAxis &axis, const Cut &cut, const IDecomp *nNueEstimate, const SystShifts &shiftMC=kNoShift, const SystShifts &shiftData=kNoShift, const Var &wei=kUnweighted)
assert(nhit_max >=nhit_nbins)
std::unique_ptr< IDecomp > LoadFrom< IDecomp >(TDirectory *dir, const std::string &label)
Definition: IDecomp.cxx:53
Spectrum ana::MichelDecomp::MC_AntiNueComponent ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 472 of file MichelDecomp.cxx.

References fAntiNue.

Referenced by GetNueNDComponentsMC(), MakeResultPlot(), NDHists(), and nue_decomp_scales_for_make_decomp().

472  {
473  return fAntiNue;
474  }
Spectrum ana::MichelDecomp::MC_AntiNumuComponent ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 482 of file MichelDecomp.cxx.

References fAntiNumu.

Referenced by GetNueNDComponentsMC(), MakeResultPlot(), NDHists(), and nue_decomp_scales_for_make_decomp().

482  {
483  return fAntiNumu;
484  }
virtual Spectrum ana::MichelDecomp::MC_MCTotal ( ) const
inlinevirtual

Definition at line 100 of file MichelDecomp.h.

References dir, ana::LoadFrom(), ana::SaveTo(), and string.

Spectrum MC_AntiNumuComponent() const override
Spectrum MC_NCTotalComponent() const override
Spectrum MC_NumuComponent() const override
Spectrum MC_NueComponent() const override
Spectrum MC_AntiNueComponent() const override
Spectrum ana::MichelDecomp::MC_NCAntiComponent ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 497 of file MichelDecomp.cxx.

References fAntiNC.

497  {
498  return fAntiNC;
499  }
Spectrum ana::MichelDecomp::MC_NCComponent ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 492 of file MichelDecomp.cxx.

References fNC.

Referenced by nue_decomp_scales_for_make_decomp().

492  {
493  return fNC;
494  }
Spectrum ana::MichelDecomp::MC_NCTotalComponent ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 487 of file MichelDecomp.cxx.

References fAntiNC, and fNC.

Referenced by GetNueNDComponentsMC(), MakeResultPlot(), and NDHists().

487  {
488  return fNC+fAntiNC;
489  }
Spectrum ana::MichelDecomp::MC_NueComponent ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 467 of file MichelDecomp.cxx.

References fNue.

Referenced by GetNueNDComponentsMC(), MakeResultPlot(), NDHists(), and nue_decomp_scales_for_make_decomp().

467  {
468  return fNue;
469  }
Spectrum ana::MichelDecomp::MC_NumuComponent ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 477 of file MichelDecomp.cxx.

References fNumu.

Referenced by GetNueNDComponentsMC(), MakeResultPlot(), NDHists(), and nue_decomp_scales_for_make_decomp().

477  {
478  return fNumu;
479  }
Spectrum ana::MichelDecomp::MCToDCMPComp ( std::vector< double >  scales,
Spectrum  MCComp 
) const
protectedvirtual

Ending code to run through decomp algebra.

Definition at line 343 of file MichelDecomp.cxx.

References fData, fMichelData, ana::ReweightableSpectrum::GetBinnings(), ana::Spectrum::GetEigen(), ana::ReweightableSpectrum::GetLabels(), ana::Spectrum::Livetime(), and ana::Spectrum::POT().

Referenced by AntiNueComponent(), AntiNumuComponent(), NCAntiComponent(), NCComponent(), NueComponent(), and NumuComponent().

344  {
345  Eigen::ArrayXd scaledMC = MCComp.GetEigen(fData.POT());
346  for (int EIdx = 0; EIdx < scaledMC.size()-2; EIdx++){
347  // Bin content in new histogram is old content * fit scale
348  int binidx = EIdx+1; // Root counts bins starting at 1
349  double bincont = scales[EIdx]*scaledMC[binidx];
350  scaledMC[binidx] = bincont;
351  }
352  return Spectrum(std::move(scaledMC),
354  fData.POT(), fData.Livetime());
355  }
_HistAxis< Var > HistAxis
Definition: HistAxis.h:103
const std::vector< std::string > & GetLabels() const
ReweightableSpectrum fMichelData
Definition: MichelDecomp.h:193
const std::vector< Binning > & GetBinnings() const
std::vector< float > Spectrum
Definition: Constants.h:610
double POT() const
Definition: Spectrum.h:227
double Livetime() const
Seconds. For informational purposes only. No calculations use this.
Definition: Spectrum.h:230
virtual Spectrum ana::MichelDecomp::MCTotal ( ) const
inlinevirtual

Definition at line 89 of file MichelDecomp.h.

virtual Spectrum AntiNumuComponent() const override
virtual Spectrum NCComponent() const override
virtual Spectrum NumuComponent() const override
virtual Spectrum AntiNueComponent() const override
virtual Spectrum NueComponent() const override
virtual Spectrum NCAntiComponent() const override
double ana::MichelDecomp::MDCMPLogLikelihood ( double  h,
int  EIdx,
MDCMPHelper  hSums 
) const
protected

Calculates the LL for a given scale, based on the data.

Definition at line 295 of file MichelDecomp.cxx.

References CalculateMCMean(), e, fMichelData, fMichelNC, fMichelNue, fMichelNumu, GetTemplateContent(), extractScale::mean, ana::NC, and ana::ReweightableSpectrum::ToTH2().

Referenced by ComputeScaleFactor().

296  {
297  double LL = 0;
298 
299  TH1* mIdxLimitHist = fMichelNumu.ToTH2(1e20);
300  for (int mIdx = 1; mIdx <= mIdxLimitHist->GetNbinsY(); mIdx++){
301  double Data = GetTemplateContent(fMichelData, EIdx, mIdx);
302  double Numu = GetTemplateContent(fMichelNumu, EIdx, mIdx);
303  double NC = GetTemplateContent(fMichelNC, EIdx, mIdx);
304  double Nue = GetTemplateContent(fMichelNue, EIdx, mIdx);
305  double mean = CalculateMCMean(h, Numu, NC, Nue, hSums);
306  if (mean == 0 && Data == 0)
307  continue;
308  if (Data == 0){
309  LL += Data - mean;
310  continue;
311  }
312  if (mean == 0)
313  mean = 1e-10;
314  LL += Data - Data * TMath::Log(Data / mean) - mean;
315  }
316  delete mIdxLimitHist;
317 
318  return LL;
319  }
double GetTemplateContent(ReweightableSpectrum spect, int EIdx, int mIdx) const
Gets bin content in template histogram, for a given E / NME bin.
double CalculateMCMean(double h, double Numu, double NC, double Nue, MDCMPHelper hSums) const
Calculates the expected MC events, for a given scale factor.
ReweightableSpectrum fMichelNumu
Definition: MichelDecomp.h:191
ReweightableSpectrum fMichelData
Definition: MichelDecomp.h:193
ReweightableSpectrum fMichelNue
Definition: MichelDecomp.h:192
Float_t e
Definition: plot.C:35
ReweightableSpectrum fMichelNC
Definition: MichelDecomp.h:190
TH2D * ToTH2(double pot) const
Spectrum ana::MichelDecomp::NCAntiComponent ( ) const
overridevirtual

Implements ana::IDecomp.

Definition at line 459 of file MichelDecomp.cxx.

References Decompose(), fAntiNC, fFitResult, isDecomposed, MCToDCMPComp(), and ana::MDCMPFitResults::ncScales.

Referenced by NCTotalComponent(), and SavePlots().

459  {
460  if (!isDecomposed)
461  Decompose();
463  }
std::vector< double > ncScales
Definition: MichelDecomp.h:26
virtual Spectrum MCToDCMPComp(std::vector< double >, Spectrum) const
Ending code to run through decomp algebra.
void Decompose() const
Calls ComputeScaleFactor for every process / E Bin, saves scale factors.
MDCMPFitResults fFitResult
Definition: MichelDecomp.h:199
Spectrum ana::MichelDecomp::NCComponent ( ) const
overridevirtual

Implements ana::IDecomp.

Definition at line 453 of file MichelDecomp.cxx.

References Decompose(), fFitResult, fNC, isDecomposed, MCToDCMPComp(), and ana::MDCMPFitResults::ncScales.

Referenced by NCTotalComponent(), nue_decomp_scales(), nue_decomp_scales_for_make_decomp(), and SavePlots().

453  {
454  if (!isDecomposed)
455  Decompose();
457  }
std::vector< double > ncScales
Definition: MichelDecomp.h:26
virtual Spectrum MCToDCMPComp(std::vector< double >, Spectrum) const
Ending code to run through decomp algebra.
void Decompose() const
Calls ComputeScaleFactor for every process / E Bin, saves scale factors.
MDCMPFitResults fFitResult
Definition: MichelDecomp.h:199
Spectrum ana::MichelDecomp::NCTotalComponent ( ) const
overridevirtual

Reimplemented from ana::IDecomp.

Definition at line 447 of file MichelDecomp.cxx.

References Decompose(), isDecomposed, NCAntiComponent(), and NCComponent().

Referenced by MakeResultPlot(), MichelDecompTest(), and NDHists().

447  {
448  if (!isDecomposed)
449  Decompose();
450  return NCComponent()+NCAntiComponent();
451  }
virtual Spectrum NCComponent() const override
void Decompose() const
Calls ComputeScaleFactor for every process / E Bin, saves scale factors.
virtual Spectrum NCAntiComponent() const override
Spectrum ana::MichelDecomp::NueComponent ( ) const
overridevirtual

Implements ana::IDecomp.

Definition at line 419 of file MichelDecomp.cxx.

References Decompose(), fFitResult, fNue, isDecomposed, MCToDCMPComp(), and ana::MDCMPFitResults::nueScales.

Referenced by draw_decomp_plots(), MakeResultPlot(), MichelDecompTest(), NDHists(), nue_decomp_scales(), nue_decomp_scales_for_make_decomp(), and SavePlots().

419  {
420  if (!isDecomposed)
421  Decompose();
423  }
virtual Spectrum MCToDCMPComp(std::vector< double >, Spectrum) const
Ending code to run through decomp algebra.
void Decompose() const
Calls ComputeScaleFactor for every process / E Bin, saves scale factors.
std::vector< double > nueScales
Definition: MichelDecomp.h:27
MDCMPFitResults fFitResult
Definition: MichelDecomp.h:199
Spectrum ana::MichelDecomp::NumuComponent ( ) const
overridevirtual

Implements ana::IDecomp.

Definition at line 433 of file MichelDecomp.cxx.

References Decompose(), fFitResult, fNumu, isDecomposed, MCToDCMPComp(), and ana::MDCMPFitResults::numuScales.

Referenced by MakeResultPlot(), MichelDecompTest(), NDHists(), nue_decomp_scales(), nue_decomp_scales_for_make_decomp(), SavePlots(), and test_micheldecomp().

433  {
434  if (!isDecomposed)
435  Decompose();
437  }
virtual Spectrum MCToDCMPComp(std::vector< double >, Spectrum) const
Ending code to run through decomp algebra.
void Decompose() const
Calls ComputeScaleFactor for every process / E Bin, saves scale factors.
std::vector< double > numuScales
Definition: MichelDecomp.h:25
MDCMPFitResults fFitResult
Definition: MichelDecomp.h:199
void ana::MichelDecomp::SaveCompPlots ( TDirectory *  dir,
std::string  comp,
Spectrum  dcmp,
Spectrum  mc 
) const
protected

Definition at line 358 of file MichelDecomp.cxx.

References fData, plot_xsec_1d::hmc, pot, ana::Spectrum::POT(), and ana::Spectrum::ToTH1().

Referenced by SavePlots().

360  {
361  double pot = fData.POT();
362  dir->cd();
363  TH1* hdcmp = dcmp.ToTH1(pot);
364  hdcmp->Write((comp+"_micheldecomp").c_str());
365  TH1* hmc = mc.ToTH1(pot);
366  hmc->Write((comp+"_mc").c_str());
367 
368  TH1* hratio = (TH1*)hdcmp->Clone("hratio");
369  hratio->Divide(hmc);
370  hratio->Write((comp+"_ratio").c_str());
371 
372  delete hdcmp; delete hmc; delete hratio;
373  }
#define pot
double POT() const
Definition: Spectrum.h:227
TDirectory * dir
Definition: macro.C:5
void ana::MichelDecomp::SavePlots ( TDirectory *  dir) const

Definition at line 395 of file MichelDecomp.cxx.

References AntiNueComponent(), AntiNumuComponent(), fAntiNC, fAntiNue, fAntiNumu, fNC, fNue, fNumu, NCAntiComponent(), NCComponent(), NueComponent(), NumuComponent(), SaveCompPlots(), SaveTempPlots(), and tmp.

Referenced by make_files_for_decomp_plots().

396  {
397  TDirectory* tmp = gDirectory;
398  dir->cd();
399 
400  SaveCompPlots(dir->mkdir("numu"), "numu",
401  NumuComponent(), fNumu);
402  SaveCompPlots(dir->mkdir("antinumu"), "antinumu",
404  SaveCompPlots(dir->mkdir("nc"), "nc",
405  NCComponent(), fNC);
406  SaveCompPlots(dir->mkdir("antinc"), "antinc",
408  SaveCompPlots(dir->mkdir("nue"), "nue",
409  NueComponent(), fNue);
410  SaveCompPlots(dir->mkdir("antinue"), "antinue",
412 
413  SaveTempPlots(dir->mkdir("templates"));
414 
415  tmp->cd();
416  }
virtual Spectrum AntiNumuComponent() const override
virtual Spectrum NCComponent() const override
Float_t tmp
Definition: plot.C:36
virtual Spectrum NumuComponent() const override
virtual Spectrum AntiNueComponent() const override
void SaveTempPlots(TDirectory *dir) const
virtual Spectrum NueComponent() const override
virtual Spectrum NCAntiComponent() const override
TDirectory * dir
Definition: macro.C:5
void SaveCompPlots(TDirectory *dir, std::string comp, Spectrum dcmp, Spectrum mc) const
void ana::MichelDecomp::SaveTempPlots ( TDirectory *  dir) const
protected

Definition at line 376 of file MichelDecomp.cxx.

References fData, fMichelData, fMichelNC, fMichelNue, fMichelNumu, pot, ana::Spectrum::POT(), ana::ReweightableSpectrum::ToTH2(), and ana::ToTH2().

Referenced by SavePlots().

377  {
378  double pot = fData.POT();
379  dir->cd();
380 
381  TH2* tempnumu = fMichelNumu.ToTH2(pot);
382  TH2* tempnc = fMichelNC. ToTH2(pot);
383  TH2* tempnue = fMichelNue. ToTH2(pot);
384  TH2* tempdata = fMichelData.ToTH2(pot);
385 
386  tempnumu->Write("NumuTemplate");
387  tempnc ->Write("NCTemplate");
388  tempnue ->Write("NueTemplate");
389  tempdata->Write("DataTemplate");
390 
391  delete tempnumu; delete tempnc; delete tempnue; delete tempdata;
392  }
ReweightableSpectrum fMichelNumu
Definition: MichelDecomp.h:191
#define pot
ReweightableSpectrum fMichelData
Definition: MichelDecomp.h:193
double POT() const
Definition: Spectrum.h:227
ReweightableSpectrum fMichelNue
Definition: MichelDecomp.h:192
TDirectory * dir
Definition: macro.C:5
TH2 * ToTH2(const Spectrum &s, double exposure, ana::EExposureType expotype, const Binning &binsx, const Binning &binsy, ana::EBinType bintype)
For use with Var2D.
Definition: UtilsExt.cxx:115
ReweightableSpectrum fMichelNC
Definition: MichelDecomp.h:190
TH2D * ToTH2(double pot) const
void ana::MichelDecomp::SaveTo ( TDirectory *  dir,
const std::string name 
) const
overridevirtual

Implements ana::IDecomp.

Definition at line 507 of file MichelDecomp.cxx.

References dir, fAntiNC, fAntiNue, fAntiNumu, fData, fMichelData, fMichelNC, fMichelNue, fMichelNumu, fNC, fNue, fNueEstimate, fNumu, ana::IDecomp::SaveTo(), ana::ReweightableSpectrum::SaveTo(), ana::Spectrum::SaveTo(), and tmp.

Referenced by make_files_for_decomp_plots(), and nue_decomp_scales().

507  {
508  TDirectory* tmp = gDirectory;
509 
510  dir = dir->mkdir(name.c_str()); // switch to subdir
511  dir->cd();
512 
513  TObjString("MichelDecomp").Write("type");
514 
515  fNC.SaveTo( dir, "NC");
516  fAntiNC.SaveTo( dir, "AntiNC");
517  fNumu.SaveTo( dir, "Numu");
518  fAntiNumu.SaveTo( dir, "AntiNumu");
519  fNue.SaveTo( dir, "Nue");
520  fAntiNue.SaveTo( dir, "AntiNue");
521  fData.SaveTo( dir, "Data");
522  fMichelNC.SaveTo( dir, "TempNC");
523  fMichelNumu.SaveTo( dir, "TempNumu");
524  fMichelNue.SaveTo( dir, "TempNue");
525  fMichelData.SaveTo( dir, "TempData");
526  fNueEstimate->SaveTo(dir, "NueEstimate");
527 
528  dir->Write();
529  delete dir;
530 
531  tmp->cd();
532  }
const XML_Char * name
Definition: expat.h:151
const IDecomp * fNueEstimate
Definition: MichelDecomp.h:195
Float_t tmp
Definition: plot.C:36
ReweightableSpectrum fMichelNumu
Definition: MichelDecomp.h:191
ReweightableSpectrum fMichelData
Definition: MichelDecomp.h:193
void SaveTo(TDirectory *dir, const std::string &name) const
Definition: Spectrum.cxx:506
ReweightableSpectrum fMichelNue
Definition: MichelDecomp.h:192
TDirectory * dir
Definition: macro.C:5
void SaveTo(TDirectory *dir, const std::string &name) const
virtual void SaveTo(TDirectory *dir, const std::string &name) const =0
ReweightableSpectrum fMichelNC
Definition: MichelDecomp.h:190
void ana::MichelDecomp::SplitByMichels ( int  EIdx,
MDCMPHelper  hSums,
std::vector< double > &  numuScales,
std::vector< double > &  ncScales,
std::vector< double > &  nueScales 
) const
protected

Definition at line 150 of file MichelDecomp.cxx.

References ComputeScaleFactor(), ana::MDCMPHelper::fNueScale, ana::MDCMPHelper::fSumData, ana::MDCMPHelper::fSumNC, ana::MDCMPHelper::fSumNue, and ana::MDCMPHelper::fSumNumu.

Referenced by Decompose().

154  {
155  // We have enough data in this bin to do MichelDecomp
156  double numuScale = ComputeScaleFactor(EIdx, hSums);
157  double ncScale =
158  (hSums.fSumData - numuScale*hSums.fSumNumu -
159  hSums.fNueScale*hSums.fSumNue) / hSums.fSumNC;
160  numuScales.push_back(numuScale);
161  ncScales.push_back(ncScale);
162  nueScales.push_back(hSums.fNueScale);
163  }
double ComputeScaleFactor(int EIdx, MDCMPHelper hSums) const
Starting code to run through decomp algebra /////////////////////////////////////////////////////////...
void ana::MichelDecomp::SplitByNue ( MDCMPHelper  hSums,
std::vector< double > &  numuScales,
std::vector< double > &  ncScales,
std::vector< double > &  nueScales 
) const
protected

Definition at line 184 of file MichelDecomp.cxx.

References ana::MDCMPHelper::fNCScale, ana::MDCMPHelper::fNueScale, and ana::MDCMPHelper::fNumuScale.

Referenced by Decompose().

188  {
189  numuScales.push_back(hSums.fNumuScale);
190  ncScales.push_back(hSums.fNCScale);
191  nueScales.push_back(hSums.fNueScale);
192  }
void ana::MichelDecomp::SplitByProp ( MDCMPHelper  hSums,
std::vector< double > &  numuScales,
std::vector< double > &  ncScales,
std::vector< double > &  nueScales 
) const
protected

Definition at line 165 of file MichelDecomp.cxx.

References ana::MDCMPHelper::fSumData, ana::MDCMPHelper::fSumNC, ana::MDCMPHelper::fSumNue, and ana::MDCMPHelper::fSumNumu.

169  {
170  // Return MC if there are no events in the MC
171  if (hSums.fSumNumu + hSums.fSumNC + hSums.fSumNue == 0){
172  numuScales.push_back(1);
173  ncScales.push_back(1);
174  nueScales.push_back(1);
175  return;
176  }
177  double DataMC = hSums.fSumData /
178  (hSums.fSumNue + hSums.fSumNumu + hSums.fSumNC);
179  numuScales.push_back(DataMC);
180  ncScales.push_back(DataMC);
181  nueScales.push_back(DataMC);
182  }

Member Data Documentation

Spectrum ana::MichelDecomp::fAntiNC
protected
Spectrum ana::MichelDecomp::fAntiNue
protected
Spectrum ana::MichelDecomp::fAntiNumu
protected
Spectrum ana::MichelDecomp::fData
protected
MDCMPFitResults ana::MichelDecomp::fFitResult
mutableprotected
ReweightableSpectrum ana::MichelDecomp::fMichelData
protected

Definition at line 193 of file MichelDecomp.h.

Referenced by Decompose(), MCToDCMPComp(), MDCMPLogLikelihood(), SaveTempPlots(), and SaveTo().

ReweightableSpectrum ana::MichelDecomp::fMichelNC
protected

Definition at line 190 of file MichelDecomp.h.

Referenced by Decompose(), MDCMPLogLikelihood(), SaveTempPlots(), and SaveTo().

ReweightableSpectrum ana::MichelDecomp::fMichelNue
protected

Definition at line 192 of file MichelDecomp.h.

Referenced by Decompose(), MDCMPLogLikelihood(), SaveTempPlots(), and SaveTo().

ReweightableSpectrum ana::MichelDecomp::fMichelNumu
protected

Definition at line 191 of file MichelDecomp.h.

Referenced by Decompose(), MDCMPLogLikelihood(), SaveTempPlots(), and SaveTo().

Spectrum ana::MichelDecomp::fNC
protected
Spectrum ana::MichelDecomp::fNue
protected
const IDecomp* ana::MichelDecomp::fNueEstimate
protected

Definition at line 195 of file MichelDecomp.h.

Referenced by GetNCScale(), GetNueScale(), GetNumuScale(), SaveTo(), and ~MichelDecomp().

Spectrum ana::MichelDecomp::fNumu
protected
bool ana::MichelDecomp::fOwnNueEstimate
protected

Definition at line 196 of file MichelDecomp.h.

Referenced by LoadFrom(), and ~MichelDecomp().

bool ana::MichelDecomp::isDecomposed
mutableprotected

The documentation for this class was generated from the following files: