MaCh3  2.5.0
Reference Guide
Public Member Functions | List of all members
PySampleHandlerInterface Class Reference

EW: As SampleHandlerBase is an abstract base class we have to do some gymnastics to get it to get it into python. More...

#include <python/samples.h>

Inheritance diagram for PySampleHandlerInterface:
[legend]
Collaboration diagram for PySampleHandlerInterface:
[legend]

Public Member Functions

std::string GetName () const override
 
std::string GetSampleTitle (const int iSample) const override
 
int GetNOscChannels (const int iSample) const override
 
void Reweight () override
 
double GetSampleLikelihood (const int iSample) const override
 
void CleanMemoryBeforeFit () override
 Allow to clean not used memory before fit starts. More...
 
void PrintRates (const bool DataOnly=false) override
 Helper function to print rates for the samples with LLH. More...
 
std::string GetKinVarName (const int iSample, const int Dimension) const override
 Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino_Energy". More...
 
std::vector< double > ReturnKinematicParameterBinning (const int Sample, const std::string &KinematicParameter) const override
 Return the binning used to draw a kinematic parameter. More...
 
TH1 * GetDataHist (const int Sample) override
 Get Data histogram. More...
 
TH1 * GetMCHist (const int Sample) override
 Get MC histogram. More...
 
TH1 * GetW2Hist (const int Sample) override
 Get W2 histogram. More...
 
double GetLikelihood () const override
 
std::unique_ptr< TH1 > Get1DVarHistByModeAndChannel (const int iSample, const std::string &ProjectionVar_Str, const int kModeToFill=-1, const int kChannelToFill=-1, const int WeightStyle=0) override
 
std::unique_ptr< TH2 > Get2DVarHistByModeAndChannel (const int iSample, const std::string &ProjectionVar_StrX, const std::string &ProjectionVar_StrY, const int kModeToFill=-1, const int kChannelToFill=-1, const int WeightStyle=0) override
 
std::unique_ptr< TH1 > Get1DVarHist (const int iSample, const std::string &ProjectionVar, const std::vector< KinematicCut > &EventSelectionVec={}, const int WeightStyle=0, const std::vector< KinematicCut > &SubEventSelectionVec={}) override
 
std::unique_ptr< TH2 > Get2DVarHist (const int iSample, const std::string &ProjectionVarX, const std::string &ProjectionVarY, const std::vector< KinematicCut > &EventSelectionVec={}, const int WeightStyle=0, const std::vector< KinematicCut > &SubEventSelectionVec={}) override
 
int GetNDim (const int Sample) const override
 DB Function to differentiate 1D or 2D binning. More...
 
std::string GetFlavourName (const int iSample, const int iChannel) const override
 
 SampleHandlerInterface ()
 The main constructor. More...
 
- Public Member Functions inherited from SampleHandlerInterface
 SampleHandlerInterface ()
 The main constructor. More...
 
virtual ~SampleHandlerInterface ()
 destructor More...
 
virtual M3::int_t GetNSamples ()
 
virtual void SaveAdditionalInfo (TDirectory *Dir)
 Store additional info in a chan. More...
 
MaCh3ModesGetMaCh3Modes () const
 Return pointer to MaCh3 modes. More...
 
unsigned int GetNEvents () const
 
double GetPoissonLLH (const double data, const double mc) const
 Calculate test statistic for a single bin using Poisson. More...
 
double GetTestStatLLH (const double data, const double mc, const double w2) const
 Calculate test statistic for a single bin. Calculation depends on setting of fTestStatistic. Data and mc -> 0 cut-offs are defined in M3::LOW_MC_BOUND. More...
 
void SetTestStatistic (TestStatistic testStat)
 Set the test statistic to be used when calculating the binned likelihoods. More...
 
TestStatistic GetTestStatistic () const
 Get the test statistic used when calculating the binned likelihoods. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SampleHandlerInterface
void QuietPlease ()
 CW: Redirect std::cout to silence some experiment specific libraries. More...
 
void NowTalk ()
 CW: Redirect std::cout to silence some experiment specific libraries. More...
 
template<typename T >
bool MatchCondition (const std::vector< T > &allowedValues, const T &value)
 check if event is affected by following conditions, for example pdg, or modes etc More...
 
- Protected Attributes inherited from SampleHandlerInterface
TestStatistic fTestStatistic
 Test statistic tells what kind of likelihood sample is using. More...
 
std::streambuf * buf
 Keep the cout buffer. More...
 
std::streambuf * errbuf
 Keep the cerr buffer. More...
 
M3::int_t nSamples
 Contains how many samples we've got. More...
 
unsigned int nEvents
 Number of MC events are there. More...
 
std::unique_ptr< MaCh3ModesModes
 Holds information about used Generator and MaCh3 modes. More...
 

Detailed Description

EW: As SampleHandlerBase is an abstract base class we have to do some gymnastics to get it to get it into python.

Definition at line 100 of file samples.h.

Member Function Documentation

◆ CleanMemoryBeforeFit()

void PySampleHandlerInterface::CleanMemoryBeforeFit ( )
inlineoverridevirtual

Allow to clean not used memory before fit starts.

Implements SampleHandlerInterface.

Definition at line 157 of file samples.h.

157  {
158  PYBIND11_OVERRIDE_PURE_NAME(
159  void, /* Return type */
160  SampleHandlerInterface, /* Parent class */
161  "clean_memory_before_fit",
162  CleanMemoryBeforeFit /* Name of function in C++ (must match Python name) */
163  );
164  }
void CleanMemoryBeforeFit() override
Allow to clean not used memory before fit starts.
Definition: samples.h:157
Class responsible for handling implementation of samples used in analysis, reweighting and returning ...

◆ Get1DVarHist()

std::unique_ptr<TH1> PySampleHandlerInterface::Get1DVarHist ( const int  iSample,
const std::string &  ProjectionVar,
const std::vector< KinematicCut > &  EventSelectionVec = {},
const int  WeightStyle = 0,
const std::vector< KinematicCut > &  SubEventSelectionVec = {} 
)
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 263 of file samples.h.

265  {},
266  const int WeightStyle = 0,
267  const std::vector<KinematicCut> &SubEventSelectionVec = {}) override {
268  (void) iSample;
269  (void) ProjectionVar;
270  (void) EventSelectionVec;
271  (void) WeightStyle;
272  (void) SubEventSelectionVec;
273  return nullptr;
274  }

◆ Get1DVarHistByModeAndChannel()

std::unique_ptr<TH1> PySampleHandlerInterface::Get1DVarHistByModeAndChannel ( const int  iSample,
const std::string &  ProjectionVar_Str,
const int  kModeToFill = -1,
const int  kChannelToFill = -1,
const int  WeightStyle = 0 
)
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 235 of file samples.h.

239  {
240  (void) iSample;
241  (void) ProjectionVar_Str;
242  (void) kModeToFill;
243  (void) kChannelToFill;
244  (void) WeightStyle;
245  return nullptr;
246  }

◆ Get2DVarHist()

std::unique_ptr<TH2> PySampleHandlerInterface::Get2DVarHist ( const int  iSample,
const std::string &  ProjectionVarX,
const std::string &  ProjectionVarY,
const std::vector< KinematicCut > &  EventSelectionVec = {},
const int  WeightStyle = 0,
const std::vector< KinematicCut > &  SubEventSelectionVec = {} 
)
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 276 of file samples.h.

279  {},
280  const int WeightStyle = 0,
281  const std::vector<KinematicCut>& SubEventSelectionVec = {}) override {
282  (void) iSample;
283  (void) ProjectionVarX;
284  (void) ProjectionVarY;
285  (void) EventSelectionVec;
286  (void) WeightStyle;
287  (void) SubEventSelectionVec;
288  return nullptr;
289  }

◆ Get2DVarHistByModeAndChannel()

std::unique_ptr<TH2> PySampleHandlerInterface::Get2DVarHistByModeAndChannel ( const int  iSample,
const std::string &  ProjectionVar_StrX,
const std::string &  ProjectionVar_StrY,
const int  kModeToFill = -1,
const int  kChannelToFill = -1,
const int  WeightStyle = 0 
)
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 248 of file samples.h.

253  {
254  (void) iSample;
255  (void) ProjectionVar_StrX;
256  (void) ProjectionVar_StrY;
257  (void) kModeToFill;
258  (void) kChannelToFill;
259  (void) WeightStyle;
260  return nullptr;
261  }

◆ GetDataHist()

TH1* PySampleHandlerInterface::GetDataHist ( const int  Sample)
inlineoverridevirtual

Get Data histogram.

Implements SampleHandlerInterface.

Definition at line 198 of file samples.h.

198  {
199  PYBIND11_OVERRIDE_PURE(
200  TH1*, /* Return type */
201  SampleHandlerInterface, /* Parent class */
202  GetDataHist, /* Name of function in C++ (must match Python name) */
203  Sample /* Argument(s) */
204  );
205  }
TH1 * GetDataHist(const int Sample) override
Get Data histogram.
Definition: samples.h:198

◆ GetFlavourName()

std::string PySampleHandlerInterface::GetFlavourName ( const int  iSample,
const int  iChannel 
) const
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 300 of file samples.h.

301  {
302  PYBIND11_OVERRIDE_PURE(
303  std::string, /* Return type */
304  SampleHandlerInterface, /* Parent class */
305  GetFlavourName, /* Name of function in C++ */
306  iSample,
307  iChannel
308  );
309  }
std::string GetFlavourName(const int iSample, const int iChannel) const override
Definition: samples.h:300

◆ GetKinVarName()

std::string PySampleHandlerInterface::GetKinVarName ( const int  iSample,
const int  Dimension 
) const
inlineoverridevirtual

Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino_Energy".

Parameters
iSampleSample index
DimensionDimension index

Implements SampleHandlerInterface.

Definition at line 177 of file samples.h.

177  {
178  PYBIND11_OVERRIDE_PURE(
179  std::string, /* Return type */
180  SampleHandlerInterface, /* Parent class */
181  GetKinVarName, /* Name of function in C++ (must match Python name) */
182  iSample, /* Argument(s) */
183  Dimension /* Argument(s) */
184  );
185  }
std::string GetKinVarName(const int iSample, const int Dimension) const override
Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino...
Definition: samples.h:177

◆ GetLikelihood()

double PySampleHandlerInterface::GetLikelihood ( ) const
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 225 of file samples.h.

225  {
226  PYBIND11_OVERRIDE_PURE_NAME(
227  double, /* Return type */
228  SampleHandlerInterface, /* Parent class */
229  "get_likelihood", /* Python name*/
230  GetLikelihood /* Name of function in C++ (must match Python name) */
231  /* Argument(s) */
232  );
233  }
double GetLikelihood() const override
Definition: samples.h:225

◆ GetMCHist()

TH1* PySampleHandlerInterface::GetMCHist ( const int  Sample)
inlineoverridevirtual

Get MC histogram.

Implements SampleHandlerInterface.

Definition at line 207 of file samples.h.

207  {
208  PYBIND11_OVERRIDE_PURE(
209  TH1*, /* Return type */
210  SampleHandlerInterface, /* Parent class */
211  GetMCHist, /* Name of function in C++ (must match Python name) */
212  Sample /* Argument(s) */
213  );
214  }
TH1 * GetMCHist(const int Sample) override
Get MC histogram.
Definition: samples.h:207

◆ GetName()

std::string PySampleHandlerInterface::GetName ( ) const
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 106 of file samples.h.

106  {
107  PYBIND11_OVERRIDE_PURE(
108  std::string, /* Return type */
109  SampleHandlerInterface, /* Parent class */
110  GetName, /* Name of function in C++ (must match Python name) */
111  );
112  }
std::string GetName() const override
Definition: samples.h:106

◆ GetNDim()

int PySampleHandlerInterface::GetNDim ( const int  Sample) const
inlineoverridevirtual

DB Function to differentiate 1D or 2D binning.

Implements SampleHandlerInterface.

Definition at line 291 of file samples.h.

291  {
292  PYBIND11_OVERRIDE_PURE(
293  int, /* Return type */
294  SampleHandlerInterface, /* Parent class */
295  GetNDim, /* Name of function in C++ */
296  Sample
297  );
298  }
int GetNDim(const int Sample) const override
DB Function to differentiate 1D or 2D binning.
Definition: samples.h:291

◆ GetNOscChannels()

int PySampleHandlerInterface::GetNOscChannels ( const int  iSample) const
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 125 of file samples.h.

125  {
126  PYBIND11_OVERRIDE_PURE(
127  int, /* Return type */
128  SampleHandlerInterface, /* Parent class */
129  GetNOscChannels, /* Name of function in C++ (must match Python name) */
130  iSample /* Argument(s) */
131  );
132  }
int GetNOscChannels(const int iSample) const override
Definition: samples.h:125

◆ GetSampleLikelihood()

double PySampleHandlerInterface::GetSampleLikelihood ( const int  iSample) const
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 146 of file samples.h.

146  {
147  PYBIND11_OVERRIDE_PURE_NAME(
148  double, /* Return type */
149  SampleHandlerInterface, /* Parent class */
150  "get_sample_likelihood",
151  GetSampleLikelihood, /* Name of function in C++ (must match Python name) */
152  iSample /* Argument(s) */
153  );
154  }
double GetSampleLikelihood(const int iSample) const override
Definition: samples.h:146

◆ GetSampleTitle()

std::string PySampleHandlerInterface::GetSampleTitle ( const int  iSample) const
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 115 of file samples.h.

115  {
116  PYBIND11_OVERRIDE_PURE(
117  std::string, /* Return type */
118  SampleHandlerInterface, /* Parent class */
119  GetSampleTitle, /* Name of function in C++ (must match Python name) */
120  iSample /* Argument(s) */
121  );
122  }
std::string GetSampleTitle(const int iSample) const override
Definition: samples.h:115

◆ GetW2Hist()

TH1* PySampleHandlerInterface::GetW2Hist ( const int  Sample)
inlineoverridevirtual

Get W2 histogram.

Implements SampleHandlerInterface.

Definition at line 216 of file samples.h.

216  {
217  PYBIND11_OVERRIDE_PURE(
218  TH1*, /* Return type */
219  SampleHandlerInterface, /* Parent class */
220  GetW2Hist, /* Name of function in C++ (must match Python name) */
221  Sample /* Argument(s) */
222  );
223  }
TH1 * GetW2Hist(const int Sample) override
Get W2 histogram.
Definition: samples.h:216

◆ PrintRates()

void PySampleHandlerInterface::PrintRates ( const bool  DataOnly = false)
inlineoverridevirtual

Helper function to print rates for the samples with LLH.

Parameters
DataOnlywhether to print data only rates

Implements SampleHandlerInterface.

Definition at line 167 of file samples.h.

167  {
168  PYBIND11_OVERRIDE_PURE(
169  void, /* Return type */
170  SampleHandlerInterface, /* Parent class */
171  PrintRates, /* Name of function in C++ (must match Python name) */
172  DataOnly /* Argument(s) */
173  );
174  }
void PrintRates(const bool DataOnly=false) override
Helper function to print rates for the samples with LLH.
Definition: samples.h:167

◆ ReturnKinematicParameterBinning()

std::vector<double> PySampleHandlerInterface::ReturnKinematicParameterBinning ( const int  Sample,
const std::string &  KinematicParameter 
) const
inlineoverridevirtual

Return the binning used to draw a kinematic parameter.

Implements SampleHandlerInterface.

Definition at line 188 of file samples.h.

188  {
189  PYBIND11_OVERRIDE_PURE(
190  std::vector<double>, /* Return type */
191  SampleHandlerInterface, /* Parent class */
192  GetKinVarName, /* Name of function in C++ (must match Python name) */
193  Sample, /* Argument(s) */
194  KinematicParameter /* Argument(s) */
195  );
196  }

◆ Reweight()

void PySampleHandlerInterface::Reweight ( )
inlineoverridevirtual

Implements SampleHandlerInterface.

Definition at line 135 of file samples.h.

135  {
136  PYBIND11_OVERRIDE_PURE_NAME(
137  void, /* Return type */
138  SampleHandlerInterface, /* Parent class */
139  "reweight",
140  Reweight /* Name of function in C++ (must match Python name) */
141  );
142  }
void Reweight() override
Definition: samples.h:135

◆ SampleHandlerInterface()

SampleHandlerInterface::SampleHandlerInterface

The main constructor.

Definition at line 33 of file SampleHandlerInterface.cpp.

4  {
5 // ***************************************************************************
6  nEvents = 0;
7  nSamples = 0;
8 }
M3::int_t nSamples
Contains how many samples we've got.
unsigned int nEvents
Number of MC events are there.

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