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"));
63 new TEfficiency(
"effAlgorithmSourceFractionsHadronL1ECLTRG",
64 "EventT0 source fractions, hadronic events, L1TRG timing from ECL;Algorithm;Fraction #epsilon",
67 new TEfficiency(
"effAlgorithmSourceFractionsHadronL1CDCTRG",
68 "EventT0 source fractions, hadronic events, L1TRG timing from CDC;Algorithm;Fraction #epsilon",
71 new TEfficiency(
"effAlgorithmSourceFractionsHadronL1TOPTRG",
72 "EventT0 source fractions, hadronic events, L1TRG timing from TOP;Algorithm;Fraction #epsilon",
75 new TEfficiency(
"effAlgorithmSourceFractionsBhaBhaL1ECLTRG",
76 "EventT0 source fractions, Bhabha events, L1TRG timing from ECL;Algorithm;Fraction #epsilon",
79 new TEfficiency(
"effAlgorithmSourceFractionsBhaBhaL1CDCTRG",
80 "EventT0 source fractions, Bhabha events, L1TRG timing from CDC;Algorithm;Fraction #epsilon",
83 new TEfficiency(
"effAlgorithmSourceFractionsBhaBhaL1TOPTRG",
84 "EventT0 source fractions, Bhabha events, L1TRG timing from TOP;Algorithm;Fraction #epsilon",
87 new TEfficiency(
"effAlgorithmSourceFractionsMuMuL1ECLTRG",
88 "EventT0 source fractions, #mu#mu events, L1TRG timing from ECL;Algorithm;Fraction #epsilon",
91 new TEfficiency(
"effAlgorithmSourceFractionsMuMuL1CDCTRG",
92 "EventT0 source fractions, #mu#mu events, L1TRG timing from CDC;Algorithm;Fraction #epsilon",
95 new TEfficiency(
"effAlgorithmSourceFractionsMuMuL1TOPTRG",
96 "EventT0 source fractions, #mu#mu events, L1TRG timing from TOP;Algorithm;Fraction #epsilon",
118 std::string histname =
"AlgorithmSourceFractionsHadronL1ECLTRG";
125 B2DEBUG(29,
"Histogram EventT0 source fractions for hadrons from ECLTRG events (" << histname <<
126 ") from EventT0 DQM not processed!");
130 histname =
"AlgorithmSourceFractionsHadronL1CDCTRG";
137 B2DEBUG(29,
"Histogram EventT0 source fractions for hadrons from CDCTRG events (" << histname <<
138 ") from EventT0 DQM not processed!");
142 histname =
"AlgorithmSourceFractionsHadronL1TOPTRG";
149 B2DEBUG(29,
"Histogram EventT0 source fractions for hadrons from TOPTRG events (" << histname <<
150 ") from EventT0 DQM not processed!");
155 histname =
"AlgorithmSourceFractionsBhaBhaL1ECLTRG";
162 B2DEBUG(29,
"Histogram EventT0 source fractions for BhaBha from ECLTRG events (" << histname <<
163 ") from EventT0 DQM not processed!");
167 histname =
"AlgorithmSourceFractionsBhaBhaL1CDCTRG";
174 B2DEBUG(29,
"Histogram EventT0 source fractions for BhaBha from CDCTRG events (" << histname <<
175 ") from EventT0 DQM not processed!");
179 histname =
"AlgorithmSourceFractionsBhaBhaL1TOPTRG";
186 B2DEBUG(29,
"Histogram EventT0 source fractions for BhaBha from TOPTRG events (" << histname <<
187 ") from EventT0 DQM not processed!");
192 histname =
"AlgorithmSourceFractionsMuMuL1ECLTRG";
199 B2DEBUG(29,
"Histogram EventT0 source fractions for MuMu from ECLTRG events (" << histname <<
") from EventT0 DQM not processed!");
203 histname =
"AlgorithmSourceFractionsMuMuL1CDCTRG";
210 B2DEBUG(29,
"Histogram EventT0 source fractions for MuMu from CDCTRG events (" << histname <<
") from EventT0 DQM not processed!");
214 histname =
"AlgorithmSourceFractionsMuMuL1TOPTRG";
221 B2DEBUG(29,
"Histogram EventT0 source fractions for MuMu from TOPTRG events (" << histname <<
") from EventT0 DQM not processed!");
258 B2DEBUG(20,
"Begin processing histogram " << histname <<
" ...");
259 TH1* h =
findHist(
"EventT0/" + histname);
266 const auto totalEntries = h->GetBinContent(-1);
267 const auto nBins = h->GetNbinsX();
268 TH1D* totalHist =
new TH1D(
"total",
"total;Algorithm;Fraction #epsilon", nBins, 0, nBins);
269 for (
int i = 0; i < nBins; i++) {
270 totalHist->SetBinContent(i + 1, totalEntries);
272 eff->SetPassedHistogram(*h,
"f");
273 eff->SetTotalHistogram(*totalHist,
"f");
277 TGraphAsymmErrors* graph = eff->GetPaintedGraph();
282 auto ax = graph->GetXaxis();
287 ax->SetTitleOffset(1.0);
288 ax->CenterTitle(kTRUE);
289 ax->Set(nBins, 0, nBins);
290 for (
int i = 0; i < nBins; i++) {
294 auto ay = graph->GetYaxis();
298 ay->SetTitleOffset(1.0);
299 ay->SetRangeUser(0, 1.05);
303 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.
~DQMHistAnalysisEventT0EfficiencyModule()
Destructor.
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.
The base class for the histogram analysis module.
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).
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.