69 CutFlowCounter(std::shared_ptr<MSGTool>
msg, std::shared_ptr<ConfigTool>
config,
const TString &name,
const TString &fname =
"")
85 void Record(uint64_t point,
double w = 1)
87 if (point <
SumE.size())
94 auto guard =
MSGUser()->StartTitleWithGuard(
"CutFlowCounter::Record");
95 MSGUser()->MSG_WARNING(
"Cut point ", point,
" does not exist!");
102 void Record(
const std::string &point,
double w = 1)
106 SumE[result->second] += 1;
107 SumW[result->second] += w;
111 auto guard =
MSGUser()->StartTitleWithGuard(
"CutFlowCounter::Record");
112 MSGUser()->MSG_WARNING(
"Cut point ", point,
" does not exist!");
120 auto subCounter = std::dynamic_pointer_cast<std::remove_pointer<
decltype(
this)>::type>(result);
121 auto guard =
MSGUser()->StartTitleWithGuard(
"CutFlowCounter::Combine");
122 if (subCounter !=
nullptr)
126 MSGUser()->MSG_WARNING(
"Two cut flow counter are note the same (",
GetResultName(),
" and ", subCounter->GetResultName(),
")");
130 for (
size_t i = 0; i <
SumE.size(); ++i)
132 SumE[i] += subCounter->SumE[i];
133 SumW[i] += subCounter->SumW[i];
142 if (point <
SumE.size())
148 auto guard =
MSGUser()->StartTitleWithGuard(
"CutFlowCounter::Record");
149 MSGUser()->MSG_WARNING(
"Cut point ", point,
" does not exist!");
159 return SumE[result->second];
163 auto guard =
MSGUser()->StartTitleWithGuard(
"CutFlowCounter::Record");
164 MSGUser()->MSG_WARNING(
"Cut point ", point,
" does not exist!");
172 if (point <
SumW.size())
178 auto guard =
MSGUser()->StartTitleWithGuard(
"CutFlowCounter::Record");
179 MSGUser()->MSG_WARNING(
"Cut point ", point,
" does not exist!");
189 return SumW[result->second];
193 auto guard =
MSGUser()->StartTitleWithGuard(
"CutFlowCounter::Record");
194 MSGUser()->MSG_WARNING(
"Cut point ", point,
" does not exist!");
201 auto guard =
MSGUser()->StartTitleWithGuard(
"CutFlowCounter::PrintSummary");
203 for (
size_t i = 0; i <
SumE.size(); ++i)
Store the cut flow with user defined cuts.
void Record(uint64_t point, double w=1)
Record a entry that pass a cut.
double GetEntries(const std::string &point)
Get the total entries of a cut point.
void BookCutPoint(const std::string &name)
Book a cut point.
void Record(const std::string &point, double w=1)
Record a entry that pass a cut.
double GetEntries(uint32_t point)
Get the total entries of a cut point.
double GetSumW(uint32_t point)
Get the sum of weights of a cut point.
double GetSumW(const std::string &point)
Get the sum of weights of a cut point.
std::vector< double > SumW
std::vector< double > SumE
std::vector< std::string > CutPointNamesVector
void PrintSummary()
Print the summary of the cut flow.
CutFlowCounter(std::shared_ptr< MSGTool > msg, std::shared_ptr< ConfigTool > config, const TString &name, const TString &fname="")
Constructor.
void Combine(std::shared_ptr< Result > result)
Combine the cut flow with another cut flow.
std::map< std::string, uint64_t > CutPointNames
Provide virtual interface to manipulate all the results inside NAGASH.
std::shared_ptr< MSGTool > msg
const TString & GetResultName()
std::shared_ptr< MSGTool > MSGUser()
Return the internal MSGTool.
std::shared_ptr< ConfigTool > config