NAGASH 0.9.8
Next Generation Analysis System
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
NAGASH::CutFlowCounter Class Reference

Store the cut flow with user defined cuts. More...

#include "NAGASH/CutFlowCounter.h"

Inheritance diagram for NAGASH::CutFlowCounter:
NAGASH::Result

Public Member Functions

 CutFlowCounter (std::shared_ptr< MSGTool > msg, std::shared_ptr< ConfigTool > config, const TString &name, const TString &fname="")
 Constructor.
 
void BookCutPoint (const std::string &name)
 Book a cut point.
 
void Combine (std::shared_ptr< Result > result)
 Combine the cut flow with another cut flow.
 
double GetEntries (const std::string &point)
 Get the total entries of a cut point.
 
double GetEntries (uint32_t point)
 Get the total entries of a cut point.
 
double GetSumW (const std::string &point)
 Get the sum of weights of a cut point.
 
double GetSumW (uint32_t point)
 Get the sum of weights of a cut point.
 
void PrintSummary ()
 Print the summary of the cut flow.
 
void Record (const std::string &point, double w=1)
 Record a entry that pass a cut.
 
void Record (uint64_t point, double w=1)
 Record a entry that pass a cut.
 
- Public Member Functions inherited from NAGASH::Result
const TString & GetOutputFileName ()
 Return the name of the result.
 
const TString & GetResultName ()
 
virtual void WriteToFile ()
 

Private Attributes

std::map< std::string, uint64_t > CutPointNames
 
std::vector< std::string > CutPointNamesVector
 
std::vector< double > SumE
 
std::vector< double > SumW
 

Additional Inherited Members

- Protected Member Functions inherited from NAGASH::Result
 Result ()=delete
 
 Result (const Result &result)=delete
 
 Result (Result &&result)=delete
 
 Result (std::shared_ptr< MSGTool > MSG, std::shared_ptr< ConfigTool > c, const TString &rname, const TString &fname="")
 virtual interface to write the result to a file.
 
virtual ~Result ()=default
 
std::shared_ptr< ConfigToolConfigUser ()
 Return the internal ConfigTool.>
 
std::shared_ptr< MSGToolMSGUser ()
 Return the internal MSGTool.
 
Resultoperator= (const Result &result)=delete
 
Resultoperator= (Result &&result)=delete
 
void SetOutputFileName (const TString &fileName)
 Set the output file name of the result.
 
ToolkitToolkitUser ()
 Return the internal Toolkit.
 

Detailed Description

Store the cut flow with user defined cuts.

Basic usage: ~~~ {c++} suppose you are using the CutFlowCounter inside a LoopEvent. NAGASH::StatusCode UserLoopEvent::InitializeUser() { ......... other initialization......... MyCutFlow = ResultGroupUser()->BookResult<CutFlowCounter>("MyCutFlow"); MyCutFlow->BookCutPoint("c0"); MyCutFlow->BookCutPoint("c1"); MyCutFlow->BookCutPoint("c2"); }

NAGASH::StatusCode UserLoopEvent::Execute() { if(pass_cut_0) { ....... other stuff ...... MyCutFlow->Record("c0", 1); if (pass_cut_1) { ...... other stuff...... MyCutFlow->Record("c1", 1); if (pass_cut_2) { ....... other stuff ...... MyCutFlow->Record("c2", 1); } } } } ~~~

After that you can get your cut flow as: ~~~ {c++} MyCutFlow->PrintSummary(); ~~~ This will show the entries, sum of weights after each cut, with the effiency of each cut and the relative efficiency between each adjacent cut.

Definition at line 55 of file CutFlowCounter.h.

Constructor & Destructor Documentation

◆ CutFlowCounter()

NAGASH::CutFlowCounter::CutFlowCounter ( std::shared_ptr< MSGTool msg,
std::shared_ptr< ConfigTool config,
const TString &  name,
const TString &  fname = "" 
)
inline

Constructor.

Parameters
msginput NAGASH::MSGTool.
configinput NAGASH::ConfigTool.
namethe name of the result.
fnamethe output file name of the result, not used in this class.

Definition at line 69 of file CutFlowCounter.h.

Member Function Documentation

◆ BookCutPoint()

void NAGASH::CutFlowCounter::BookCutPoint ( const std::string &  name)
inline

Book a cut point.

Parameters
namename of the cut point.

Definition at line 74 of file CutFlowCounter.h.

◆ Combine()

void NAGASH::CutFlowCounter::Combine ( std::shared_ptr< Result result)
inlinevirtual

Combine the cut flow with another cut flow.

Parameters
resultinput CutFlowCounter to be combined.

Reimplemented from NAGASH::Result.

Definition at line 118 of file CutFlowCounter.h.

◆ GetEntries() [1/2]

double NAGASH::CutFlowCounter::GetEntries ( const std::string &  point)
inline

Get the total entries of a cut point.

Parameters
pointthe name of the cut point.

Definition at line 155 of file CutFlowCounter.h.

◆ GetEntries() [2/2]

double NAGASH::CutFlowCounter::GetEntries ( uint32_t  point)
inline

Get the total entries of a cut point.

Parameters
pointindex of the cut point.

Definition at line 140 of file CutFlowCounter.h.

◆ GetSumW() [1/2]

double NAGASH::CutFlowCounter::GetSumW ( const std::string &  point)
inline

Get the sum of weights of a cut point.

Parameters
pointthe name of the cut point.

Definition at line 185 of file CutFlowCounter.h.

◆ GetSumW() [2/2]

double NAGASH::CutFlowCounter::GetSumW ( uint32_t  point)
inline

Get the sum of weights of a cut point.

Parameters
pointthe index of the cut point.

Definition at line 170 of file CutFlowCounter.h.

◆ PrintSummary()

void NAGASH::CutFlowCounter::PrintSummary ( )
inline

Print the summary of the cut flow.

Definition at line 199 of file CutFlowCounter.h.

◆ Record() [1/2]

void NAGASH::CutFlowCounter::Record ( const std::string &  point,
double  w = 1 
)
inline

Record a entry that pass a cut.

Parameters
pointthe name of the cut point.
wthe weight of this entry.

Definition at line 102 of file CutFlowCounter.h.

◆ Record() [2/2]

void NAGASH::CutFlowCounter::Record ( uint64_t  point,
double  w = 1 
)
inline

Record a entry that pass a cut.

Parameters
pointthe index of the cut point.
wthe weight of this entry.

Definition at line 85 of file CutFlowCounter.h.

Member Data Documentation

◆ CutPointNames

std::map<std::string, uint64_t> NAGASH::CutFlowCounter::CutPointNames
private

Definition at line 60 of file CutFlowCounter.h.

◆ CutPointNamesVector

std::vector<std::string> NAGASH::CutFlowCounter::CutPointNamesVector
private

Definition at line 61 of file CutFlowCounter.h.

◆ SumE

std::vector<double> NAGASH::CutFlowCounter::SumE
private

Definition at line 58 of file CutFlowCounter.h.

◆ SumW

std::vector<double> NAGASH::CutFlowCounter::SumW
private

Definition at line 59 of file CutFlowCounter.h.


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