NueCCIncCrossSectionAnalysis.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CAFAna/Core/Spectrum.h"
8 #include "CAFAna/XSec/Flux.h"
9 #include "TH3F.h"
10 #include "TH3.h"
11 #include "TH1.h"
12 #include "TH1F.h"
13 #include "TH2F.h"
14 #include "TH2.h"
15 
16 //#include "TSVDUnfold.h"
17 
18 #include <vector>
19 
20 namespace ana
21 {
22 
23  namespace nueccinc
24  {
25 
27  public:
29  SpectrumLoaderBase &lLoad,
30  HistAxis yAxis,
31  HistAxis xAxis,
32  HistAxis zAxis,
33  HistAxis recoAxis2D,
34  NuTruthHistAxis efficiencyAxis2D,
35  NuTruthHistAxis efficiencyAxis1D,
36  HistAxis pidAxis,
37  Binning fluxBins,
38  Cut selection,
39  NuTruthCut isSig,
40  TVector3 min,
41  TVector3 max,
42  SystShifts shift,
43  NuTruthVar weiNT,
44  Var wei);
45 
46 
48 
50  Spectrum sTemplate3D,
51  Spectrum sAnalysisSig1D,
52  Spectrum sAnalysisSigNuTree1D,
53  Spectrum sAnalysisSig2D,
54  Spectrum sAnalysisSigNuTree2D,
55  Spectrum sUnfolding1D,
56  Spectrum sUnfolding2D,
57  TVector3 sFidMin,
58  TVector3 sFidMax,
59  Spectrum* sFlux,
60  bool loadFromFile);
61 
62  TH1F* getTemplate(int xbin,int ybin,Binning binningx, Binning binnningy,
63  Binning binningz);
64  TH1F* getFullTemplate();
65  TH3F* getTemplate3D(Binning binningx, Binning binnningy,
66  Binning binningz);
67  TH3F* getTemplateShapeOnly3D(Binning binningx, Binning binningy,
68  Binning binningz, double integral);
69  TH1F* getTemplateShapeOnly1D(double integral);
71  TH1F* getEfficiency1D();
72  TH1F* getEfficiency1D(Binning binningx, Binning binningy,
73  std::string outaxis);
74  TH2F* getEfficiency2D(Binning binningx,Binning binningy);
75  TH3F* getAnalysis3D(Binning binningx, Binning binnningy,
76  Binning binningz);
77  TH2F* getAnalysis2D(Binning binningx, Binning binnningy,
78  Binning binningz);
79  TH1F* getAnalysis1D(Binning binningx, Binning binnningy,
80  Binning binningz, std::string outaxis);
81  TH1F* getFlux1D();
82  TH2F* getUnfoldingMatrix(std::string dimension);
84  TH2F* getSelectedSignalPrediction2D(Binning binningx, Binning binningy);
86  TH2F* getTrueSignalPrediction2D(Binning binningx, Binning binningy);
87  TH1F* ConvertTo1DHistFrom2DHist(TH2F* hist);
88  TH2F* ConvertTo2DHistFrom1DHist(TH2F* hSample2D,TH1F* hist);
89 
90  TH1F* UnfoldHist(TH1F* data_hist_1D, TH2F* hUnfoldingMatrix,
91  int iterations);
92  TH1F* doUnfolding1D(TH1F* datahist, int iterations);
93  TH2F* doUnfolding2D(TH2F* datahist, int iterations);
94 
95  std::unique_ptr<NueCCIncCrossSectionAnalysis>
96  AddEnhancedSample(std::vector<Spectrum> sample,
98  Binning zbins,Binning bins2D,
100 
101 
102 
103  void SaveTo(TDirectory* dir) const;
104  static std::unique_ptr<NueCCIncCrossSectionAnalysis>
105  LoadFrom(TDirectory* dir);
106 
107  //New Additions
117  std::vector<TVector3> returnFiducialVectors();
118 
119  private:
121  Spectrum template3D,
122  Spectrum analysisSig1D,
123  Spectrum analysisSigNT1D,
124  Spectrum analysisSig2D,
125  Spectrum analysisSigNT2D,
126  Spectrum unfolding1D,
127  Spectrum unfolding2D,
128  TVector3 min,
129  TVector3 max,
130  Spectrum* flux)
131  : fAnalysis3D(analysis3D),
132  fTemplate3D(template3D),
133  fAnalysisSig1D(analysisSig1D),
134  fAnalysisSigNuTree1D(analysisSigNT1D),
135  fAnalysisSig2D(analysisSig2D),
136  fAnalysisSigNuTree2D(analysisSigNT2D),
137  fUnfolding1D(unfolding1D),
138  fUnfolding2D(unfolding2D),
139  fFidMin(min),
140  fFidMax(max),
141  fFlux(flux)
142  {}
143 
145  std::vector<Spectrum*> SpectrumEfficiency(std::string dimension);
149  std::vector<TVector3> GetFiducialVolume();
150 
159 
160  TVector3 fFidMin;
161  TVector3 fFidMax;
162 
164  };
165 
167  public:
169  SpectrumLoaderBase &lLoad,
170  HistAxis yAxis,
171  HistAxis xAxis,
172  HistAxis zAxis,
173  HistAxis pidAxis,
174  Cut selection,
175  std::vector<Cut> templateCuts,
176  double numberTemplates,
177  const SystShifts shift,
178  const Var wei);
179 
181 
182  std::vector<TH1F*> getAllTemplates1D(int xbin,int ybin,
183  Binning binningx, Binning binnningy,
184  Binning binningz);
185  std::vector<TH3F*> getAllTemplates3D(Binning binningx, Binning binnningy,
186  Binning binningz);
187  std::vector<TH3F*> getAllAnalysis3D(Binning binningx, Binning binnningy,
188  Binning binningz);
189  std::vector<TH1F*> getFullTemplates1D();
190 
191 
192  void SaveTo(TDirectory* dir) const;
193  static std::unique_ptr<NueCCIncCrossSectionTemplates>
194  LoadFrom(TDirectory* dir);
195 
196 
197  NueCCIncCrossSectionTemplates(std::vector<Spectrum*> sAnalysis,
198  std::vector<Spectrum*> sTemplates,
199  double numTypes, bool loadFromFile);
200 
201  std::vector<Spectrum*> returnTemplates3D();
202  std::vector<Spectrum*> returnAnalysis3D();
203 
204 
205  private:
206  NueCCIncCrossSectionTemplates(std::vector<Spectrum*> analysis3D,
207  std::vector<Spectrum*> templates3D,
208  double numTypes)
209  : fAnalyses3D(analysis3D),
210  fTemplates3D(templates3D),
211  numCuts(numTypes)
212  {}
213 
214  std::vector<Spectrum*> Templates();
215  std::vector<Spectrum*> Analysis();
216 
217  std::vector<Spectrum*> fAnalyses3D;
218  std::vector<Spectrum*> fTemplates3D;
219  double numCuts;
220  };
221 
223  public:
225  SpectrumLoaderBase &lLoad,
226  HistAxis yAxis,
227  HistAxis xAxis,
228  HistAxis zAxis,
229  HistAxis recoAxis2D,
230  NuTruthHistAxis efficiencyAxis2D,
231  NuTruthHistAxis efficiencyAxis1D,
232  HistAxis pidAxis,
233  Cut selection,
234  std::vector<Cut> templateCuts,
235  double numberTemplates,
236  NuTruthCut isSig,
237  SystShifts shift,
238  NuTruthVar weiNT,
239  Var wei,
240  Var weiNue,
241  NuTruthVar weiNueNT);
242 
243 
245 
246  std::vector<Spectrum> getCrossSectionAnalysisSpectra();
247  std::vector<Spectrum*> getAnalysis3DSpectra();
248  std::vector<Spectrum*> getTemplate3DSpectra();
249 
250  void SaveTo(TDirectory* dir) const;
251  static std::unique_ptr<NueCCIncEnhancedSamples>
252  LoadFrom(TDirectory* dir);
253 
254  protected:
255  NueCCIncEnhancedSamples(std::vector<Spectrum*> vect_analysis3D,
256  std::vector<Spectrum*> vect_templates3D,
257  Spectrum analysisSig1D,
258  Spectrum analysisSigNT1D,
259  Spectrum analysisSig2D,
260  Spectrum analysisSigNT2D,
261  Spectrum unfolding1D,
262  Spectrum unfolding2D,
263  double numTypes)
264  : fAnalyses3D(vect_analysis3D),
265  fTemplates3D(vect_templates3D),
266  fAnalysisSig1D(analysisSig1D),
267  fAnalysisSigNuTree1D(analysisSigNT1D),
268  fAnalysisSig2D(analysisSig2D),
269  fAnalysisSigNuTree2D(analysisSigNT2D),
270  fUnfolding1D(unfolding1D),
271  fUnfolding2D(unfolding2D),
272  numCuts(numTypes)
273  {}
274 
275  std::vector<Spectrum*> NominalAnalysisSpectra();
276  std::vector<Spectrum*> NominalTemplateSpectra();
277  std::vector<Spectrum> StandardSpectra();
278 
279 
280  std::vector<Spectrum*> fAnalyses3D;
281  std::vector<Spectrum*> fTemplates3D;
288  double numCuts;
289 
290 
291  };
292 
293  }//end namespace nueccinc
294 
295 }//end namsespace ana
TH1F * doUnfolding1D(TH1F *datahist, int iterations)
TH3F * getAnalysis3D(Binning binningx, Binning binnningy, Binning binningz)
TH1F * getTemplate(int xbin, int ybin, Binning binningx, Binning binnningy, Binning binningz)
const std::string sTemplates
TH2F * doUnfolding2D(TH2F *datahist, int iterations)
TH2F * getAnalysis2D(Binning binningx, Binning binnningy, Binning binningz)
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
NueCCIncCrossSectionAnalysis(SpectrumLoaderBase &lLoad, HistAxis yAxis, HistAxis xAxis, HistAxis zAxis, HistAxis recoAxis2D, NuTruthHistAxis efficiencyAxis2D, NuTruthHistAxis efficiencyAxis1D, HistAxis pidAxis, Binning fluxBins, Cut selection, NuTruthCut isSig, TVector3 min, TVector3 max, SystShifts shift, NuTruthVar weiNT, Var wei)
const Binning zbins
Definition: NumuCCIncBins.h:21
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
NueCCIncCrossSectionTemplates(std::vector< Spectrum * > analysis3D, std::vector< Spectrum * > templates3D, double numTypes)
static std::unique_ptr< NueCCIncCrossSectionAnalysis > LoadFrom(TDirectory *dir)
Loaders::FluxType flux
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
const Binning pidbins
Definition: NueCCIncBins.h:38
TH3F * getTemplate3D(Binning binningx, Binning binnningy, Binning binningz)
const int xbins
Definition: MakePlots.C:82
TH2F * getEfficiency2D(Binning binningx, Binning binningy)
TH2F * ConvertTo2DHistFrom1DHist(TH2F *hSample2D, TH1F *hist)
NueCCIncCrossSectionAnalysis(Spectrum analysis3D, Spectrum template3D, Spectrum analysisSig1D, Spectrum analysisSigNT1D, Spectrum analysisSig2D, Spectrum analysisSigNT2D, Spectrum unfolding1D, Spectrum unfolding2D, TVector3 min, TVector3 max, Spectrum *flux)
TH2F * getSelectedSignalPrediction2D(Binning binningx, Binning binningy)
TH1F * UnfoldHist(TH1F *data_hist_1D, TH2F *hUnfoldingMatrix, int iterations)
std::unique_ptr< NueCCIncCrossSectionAnalysis > AddEnhancedSample(std::vector< Spectrum > sample, Binning xbins, Binning ybins, Binning zbins, Binning bins2D, Binning pidbins)
const std::string sAnalysis
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
TH3F * getTemplateShapeOnly3D(Binning binningx, Binning binningy, Binning binningz, double integral)
const int ybins
Base class for the various types of spectrum loader.
std::vector< Spectrum * > SpectrumEfficiency(std::string dimension)
TH2F * getTrueSignalPrediction2D(Binning binningx, Binning binningy)
TDirectory * dir
Definition: macro.C:5
NueCCIncEnhancedSamples(std::vector< Spectrum * > vect_analysis3D, std::vector< Spectrum * > vect_templates3D, Spectrum analysisSig1D, Spectrum analysisSigNT1D, Spectrum analysisSig2D, Spectrum analysisSigNT2D, Spectrum unfolding1D, Spectrum unfolding2D, double numTypes)
TH1F * getAnalysis1D(Binning binningx, Binning binnningy, Binning binningz, std::string outaxis)
Template for Var and SpillVar.
void getCrossSectionAnalysisSpectra()
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
Long64_t iterations[nThreads]
Definition: PhotonSim_mp.C:71
enum BeamMode string