9#include <svd/modules/svdDQM/SVDDQMHitTimeModule.h>
10#include <hlt/softwaretrigger/core/FinalTriggerDecisionCalculator.h>
11#include <framework/dataobjects/EventMetaData.h>
12#include <framework/core/HistoModule.h>
13#include <mdst/dataobjects/TRGSummary.h>
14#include <TDirectory.h>
17using namespace SoftwareTrigger;
25 setDescription(
"Make data quality monitoring plots for SVD Hit Time for bhabha, mu mu, and hadron samples seeded by different trigger times (ECL, CDC).");
27 std::string(
"SVDHitTime"));
33 "if True, svd time back in SVD time reference",
bool(
false));
36 addParam(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
48 B2FATAL(
"no valid configuration found for SVD reconstruction");
50 B2DEBUG(20,
"SVDRecoConfiguration: from now on we are using " <<
m_svdPlotsConfig->get_uniqueID());
56 TDirectory* oldDir = gDirectory;
63 TString refFrame =
"in FTSW reference";
65 refFrame =
"in SVD reference";
68 Form(
"SVD L3 V-Side Cluster Time %s: bhabhas, ECLTRG time", refFrame.Data()),
72 "SVD L3 V-Side Cluster Time - EventT0 : bhabhas, ECLTRG time",
77 Form(
"SVD L3 V-Side Cluster Time %s: hadrons, ECLTRG time", refFrame.Data()),
81 "SVD L3 V-Side Cluster Time - EventT0 : hadrons, ECLTRG time",
86 Form(
"SVD L3 V-Side Cluster Time %s: mumus, ECLTRG time", refFrame.Data()),
90 "SVD L3 V-Side Cluster Time - EventT0 : mumus, ECLTRG time",
95 Form(
"SVD L3 V-Side Cluster Time %s: bhabhas, CDCTRG time", refFrame.Data()),
99 "SVD L3 V-Side Cluster Time - EventT0 : bhabhas, CDCTRG time",
100 nBins, minT0, maxT0);
104 Form(
"SVD L3 V-Side Cluster Time %s: hadrons, CDCTRG time", refFrame.Data()),
105 nBins, minT0, maxT0);
108 "SVD L3 V-Side Cluster Time - EventT0 : hadrons, CDCTRG time",
109 nBins, minT0, maxT0);
113 Form(
"SVD L3 V-Side Cluster Time %s: mumus, CDCTRG time", refFrame.Data()),
114 nBins, minT0, maxT0);
117 "SVD L3 V-Side Cluster Time - EventT0 : mumus, CDCTRG time",
118 nBins, minT0, maxT0);
122 m_SVDEventT03Sample =
new TH1F(
"SVD3EventT0",
"SVD EventT0 for 3 samples", nBins, minT0, maxT0);
126 m_SVDEventT06Sample =
new TH1F(
"SVDEventT06Sample",
"SVD EventT0 for 6 samples", nBins, minT0, maxT0);
131 "SVD EventT0 3 samples : bhabhas, ECLTRG time",
132 nBins, minT0, maxT0);
136 "SVD EventT0 3 samples : hadrons, ECLTRG time",
137 nBins, minT0, maxT0);
141 "SVD EventT0 3 samples : mumus, ECLTRG time",
142 nBins, minT0, maxT0);
146 "SVD EventT0 3 samples : bhabhas, CDCTRG time",
147 nBins, minT0, maxT0);
151 "SVD EventT0 3 samples : hadrons, CDCTRG time",
152 nBins, minT0, maxT0);
156 "SVD EventT0 3 samples : mumus, CDCTRG time",
157 nBins, minT0, maxT0);
163 "SVD EventT0 6 samples : bhabhas, ECLTRG time",
164 nBins, minT0, maxT0);
168 "SVD EventT0 6 samples : hadrons, ECLTRG time",
169 nBins, minT0, maxT0);
173 "SVD EventT0 6 samples : mumus, ECLTRG time",
174 nBins, minT0, maxT0);
178 "SVD EventT0 6 samples : bhabhas, CDCTRG time",
179 nBins, minT0, maxT0);
183 "SVD EventT0 6 samples : hadrons, CDCTRG time",
184 nBins, minT0, maxT0);
188 "SVD EventT0 6 samples : mumus, CDCTRG time",
189 nBins, minT0, maxT0);
257 if (!eventAccepted)
return;
261 B2WARNING(
"Missing TRGSummary, SVDDQMHitTime is skipped.");
265 B2WARNING(
"Missing SVDEventInfo, SVDDQMHitTime is skipped.");
272 B2WARNING(
"Missing SVDClusters, SVDDQMHitTime is skipped.");
278 B2WARNING(
"TRGSummary object not available but required to indicate which detector provided the L1 trigger time");
284 bool Is_ECL_L1TriggerSource = false ;
285 bool Is_CDC_L1TriggerSource = false ;
287 Is_ECL_L1TriggerSource = true ;
289 Is_CDC_L1TriggerSource = true ;
292 B2DEBUG(20,
"Is_ECL_L1TriggerSource = " << Is_ECL_L1TriggerSource) ;
293 B2DEBUG(20,
"Is_CDC_L1TriggerSource= " << Is_CDC_L1TriggerSource) ;
297 B2WARNING(
"SoftwareTriggerResult object not available but require to select bhabha/mumu/hadron events for this module");
301 const std::map<std::string, int>& fresults =
m_TrgResult->getResults();
302 if ((fresults.find(
"software_trigger_cut&skim&accept_bhabha") == fresults.end()) ||
303 (fresults.find(
"software_trigger_cut&skim&accept_mumu_2trk") == fresults.end()) ||
304 (fresults.find(
"software_trigger_cut&skim&accept_hadron") == fresults.end())) {
305 B2WARNING(
"SVDDQMHitTimeModule: Can't find required bhabha or mumu or hadron trigger identifier");
312 const bool IsEvtAcceptedBhabha = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_bhabha") ==
314 const bool IsEvtAcceptedHadron = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_hadron") ==
316 const bool IsEvtAcceptedMumu = (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_mumu_2trk") ==
320 B2DEBUG(20,
"bhabha trigger result = " <<
static_cast<std::underlying_type<SoftwareTriggerCutResult>::type
>
321 (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_bhabha"))) ;
322 B2DEBUG(20,
"hadron trigger result = " <<
static_cast<std::underlying_type<SoftwareTriggerCutResult>::type
>
323 (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_hadron"))) ;
324 B2DEBUG(20,
"mu mu trigger result = " <<
static_cast<std::underlying_type<SoftwareTriggerCutResult>::type
>
325 (
m_TrgResult->getResult(
"software_trigger_cut&skim&accept_mumu_2trk"))) ;
326 B2DEBUG(20,
"bhabha trigger comparison bool = " << IsEvtAcceptedBhabha) ;
327 B2DEBUG(20,
"hadron trigger comparison bool = " << IsEvtAcceptedHadron) ;
328 B2DEBUG(20,
"mumu trigger comparison bool = " << IsEvtAcceptedMumu) ;
332 double eventT0 = -1000;
343 if (
m_eventT0->hasTemporaryEventT0(Const::EDetector::SVD)) {
344 const auto bestSVDEvtT0 =
m_eventT0->getBestSVDTemporaryEventT0() ;
346 float svdEventT0 = bestSVDEvtT0->eventT0 ;
355 if (Is_ECL_L1TriggerSource) {
356 if (IsEvtAcceptedBhabha) {
363 if (IsEvtAcceptedHadron) {
370 if (IsEvtAcceptedMumu) {
380 else if (Is_CDC_L1TriggerSource) {
381 if (IsEvtAcceptedBhabha) {
388 if (IsEvtAcceptedHadron) {
395 if (IsEvtAcceptedMumu) {
410 if (cluster.getSensorID().getLayerNumber() != 3)
continue;
412 if (cluster.isUCluster())
continue;
414 double time = cluster.getClsTime();
418 time = time -
m_svdEventInfo->getSVD2FTSWTimeShift(cluster.getFirstFrame());
421 if (Is_ECL_L1TriggerSource) {
422 if (IsEvtAcceptedBhabha) {
426 if (IsEvtAcceptedHadron) {
430 if (IsEvtAcceptedMumu) {
437 else if (Is_CDC_L1TriggerSource) {
438 if (IsEvtAcceptedBhabha) {
442 if (IsEvtAcceptedHadron) {
446 if (IsEvtAcceptedMumu) {
452 B2DEBUG(20,
"eventT0 = " << eventT0 <<
" ns" <<
", SVD HitTime = " << time <<
" ns") ;
HistoModule()
Constructor.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
bool m_useParamFromDB
if true read back from DB configuration parameters
virtual ~SVDDQMHitTimeModule()
Destructor.
TH1F * m_SVDEventT03Sample_mumu_L1_CDCTRG
svd eventT0 histogram for mu mu events wrt the CDC trigger time for 3 samples
StoreObjPtr< EventT0 > m_eventT0
EventT0 data object.
bool m_skipRejectedEvents
if true skip events rejected by HLT
TH1F * m_l3v_mumu_L1_ECLTRG
svd time histogram for mu mu events wrt the ECL trigger time
virtual void initialize() override
Initialize the module.
StoreObjPtr< SVDEventInfo > m_svdEventInfo
SVDEventInfo data object.
TH1F * m_SVDEventT03Sample_hadron_L1_CDCTRG
svd eventT0 histogram for hadronic events wrt the CDC trigger time for 3 samples
TH1F * m_SVDEventT03Sample_mumu_L1_ECLTRG
svd eventT0 histogram for mu mu events wrt the ECL trigger time for 3 samples
virtual void event() override
This method is called for each event.
TH1F * m_SVDEventT06Sample_hadron_L1_CDCTRG
svd EventT0 histogram for hadronic events wrt the CDC trigger time for 6 samples
TH1F * m_l3vEvtT0_mumu_L1_ECLTRG
svd time histogram for mu mu events wrt the ECL trigger time
TH1F * m_SVDEventT06Sample
SVD event T0 for 6 samples.
TH1F * m_SVDEventT06Sample_bhabha_L1_CDCTRG
svd eventT0 histogram for bhabha events wrt the CDC trigger time for 6 samples
TH1F * m_SVDEventT06Sample_bhabha_L1_ECLTRG
svd eventT0 histogram for bhabha events wrt the ECL trigger time for 6 samples
DBObjPtr< SVDDQMPlotsConfiguration > m_svdPlotsConfig
SVD DQM plots configuration.
StoreArray< SVDCluster > m_clusters
Store array for clusters.
TH1F * m_l3v_hadron_L1_CDCTRG
svd time histogram for hadronic events wrt the CDC trigger time
TH1F * m_l3vEvtT0_mumu_L1_CDCTRG
svd time histogram for mu mu events wrt the CDC trigger time
TH1F * m_l3vEvtT0_hadron_L1_CDCTRG
svd time histogram for hadronic events wrt the CDC trigger time
TH1F * m_l3v_hadron_L1_ECLTRG
svd time histogram for hadronic events wrt the ECL trigger time
TH1F * m_l3vEvtT0_hadron_L1_ECLTRG
svd time histogram for hadronic events wrt the ECL trigger time
StoreObjPtr< TRGSummary > m_objTrgSummary
Trigger Summary data object.
virtual void beginRun() override
This method is called for each run.
std::string m_histogramDirectoryName
Name of the histogram directory in ROOT file.
TH1F * m_l3v_bhabha_L1_ECLTRG
svd time histogram for bhabha events wrt the ECL trigger time
bool m_3Samples
if true enable 3 samples histograms analysis
TH1F * m_l3vEvtT0_bhabha_L1_CDCTRG
svd time histogram for bhabha events wrt the CDC trigger time
TH1F * m_SVDEventT06Sample_mumu_L1_CDCTRG
svd eventT0 histogram for mu mu events wrt the CDC trigger time for 6 samples
TH1F * m_SVDEventT03Sample_bhabha_L1_ECLTRG
svd eventT0 histogram for bhabha events wrt the ECL trigger time for 3 samples
TH1F * m_l3v_mumu_L1_CDCTRG
svd time histogram for mu mu events wrt the CDC trigger time
bool m_desynchSVDTime
if TRUE: svdTime back in SVD time reference
TH1F * m_l3v_bhabha_L1_CDCTRG
svd time histogram for bhabha events wrt the CDC trigger time
TH1F * m_SVDEventT06Sample_hadron_L1_ECLTRG
svd eventT0 histogram for hadronic events wrt the ECL trigger time for 6 samples
TH1F * m_SVDEventT03Sample_hadron_L1_ECLTRG
svd eventT0 histogram for hadronic events wrt the ECL trigger time for 3 samples
StoreObjPtr< SoftwareTriggerResult > m_resultStoreObjectPointer
Store Object for reading the trigger decision.
TH1F * m_SVDEventT06Sample_mumu_L1_ECLTRG
svd eventT0 histogram for mu mu events wrt the ECL trigger time for 6 samples
int m_L1TimingSrc
L1 timing source from getTimeType() in TRGSummary See ETimingTYpe in mdst/dataobjects/include/TRGSumm...
std::string m_storeSVDClustersName
SVDClusters StoreArray name.
SVDDQMHitTimeModule()
Default constructor.
TH1F * m_SVDEventT03Sample
SVD event T0 for 3 samples.
std::string m_storeSVDEventInfoName
SVDEventInfo StoreObjPtry name.
StoreObjPtr< SoftwareTriggerResult > m_TrgResult
Trigger selection data object.
TH1F * m_l3vEvtT0_bhabha_L1_ECLTRG
svd time histogram for bhabha events wrt the ECL trigger time
TH1F * m_SVDEventT03Sample_bhabha_L1_CDCTRG
svd eventT0 histogram for bhabha events wrt the CDC trigger time for 3 samples
virtual void defineHisto() override
Definition of histograms.
static bool getFinalTriggerDecision(const SoftwareTriggerResult &result, bool forgetTotalResult=false)
Calculate the final cut decision using all "total_results" of all sub triggers in the software trigge...
@ TTYP_CDC
events triggered by CDC timing
@ TTYP_ECL
events triggered by ECL timing
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.
@ c_accept
Accept this event.
Abstract base class for different kinds of events.