MaCh3  2.2.3
Reference Guide
FarDetectorCoreInfoStruct.h
Go to the documentation of this file.
1 #pragma once
2 #include <vector>
3 #include <string>
4 
6 
8 struct OscChannelInfo {
10  std::string flavourName;
12  std::string flavourName_Latex;
13 
15  int InitPDG;
17  int FinalPDG;
18 
20  double ChannelIndex;
21 };
22 
28 inline int GetOscChannel(const std::vector<OscChannelInfo>& OscChannel, const int InitFlav, const int FinalFlav) {
29  for (size_t i = 0; i < OscChannel.size(); ++i) {
30  if (InitFlav == OscChannel[i].InitPDG && FinalFlav == OscChannel[i].FinalPDG) {
31  return static_cast<int>(OscChannel[i].ChannelIndex);
32  }
33  }
34 
35  MACH3LOG_ERROR("Didn't find Osc channel for InitFlav = {}, FinalFlav = {}", InitFlav, FinalFlav);
36  throw MaCh3Exception(__FILE__, __LINE__);
37 }
38 
40 struct SampleInfo {
42  SampleInfo() = default;
43 
46  if(dathist != nullptr) delete dathist;
47  if(dathist2d != nullptr) delete dathist2d;
48  if(_hPDF1D != nullptr) delete _hPDF1D;
49  if(_hPDF2D != nullptr) delete _hPDF2D;
50  }
51 
53  std::string XVarStr = "";
55  std::string YVarStr = "";
56 
58  std::string SampleTitle = "";
59 
62 
64  TH1D *dathist = nullptr;
66  TH2D *dathist2d = nullptr;
67 
69  TH1D* _hPDF1D = nullptr;
71  TH2D* _hPDF2D = nullptr;
72 
75  TString histname1d = (XVarStr).c_str();
76  TString histname2d = (XVarStr + "_" + YVarStr).c_str();
77  TString histtitle = SampleTitle;
78 
79  //The binning here is arbitrary, now we get info from cfg so the
80  //set1DBinning and set2Dbinning calls below will make the binning
81  //to be what we actually want
82  _hPDF1D = new TH1D("h" + histname1d + SampleTitle, histtitle, 1, 0, 1);
83  dathist = new TH1D("d" + histname1d + SampleTitle, histtitle, 1, 0, 1);
84  _hPDF2D = new TH2D("h" + histname2d + SampleTitle, histtitle, 1, 0, 1, 1, 0, 1);
85  dathist2d = new TH2D("d" + histname2d + SampleTitle, histtitle, 1, 0, 1, 1, 0, 1);
86 
87  _hPDF1D->GetXaxis()->SetTitle(XVarStr.c_str());
88  dathist->GetXaxis()->SetTitle(XVarStr.c_str());
89  _hPDF2D->GetXaxis()->SetTitle(XVarStr.c_str());
90  dathist2d->GetXaxis()->SetTitle(XVarStr.c_str());
91  }
92 };
93 
97  FarDetectorCoreInfo(FarDetectorCoreInfo const &other) = delete;
101 
103 
104  const int* Target = 0;
105  const int* nupdg = 0;
106  const int* nupdgUnosc = 0;
107 
108  //THe x_var and y_vars that you're binning in
109  const double* x_var = &M3::Unity_D;
110  const double* y_var = &M3::Unity_D;
111  const double* rw_etru = &M3::_BAD_DOUBLE_;
112  const double* rw_truecz = &M3::_BAD_DOUBLE_;
113 
115  std::vector<const double*> xsec_norm_pointers;
117  std::vector<const M3::float_t*> xsec_spline_pointers;
123  std::vector<const M3::float_t*> total_weight_pointers;
124 
125  //M3::float_t total_w = M3::_BAD_INT_;
126 
127  int NomXBin = -1;
128  int NomYBin = -1;
129 
130  bool isNC = false;
131 
132  const double* mode = &M3::Unity_D;
133 };
int GetOscChannel(const std::vector< OscChannelInfo > &OscChannel, const int InitFlav, const int FinalFlav)
KS: Get Osc Channel Index based on initial and final PDG codes.
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:27
Custom exception class for MaCh3 errors.
double float_t
Definition: Core.h:30
constexpr static const double _BAD_DOUBLE_
Default value used for double initialisation.
Definition: Core.h:46
constexpr static const float_t Unity
Definition: Core.h:57
constexpr static const int _BAD_INT_
Default value used for int initialisation.
Definition: Core.h:48
constexpr static const double Unity_D
Some commonly used variables to which we set pointers to.
Definition: Core.h:52
constructors are same for all three so put in here
const M3::float_t * osc_w_pointer
pointer to oscillation weight which is being calculated by Oscillation Handler
FarDetectorCoreInfo & operator=(FarDetectorCoreInfo &&other)=delete
FarDetectorCoreInfo(FarDetectorCoreInfo &&other)=default
std::vector< const M3::float_t * > total_weight_pointers
Pointers to xsec_w, osc_w_pointer and remaining experiment specific weights.
FarDetectorCoreInfo & operator=(FarDetectorCoreInfo const &other)=delete
std::vector< const double * > xsec_norm_pointers
Pointers to normalisation weights which are being taken from Parameter Handler.
M3::float_t xsec_w
Total weight of norm and spline parameters.
std::vector< const M3::float_t * > xsec_spline_pointers
Pointers to spline weights which are being calculated by Splines Handler.
const int * Target
target the interaction was on
FarDetectorCoreInfo(FarDetectorCoreInfo const &other)=delete
KS: Store info about used osc channels.
int InitPDG
PDG of initial flavour.
double ChannelIndex
In case experiment specific would like to have pointer to channel after using GetOscChannel,...
int FinalPDG
PDG of oscillated/final flavour.
std::string flavourName
Name of osc channel.
std::string flavourName_Latex
Fancy channel name (e.g., LaTeX formatted)
KS: Store info about MC sample.
TH1D * _hPDF1D
histogram used for plotting storing 1D MC distribution
void InitialiseHistograms()
Initialise histograms used for plotting.
TH2D * _hPDF2D
histogram used for plotting storing 2D MC distribution
int nDimensions
Keep track of the dimensions of the sample binning.
~SampleInfo()
Destructor.
SampleInfo()=default
Default constructor.
std::string XVarStr
the strings associated with the variables used for the X binning e.g. "RecoNeutrinoEnergy"
std::string SampleTitle
the name of this sample e.g."muon-like"
TH2D * dathist2d
histogram used for plotting storing 2D data distribution
TH1D * dathist
histogram used for plotting storing 1D data distribution
std::string YVarStr
the strings associated with the variables used for the Y binning e.g. "RecoNeutrinoEnergy"