14#include <dqm/analysis/modules/DQMHistAnalysisEventT0TriggerJitter.h>
26REG_MODULE(DQMHistAnalysisEventT0TriggerJitter);
35 setDescription(
"Determining and processing EventT0s from different subdetectors (ECL, CDC, TOP, SVD) for different L1 trigger sources (ECL, CDC, and TOP) to estimate trigger jitter information for different HLT event types (hadron, BhaBha, ยตยต).");
39 addParam(
"prefixCanvas",
m_prefixCanvas,
"Prefix to be added to canvas filename when saved as pdf.", std::string(
"c"));
82 double sigma = par[3];
83 double mean2 = par[4];
84 double sigma2 = par[5];
86 return N * frac * TMath::Gaus(x[0], mean, sigma) + N * (1 - frac) * TMath::Gaus(x[0], mean2, sigma2);
93 B2DEBUG(20,
"h == nullptr");
101 auto nValidEntries = h->GetEntries() - h->GetBinContent(0) - h->GetBinContent(h->GetNbinsX() + 1);
103 B2DEBUG(20,
"not enough entries");
110 h->Scale(1. / nValidEntries);
111 h->GetXaxis()->SetRangeUser(-50, 50);
115 fitf.SetParNames(
"N",
"f_{1}",
"#mu_{1}",
"#sigma_{1}",
"#mu_{2}",
"#sigma_{2}");
116 fitf.SetParameters(0.1, 0.8, 0, 5, 0, 15);
117 fitf.SetParLimits(1, 0, 1);
118 fitf.SetParLimits(3, 0, 100);
119 fitf.SetParLimits(5, 0, 100);
121 if (h->Fit(&fitf,
"SR+") != 0) {
122 B2DEBUG(20,
"failed fit");
128 fitf.GetParameters(&par[0]);
130 for (
int i = 0; i < 6; i++)
131 parErr[i] = fitf.GetParError(i) ;
135 TF1 gauss1(
"gauss1",
"gaus", -100, 100);
136 TF1 gauss2(
"gauss2",
"gaus", -100, 100);
138 gauss1.SetLineColor(kBlue);
139 gauss1.SetLineStyle(kDashed);
140 gauss1.SetParameters(par[0]*par[1], par[2], par[3]);
142 gauss2.SetLineColor(kRed);
143 gauss2.SetLineStyle(kDashed);
144 gauss2.SetParameters(par[0] * (1 - par[1]), par[4], par[5]);
147 m_monObj->
setVariable(Form(
"N_%s", tag.Data()), nValidEntries, TMath::Sqrt(nValidEntries));
155 gStyle->SetOptFit(1111);
158 fitf.DrawClone(
"same");
159 gauss1.DrawClone(
"same");
160 gauss2.DrawClone(
"same");
171 TH1* h =
findHist(
"EventT0/m_histEventT0_ECL_hadron_L1_ECLTRG");
172 TString tag =
"hadronECLTRG";
179 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
186 h =
findHist(
"EventT0/m_histEventT0_ECL_bhabha_L1_ECLTRG");
187 tag =
"bhabhaECLTRG";
194 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
201 h =
findHist(
"EventT0/m_histEventT0_ECL_mumu_L1_ECLTRG");
209 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
219 h =
findHist(
"EventT0/m_histEventT0_CDC_hadron_L1_ECLTRG");
220 tag =
"hadronECLTRG";
227 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
234 h =
findHist(
"EventT0/m_histEventT0_CDC_bhabha_L1_ECLTRG");
235 tag =
"bhabhaECLTRG";
242 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
249 h =
findHist(
"EventT0/m_histEventT0_CDC_mumu_L1_ECLTRG");
257 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
267 h =
findHist(
"EventT0/m_histEventT0_TOP_hadron_L1_ECLTRG");
268 tag =
"hadronECLTRG";
275 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
282 h =
findHist(
"EventT0/m_histEventT0_TOP_bhabha_L1_ECLTRG");
283 tag =
"bhabhaECLTRG";
290 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
297 h =
findHist(
"EventT0/m_histEventT0_TOP_mumu_L1_ECLTRG");
305 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
315 h =
findHist(
"EventT0/m_histEventT0_SVD_hadron_L1_ECLTRG");
316 tag =
"hadronECLTRG";
323 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
330 h =
findHist(
"EventT0/m_histEventT0_SVD_bhabha_L1_ECLTRG");
331 tag =
"bhabhaECLTRG";
338 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
345 h =
findHist(
"EventT0/m_histEventT0_SVD_mumu_L1_ECLTRG");
353 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
367 TH1* h =
findHist(
"EventT0/m_histEventT0_ECL_hadron_L1_CDCTRG");
368 TString tag =
"hadronCDCTRG";
376 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
383 h =
findHist(
"EventT0/m_histEventT0_ECL_bhabha_L1_CDCTRG");
384 tag =
"bhabhaCDCTRG";
392 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
399 h =
findHist(
"EventT0/m_histEventT0_ECL_mumu_L1_CDCTRG");
407 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
417 h =
findHist(
"EventT0/m_histEventT0_CDC_hadron_L1_CDCTRG");
418 tag =
"hadronCDCTRG";
426 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
433 h =
findHist(
"EventT0/m_histEventT0_CDC_bhabha_L1_CDCTRG");
434 tag =
"bhabhaCDCTRG";
442 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
449 h =
findHist(
"EventT0/m_histEventT0_CDC_mumu_L1_CDCTRG");
457 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
467 h =
findHist(
"EventT0/m_histEventT0_TOP_hadron_L1_CDCTRG");
468 tag =
"hadronCDCTRG";
476 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
483 h =
findHist(
"EventT0/m_histEventT0_TOP_bhabha_L1_CDCTRG");
484 tag =
"bhabhaCDCTRG";
492 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
499 h =
findHist(
"EventT0/m_histEventT0_TOP_mumu_L1_CDCTRG");
507 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
517 h =
findHist(
"EventT0/m_histEventT0_SVD_hadron_L1_CDCTRG");
518 tag =
"hadronCDCTRG";
526 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
533 h =
findHist(
"EventT0/m_histEventT0_SVD_bhabha_L1_CDCTRG");
534 tag =
"bhabhaCDCTRG";
542 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
549 h =
findHist(
"EventT0/m_histEventT0_SVD_mumu_L1_CDCTRG");
557 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
569 TH1* h =
findHist(
"EventT0/m_histEventT0_ECL_hadron_L1_TOPTRG");
570 TString tag =
"hadronTOPTRG";
578 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
585 h =
findHist(
"EventT0/m_histEventT0_ECL_bhabha_L1_TOPTRG");
586 tag =
"bhabhaTOPTRG";
594 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
601 h =
findHist(
"EventT0/m_histEventT0_ECL_mumu_L1_TOPTRG");
609 B2DEBUG(29, Form(
"Histogram ECL EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
619 h =
findHist(
"EventT0/m_histEventT0_CDC_hadron_L1_TOPTRG");
620 tag =
"hadronTOPTRG";
628 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
635 h =
findHist(
"EventT0/m_histEventT0_CDC_bhabha_L1_TOPTRG");
636 tag =
"bhabhaTOPTRG";
644 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
651 h =
findHist(
"EventT0/m_histEventT0_CDC_mumu_L1_TOPTRG");
659 B2DEBUG(29, Form(
"Histogram CDC EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
669 h =
findHist(
"EventT0/m_histEventT0_TOP_hadron_L1_TOPTRG");
670 tag =
"hadronTOPTRG";
678 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
685 h =
findHist(
"EventT0/m_histEventT0_TOP_bhabha_L1_TOPTRG");
686 tag =
"bhabhaTOPTRG";
694 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
701 h =
findHist(
"EventT0/m_histEventT0_TOP_mumu_L1_TOPTRG");
709 B2DEBUG(29, Form(
"Histogram TOP EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
719 h =
findHist(
"EventT0/m_histEventT0_SVD_hadron_L1_TOPTRG");
720 tag =
"hadronTOPTRG";
728 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
735 h =
findHist(
"EventT0/m_histEventT0_SVD_bhabha_L1_TOPTRG");
736 tag =
"bhabhaTOPTRG";
744 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
751 h =
findHist(
"EventT0/m_histEventT0_SVD_mumu_L1_TOPTRG");
759 B2DEBUG(29, Form(
"Histogram SVD EventT0 for %s from EventT0 DQM not processed!", tag.Data()));
void initializeCanvases()
Initialise canvases.
TCanvas * m_cCDCTimeMuMuECLTRG
Canvas for CDC time ECLTRG jitter mumu.
TCanvas * m_cECLTimeHadronsECLTRG
Canvas for ECL time ECLTRG jitter hadrons.
void initialize() override final
create TCanvas and MonitoringObject
TCanvas * m_cTOPTimeHadronsECLTRG
Canvas for TOP time ECLTRG jitter hadrons.
TCanvas * m_cECLTimeHadronsCDCTRG
Canvas for ECL time CDCTRG jitter hadrons.
TCanvas * m_cECLTimeMuMuECLTRG
Canvas for ECL time ECLTRG jitter mumu.
TCanvas * m_cCDCTimeHadronsECLTRG
Canvas for CDC time ECLTRG jitter hadrons.
static double fDoubleGaus(double *x, double *par)
double gaussian fitting function for the jitter distribution
TCanvas * m_cCDCTimeBhaBhaECLTRG
Canvas for CDC time ECLTRG jitter bhabhas.
TCanvas * m_cSVDTimeMuMuTOPTRG
Canvas for SVD time TOPTRG jitter mumu.
void deleteCanvases()
Delete canvases.
TCanvas * m_cCDCTimeHadronsTOPTRG
Canvas for CDC time TOPTRG jitter hadrons.
TCanvas * m_cECLTimeBhaBhaECLTRG
Canvas for ECL time ECLTRG jitter bhabhas.
TCanvas * m_cCDCTimeBhaBhaCDCTRG
Canvas for CDC time CDCTRG jitter bhabhas.
std::string m_prefixCanvas
prefix to be added to canvas name when saved as pdf
TCanvas * m_cCDCTimeMuMuCDCTRG
Canvas for CDC time CDCTRG jitter mumu.
MonitoringObject * m_monObj
MonitoringObject to be produced by this module.
TCanvas * m_cCDCTimeMuMuTOPTRG
Canvas for CDC time TOPTRG jitter mumu.
TCanvas * m_cCDCTimeHadronsCDCTRG
Canvas for CDC time CDCTRG jitter hadrons.
TCanvas * m_cTOPTimeHadronsTOPTRG
Canvas for TOP time TOPTRG jitter hadrons.
void terminate() override final
delete pointers
void clearCanvases()
Initialise canvases.
void analyseTOPTRGEventT0Distributions()
Analyse the TOPTRG EventT0 distributions.
void event() override final
fit the histograms in the event
TCanvas * m_cECLTimeBhaBhaTOPTRG
Canvas for ECL time TOPTRG jitter bhabhas.
bool m_printCanvas
if true print the pdf of the canvases
TCanvas * m_cTOPTimeBhaBhaECLTRG
Canvas for TOP time ECLTRG jitter bhabhas.
TCanvas * m_cSVDTimeHadronsTOPTRG
Canvas for SVD time TOPTRG jitter hadrons.
TCanvas * m_cTOPTimeBhaBhaTOPTRG
Canvas for TOP time TOPTRG jitter bhabhas.
TCanvas * m_cSVDTimeBhaBhaECLTRG
Canvas for SVD time ECLTRG jitter bhabhas.
TCanvas * m_cTOPTimeBhaBhaCDCTRG
Canvas for TOP time CDCTRG jitter bhabhas.
uint m_nEntriesMin
minimum number of entries to process the histogram
TCanvas * m_cECLTimeMuMuCDCTRG
Canvas for ECL time CDCTRG jitter mumu.
TCanvas * m_cSVDTimeMuMuCDCTRG
Canvas for SVD time CDCTRG jitter mumu.
TCanvas * m_cTOPTimeMuMuTOPTRG
Canvas for TOP time TOPTRG jitter mumu.
TCanvas * m_cECLTimeBhaBhaCDCTRG
Canvas for ECL time CDCTRG jitter bhabhas.
TCanvas * m_cTOPTimeHadronsCDCTRG
Canvas for TOP time CDCTRG jitter hadrons.
TCanvas * m_cECLTimeHadronsTOPTRG
Canvas for ECL time TOPTRG jitter hadrons.
TCanvas * m_cCDCTimeBhaBhaTOPTRG
Canvas for CDC time TOPTRG jitter bhabhas.
bool processHistogram(TH1 *h, TString tag)
process the EventT0 distribution fitting with two gaussians filling the MonitoringObject
void beginRun() override final
clear TCanvas
TCanvas * m_cSVDTimeHadronsECLTRG
Canvas for SVD time ECLTRG jitter hadrons.
TCanvas * m_cECLTimeMuMuTOPTRG
Canvas for ECL time TOPTRG jitter mumu.
TCanvas * m_cTOPTimeMuMuCDCTRG
Canvas for TOP time CDCTRG jitter mumu.
DQMHistAnalysisEventT0TriggerJitterModule()
Constructor.
~DQMHistAnalysisEventT0TriggerJitterModule()
Destructor.
void printCanvases()
Print canvases if required.
TCanvas * m_cSVDTimeMuMuECLTRG
Canvas for SVD time ECLTRG jitter mumu.
TCanvas * m_cSVDTimeHadronsCDCTRG
Canvas for SVD time CDCTRG jitter hadrons.
void analyseECLTRGEventT0Distributions()
Analyse the ECLTRG EventT0 distributions.
TCanvas * m_cTOPTimeMuMuECLTRG
Canvas for TOP time ECLTRG jitter mumu.
TCanvas * m_cSVDTimeBhaBhaCDCTRG
Canvas for SVD time CDCTRG jitter bhabhas.
TCanvas * m_cSVDTimeBhaBhaTOPTRG
Canvas for SVD time TOPTRG jitter bhabhas.
void analyseCDCTRGEventT0Distributions()
Analyse the CDCTRG EventT0 distributions.
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 setVariable(const std::string &var, float val, float upErr=-1., float dwErr=-1)
set value to float variable (new variable is made if not yet existing)
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.