9 #include "svd/modules/svdDQM/SVDDQMClustersOnTrackModule.h"
11 #include <hlt/softwaretrigger/core/FinalTriggerDecisionCalculator.h>
12 #include <framework/datastore/DataStore.h>
13 #include <framework/datastore/StoreObjPtr.h>
14 #include <framework/datastore/StoreArray.h>
15 #include <framework/dataobjects/EventMetaData.h>
16 #include <svd/dataobjects/SVDShaperDigit.h>
17 #include <svd/dataobjects/SVDRecoDigit.h>
18 #include <svd/dataobjects/SVDCluster.h>
19 #include <tracking/dataobjects/RecoTrack.h>
20 #include <vxd/geometry/GeoTools.h>
22 #include "TDirectory.h"
26 using namespace SoftwareTrigger;
41 setDescription(
"SVD DQM module for clusters related to tracks.");
43 setPropertyFlags(c_ParallelProcessingCertified);
44 addParam(
"skipHLTRejectedEvents", m_skipRejectedEvents,
"If True, skip events rejected by HLT.",
bool(
true));
45 addParam(
"TriggerBin", m_tb,
"select events for a specific trigger bin, if -1 then no selection is applied (default)",
int(-1));
46 addParam(
"histogramDirectoryName", m_histogramDirectoryName,
"Name of the directory where histograms will be placed.",
47 std::string(
"SVDClsTrk"));
48 addParam(
"desynchronizeSVDTime", m_desynchSVDTime,
49 "if True, svd time back in SVD time reference",
bool(
false));
50 addParam(
"EventInfo", m_svdEventInfoName,
"SVDEventInfo StoreArray name.", std::string(
""));
51 addParam(
"Clusters", m_svdClustersName,
"SVDCluster StoreArray name.", std::string(
""));
52 addParam(
"RecoDigits", m_svdRecoDigitsName,
"SVDRecoDigits StoreArray name.", std::string(
""));
53 addParam(
"ShaperDigits", m_svdShaperDigitsName,
"SVDShaperDigits StoreArray name.", std::string(
""));
55 m_histoList =
new TList();
59 SVDDQMClustersOnTrackModule::~SVDDQMClustersOnTrackModule()
67 void SVDDQMClustersOnTrackModule::defineHisto()
69 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
70 if (gTools->getNumberOfLayers() == 0) {
71 B2FATAL(
"Missing geometry for VXD, check steering file.");
73 if (gTools->getNumberOfSVDLayers() == 0) {
74 B2WARNING(
"Missing geometry for SVD, SVD-DQM is skiped.");
79 TDirectory* oldDir = gDirectory;
80 if (m_histogramDirectoryName !=
"") {
81 oldDir->mkdir(m_histogramDirectoryName.c_str());
82 oldDir->cd(m_histogramDirectoryName.c_str());
86 float ChargeMax = 160;
96 TString refFrame =
"in FTSW reference";
98 refFrame =
"in SVD reference";
104 TString name =
"SVDTRK_ClusterChargeU3";
105 TString title =
"SVD U-Cluster-on-Track Charge for layer 3 sensors";
106 m_clsTrkChargeU3 =
new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
107 m_clsTrkChargeU3->GetXaxis()->SetTitle(
"cluster charge [ke-]");
108 m_clsTrkChargeU3->GetYaxis()->SetTitle(
"count");
109 m_histoList->Add(m_clsTrkChargeU3);
110 name =
"SVDTRK_ClusterChargeV3";
111 title =
"SVD V-Cluster-on-Track Charge for layer 3 sensors";
112 m_clsTrkChargeV3 =
new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
113 m_clsTrkChargeV3->GetXaxis()->SetTitle(
"cluster charge [ke-]");
114 m_clsTrkChargeV3->GetYaxis()->SetTitle(
"count");
115 m_histoList->Add(m_clsTrkChargeV3);
117 name =
"SVDTRK_ClusterChargeU456";
118 title =
"SVD U-Cluster-on-Track Charge for layers 4,5,6 sensors";
119 m_clsTrkChargeU456 =
new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
120 m_clsTrkChargeU456->GetXaxis()->SetTitle(
"cluster charge [ke-]");
121 m_clsTrkChargeU456->GetYaxis()->SetTitle(
"count");
122 m_histoList->Add(m_clsTrkChargeU456);
124 name =
"SVDTRK_ClusterChargeV456";
125 title =
"SVD V-Cluster-on-Track Charge for layers 4,5,6 sensors";
126 m_clsTrkChargeV456 =
new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
127 m_clsTrkChargeV456->GetXaxis()->SetTitle(
"cluster charge [ke-]");
128 m_clsTrkChargeV456->GetYaxis()->SetTitle(
"count");
129 m_histoList->Add(m_clsTrkChargeV456);
134 name =
"SVDTRK_ClusterSNRU3";
135 title =
"SVD U-Cluster-on-Track SNR for layer 3 sensors";
136 m_clsTrkSNRU3 =
new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
137 m_clsTrkSNRU3->GetXaxis()->SetTitle(
"cluster SNR");
138 m_clsTrkSNRU3->GetYaxis()->SetTitle(
"count");
139 m_histoList->Add(m_clsTrkSNRU3);
140 name =
"SVDTRK_ClusterSNRV3";
141 title =
"SVD V-Cluster-on-Track SNR for layer 3 sensors";
142 m_clsTrkSNRV3 =
new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
143 m_clsTrkSNRV3->GetXaxis()->SetTitle(
"cluster SNR");
144 m_clsTrkSNRV3->GetYaxis()->SetTitle(
"count");
145 m_histoList->Add(m_clsTrkSNRV3);
147 name =
"SVDTRK_ClusterSNRU456";
148 title =
"SVD U-Cluster-on-Track SNR for layers 4,5,6 sensors";
149 m_clsTrkSNRU456 =
new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
150 m_clsTrkSNRU456->GetXaxis()->SetTitle(
"cluster SNR");
151 m_clsTrkSNRU456->GetYaxis()->SetTitle(
"count");
152 m_histoList->Add(m_clsTrkSNRU456);
153 name =
"SVDTRK_ClusterSNRV456";
154 title =
"SVD V-Cluster-on-Track SNR for layers 4,5,6 sensors";
155 m_clsTrkSNRV456 =
new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
156 m_clsTrkSNRV456->GetXaxis()->SetTitle(
"cluster SNR");
157 m_clsTrkSNRV456->GetYaxis()->SetTitle(
"count");
158 m_histoList->Add(m_clsTrkSNRV456);
163 name =
"SVDTRK_ClusterTimeU3";
164 title = Form(
"SVD U-Cluster-on-Track Time %s for layer 3 sensors", refFrame.Data());
165 m_clsTrkTimeU3 =
new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
166 m_clsTrkTimeU3->GetXaxis()->SetTitle(
"cluster time (ns)");
167 m_clsTrkTimeU3->GetYaxis()->SetTitle(
"count");
168 m_histoList->Add(m_clsTrkTimeU3);
169 name =
"SVDTRK_ClusterTimeV3";
170 title = Form(
"SVD V-Cluster-on-Track Time %s for layer 3 sensors", refFrame.Data());
171 m_clsTrkTimeV3 =
new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
172 m_clsTrkTimeV3->GetXaxis()->SetTitle(
"cluster time (ns)");
173 m_clsTrkTimeV3->GetYaxis()->SetTitle(
"count");
174 m_histoList->Add(m_clsTrkTimeV3);
176 name =
"SVDTRK_ClusterTimeU456";
177 title = Form(
"SVD U-Cluster-on-Track Time %s for layers 4,5,6 sensors", refFrame.Data());
178 m_clsTrkTimeU456 =
new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
179 m_clsTrkTimeU456->GetXaxis()->SetTitle(
"cluster time (ns)");
180 m_clsTrkTimeU456->GetYaxis()->SetTitle(
"count");
181 m_histoList->Add(m_clsTrkTimeU456);
182 name =
"SVDTRK_ClusterTimeV456";
183 title = Form(
"SVD V-Cluster-on-Track Time %s for layers 4,5,6 sensors", refFrame.Data());
184 m_clsTrkTimeV456 =
new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
185 m_clsTrkTimeV456->GetXaxis()->SetTitle(
"cluster time (ns)");
186 m_clsTrkTimeV456->GetYaxis()->SetTitle(
"count");
187 m_histoList->Add(m_clsTrkTimeV456);
192 name =
"SVDTRK_ClusterTimeUvsEventT0";
193 title = Form(
"SVD U-Cluster-on-Track Time vs EventT0 %s for layer 3 sensors", refFrame.Data());
194 m_clsTrkTimeUEvtT0 =
new TH2F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax, 100, -50, 50);
195 m_clsTrkTimeUEvtT0->GetXaxis()->SetTitle(
"clusters time (ns)");
196 m_clsTrkTimeUEvtT0->GetYaxis()->SetTitle(
"EventT0 (ns)");
197 m_histoList->Add(m_clsTrkTimeUEvtT0);
198 name =
"SVDTRK_ClusterTimeVvsEventT0";
199 title = Form(
"SVD V-Cluster-on-Track Time vs EventT0 %s for layer 3 sensors", refFrame.Data());
200 m_clsTrkTimeVEvtT0 =
new TH2F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax, 100, -50, 50);
201 m_clsTrkTimeVEvtT0->GetXaxis()->SetTitle(
"cluster time (ns)");
202 m_clsTrkTimeVEvtT0->GetYaxis()->SetTitle(
"EventT0 (ns)");
203 m_histoList->Add(m_clsTrkTimeVEvtT0);
208 name =
"SVDTRK_StripMaxBinUAll";
209 title =
"SVD U-Strip-on-Track MaxBin for all sensors";
210 m_stripMaxBinUAll =
new TH1F(name.Data(), title.Data(), MaxBinBins, 0, MaxBinMax);
211 m_stripMaxBinUAll->GetXaxis()->SetTitle(
"max bin");
212 m_stripMaxBinUAll->GetYaxis()->SetTitle(
"count");
213 m_histoList->Add(m_stripMaxBinUAll);
214 name =
"SVDTRK_StripMaxBinVAll";
215 title =
"SVD V-Strip-on-Track MaxBin for all sensors";
216 m_stripMaxBinVAll =
new TH1F(name.Data(), title.Data(), MaxBinBins, 0, MaxBinMax);
217 m_stripMaxBinVAll->GetXaxis()->SetTitle(
"max bin");
218 m_stripMaxBinVAll->GetYaxis()->SetTitle(
"count");
219 m_histoList->Add(m_stripMaxBinVAll);
226 void SVDDQMClustersOnTrackModule::initialize()
231 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
232 if (gTools->getNumberOfSVDLayers() != 0) {
234 m_svdEventInfo.isOptional(m_svdEventInfoName);
235 m_eventT0.isOptional();
236 m_tracks.isOptional();
237 m_resultStoreObjectPointer.isOptional();
242 void SVDDQMClustersOnTrackModule::beginRun()
245 m_expNumber = evtMetaData->getExperiment();
246 m_runNumber = evtMetaData->getRun();
248 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
249 if (gTools->getNumberOfSVDLayers() == 0)
return;
252 TString runID = TString::Format(
" ~ Exp%d Run%d", m_expNumber, m_runNumber);
254 TIter nextH(m_histoList);
255 while ((obj = nextH()))
256 if (obj->InheritsFrom(
"TH1")) {
257 ((TH1F*)obj)->SetTitle(obj->GetTitle() + runID);
258 ((TH1F*)obj)->Reset();
262 void SVDDQMClustersOnTrackModule::event()
265 if (!m_tracks.isValid()) {
266 B2WARNING(
"Missing Tracks StoreArray. Skipping SVDDQMClustersOnTrack");
270 if (!m_svdEventInfo.isValid())
274 if (m_svdEventInfo->getModeByte().getTriggerBin() != m_tb)
279 double eventT0 = -1000;
280 if (m_eventT0.isOptional())
281 if (m_eventT0.isValid())
282 if (m_eventT0->hasEventT0())
283 eventT0 = m_eventT0->getEventT0();
286 if (m_desynchSVDTime && m_svdEventInfo.isValid())
287 eventT0 = eventT0 - m_svdEventInfo->getSVD2FTSWTimeShift(0);
291 if (m_skipRejectedEvents && (m_resultStoreObjectPointer.isValid())) {
292 const bool eventAccepted = FinalTriggerDecisionCalculator::getFinalTriggerDecision(*m_resultStoreObjectPointer);
293 if (!eventAccepted)
return;
296 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
297 if (gTools->getNumberOfSVDLayers() == 0)
return;
299 for (
const Track& track : m_tracks) {
301 const TrackFitResult* tfr = track.getTrackFitResultWithClosestMass(Const::pion);
302 if (not tfr)
continue;
305 if (not recoTrack)
continue;
309 int iLayer = svdCluster.getSensorID().getLayerNumber();
311 float time = svdCluster.getClsTime();
312 if (m_desynchSVDTime && m_svdEventInfo.isValid())
313 time = time - m_svdEventInfo->getSVD2FTSWTimeShift(svdCluster.getFirstFrame());
315 if (svdCluster.isUCluster()) {
317 m_clsTrkTimeUEvtT0->Fill(time, eventT0);
320 if (m_clsTrkChargeU3 !=
nullptr) m_clsTrkChargeU3->Fill(svdCluster.getCharge() / 1000.0);
321 if (m_clsTrkSNRU3 !=
nullptr) m_clsTrkSNRU3->Fill(svdCluster.getSNR());
322 if (m_clsTrkTimeU3 !=
nullptr) m_clsTrkTimeU3->Fill(time);
324 if (m_clsTrkChargeU456 !=
nullptr) m_clsTrkChargeU456->Fill(svdCluster.getCharge() / 1000.0);
325 if (m_clsTrkSNRU456 !=
nullptr) m_clsTrkSNRU456->Fill(svdCluster.getSNR());
326 if (m_clsTrkTimeU456 !=
nullptr) m_clsTrkTimeU456->Fill(time);
332 if (m_stripMaxBinUAll !=
nullptr and shaper !=
nullptr) m_stripMaxBinUAll->Fill(shaper->
getMaxTimeBin());
338 m_clsTrkTimeVEvtT0->Fill(time, eventT0);
341 if (m_clsTrkChargeV3 !=
nullptr) m_clsTrkChargeV3->Fill(svdCluster.getCharge() / 1000.0);
342 if (m_clsTrkSNRV3 !=
nullptr) m_clsTrkSNRV3->Fill(svdCluster.getSNR());
343 if (m_clsTrkTimeV3 !=
nullptr) m_clsTrkTimeV3->Fill(time);
345 if (m_clsTrkChargeV456 !=
nullptr) m_clsTrkChargeV456->Fill(svdCluster.getCharge() / 1000.0);
346 if (m_clsTrkSNRV456 !=
nullptr) m_clsTrkSNRV456->Fill(svdCluster.getSNR());
347 if (m_clsTrkTimeV456 !=
nullptr) m_clsTrkTimeV456->Fill(time);
353 if (m_stripMaxBinVAll !=
nullptr and shaper !=
nullptr) m_stripMaxBinVAll->Fill(shaper->
getMaxTimeBin());
363 void SVDDQMClustersOnTrackModule::terminate()
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
This is the Reconstruction Event-Data Model Track.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
RelationVector< T > getRelationsWith(const std::string &name="", const std::string &namedRelation="") const
Get the relations between this object and another store array.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
SVD DQM Module for Clusters related to Tracks.
The SVD ShaperDigit class.
int getMaxTimeBin() const
Get the max bin.
Type-safe access to single objects in the data store.
Values of the result of a track fit with a given particle hypothesis.
Class that bundles various TrackFitResults.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.