Belle II Software development
SVDDQMClustersOnTrackModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include "svd/modules/svdDQM/SVDDQMClustersOnTrackModule.h"
10
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/SensorInfoBase.h>
21#include <vxd/geometry/GeoTools.h>
22
23#include <boost/format.hpp>
24
25#include "TDirectory.h"
26
27using namespace std;
28using boost::format;
29using namespace Belle2;
30using namespace SoftwareTrigger;
31
32//-----------------------------------------------------------------
33// Register the Module
34//-----------------------------------------------------------------
35REG_MODULE(SVDDQMClustersOnTrack);
36
37
38//-----------------------------------------------------------------
39// Implementation
40//-----------------------------------------------------------------
41
43{
44 //Set module properties
45 setDescription("SVD DQM module for clusters related to tracks.");
46
47 setPropertyFlags(c_ParallelProcessingCertified); // specify this flag if you need parallel processing
48 addParam("TriggerBin", m_tb, "select events for a specific trigger bin, if -1 then no selection is applied (default)", int(-1));
49 addParam("histogramDirectoryName", m_histogramDirectoryName, "Name of the directory where histograms will be placed.",
50 std::string("SVDClsTrk"));
51 addParam("desynchronizeSVDTime", m_desynchSVDTime,
52 "if True, svd time back in SVD time reference", bool(false));
53 addParam("EventInfo", m_svdEventInfoName, "SVDEventInfo StoreArray name.", std::string(""));
54 addParam("Clusters", m_svdClustersName, "SVDCluster StoreArray name.", std::string(""));
55 addParam("RecoDigits", m_svdRecoDigitsName, "SVDRecoDigits StoreArray name.", std::string(""));
56 addParam("ShaperDigits", m_svdShaperDigitsName, "SVDShaperDigits StoreArray name.", std::string(""));
57 addParam("useParamFromDB", m_useParamFromDB, "use SVDDQMPlotsConfiguration from DB", bool(true));
58 addParam("skipHLTRejectedEvents", m_skipRejectedEvents, "If True, skip events rejected by HLT.", bool(false));
59 addParam("samples3", m_3Samples, "if True 3 samples histograms analysis is performed", bool(false));
60 addParam("AdditionalSensorsToMonitor", m_additionalSensorsToMonitor, "Additionnal sensor list to monitor",
62
63 m_histoList = new TList();
64
65 m_ladderMap = {
66 {{3, 1}, 0}, {{3, 2}, 1},
67 {{4, 1}, 2}, {{4, 2}, 3}, {{4, 3}, 4},
68 {{5, 1}, 5}, {{5, 2}, 6}, {{5, 3}, 7}, {{5, 4}, 8},
69 {{6, 1}, 9}, {{6, 2}, 10}, {{6, 3}, 11}, {{6, 4}, 12}, {{6, 5}, 13}
70 };
71}
72
73
74SVDDQMClustersOnTrackModule::~SVDDQMClustersOnTrackModule()
75{
76}
77
78//------------------------------------------------------------------
79// Function to define histograms
80//-----------------------------------------------------------------
81
83{
84 if (m_useParamFromDB) {
85 if (!m_svdPlotsConfig.isValid())
86 B2FATAL("no valid configuration found for SVD reconstruction");
87 else {
88 B2DEBUG(20, "SVDRecoConfiguration: from now on we are using " << m_svdPlotsConfig->get_uniqueID());
89 //read back from payload
90 m_3Samples = m_svdPlotsConfig->isPlotsFor3SampleMonitoring();
91 m_listOfSensorsToMonitor = m_svdPlotsConfig->getListOfSensors();
92 m_skipRejectedEvents = m_svdPlotsConfig->isSkipHLTRejectedEvents();
93 }
94 }
95
96 if (m_additionalSensorsToMonitor.size() != 0)
99
100 if (m_listOfSensorsToMonitor.size() != 0)
101 m_addSensorPlots = true;
102
103 for (auto sensor : m_listOfSensorsToMonitor) {
104 B2DEBUG(20, "ClusTrk: additional sensors to be monitored " << sensor);
105 }
106
107 // geometry checks
108 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
109 if (gTools->getNumberOfLayers() == 0) {
110 B2FATAL("Missing geometry for VXD, check steering file.");
111 }
112 if (gTools->getNumberOfSVDLayers() == 0) {
113 B2WARNING("Missing geometry for SVD, SVD-DQM is skipped.");
114 return;
115 }
116
117 // Create a separate histogram directories and cd into it.
118 TDirectory* oldDir = gDirectory;
119 if (m_histogramDirectoryName != "") {
120 oldDir->mkdir(m_histogramDirectoryName.c_str());// do not use return value with ->cd(), its ZERO if dir already exists
121 oldDir->cd(m_histogramDirectoryName.c_str());
122 }
123
124 if (m_addSensorPlots) {
125 m_clstrkChargeU = new TH1F*[m_listOfSensorsToMonitor.size()];
126 m_clstrkChargeV = new TH1F*[m_listOfSensorsToMonitor.size()];
127 m_clstrkSNRU = new TH1F*[m_listOfSensorsToMonitor.size()];
128 m_clstrkSNRV = new TH1F*[m_listOfSensorsToMonitor.size()];
129 m_clstrkTimeU = new TH1F*[m_listOfSensorsToMonitor.size()];
130 m_clstrkTimeV = new TH1F*[m_listOfSensorsToMonitor.size()];
131 }
132
133 int ChargeBins = 80;
134 float ChargeMax = 160;
135 int SNRBins = 50;
136 float SNRMax = 100;
137 int TimeBins = 300;
138 float TimeMin = -150;
139 float TimeMax = 150;
140
141 int MaxBinBins = 6;
142 int MaxBinMax = 6;
143
144 TString refFrame = "in FTSW reference";
146 refFrame = "in SVD reference";
147
148
149 //----------------------------------------------------------------
150 // Charge of clusters for L3/L456 sensors
151 //----------------------------------------------------------------
152 TString name = "SVDTRK_ClusterChargeU3";
153 TString title = "SVD U-Cluster-on-Track Charge for layer 3 sensors";
154 m_clsTrkChargeU3 = new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
155 m_clsTrkChargeU3->GetXaxis()->SetTitle("cluster charge [ke-]");
156 m_clsTrkChargeU3->GetYaxis()->SetTitle("count");
158 name = "SVDTRK_ClusterChargeV3";
159 title = "SVD V-Cluster-on-Track Charge for layer 3 sensors";
160 m_clsTrkChargeV3 = new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
161 m_clsTrkChargeV3->GetXaxis()->SetTitle("cluster charge [ke-]");
162 m_clsTrkChargeV3->GetYaxis()->SetTitle("count");
164
165 name = "SVDTRK_ClusterChargeU456";
166 title = "SVD U-Cluster-on-Track Charge for layers 4,5,6 sensors";
167 m_clsTrkChargeU456 = new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
168 m_clsTrkChargeU456->GetXaxis()->SetTitle("cluster charge [ke-]");
169 m_clsTrkChargeU456->GetYaxis()->SetTitle("count");
171
172 name = "SVDTRK_ClusterChargeV456";
173 title = "SVD V-Cluster-on-Track Charge for layers 4,5,6 sensors";
174 m_clsTrkChargeV456 = new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
175 m_clsTrkChargeV456->GetXaxis()->SetTitle("cluster charge [ke-]");
176 m_clsTrkChargeV456->GetYaxis()->SetTitle("count");
178
179
180 m_clsTrkCharge = new TH1F*[m_ladderMap.size()];
181 m_clsTrkSNR = new TH1F*[m_ladderMap.size()];
182
183 for (const auto& it : m_ladderMap) {
184 std::pair<int, int> p = it.first;
185 int layer = p.first;
186 int sensor = p.second;
187 int idx = it.second;
188 name = Form("SVDTRK_ClusterCharge_L%d.x.%d", layer, sensor);
189 title = Form("SVD Cluster-on-Track Charge for L%d.x.%d", layer, sensor);
190 m_clsTrkCharge[idx] = new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
191 m_clsTrkCharge[idx]->GetXaxis()->SetTitle("cluster charge [ke-]");
192 m_clsTrkCharge[idx]->GetYaxis()->SetTitle("count");
193 m_histoList->Add(m_clsTrkCharge[idx]);
194
195 //printf("name %s layer %d sensor %d index %d\n", name.Data(), layer, sensor, idx);
196 name = Form("SVDTRK_ClusterSNR_L%d.x.%d", layer, sensor);
197 title = Form("SVD Cluster-on-Track SNR for L%d.x.%d", layer, sensor);
198 m_clsTrkSNR[idx] = new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
199 m_clsTrkSNR[idx]->GetXaxis()->SetTitle("cluster SNR");
200 m_clsTrkSNR[idx]->GetYaxis()->SetTitle("count");
201 m_histoList->Add(m_clsTrkSNR[idx]);
202 }
203
204 //----------------------------------------------------------------
205 // SNR of clusters for L3/L456 sensors
206 //----------------------------------------------------------------
207 name = "SVDTRK_ClusterSNRU3";
208 title = "SVD U-Cluster-on-Track SNR for layer 3 sensors";
209 m_clsTrkSNRU3 = new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
210 m_clsTrkSNRU3->GetXaxis()->SetTitle("cluster SNR");
211 m_clsTrkSNRU3->GetYaxis()->SetTitle("count");
213 name = "SVDTRK_ClusterSNRV3";
214 title = "SVD V-Cluster-on-Track SNR for layer 3 sensors";
215 m_clsTrkSNRV3 = new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
216 m_clsTrkSNRV3->GetXaxis()->SetTitle("cluster SNR");
217 m_clsTrkSNRV3->GetYaxis()->SetTitle("count");
219
220 name = "SVDTRK_ClusterSNRU456";
221 title = "SVD U-Cluster-on-Track SNR for layers 4,5,6 sensors";
222 m_clsTrkSNRU456 = new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
223 m_clsTrkSNRU456->GetXaxis()->SetTitle("cluster SNR");
224 m_clsTrkSNRU456->GetYaxis()->SetTitle("count");
226 name = "SVDTRK_ClusterSNRV456";
227 title = "SVD V-Cluster-on-Track SNR for layers 4,5,6 sensors";
228 m_clsTrkSNRV456 = new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
229 m_clsTrkSNRV456->GetXaxis()->SetTitle("cluster SNR");
230 m_clsTrkSNRV456->GetYaxis()->SetTitle("count");
232
233 //----------------------------------------------------------------
234 // Time of clusters for L3/L456 sensors
235 //----------------------------------------------------------------
236 name = "SVDTRK_ClusterTimeU3";
237 title = Form("SVD U-Cluster-on-Track Time %s for layer 3 sensors", refFrame.Data());
238 m_clsTrkTimeU3 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
239 m_clsTrkTimeU3->GetXaxis()->SetTitle("cluster time (ns)");
240 m_clsTrkTimeU3->GetYaxis()->SetTitle("count");
242 name = "SVDTRK_ClusterTimeV3";
243 title = Form("SVD V-Cluster-on-Track Time %s for layer 3 sensors", refFrame.Data());
244 m_clsTrkTimeV3 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
245 m_clsTrkTimeV3->GetXaxis()->SetTitle("cluster time (ns)");
246 m_clsTrkTimeV3->GetYaxis()->SetTitle("count");
248
249 if (m_3Samples) {
250 name = "SVDTRK_Cluster3SampleTimeU3";
251 title = Form("SVD U-Cluster-on-Track Time %s for layer 3 sensors for 3 samples", refFrame.Data());
252 m_cls3SampleTrkTimeU3 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
253 m_cls3SampleTrkTimeU3->GetXaxis()->SetTitle("cluster time (ns)");
254 m_cls3SampleTrkTimeU3->GetYaxis()->SetTitle("count");
256 name = "SVDTRK_Cluster3SampleTimeV3";
257 title = Form("SVD V-Cluster-on-Track Time %s for layer 3 sensors for 3 samples", refFrame.Data());
258 m_cls3SampleTrkTimeV3 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
259 m_cls3SampleTrkTimeV3->GetXaxis()->SetTitle("cluster time (ns)");
260 m_cls3SampleTrkTimeV3->GetYaxis()->SetTitle("count");
262
263 name = "SVDTRK_Cluster6SampleTimeU3";
264 title = Form("SVD U-Cluster-on-Track Time %s for layer 3 sensors for 6 samples", refFrame.Data());
265 m_cls6SampleTrkTimeU3 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
266 m_cls6SampleTrkTimeU3->GetXaxis()->SetTitle("cluster time (ns)");
267 m_cls6SampleTrkTimeU3->GetYaxis()->SetTitle("count");
269 name = "SVDTRK_Cluster6SampleTimeV3";
270 title = Form("SVD V-Cluster-on-Track Time %s for layer 3 sensors for 6 samples", refFrame.Data());
271 m_cls6SampleTrkTimeV3 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
272 m_cls6SampleTrkTimeV3->GetXaxis()->SetTitle("cluster time (ns)");
273 m_cls6SampleTrkTimeV3->GetYaxis()->SetTitle("count");
275 }
276
277 name = "SVDTRK_ClusterTimeU456";
278 title = Form("SVD U-Cluster-on-Track Time %s for layers 4,5,6 sensors", refFrame.Data());
279 m_clsTrkTimeU456 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
280 m_clsTrkTimeU456->GetXaxis()->SetTitle("cluster time (ns)");
281 m_clsTrkTimeU456->GetYaxis()->SetTitle("count");
283 name = "SVDTRK_ClusterTimeV456";
284 title = Form("SVD V-Cluster-on-Track Time %s for layers 4,5,6 sensors", refFrame.Data());
285 m_clsTrkTimeV456 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
286 m_clsTrkTimeV456->GetXaxis()->SetTitle("cluster time (ns)");
287 m_clsTrkTimeV456->GetYaxis()->SetTitle("count");
289
290 if (m_3Samples) {
291 name = "SVDTRK_Cluster3SampleTimeU456";
292 title = Form("SVD U-Cluster-on-Track Time %s for layers 4,5,6 sensors for 3 samples", refFrame.Data());
293 m_cls3SampleTrkTimeU456 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
294 m_cls3SampleTrkTimeU456->GetXaxis()->SetTitle("cluster time (ns)");
295 m_cls3SampleTrkTimeU456->GetYaxis()->SetTitle("count");
297 name = "SVDTRK_Cluster3SampleTimeV456";
298 title = Form("SVD V-Cluster-on-Track Time %s for layers 4,5,6 sensors for 3 samples", refFrame.Data());
299 m_cls3SampleTrkTimeV456 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
300 m_cls3SampleTrkTimeV456->GetXaxis()->SetTitle("cluster time (ns)");
301 m_cls3SampleTrkTimeV456->GetYaxis()->SetTitle("count");
303
304 name = "SVDTRK_Cluster6SampleTimeU456";
305 title = Form("SVD U-Cluster-on-Track Time %s for layers 4,5,6 sensors for 6 samples", refFrame.Data());
306 m_cls6SampleTrkTimeU456 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
307 m_cls6SampleTrkTimeU456->GetXaxis()->SetTitle("cluster time (ns)");
308 m_cls6SampleTrkTimeU456->GetYaxis()->SetTitle("count");
310 name = "SVDTRK_Cluster6SampleTimeV456";
311 title = Form("SVD V-Cluster-on-Track Time %s for layers 4,5,6 sensors for 6 samples", refFrame.Data());
312 m_cls6SampleTrkTimeV456 = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
313 m_cls6SampleTrkTimeV456->GetXaxis()->SetTitle("cluster time (ns)");
314 m_cls6SampleTrkTimeV456->GetYaxis()->SetTitle("count");
316 }
317
318 //----------------------------------------------------------------
319 // EventT0 vs Time of clusters for U and V sides
320 //----------------------------------------------------------------
321 name = "SVDTRK_ClusterTimeUvsEventT0";
322 title = Form("SVD U-Cluster-on-Track Time vs EventT0 %s for layer 3 sensors", refFrame.Data());
323 m_clsTrkTimeUEvtT0 = new TH2F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax, 100, -50, 50);
324 m_clsTrkTimeUEvtT0->GetXaxis()->SetTitle("clusters time (ns)");
325 m_clsTrkTimeUEvtT0->GetYaxis()->SetTitle("EventT0 (ns)");
327 name = "SVDTRK_ClusterTimeVvsEventT0";
328 title = Form("SVD V-Cluster-on-Track Time vs EventT0 %s for layer 3 sensors", refFrame.Data());
329 m_clsTrkTimeVEvtT0 = new TH2F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax, 100, -50, 50);
330 m_clsTrkTimeVEvtT0->GetXaxis()->SetTitle("cluster time (ns)");
331 m_clsTrkTimeVEvtT0->GetYaxis()->SetTitle("EventT0 (ns)");
333
334 //----------------------------------------------------------------
335 // MaxBin of strips for all sensors (offline ZS)
336 //----------------------------------------------------------------
337 name = "SVDTRK_StripMaxBinUAll";
338 title = "SVD U-Strip-on-Track MaxBin for all sensors";
339 m_stripMaxBinUAll = new TH1F(name.Data(), title.Data(), MaxBinBins, 0, MaxBinMax);
340 m_stripMaxBinUAll->GetXaxis()->SetTitle("max bin");
341 m_stripMaxBinUAll->GetYaxis()->SetTitle("count");
343 name = "SVDTRK_StripMaxBinVAll";
344 title = "SVD V-Strip-on-Track MaxBin for all sensors";
345 m_stripMaxBinVAll = new TH1F(name.Data(), title.Data(), MaxBinBins, 0, MaxBinMax);
346 m_stripMaxBinVAll->GetXaxis()->SetTitle("max bin");
347 m_stripMaxBinVAll->GetYaxis()->SetTitle("count");
349
350 //----------------------------------------------------------------
351 // Additional sensor plots
352 //----------------------------------------------------------------
353 if (m_addSensorPlots) {
354 for (int i = 0; i < (int)m_listOfSensorsToMonitor.size(); i++) {
355
356 string sensorDescr = m_listOfSensorsToMonitor[i];
357 replace(sensorDescr.begin(), sensorDescr.end(), '.', '_');
358
359 //----------------------------------------------------------------
360 // Charge of clusters
361 //----------------------------------------------------------------
362 name = str(format("SVDTRK_%1%_ClusterChargeU") % sensorDescr);
363 title = str(format("SVD Sensor %1% U-Cluster-on-Track Charge") % sensorDescr);
364 m_clstrkChargeU[i] = new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
365 m_clstrkChargeU[i]->GetXaxis()->SetTitle("cluster charge [ke-]");
366 m_clstrkChargeU[i]->GetYaxis()->SetTitle("count");
368 name = str(format("SVDTRK_%1%_ClusterChargeV") % sensorDescr);
369 title = str(format("SVD Sensor %1% V-Cluster-on-Track Charge") % sensorDescr);
370 m_clstrkChargeV[i] = new TH1F(name.Data(), title.Data(), ChargeBins, 0, ChargeMax);
371 m_clstrkChargeV[i]->GetXaxis()->SetTitle("cluster charge [ke-]");
372 m_clstrkChargeV[i]->GetYaxis()->SetTitle("count");
374 //----------------------------------------------------------------
375 // SNR of clusters
376 //----------------------------------------------------------------
377 name = str(format("SVDTRK_%1%_ClusterSNRU") % sensorDescr);
378 title = str(format("SVD Sensor %1% U-Cluster-on-Track SNR") % sensorDescr);
379 m_clstrkSNRU[i] = new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
380 m_clstrkSNRU[i]->GetXaxis()->SetTitle("cluster SNR");
381 m_clstrkSNRU[i]->GetYaxis()->SetTitle("count");
382 m_histoList->Add(m_clstrkSNRU[i]);
383 name = str(format("SVDTRK_%1%_ClusterSNRV") % sensorDescr);
384 title = str(format("SVD Sensor %1% V-Cluster-on-Track SNR") % sensorDescr);
385 m_clstrkSNRV[i] = new TH1F(name.Data(), title.Data(), SNRBins, 0, SNRMax);
386 m_clstrkSNRV[i]->GetXaxis()->SetTitle("cluster SNR");
387 m_clstrkSNRV[i]->GetYaxis()->SetTitle("count");
388 m_histoList->Add(m_clstrkSNRV[i]);
389 //----------------------------------------------------------------
390 // Cluster time distribution
391 //----------------------------------------------------------------
392 name = str(format("SVDTRK_%1%_ClusterTimeU") % sensorDescr);
393 title = Form("SVD Sensor %s U-Cluster-on-Track Time %s", sensorDescr.c_str(), refFrame.Data());
394 m_clstrkTimeU[i] = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
395 m_clstrkTimeU[i]->GetXaxis()->SetTitle("cluster time (ns)");
396 m_clstrkTimeU[i]->GetYaxis()->SetTitle("count");
397 m_histoList->Add(m_clstrkTimeU[i]);
398 name = str(format("SVDTRK_%1%_ClusterTimeV") % sensorDescr);
399 title = Form("SVD Sensor %s V-Cluster-on-Track Time %s", sensorDescr.c_str(), refFrame.Data());
400 m_clstrkTimeV[i] = new TH1F(name.Data(), title.Data(), TimeBins, TimeMin, TimeMax);
401 m_clstrkTimeV[i]->GetXaxis()->SetTitle("cluster time (ns)");
402 m_clstrkTimeV[i]->GetYaxis()->SetTitle("count");
403 m_histoList->Add(m_clstrkTimeV[i]);
404 }
405 }
406 oldDir->cd();
407}
408
409
411{
412 // Register histograms (calls back defineHisto)
413 REG_HISTOGRAM
414
415 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
416 if (gTools->getNumberOfSVDLayers() != 0) {
417
419 m_eventT0.isOptional();
420 m_tracks.isOptional();
421 m_resultStoreObjectPointer.isOptional();
422
423 }
424}
425
427{
428 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
429 if (gTools->getNumberOfSVDLayers() == 0) return;
430
431 // Add experiment and run number to the title of selected histograms (CR shifter plots)
432 StoreObjPtr<EventMetaData> evtMetaData;
433 m_expNumber = evtMetaData->getExperiment();
434 m_runNumber = evtMetaData->getRun();
435 TString runID = TString::Format(" ~ Exp%d Run%d", m_expNumber, m_runNumber);
436
437 //reset histograms
438 TObject* obj;
439 TIter nextH(m_histoList);
440 while ((obj = nextH()))
441 if (obj->InheritsFrom("TH1")) {
442 ((TH1F*)obj)->Reset();
443
444 TString tmp = (TString)obj->GetTitle();
445 Int_t pos = tmp.Last('~');
446 if (pos == -1) pos = tmp.Length() + 2;
447
448 TString title = tmp(0, pos - 2);
449 ((TH1F*)obj)->SetTitle(title + runID);
450 }
451}
452
454{
455
456 if (!m_tracks.isValid()) {
457 B2WARNING("Missing Tracks StoreArray. Skipping SVDDQMClustersOnTrack");
458 return;
459 }
460
461 if (!m_svdEventInfo.isValid())
462 m_tb = -1;
463 else {
464 if (m_tb != -1)
465 if (m_svdEventInfo->getModeByte().getTriggerBin() != m_tb)
466 return;
467 }
468
469 int nSamples = 0;
470 if (m_svdEventInfo.isValid())
471 nSamples = m_svdEventInfo->getNSamples();
472 else
473 return;
474
475 // get EventT0 if present and valid
476 double eventT0 = -1000;
477 if (m_eventT0.isOptional())
478 if (m_eventT0.isValid())
479 if (m_eventT0->hasEventT0())
480 eventT0 = m_eventT0->getEventT0();
481
482 // if svd time in SVD time reference is shown, eventT0 is also synchronized with SVD reference frame, firstFrame = 0
483 if (m_desynchSVDTime && m_svdEventInfo.isValid())
484 eventT0 = eventT0 - m_svdEventInfo->getSVD2FTSWTimeShift(0);
485
486 //check HLT decision and increase number of events only if the event has been accepted
487
490 if (!eventAccepted) return;
491 }
492
493 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
494 if (gTools->getNumberOfSVDLayers() == 0) return;
495
496
497 for (const Track& track : m_tracks) {
498
499 const TrackFitResult* tfr = track.getTrackFitResultWithClosestMass(Const::pion);
500 if (not tfr) continue;
501
502 const RecoTrack* recoTrack = track.getRelated<RecoTrack>();
503 if (not recoTrack) continue;
504
505 for (const SVDCluster& svdCluster : recoTrack->getRelationsWith<SVDCluster>(m_svdClustersName)) {
506
507 int iLayer = svdCluster.getSensorID().getLayerNumber();
508 int iLadder = svdCluster.getSensorID().getLadderNumber();
509 int iSensor = svdCluster.getSensorID().getSensorNumber();
510
511 if (m_addSensorPlots) {
512 string sensorId = str(format("%1%.%2%.%3%") % iLayer % iLadder % iSensor);
513
514 auto it = find(m_listOfSensorsToMonitor.begin(), m_listOfSensorsToMonitor.end(), sensorId);
515 if (it != m_listOfSensorsToMonitor.end()) {
516 int idx = distance(m_listOfSensorsToMonitor.begin(), it);
517
518 if (svdCluster.isUCluster()) {
519 if (m_clstrkChargeU[idx]) m_clstrkChargeU[idx]->Fill(svdCluster.getCharge() / 1000.0);
520 if (m_clstrkSNRU[idx]) m_clstrkSNRU[idx]->Fill(svdCluster.getSNR());
521 if (m_clstrkTimeU[idx]) m_clstrkTimeU[idx]->Fill(svdCluster.getClsTime());
522 } else {
523 if (m_clstrkChargeV[idx]) m_clstrkChargeV[idx]->Fill(svdCluster.getCharge() / 1000.0);
524 if (m_clstrkSNRV[idx]) m_clstrkSNRV[idx]->Fill(svdCluster.getSNR());
525 if (m_clstrkTimeV[idx]) m_clstrkTimeV[idx]->Fill(svdCluster.getClsTime());
526 }
527 }
528 }
529
530
531 std::pair<int, int> p(iLayer, iSensor);
532 int idx = m_ladderMap[p];
533
534 if (m_clsTrkCharge[idx] != nullptr) m_clsTrkCharge[idx]->Fill(svdCluster.getCharge() / 1000.0); // in kelectrons
535 if (m_clsTrkSNR[idx] != nullptr) m_clsTrkSNR[idx]->Fill(svdCluster.getSNR());
536
537 float time = svdCluster.getClsTime();
538 if (m_desynchSVDTime && m_svdEventInfo.isValid())
539 time = time - m_svdEventInfo->getSVD2FTSWTimeShift(svdCluster.getFirstFrame());
540
541 if (svdCluster.isUCluster()) {
542
543 m_clsTrkTimeUEvtT0->Fill(time, eventT0);
544
545 if (iLayer == 3) {
546 if (m_clsTrkChargeU3 != nullptr) m_clsTrkChargeU3->Fill(svdCluster.getCharge() / 1000.0); // in kelectrons
547 if (m_clsTrkSNRU3 != nullptr) m_clsTrkSNRU3->Fill(svdCluster.getSNR());
548 if (m_clsTrkTimeU3 != nullptr) m_clsTrkTimeU3->Fill(time);
549
550 if (m_3Samples) {
551 if (nSamples == 3) {
552 if (m_cls3SampleTrkTimeU3 != nullptr) m_cls3SampleTrkTimeU3->Fill(time);
553 } else {
554 if (m_cls6SampleTrkTimeU3 != nullptr) m_cls6SampleTrkTimeU3->Fill(time);
555 }
556 }
557 } else {
558 if (m_clsTrkChargeU456 != nullptr) m_clsTrkChargeU456->Fill(svdCluster.getCharge() / 1000.0); // in kelectrons
559 if (m_clsTrkSNRU456 != nullptr) m_clsTrkSNRU456->Fill(svdCluster.getSNR());
560 if (m_clsTrkTimeU456 != nullptr) m_clsTrkTimeU456->Fill(time);
561
562 if (m_3Samples) {
563 if (nSamples == 3) {
564 if (m_cls3SampleTrkTimeU456 != nullptr) m_cls3SampleTrkTimeU456->Fill(time);
565 } else {
566 if (m_cls6SampleTrkTimeU456 != nullptr) m_cls6SampleTrkTimeU456->Fill(time);
567 }
568 }
569 }
570
571 for (const SVDRecoDigit& recoDigit : svdCluster.getRelationsTo<SVDRecoDigit>(m_svdRecoDigitsName)) {
572
574 if (m_stripMaxBinUAll != nullptr and shaper != nullptr) m_stripMaxBinUAll->Fill(shaper->getMaxTimeBin());
575 }
576
577
578 } else {
579
580 m_clsTrkTimeVEvtT0->Fill(time, eventT0);
581
582 if (iLayer == 3) {
583 if (m_clsTrkChargeV3 != nullptr) m_clsTrkChargeV3->Fill(svdCluster.getCharge() / 1000.0); // in kelectrons
584 if (m_clsTrkSNRV3 != nullptr) m_clsTrkSNRV3->Fill(svdCluster.getSNR());
585 if (m_clsTrkTimeV3 != nullptr) m_clsTrkTimeV3->Fill(time);
586 if (m_3Samples) {
587 if (nSamples == 3) {
588 if (m_cls3SampleTrkTimeV3 != nullptr) m_cls3SampleTrkTimeV3->Fill(time);
589 } else {
590 if (m_cls6SampleTrkTimeV3 != nullptr) m_cls6SampleTrkTimeV3->Fill(time);
591 }
592 }
593 } else {
594 if (m_clsTrkChargeV456 != nullptr) m_clsTrkChargeV456->Fill(svdCluster.getCharge() / 1000.0); // in kelectrons
595 if (m_clsTrkSNRV456 != nullptr) m_clsTrkSNRV456->Fill(svdCluster.getSNR());
596 if (m_clsTrkTimeV456 != nullptr) m_clsTrkTimeV456->Fill(time);
597 if (m_3Samples) {
598 if (nSamples == 3) {
599 if (m_cls3SampleTrkTimeV456 != nullptr) m_cls3SampleTrkTimeV456->Fill(time);
600 } else {
601 if (m_cls6SampleTrkTimeV456 != nullptr) m_cls6SampleTrkTimeV456->Fill(time);
602 }
603 }
604 }
605
606 for (const SVDRecoDigit& recoDigit : svdCluster.getRelationsTo<SVDRecoDigit>(m_svdRecoDigitsName)) {
607
609 if (m_stripMaxBinVAll != nullptr and shaper != nullptr) m_stripMaxBinVAll->Fill(shaper->getMaxTimeBin());
610 }
611
612 }
613
614 }
615 }
616}
617
618
620{
621
622 delete m_histoList;
623
624}
static const ChargedStable pion
charged pion particle
Definition Const.h:661
HistoModule()
Constructor.
Definition HistoModule.h:32
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
This is the Reconstruction Event-Data Model Track.
Definition RecoTrack.h:79
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
RelationVector< T > getRelationsWith(const std::string &name="", const std::string &namedRelation="") const
Get the relations between this object and another store array.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition SVDCluster.h:29
bool m_useParamFromDB
if true read back from DB configuration parameters
std::string m_svdClustersName
SVDClusters data object name.
void initialize() override final
Module function initialize.
TH1F ** m_clsTrkCharge
charge of clusters related to tracks per ladder
TH1F * m_clsTrkSNRV456
v SNR of clusters related to tracks for layer 4,5,6 sensors
std::string m_svdShaperDigitsName
SVDShaperDigits data object name.
StoreObjPtr< EventT0 > m_eventT0
EventT0 data object.
bool m_skipRejectedEvents
if true skip events rejected by HLT
std::vector< std::string > m_additionalSensorsToMonitor
additional list of sensor to monitor (Charge, SNR, time; U/V) from parameter
TH1F * m_clsTrkTimeU3
u Time of clusters related to tracks for layer 3 sensors
TH1F * m_cls3SampleTrkTimeV3
v Time of clusters related to tracks for layer 3 sensors for 3 samples
StoreObjPtr< SVDEventInfo > m_svdEventInfo
SVDEventInfo data object.
TH1F * m_cls3SampleTrkTimeU456
u Time of clusters related to tracks for layer 4,5,6 sensors for 3 samples
TH1F * m_clsTrkChargeV3
v charge of clusters related to tracks for layer 3 sensors
void defineHisto() override final
Contains the Histogram definitions.
TH1F * m_clsTrkSNRU456
u SNR of clusters related to tracks for layer 4,5,6 sensors
TH1F * m_clsTrkSNRV3
v SNR of clusters related to tracks for layer 3 sensors
DBObjPtr< SVDDQMPlotsConfiguration > m_svdPlotsConfig
SVD DQM plots configuration.
TH1F * m_cls6SampleTrkTimeU3
u Time of clusters related to tracks for layer 3 sensors for 3 samples
TH1F * m_cls6SampleTrkTimeV456
v Time of clusters related to tracks for layer 4,5,6 sensors for 6 samples
bool m_addSensorPlots
if additional histograms (Charge, SNR, time) for a given list of sensors
TH2F * m_clsTrkTimeUEvtT0
u Time of clusters related to tracks vs EventT0
void terminate() override final
Module function terminate.
TH1F * m_clsTrkChargeU456
u charge of clusters related to tracks for layer 4,5,6 sensors
TH1F * m_cls6SampleTrkTimeV3
v Time of clusters related to tracks for layer 3 sensors for 3 samples
void event() override final
Module function event.
TH1F * m_clsTrkTimeV3
v Time of clusters related to tracks for layer 3 sensors
TH1F * m_cls3SampleTrkTimeU3
u Time of clusters related to tracks for layer 3 sensors for 3 samples
TH1F ** m_clstrkSNRU
u SNR of clusters per sensor
std::string m_histogramDirectoryName
Name of the histogram directory in ROOT file.
StoreArray< Track > m_tracks
StoreArray of the Tracks.
int m_tb
choose one trigger bin, or none if the value is -1
TH1F * m_stripMaxBinUAll
u MaxBin of strips related to tracks for all sensors
bool m_3Samples
if true enable 3 samples histograms analysis
TList * m_histoList
list of cumulative histograms
std::string m_svdRecoDigitsName
SVDRecoDigits data object name.
std::string m_svdEventInfoName
SVDEventInfo data object name.
TH1F * m_cls6SampleTrkTimeU456
u Time of clusters related to tracks for layer 4,5,6 sensors for 6 samples
TH1F ** m_clstrkSNRV
v SNR of clusters per sensor
void beginRun() override final
Module function beginRun.
TH1F * m_clsTrkSNRU3
u SNR of clusters related to tracks for layer 3 sensors
bool m_desynchSVDTime
if TRUE: svdTime back in SVD time reference
TH1F * m_clsTrkChargeU3
u charge of clusters related to tracks for layer 3 sensors
TH1F * m_stripMaxBinVAll
v MaxBin of strips related to tracks for all sensors
TH1F * m_cls3SampleTrkTimeV456
v Time of clusters related to tracks for layer 4,5,6 sensors for 3 samples
StoreObjPtr< SoftwareTriggerResult > m_resultStoreObjectPointer
Store Object for reading the trigger decision.
TH1F * m_clsTrkTimeU456
u Time of clusters related to tracks for layer 4,5,6 sensors
TH1F ** m_clsTrkSNR
SNR of clusters related to tracks per ladder.
TH2F * m_clsTrkTimeVEvtT0
v Time of clusters related to tracks vs EventT0
std::vector< std::string > m_listOfSensorsToMonitor
list of sensor to monitor (Charge, SNR, time; U/V) taken from DB (payload)
TH1F * m_clsTrkChargeV456
v charge of clusters related to tracks for layer 4,5,6 sensors
TH1F * m_clsTrkTimeV456
v Time of clusters related to tracks for layer 4,5,6 sensors
std::map< std::pair< int, int >, int > m_ladderMap
map of ladder index
The SVD RecoDigit class.
The SVD ShaperDigit class.
int getMaxTimeBin() const
Get the max bin.
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...
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Values of the result of a track fit with a given particle hypothesis.
Class that bundles various TrackFitResults.
Definition Track.h:25
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition GeoCache.cc:214
const GeoTools * getGeoTools()
Return a raw pointer to a GeoTools object.
Definition GeoCache.h:142
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.
STL namespace.