14#include <dqm/analysis/modules/DQMHistAnalysisEventT0Efficiency.h>
17#include <TGraphAsymmErrors.h>
34 setDescription(
"Calculate EventT0 algorithm efficiencies for the different trigger types, EventT0 algorithm sources, and event types (hadron, bhabha, ยตยต).");
38 addParam(
"prefixCanvas",
m_prefixCanvas,
"Prefix to be added to canvas filename when saved as pdf.", std::string(
"c"));
61 new TEfficiency(
"effAlgorithmSourceFractionsHadronL1ECLTRG",
62 "EventT0 source fractions, hadronic events, L1TRG timing from ECL;Algorithm;Fraction #epsilon",
65 new TEfficiency(
"effAlgorithmSourceFractionsHadronL1CDCTRG",
66 "EventT0 source fractions, hadronic events, L1TRG timing from CDC;Algorithm;Fraction #epsilon",
69 new TEfficiency(
"effAlgorithmSourceFractionsHadronL1TOPTRG",
70 "EventT0 source fractions, hadronic events, L1TRG timing from TOP;Algorithm;Fraction #epsilon",
73 new TEfficiency(
"effAlgorithmSourceFractionsBhaBhaL1ECLTRG",
74 "EventT0 source fractions, Bhabha events, L1TRG timing from ECL;Algorithm;Fraction #epsilon",
77 new TEfficiency(
"effAlgorithmSourceFractionsBhaBhaL1CDCTRG",
78 "EventT0 source fractions, Bhabha events, L1TRG timing from CDC;Algorithm;Fraction #epsilon",
81 new TEfficiency(
"effAlgorithmSourceFractionsBhaBhaL1TOPTRG",
82 "EventT0 source fractions, Bhabha events, L1TRG timing from TOP;Algorithm;Fraction #epsilon",
85 new TEfficiency(
"effAlgorithmSourceFractionsMuMuL1ECLTRG",
86 "EventT0 source fractions, #mu#mu events, L1TRG timing from ECL;Algorithm;Fraction #epsilon",
89 new TEfficiency(
"effAlgorithmSourceFractionsMuMuL1CDCTRG",
90 "EventT0 source fractions, #mu#mu events, L1TRG timing from CDC;Algorithm;Fraction #epsilon",
93 new TEfficiency(
"effAlgorithmSourceFractionsMuMuL1TOPTRG",
94 "EventT0 source fractions, #mu#mu events, L1TRG timing from TOP;Algorithm;Fraction #epsilon",
116 std::string histname =
"AlgorithmSourceFractionsHadronL1ECLTRG";
123 B2DEBUG(29,
"Histogram EventT0 source fractions for hadrons from ECLTRG events (" << histname <<
124 ") from EventT0 DQM not processed!");
128 histname =
"AlgorithmSourceFractionsHadronL1CDCTRG";
135 B2DEBUG(29,
"Histogram EventT0 source fractions for hadrons from CDCTRG events (" << histname <<
136 ") from EventT0 DQM not processed!");
140 histname =
"AlgorithmSourceFractionsHadronL1TOPTRG";
147 B2DEBUG(29,
"Histogram EventT0 source fractions for hadrons from TOPTRG events (" << histname <<
148 ") from EventT0 DQM not processed!");
153 histname =
"AlgorithmSourceFractionsBhaBhaL1ECLTRG";
160 B2DEBUG(29,
"Histogram EventT0 source fractions for BhaBha from ECLTRG events (" << histname <<
161 ") from EventT0 DQM not processed!");
165 histname =
"AlgorithmSourceFractionsBhaBhaL1CDCTRG";
172 B2DEBUG(29,
"Histogram EventT0 source fractions for BhaBha from CDCTRG events (" << histname <<
173 ") from EventT0 DQM not processed!");
177 histname =
"AlgorithmSourceFractionsBhaBhaL1TOPTRG";
184 B2DEBUG(29,
"Histogram EventT0 source fractions for BhaBha from TOPTRG events (" << histname <<
185 ") from EventT0 DQM not processed!");
190 histname =
"AlgorithmSourceFractionsMuMuL1ECLTRG";
197 B2DEBUG(29,
"Histogram EventT0 source fractions for MuMu from ECLTRG events (" << histname <<
") from EventT0 DQM not processed!");
201 histname =
"AlgorithmSourceFractionsMuMuL1CDCTRG";
208 B2DEBUG(29,
"Histogram EventT0 source fractions for MuMu from CDCTRG events (" << histname <<
") from EventT0 DQM not processed!");
212 histname =
"AlgorithmSourceFractionsMuMuL1TOPTRG";
219 B2DEBUG(29,
"Histogram EventT0 source fractions for MuMu from TOPTRG events (" << histname <<
") from EventT0 DQM not processed!");
256 B2DEBUG(20,
"Begin processing histogram " << histname <<
" ...");
257 TH1* h =
findHist(
"EventT0/" + histname);
264 const auto totalEntries = h->GetBinContent(-1);
265 const auto nBins = h->GetNbinsX();
266 TH1D totalHist(
"total",
"total;Algorithm;Fraction #epsilon", nBins, 0, nBins);
267 for (
int i = 0; i < nBins; i++) {
268 totalHist.SetBinContent(i + 1, totalEntries);
270 eff->SetPassedHistogram(*h,
"f");
271 eff->SetTotalHistogram(totalHist,
"f");
275 TGraphAsymmErrors* graph = eff->GetPaintedGraph();
280 auto ax = graph->GetXaxis();
285 ax->SetTitleOffset(1.0);
286 ax->CenterTitle(kTRUE);
287 ax->Set(nBins, 0, nBins);
288 for (
int i = 0; i < nBins; i++) {
292 auto ay = graph->GetYaxis();
296 ay->SetTitleOffset(1.0);
297 ay->SetRangeUser(0, 1.05);
301 B2DEBUG(20,
"Finished processing histogram " << histname <<
"!");
TEfficiency * m_eAlgorithmSourceFractionsMuMuL1ECLTRG
Fraction of events with EventT0 from a given algorithm, HLT mumu events, L1 time by ECL trigger.
void initialize() override final
create TCanvas and MonitoringObject
TEfficiency * m_eAlgorithmSourceFractionsBhaBhaL1ECLTRG
Fraction of events with EventT0 from a given algorithm, HLT bhabha events, L1 time by ECL trigger.
const char * c_eventT0Algorithms[6]
EventT0 algorithms for which to calculate fractions of abundance.
TCanvas * m_cT0FractionsMuMuECLTRG
Canvas for time fractions for ECLTRG mumu.
bool FillEfficiencyHistogram(const std::string &histname, TEfficiency *eff)
Fill the TEfficiency plots.
std::string m_prefixCanvas
prefix to be added to canvas name when saved as pdf
MonitoringObject * m_monObj
MonitoringObject to be produced by this module.
void terminate() override final
delete pointers
TCanvas * m_cT0FractionsBhaBhaCDCTRG
Canvas for time fractions for CDCTRG bhabhas.
TCanvas * m_cT0FractionsHadronCDCTRG
Canvas for time fractions for CDCTRG hadrons.
void event() override final
Event.
TEfficiency * m_eAlgorithmSourceFractionsBhaBhaL1CDCTRG
Fraction of events with EventT0 from a given algorithm, HLT bhabha events, L1 time by CDC trigger.
bool m_printCanvas
if true print the pdf of the canvases
TCanvas * m_cT0FractionsBhaBhaECLTRG
Canvas for time fractions for ECLTRG bhabhas.
DQMHistAnalysisEventT0EfficiencyModule()
Constructor.
uint m_nEntriesMin
minimum number of entries to process the histogram
TCanvas * m_cT0FractionsHadronECLTRG
Canvas for time fractions for ECLTRG hadrons.
TEfficiency * m_eAlgorithmSourceFractionsHadronL1ECLTRG
Fraction of events with EventT0 from a given algorithm, HLT hadronic events, L1 time by ECL trigger.
TCanvas * m_cT0FractionsMuMuTOPTRG
Canvas for time fractions for TOPTRG mumu.
TCanvas * m_cT0FractionsMuMuCDCTRG
Canvas for time fractions for CDCTRG mumu.
TEfficiency * m_eAlgorithmSourceFractionsHadronL1CDCTRG
Fraction of events with EventT0 from a given algorithm, HLT hadronic events, L1 time by CDC trigger.
void beginRun() override final
clear TCanvas
TEfficiency * m_eAlgorithmSourceFractionsMuMuL1TOPTRG
Fraction of events with EventT0 from a given algorithm, HLT mumu events, L1 time by TOP trigger.
TCanvas * m_cT0FractionsHadronTOPTRG
Canvas for time fractions for TOPTRG hadrons.
TEfficiency * m_eAlgorithmSourceFractionsMuMuL1CDCTRG
Fraction of events with EventT0 from a given algorithm, HLT mumu events, L1 time by CDC trigger.
TEfficiency * m_eAlgorithmSourceFractionsBhaBhaL1TOPTRG
Fraction of events with EventT0 from a given algorithm, HLT bhabha events, L1 time by TOP trigger.
TEfficiency * m_eAlgorithmSourceFractionsHadronL1TOPTRG
Fraction of events with EventT0 from a given algorithm, HLT hadronic events, L1 time by TOP trigger.
TCanvas * m_cT0FractionsBhaBhaTOPTRG
Canvas for time fractions for TOPTRG bhabhas.
static MonitoringObject * getMonitoringObject(const std::string &name)
Get MonitoringObject with given name (new object is created if non-existing)
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
DQMHistAnalysisModule()
Constructor / Destructor.
void setDescription(const std::string &description)
Sets the description of the module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.