MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
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.
 
virtual ~SampleHandlerBase ()
 destructor
 
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.
 
virtual void SaveAdditionalInfo (TDirectory *Dir)
 Store additional info in a chan.
 
MaCh3ModesGetMaCh3Modes () const
 Return pointer to MaCh3 modes.
 
virtual void Reweight ()=0
 
virtual double GetLikelihood ()=0
 
unsigned int GetNEvents () const
 
virtual int GetNMCSamples ()
 
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 GetTestStatLLH (double data, double mc) const
 Calculate test statistic for a single bin using Poisson.
 
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.
 
void SetTestStatistic (TestStatistic testStat)
 Set the test statistic to be used when calculating the binned likelihoods.
 

Protected Member Functions

void QuietPlease ()
 CW: Redirect std::cout to silence some experiment specific libraries.
 
void NowTalk ()
 CW: Redirect std::cout to silence some experiment specific libraries.
 
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
 

Protected Attributes

TestStatistic fTestStatistic
 Test statistic tells what kind of likelihood sample is using.
 
std::streambuf * buf
 Keep the cout buffer.
 
std::streambuf * errbuf
 Keep the cerr buffer.
 
M3::int_t nSamples
 Contains how many samples we've got.
 
unsigned int nEvents
 Number of MC events are there.
 
std::unique_ptr< MaCh3ModesModes
 Holds information about used Generator and MaCh3 modes.
 

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 PySampleHandlerBase, and PySampleHandlerFD.

◆ GetData()

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

Definition at line 69 of file SampleHandlerBase.h.

69{ (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 74 of file SampleHandlerBase.h.

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

◆ GetPDF()

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

Definition at line 71 of file SampleHandlerBase.h.

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

◆ GetPDFMode()

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

Definition at line 72 of file SampleHandlerBase.h.

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

◆ GetW2()

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

Definition at line 70 of file SampleHandlerBase.h.

70{ (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 109 of file SampleHandlerBase.h.

109 {
110 if (allowedValues.empty()) {
111 return true; // Apply to all if no specific values are specified
112 }
113 return std::find(allowedValues.begin(), allowedValues.end(), value) != allowedValues.end();
114 }

◆ 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 PySampleHandlerBase, and SampleHandlerFD.

◆ 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 67 of file SampleHandlerBase.h.

67 {
68 (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 120 of file SampleHandlerBase.h.

◆ errbuf

std::streambuf* SampleHandlerBase::errbuf
protected

Keep the cerr buffer.

Definition at line 122 of file SampleHandlerBase.h.

◆ fTestStatistic

TestStatistic SampleHandlerBase::fTestStatistic
protected

Test statistic tells what kind of likelihood sample is using.

Definition at line 117 of file SampleHandlerBase.h.

◆ Modes

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

Holds information about used Generator and MaCh3 modes.

Definition at line 131 of file SampleHandlerBase.h.

◆ nEvents

unsigned int SampleHandlerBase::nEvents
protected

Number of MC events are there.

Definition at line 128 of file SampleHandlerBase.h.

◆ nSamples

M3::int_t SampleHandlerBase::nSamples
protected

Contains how many samples we've got.

Definition at line 125 of file SampleHandlerBase.h.


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