MaCh3  2.2.3
Reference Guide
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SampleHandlerBase Class Referenceabstract

Class responsible for handling implementation of samples used in analysis, reweighting and returning LLH. More...

#include <Samples/SampleHandlerBase.h>

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

Public Member Functions

 SampleHandlerBase ()
 The main constructor. More...
 
virtual ~SampleHandlerBase ()
 destructor More...
 
virtual M3::int_t GetNsamples ()
 
virtual std::string GetTitle () const
 
virtual std::string GetSampleName (int Sample) const =0
 
virtual double GetSampleLikelihood (const int isample)
 
virtual void CleanMemoryBeforeFit ()=0
 Allow to clean not used memory before fit starts. More...
 
virtual void SaveAdditionalInfo (TDirectory *Dir)
 Store additional info in a chan. More...
 
MaCh3ModesGetMaCh3Modes () const
 Return pointer to MaCh3 modes. More...
 
virtual void Reweight ()=0
 
virtual double GetLikelihood ()=0
 
unsigned int GetNEvents () const
 
virtual int GetNOscChannels ()
 
virtual void SetupBinning (const M3::int_t Selection, std::vector< double > &BinningX, std::vector< double > &BinningY)
 
virtual TH1 * GetData (const int Selection)
 
virtual TH2Poly * GetW2 (const int Selection)
 
virtual TH1 * GetPDF (const int Selection)
 
virtual TH1 * GetPDFMode (const int Selection, const int Mode)
 
virtual std::string GetKinVarLabel (const int sample, const int Dimension)
 
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...
 

Protected Member Functions

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

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

Class responsible for handling implementation of samples used in analysis, reweighting and returning LLH.

Definition at line 25 of file SampleHandlerBase.h.

Constructor & Destructor Documentation

◆ SampleHandlerBase()

SampleHandlerBase::SampleHandlerBase ( )

The main constructor.

Definition at line 4 of file SampleHandlerBase.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.

◆ ~SampleHandlerBase()

SampleHandlerBase::~SampleHandlerBase ( )
virtual

destructor

Definition at line 11 of file SampleHandlerBase.cpp.

11  {
12 // ***************************************************************************
13 
14 }

Member Function Documentation

◆ CleanMemoryBeforeFit()

virtual void SampleHandlerBase::CleanMemoryBeforeFit ( )
pure virtual

Allow to clean not used memory before fit starts.

Implemented in PySampleHandlerFD, and PySampleHandlerBase.

◆ GetData()

virtual TH1* SampleHandlerBase::GetData ( const int  Selection)
inlinevirtual

Definition at line 67 of file SampleHandlerBase.h.

67 { (void) Selection; throw MaCh3Exception(__FILE__ , __LINE__ , "Not implemented"); }
Custom exception class for MaCh3 errors.

◆ GetKinVarLabel()

virtual std::string SampleHandlerBase::GetKinVarLabel ( const int  sample,
const int  Dimension 
)
inlinevirtual

Definition at line 72 of file SampleHandlerBase.h.

72  {
73  (void) sample; (void) Dimension; throw MaCh3Exception(__FILE__ , __LINE__ , "Not implemented"); };

◆ GetPDF()

virtual TH1* SampleHandlerBase::GetPDF ( const int  Selection)
inlinevirtual

Definition at line 69 of file SampleHandlerBase.h.

69 { (void) Selection; throw MaCh3Exception(__FILE__ , __LINE__ , "Not implemented");}

◆ GetPDFMode()

virtual TH1* SampleHandlerBase::GetPDFMode ( const int  Selection,
const int  Mode 
)
inlinevirtual

Definition at line 70 of file SampleHandlerBase.h.

70  {
71  (void) Selection; (void) Mode; throw MaCh3Exception(__FILE__ , __LINE__ , "Not implemented"); }

◆ GetW2()

virtual TH2Poly* SampleHandlerBase::GetW2 ( const int  Selection)
inlinevirtual

Definition at line 68 of file SampleHandlerBase.h.

68 { (void) Selection; throw MaCh3Exception(__FILE__ , __LINE__ , "Not implemented");}

◆ MatchCondition()

template<typename T >
bool SampleHandlerBase::MatchCondition ( const std::vector< T > &  allowedValues,
const T &  value 
)
inlineprotected

check if event is affected by following conditions, for example pdg, or modes etc

Definition at line 182 of file SampleHandlerBase.h.

182  {
183  if (allowedValues.empty()) {
184  return true; // Apply to all if no specific values are specified
185  }
186  return std::find(allowedValues.begin(), allowedValues.end(), value) != allowedValues.end();
187  }

◆ NowTalk()

void SampleHandlerBase::NowTalk ( )
protected

CW: Redirect std::cout to silence some experiment specific libraries.

Definition at line 211 of file SampleHandlerBase.cpp.

211  {
212 // ***************************************************************************
213  #if DEBUG > 0
214  return;
215  #else
216  std::cout.rdbuf(buf);
217  std::cerr.rdbuf(errbuf);
218  #endif
219 }
std::streambuf * buf
Keep the cout buffer.
std::streambuf * errbuf
Keep the cerr buffer.

◆ QuietPlease()

void SampleHandlerBase::QuietPlease ( )
protected

CW: Redirect std::cout to silence some experiment specific libraries.

Definition at line 197 of file SampleHandlerBase.cpp.

197  {
198 // ***************************************************************************
199  #if DEBUG > 0
200  return;
201  #else
202  buf = std::cout.rdbuf();
203  errbuf = std::cerr.rdbuf();
204  std::cout.rdbuf( nullptr );
205  std::cerr.rdbuf( nullptr );
206  #endif
207 }

◆ Reweight()

virtual void SampleHandlerBase::Reweight ( )
pure virtual

Implemented in SampleHandlerFD, and PySampleHandlerBase.

◆ SaveAdditionalInfo()

virtual void SampleHandlerBase::SaveAdditionalInfo ( TDirectory *  Dir)
inlinevirtual

Store additional info in a chan.

Reimplemented in SampleHandlerFD.

Definition at line 50 of file SampleHandlerBase.h.

50 {(void) Dir;};

◆ SetupBinning()

virtual void SampleHandlerBase::SetupBinning ( const M3::int_t  Selection,
std::vector< double > &  BinningX,
std::vector< double > &  BinningY 
)
inlinevirtual

Definition at line 65 of file SampleHandlerBase.h.

65  {
66  (void) Selection; (void) BinningX; (void) BinningY; throw MaCh3Exception(__FILE__ , __LINE__ , "Not implemented");}

Member Data Documentation

◆ buf

std::streambuf* SampleHandlerBase::buf
protected

Keep the cout buffer.

Definition at line 193 of file SampleHandlerBase.h.

◆ errbuf

std::streambuf* SampleHandlerBase::errbuf
protected

Keep the cerr buffer.

Definition at line 195 of file SampleHandlerBase.h.

◆ fTestStatistic

TestStatistic SampleHandlerBase::fTestStatistic
protected

Test statistic tells what kind of likelihood sample is using.

Definition at line 190 of file SampleHandlerBase.h.

◆ Modes

std::unique_ptr<MaCh3Modes> SampleHandlerBase::Modes
protected

Holds information about used Generator and MaCh3 modes.

Definition at line 204 of file SampleHandlerBase.h.

◆ nEvents

unsigned int SampleHandlerBase::nEvents
protected

Number of MC events are there.

Definition at line 201 of file SampleHandlerBase.h.

◆ nSamples

M3::int_t SampleHandlerBase::nSamples
protected

Contains how many samples we've got.

Definition at line 198 of file SampleHandlerBase.h.


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