Belle II Software  release-05-01-25
VXDDQMExpressRecoModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Peter Kodys *
7  * *
8  * Prepared for Belle II geometry *
9  * *
10  * This software is provided "as is" without any warranty. *
11  **************************************************************************/
12 
13 #include "vxd/modules/vxdDQM/VXDDQMExpressRecoModule.h"
14 
15 #include <framework/datastore/StoreArray.h>
16 #include <framework/datastore/RelationArray.h>
17 
18 #include <svd/dataobjects/SVDShaperDigit.h>
19 #include <svd/dataobjects/SVDCluster.h>
20 #include <svd/geometry/SensorInfo.h>
21 
22 #include <pxd/dataobjects/PXDDigit.h>
23 #include <pxd/dataobjects/PXDCluster.h>
24 #include <pxd/geometry/SensorInfo.h>
25 
26 #include <vxd/geometry/SensorInfoBase.h>
27 #include <vxd/geometry/GeoTools.h>
28 
29 #include <TMath.h>
30 
31 #include <boost/format.hpp>
32 
33 #include "TDirectory.h"
34 
35 using namespace std;
36 using boost::format;
37 using namespace Belle2;
38 
39 //-----------------------------------------------------------------
40 // Register the Module
41 //-----------------------------------------------------------------
42 REG_MODULE(VXDDQMExpressReco)
43 
44 
45 //-----------------------------------------------------------------
46 // Implementation
47 //-----------------------------------------------------------------
48 
50 {
51  //Set module properties
52  setDescription("VXD DQM module for Express Reco "
53  "Recommended Number of events for monitor is 40 kEvents or more to fill all histograms "
54  );
55 
56  setPropertyFlags(c_ParallelProcessingCertified); // specify this flag if you need parallel processing
57  addParam("UseDigits", m_UseDigits,
58  "flag <0,1> for using digits only, no cluster information will be required, default = 0 ", m_UseDigits);
59  addParam("CorrelationGranulation", m_CorrelationGranulation,
60  "Set granulation of histogram plots, default is 1 degree, min = 0.02 degree, max = 1 degree ", m_CorrelationGranulation);
61  addParam("SwapPXD", m_SwapPXD, "flag <0,1> very special case for swap of phi-theta coordinates, default = 0 ", m_SwapPXD);
62  addParam("CutCorrelationSigPXD", m_CutCorrelationSigPXD,
63  "Cut threshold of PXD signal for accepting to correlations, default = 0 ADU ", m_CutCorrelationSigPXD);
64  addParam("CutCorrelationSigUSVD", m_CutCorrelationSigUSVD,
65  "Cut threshold of SVD signal for accepting to correlations in u, default = 0 ADU ", m_CutCorrelationSigUSVD);
66  addParam("CutCorrelationSigVSVD", m_CutCorrelationSigVSVD,
67  "Cut threshold of SVD signal for accepting to correlations in v, default = 0 ADU ", m_CutCorrelationSigVSVD);
68  addParam("CutCorrelationTimeSVD", m_CutCorrelationTimeSVD,
69  "Cut threshold of SVD time window for accepting to correlations, default = 70 ns ", m_CutCorrelationTimeSVD);
70 
71  addParam("histogramDirectoryName", m_histogramDirectoryName, "Name of the directory where histograms will be placed",
72  std::string("VXDExpReco"));
73 }
74 
75 
76 VXDDQMExpressRecoModule::~VXDDQMExpressRecoModule()
77 {
78 }
79 
80 //------------------------------------------------------------------
81 // Function to define histograms
82 //-----------------------------------------------------------------
83 
84 void VXDDQMExpressRecoModule::defineHisto()
85 {
86  auto gTools = VXD::GeoCache::getInstance().getGeoTools();
87  if (gTools->getNumberOfLayers() == 0) {
88  B2WARNING("Missing geometry for VXD, check steering file.");
89  return;
90  }
91  if (gTools->getNumberOfPXDLayers() == 0) {
92  B2WARNING("Missing geometry for PXD.");
93  }
94  if (gTools->getNumberOfSVDLayers() == 0) {
95  B2WARNING("Missing geometry for SVD.");
96  }
97 
98  // Create a separate histogram directories and cd into it.
99  TDirectory* oldDir = gDirectory;
100  if (m_histogramDirectoryName != "") {
101  oldDir->mkdir(m_histogramDirectoryName.c_str());// do not use return value with ->cd(), its ZERO if dir already exists
102  oldDir->cd(m_histogramDirectoryName.c_str());
103  }
104 
105  if (m_CorrelationGranulation > 5.0) m_CorrelationGranulation = 5.0; // set maximum of gramularity to 1 degree
106  if (m_CorrelationGranulation < 0.02) m_CorrelationGranulation = 0.02; // set minimum of gramularity to 0.02 degree
107 
108  // if binning go over h_MaxBins it decrease preset of range
109  int h_MaxBins = 2000; //maximal size of histogram binning:
110 
111  VXD::GeoCache& geo = VXD::GeoCache::getInstance();
112 
113  // basic constants presets:
114  int nVXDLayers = gTools->getNumberOfLayers();
115 
116  // Create basic histograms:
117  m_correlationsSP = (TH2F**) new TH2F*[nVXDLayers * nVXDLayers];
118  m_correlationsSP1DPhi = (TH1F**) new TH1F*[nVXDLayers * nVXDLayers];
119  m_correlationsSP1DTheta = (TH1F**) new TH1F*[nVXDLayers * nVXDLayers];
120 
121 
122  for (int i = 0; i < nVXDLayers; i++) {
123  for (int j = 0; j < nVXDLayers; j++) {
124  m_correlationsSP[nVXDLayers * j + i] = NULL;
125  m_correlationsSP1DPhi[nVXDLayers * j + i] = NULL;
126  m_correlationsSP1DTheta[nVXDLayers * j + i] = NULL;
127  }
128  }
129 
130  string Diru = str(format("Phi"));
131  string Dirv = str(format("Theta"));
132  string Unit = str(format("degree"));
133  string AxisTitPhi = str(format("%1% position [%2%]") % Diru.c_str() % Unit.c_str()); // 0..360 degree, from x+ to y+...
134  string AxisTitTheta = str(format("%1% position [%2%]") % Dirv.c_str() % Unit.c_str()); // 0..180 degree, z+ to z-
135  if (m_UseDigits) {
136  AxisTitPhi = str(format("From digits: %1%") % AxisTitPhi);
137  AxisTitTheta = str(format("From digits: %1%") % AxisTitTheta);
138  }
139  for (VxdID layer1 : geo.getLayers()) {
140  int i = layer1.getLayerNumber() - gTools->getFirstLayer();
141  float uSize1s, uSize1e;
142  float vSize1s, vSize1e;
143  int nStripsU1, nStripsV1;
144  uSize1s = -180.0; // degree
145  uSize1e = 180.0; // degree
146  vSize1s = 0.0; // degree
147  vSize1e = 180.0; // degree
148  nStripsU1 = (uSize1e - uSize1s) / m_CorrelationGranulation;
149  if (nStripsU1 > h_MaxBins) nStripsU1 = h_MaxBins;
150  nStripsV1 = nStripsU1;
151  for (VxdID layer2 : geo.getLayers()) {
152  int j = layer2.getLayerNumber() - gTools->getFirstLayer();
153  float uSize2s, uSize2e;
154  float vSize2s, vSize2e;
155  int nStripsU2, nStripsV2;
156  uSize2s = -180.0; // degree
157  uSize2e = 180.0; // degree
158  vSize2s = 0.0; // degree
159  vSize2e = 180.0; // degree
160  nStripsU2 = nStripsU1;
161  nStripsV2 = nStripsV1;
162 
163  if (i == j) { // hit maps
164  string nameSP = str(format("DQMER_VXD_Hitmap_L%1%") % layer2.getLayerNumber());
165  string titleSP = str(format("DQM ER VXD Hitmap, layer %1%") % layer2.getLayerNumber());
166  m_correlationsSP[nVXDLayers * j + i] = new TH2F(nameSP.c_str(), titleSP.c_str(),
167  nStripsU2, uSize2s, uSize2e,
168  nStripsV2, vSize2s, vSize2e);
169  m_correlationsSP[nVXDLayers * j + i]->GetXaxis()->SetTitle(AxisTitPhi.c_str());
170  m_correlationsSP[nVXDLayers * j + i]->GetYaxis()->SetTitle(AxisTitTheta.c_str());
171  m_correlationsSP[nVXDLayers * j + i]->GetZaxis()->SetTitle("hits");
172 
173  nameSP = str(format("DQMER_VXD_Hitmap_%1%_L%2%") % Diru.c_str() % layer2.getLayerNumber());
174  titleSP = str(format("DQM ER VXD Hitmap in %1%, layer %2%") % Diru.c_str() % layer2.getLayerNumber());
175  m_correlationsSP1DPhi[nVXDLayers * j + i] = new TH1F(nameSP.c_str(), titleSP.c_str(),
176  nStripsU2, uSize2s, uSize2e);
177  m_correlationsSP1DPhi[nVXDLayers * j + i]->GetXaxis()->SetTitle(AxisTitPhi.c_str());
178  m_correlationsSP1DPhi[nVXDLayers * j + i]->GetYaxis()->SetTitle("hits");
179 
180  nameSP = str(format("DQMER_VXD_Hitmap_%1%_L%2%") % Dirv.c_str() % layer2.getLayerNumber());
181  titleSP = str(format("DQM ER VXD Hitmap in %1%, layer %2%") % Dirv.c_str() % layer2.getLayerNumber());
182  m_correlationsSP1DTheta[nVXDLayers * j + i] = new TH1F(nameSP.c_str(), titleSP.c_str(),
183  nStripsV2, vSize2s, vSize2e);
184  m_correlationsSP1DTheta[nVXDLayers * j + i]->GetXaxis()->SetTitle(AxisTitTheta.c_str());
185  m_correlationsSP1DTheta[nVXDLayers * j + i]->GetYaxis()->SetTitle("hits");
186 
187  } else if (i < j) { // correlations for Phi
188  string nameSP = str(format("DQMER_VXD_Correlations_%1%_L%2%_L%3%") % Diru.c_str() % layer1.getLayerNumber() %
189  layer2.getLayerNumber());
190  string titleSP = str(format("DQM ER VXD Correlations in %1%, layers %2% %3%") % Diru.c_str() % layer1.getLayerNumber() %
191  layer2.getLayerNumber());
192  m_correlationsSP[nVXDLayers * j + i] = new TH2F(nameSP.c_str(), titleSP.c_str(),
193  nStripsU1, uSize1s, uSize1e,
194  nStripsU2, uSize2s, uSize2e);
195  string axisxtitle = str(format("%1%, layer %2%") % AxisTitPhi.c_str() % layer1.getLayerNumber());
196  string axisytitle = str(format("%1%, layer %2%") % AxisTitPhi.c_str() % layer2.getLayerNumber());
197  m_correlationsSP[nVXDLayers * j + i]->GetXaxis()->SetTitle(axisxtitle.c_str());
198  m_correlationsSP[nVXDLayers * j + i]->GetYaxis()->SetTitle(axisytitle.c_str());
199  m_correlationsSP[nVXDLayers * j + i]->GetZaxis()->SetTitle("hits");
200 
201  nameSP = str(format("DQMER_VXD_1D_Correlations_%1%_L%2%_L%3%") % Diru.c_str() % layer1.getLayerNumber() % layer2.getLayerNumber());
202  titleSP = str(format("DQM ER VXD 1D Correlations in %1%, layers %2% %3%") % Diru.c_str() % layer1.getLayerNumber() %
203  layer2.getLayerNumber());
204  m_correlationsSP1DPhi[nVXDLayers * j + i] = new TH1F(nameSP.c_str(), titleSP.c_str(),
205  nStripsU1, uSize1s, uSize1e);
206  axisxtitle = str(format("%1%, layer %2% - %3%") % AxisTitPhi.c_str() % layer1.getLayerNumber() % layer2.getLayerNumber());
207  m_correlationsSP1DPhi[nVXDLayers * j + i]->GetXaxis()->SetTitle(axisxtitle.c_str());
208  m_correlationsSP1DPhi[nVXDLayers * j + i]->GetYaxis()->SetTitle("hits");
209  } else { // correlations for Theta
210  string nameSP = str(format("DQMER_VXD_Correlations_%1%_L%2%_L%3%") % Dirv.c_str() % layer1.getLayerNumber() %
211  layer2.getLayerNumber());
212  string titleSP = str(format("DQM ER VXD Correlations in %1%, layers %2% %3%") % Dirv.c_str() % layer1.getLayerNumber() %
213  layer2.getLayerNumber());
214  m_correlationsSP[nVXDLayers * j + i] = new TH2F(nameSP.c_str(), titleSP.c_str(),
215  nStripsV1, vSize1s, vSize1e,
216  nStripsV2, vSize2s, vSize2e);
217  string axisxtitle = str(format("%1%, layer %2%") % AxisTitTheta.c_str() % layer1.getLayerNumber());
218  string axisytitle = str(format("%1%, layer %2%") % AxisTitTheta.c_str() % layer2.getLayerNumber());
219  m_correlationsSP[nVXDLayers * j + i]->GetXaxis()->SetTitle(axisxtitle.c_str());
220  m_correlationsSP[nVXDLayers * j + i]->GetYaxis()->SetTitle(axisytitle.c_str());
221  m_correlationsSP[nVXDLayers * j + i]->GetZaxis()->SetTitle("hits");
222 
223  nameSP = str(format("DQMER_VXD_1D_Correlations_%1%_L%2%_L%3%") % Dirv.c_str() % layer1.getLayerNumber() % layer2.getLayerNumber());
224  titleSP = str(format("DQM ER VXD 1D Correlations in %1%, layers %2% %3%") % Dirv.c_str() % layer1.getLayerNumber() %
225  layer2.getLayerNumber());
226  m_correlationsSP1DTheta[nVXDLayers * j + i] = new TH1F(nameSP.c_str(), titleSP.c_str(),
227  nStripsV1, -vSize1e, vSize1e);
228  axisxtitle = str(format("%1%, layer %2% - %3%") % AxisTitTheta.c_str() % layer1.getLayerNumber() % layer2.getLayerNumber());
229  m_correlationsSP1DTheta[nVXDLayers * j + i]->GetXaxis()->SetTitle(axisxtitle.c_str());
230  m_correlationsSP1DTheta[nVXDLayers * j + i]->GetYaxis()->SetTitle("hits");
231  }
232  }
233  }
234 
235  oldDir->cd();
236 }
237 
238 
239 void VXDDQMExpressRecoModule::initialize()
240 {
241  // Register histograms (calls back defineHisto)
242  REG_HISTOGRAM
243 
244  auto gTools = VXD::GeoCache::getInstance().getGeoTools();
245  if (gTools->getNumberOfLayers() != 0) {
246  //Register collections
247  StoreArray<PXDDigit> storePXDDigits(m_storePXDDigitsName);
248  StoreArray<SVDShaperDigit> storeSVDShaperDigits(m_storeSVDShaperDigitsName);
249  StoreArray<PXDCluster> storePXDClusters(m_storePXDClustersName);
250  StoreArray<SVDCluster> storeSVDClusters(m_storeSVDClustersName);
251  RelationArray relPXDClusterDigits(storePXDClusters, storePXDDigits);
252  RelationArray relSVDClusterDigits(storeSVDClusters, storeSVDShaperDigits);
253  m_storePXDClustersName = storePXDClusters.getName();
254  m_relPXDClusterDigitName = relPXDClusterDigits.getName();
255  m_storeSVDClustersName = storeSVDClusters.getName();
256  m_relSVDClusterDigitName = relSVDClusterDigits.getName();
257 
258  storePXDDigits.isRequired();
259  storeSVDShaperDigits.isRequired();
260 
261  //Store names to speed up creation later
262  m_storePXDDigitsName = storePXDDigits.getName();
263  m_storeSVDShaperDigitsName = storeSVDShaperDigits.getName();
264  }
265 }
266 
267 void VXDDQMExpressRecoModule::beginRun()
268 {
269  auto gTools = VXD::GeoCache::getInstance().getGeoTools();
270  if (gTools->getNumberOfLayers() == 0) return;
271 
272  // Just to make sure, reset all the histograms.
273  int nVXDLayers = gTools->getNumberOfLayers();
274  for (int i = 0; i < nVXDLayers; i++) {
275  for (int j = 0; j < nVXDLayers; j++) {
276  if (m_correlationsSP[nVXDLayers * j + i] != NULL) m_correlationsSP[nVXDLayers * j + i]->Reset();
277  if (m_correlationsSP1DPhi[nVXDLayers * j + i] != NULL) m_correlationsSP1DPhi[nVXDLayers * j + i]->Reset();
278  if (m_correlationsSP1DTheta[nVXDLayers * j + i] != NULL) m_correlationsSP1DTheta[nVXDLayers * j + i]->Reset();
279  }
280  }
281 }
282 
283 
284 void VXDDQMExpressRecoModule::event()
285 {
286  auto gTools = VXD::GeoCache::getInstance().getGeoTools();
287  if (gTools->getNumberOfLayers() == 0) return;
288 
289  const StoreArray<PXDDigit> storePXDDigits(m_storePXDDigitsName);
290  const StoreArray<SVDShaperDigit> storeSVDShaperDigits(m_storeSVDShaperDigitsName);
291 
292  const StoreArray<SVDCluster> storeSVDClusters(m_storeSVDClustersName);
293  const StoreArray<PXDCluster> storePXDClusters(m_storePXDClustersName);
294 
295  const RelationArray relPXDClusterDigits(storePXDClusters, storePXDDigits, m_relPXDClusterDigitName);
296  const RelationArray relSVDClusterDigits(storeSVDClusters, storeSVDShaperDigits, m_relSVDClusterDigitName);
297 
298  // If there are no digits, leave
299  if (!storePXDDigits && !storeSVDShaperDigits) return;
300 
301  // basic constants presets:
302  int nVXDLayers = gTools->getNumberOfLayers();
303  int firstVXDLayer = gTools->getFirstLayer();
304  int firstPXDLayer = gTools->getFirstPXDLayer();
305  int lastPXDLayer = gTools->getLastPXDLayer();
306  int firstSVDLayer = gTools->getFirstSVDLayer();
307  int lastSVDLayer = gTools->getLastSVDLayer();
308 
309  int MaxHits = 0;
310  if (m_UseDigits) {
311  MaxHits = storeSVDShaperDigits.getEntries() + storePXDDigits.getEntries();
312  } else {
313  MaxHits = storeSVDClusters.getEntries() + storePXDClusters.getEntries();
314  }
315 
316  // If there are no hits, leave
317  if (MaxHits == 0) return;
318 
319  for (int i1 = 0; i1 < MaxHits; i1++) {
320  // preparing of first value for correlation plots with postfix "1":
321  float fTime1 = 0.0;
322  float fPosSPU1 = 0.0;
323  float fPosSPV1 = 0.0;
324  int iIsPXD1 = 0;
325  int index1 = 0;
326  int iIsU1 = 0;
327  int iIsV1 = 0;
328  int iLayer1 = 0;
329  if (m_UseDigits) { // DIGITS:
330  if (i1 < storePXDDigits.getEntries()) { // PXD digits/clusters:
331  const PXDDigit& digitPXD1 = *storePXDDigits[i1];
332  iLayer1 = digitPXD1.getSensorID().getLayerNumber();
333  if ((iLayer1 < firstPXDLayer) || (iLayer1 > lastPXDLayer)) continue;
334  index1 = iLayer1 - firstVXDLayer;
335  float fCharge1 = digitPXD1.getCharge();
336  if (fCharge1 < m_CutCorrelationSigPXD) continue;
337  VxdID sensorID1 = digitPXD1.getSensorID();
338  auto info = dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::get(sensorID1));
339  TVector3 rLocal1(info.getUCellPosition(digitPXD1.getUCellID()), info.getVCellPosition(digitPXD1.getVCellID()), 0);
340  TVector3 ral1 = info.pointToGlobal(rLocal1);
341  iIsPXD1 = 1;
342  iIsU1 = 1;
343  iIsV1 = 1;
344  fPosSPU1 = ral1.Phi() / TMath::Pi() * 180;
345  fPosSPV1 = ral1.Theta() / TMath::Pi() * 180;
346  if (m_SwapPXD) {
347  fPosSPV1 = ral1.Phi() / TMath::Pi() * 180;
348  fPosSPU1 = ral1.Theta() / TMath::Pi() * 180;
349  }
350  } else { // SVD digits/clusters:
351  const SVDShaperDigit& digitSVD1 = *storeSVDShaperDigits[i1 - storePXDDigits.getEntries()];
352  iLayer1 = digitSVD1.getSensorID().getLayerNumber();
353  if ((iLayer1 < firstSVDLayer) || (iLayer1 > lastSVDLayer)) continue;
354  index1 = iLayer1 - firstVXDLayer;
355  fTime1 = digitSVD1.getFADCTime();
356  VxdID sensorID1 = digitSVD1.getSensorID();
357  auto info = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::get(sensorID1));
358  SVDShaperDigit::APVFloatSamples samples = digitSVD1.getSamples();
359  if (digitSVD1.isUStrip()) {
360  int iCont = 0;
361  for (size_t i = 0; i < SVDShaperDigit::c_nAPVSamples; ++i) {
362  float fCharge1 = samples[i];
363  if (fCharge1 > m_CutCorrelationSigUSVD) iCont = 1;
364  }
365  if (iCont == 0) continue;
366  float possi = info.getUCellPosition(digitSVD1.getCellID());
367  TVector3 rLocal1(possi, 0 , 0);
368  TVector3 ral1 = info.pointToGlobal(rLocal1);
369  iIsU1 = 1;
370  fPosSPU1 = ral1.Phi() / TMath::Pi() * 180;
371  } else {
372  int iCont = 0;
373  for (size_t i = 0; i < SVDShaperDigit::c_nAPVSamples; ++i) {
374  float fCharge1 = samples[i];
375  if (fCharge1 > m_CutCorrelationSigVSVD) iCont = 1;
376  }
377  if (iCont == 0) continue;
378 
379  //float possi = digitSVD1.getCellPosition(); // is not work anymore
380  float possi = info.getVCellPosition(digitSVD1.getCellID());
381 
382  TVector3 rLocal1(0, possi, 0);
383  TVector3 ral1 = info.pointToGlobal(rLocal1);
384  iIsV1 = 1;
385  fPosSPV1 = ral1.Theta() / TMath::Pi() * 180;
386  }
387  }
388  } else { // CLUSTERS:
389  if (i1 < storePXDClusters.getEntries()) { // PXD digits/clusters:
390  const PXDCluster& clusterPXD1 = *storePXDClusters[i1];
391  iLayer1 = clusterPXD1.getSensorID().getLayerNumber();
392  if ((iLayer1 < firstPXDLayer) || (iLayer1 > lastPXDLayer)) continue;
393  index1 = iLayer1 - firstVXDLayer;
394  float fCharge1 = clusterPXD1.getCharge();
395  if (fCharge1 < m_CutCorrelationSigPXD) continue;
396  VxdID sensorID1 = clusterPXD1.getSensorID();
397  auto info = dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::get(sensorID1));
398  TVector3 rLocal1(clusterPXD1.getU(), clusterPXD1.getV(), 0);
399  TVector3 ral1 = info.pointToGlobal(rLocal1);
400  iIsPXD1 = 1;
401  iIsU1 = 1;
402  iIsV1 = 1;
403  fPosSPU1 = ral1.Phi() / TMath::Pi() * 180;
404  fPosSPV1 = ral1.Theta() / TMath::Pi() * 180;
405  if (m_SwapPXD) {
406  fPosSPV1 = ral1.Phi() / TMath::Pi() * 180;
407  fPosSPU1 = ral1.Theta() / TMath::Pi() * 180;
408  }
409  } else { // SVD digits/clusters:
410  const SVDCluster& clusterSVD1 = *storeSVDClusters[i1 - storePXDClusters.getEntries()];
411  iLayer1 = clusterSVD1.getSensorID().getLayerNumber();
412  if ((iLayer1 < firstSVDLayer) || (iLayer1 > lastSVDLayer)) continue;
413  index1 = iLayer1 - firstVXDLayer;
414  float fCharge1 = clusterSVD1.getCharge();
415  fTime1 = clusterSVD1.getClsTime();
416  VxdID sensorID1 = clusterSVD1.getSensorID();
417  auto info = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::get(sensorID1));
418  if (clusterSVD1.isUCluster()) {
419  if (fCharge1 < m_CutCorrelationSigUSVD * 200) continue; // in electrons
420  TVector3 rLocal1(clusterSVD1.getPosition(), 0 , 0);
421  TVector3 ral1 = info.pointToGlobal(rLocal1);
422  iIsU1 = 1;
423  fPosSPU1 = ral1.Phi() / TMath::Pi() * 180;
424  } else {
425  if (fCharge1 < m_CutCorrelationSigVSVD * 200) continue; // in electrons
426  TVector3 rLocal1(0, clusterSVD1.getPosition(), 0);
427  TVector3 ral1 = info.pointToGlobal(rLocal1);
428  iIsV1 = 1;
429  fPosSPV1 = ral1.Theta() / TMath::Pi() * 180;
430  }
431  }
432  }
433  // hit maps for PXD:
434  if ((iIsU1 == 1) && (iIsV1 == 1)) {
435  if (m_correlationsSP[nVXDLayers * index1 + index1] != NULL)
436  m_correlationsSP[nVXDLayers * index1 + index1]->Fill(fPosSPU1, fPosSPV1);
437  if (m_correlationsSP1DPhi[nVXDLayers * index1 + index1] != NULL)
438  m_correlationsSP1DPhi[nVXDLayers * index1 + index1]->Fill(fPosSPU1);
439  if (m_correlationsSP1DTheta[nVXDLayers * index1 + index1] != NULL)
440  m_correlationsSP1DTheta[nVXDLayers * index1 + index1]->Fill(fPosSPV1);
441  }
442  for (int i2 = 0; i2 < MaxHits; i2++) {
443  // preparing of second value for correlation plots with postfix "2":
444  float fTime2 = 0.0;
445  float fPosSPU2 = 0.0;
446  float fPosSPV2 = 0.0;
447  int iIsPXD2 = 0;
448  int index2 = 0;
449  int iIsU2 = 0;
450  int iIsV2 = 0;
451  int iLayer2 = 0;
452  if (m_UseDigits) { // DIGITS:
453  if (i2 < storePXDDigits.getEntries()) { // PXD digits/clusters:
454  const PXDDigit& digitPXD2 = *storePXDDigits[i2];
455  iLayer2 = digitPXD2.getSensorID().getLayerNumber();
456  if ((iLayer2 < firstPXDLayer) || (iLayer2 > lastPXDLayer)) continue;
457  index2 = iLayer2 - firstVXDLayer;
458  float fCharge2 = digitPXD2.getCharge();
459  if (fCharge2 < m_CutCorrelationSigPXD) continue;
460  VxdID sensorID2 = digitPXD2.getSensorID();
461  auto info = dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::get(sensorID2));
462  TVector3 rLocal2(info.getUCellPosition(digitPXD2.getUCellID()), info.getVCellPosition(digitPXD2.getVCellID()), 0);
463  TVector3 ral2 = info.pointToGlobal(rLocal2);
464  iIsPXD2 = 1;
465  iIsU2 = 1;
466  iIsV2 = 1;
467  fPosSPU2 = ral2.Phi() / TMath::Pi() * 180;
468  fPosSPV2 = ral2.Theta() / TMath::Pi() * 180;
469  if (m_SwapPXD) {
470  fPosSPV2 = ral2.Phi() / TMath::Pi() * 180;
471  fPosSPU2 = ral2.Theta() / TMath::Pi() * 180;
472  }
473  } else { // SVD digits/clusters:
474  const SVDShaperDigit& digitSVD2 = *storeSVDShaperDigits[i2 - storePXDDigits.getEntries()];
475  iLayer2 = digitSVD2.getSensorID().getLayerNumber();
476  if ((iLayer2 < firstSVDLayer) || (iLayer2 > lastSVDLayer)) continue;
477  index2 = iLayer2 - firstVXDLayer;
478  fTime2 = digitSVD2.getFADCTime();
479  VxdID sensorID2 = digitSVD2.getSensorID();
480  auto info = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::get(sensorID2));
481 
482  SVDShaperDigit::APVFloatSamples samples = digitSVD2.getSamples();
483  if (digitSVD2.isUStrip()) {
484  int iCont = 0;
485  for (size_t i = 0; i < SVDShaperDigit::c_nAPVSamples; ++i) {
486  float fCharge2 = samples[i];
487  if (fCharge2 > m_CutCorrelationSigUSVD) iCont = 1;
488  }
489  if (iCont == 0) continue;
490  float possi = info.getUCellPosition(digitSVD2.getCellID());
491  TVector3 rLocal2(possi, 0 , 0);
492  TVector3 ral2 = info.pointToGlobal(rLocal2);
493  iIsU2 = 1;
494  fPosSPU2 = ral2.Phi() / TMath::Pi() * 180;
495  } else {
496  int iCont = 0;
497  for (size_t i = 0; i < SVDShaperDigit::c_nAPVSamples; ++i) {
498  float fCharge2 = samples[i];
499  if (fCharge2 > m_CutCorrelationSigVSVD) iCont = 1;
500  }
501  if (iCont == 0) continue;
502  float possi = info.getVCellPosition(digitSVD2.getCellID());
503  TVector3 rLocal2(0, possi, 0);
504  TVector3 ral2 = info.pointToGlobal(rLocal2);
505  iIsV2 = 1;
506  fPosSPV2 = ral2.Theta() / TMath::Pi() * 180;
507  }
508  }
509  } else { // CLUSTERS:
510  if (i2 < storePXDClusters.getEntries()) { // PXD digits/clusters:
511  const PXDCluster& clusterPXD2 = *storePXDClusters[i2];
512  iLayer2 = clusterPXD2.getSensorID().getLayerNumber();
513  if ((iLayer2 < firstPXDLayer) || (iLayer2 > lastPXDLayer)) continue;
514  index2 = iLayer2 - firstVXDLayer;
515  float fCharge2 = clusterPXD2.getCharge();
516  if (fCharge2 < m_CutCorrelationSigPXD) continue;
517  VxdID sensorID2 = clusterPXD2.getSensorID();
518  auto info = dynamic_cast<const PXD::SensorInfo&>(VXD::GeoCache::get(sensorID2));
519  TVector3 rLocal2(clusterPXD2.getU(), clusterPXD2.getV(), 0);
520  TVector3 ral2 = info.pointToGlobal(rLocal2);
521  iIsPXD2 = 1;
522  iIsU2 = 1;
523  iIsV2 = 1;
524  fPosSPU2 = ral2.Phi() / TMath::Pi() * 180;
525  fPosSPV2 = ral2.Theta() / TMath::Pi() * 180;
526  if (m_SwapPXD) {
527  fPosSPV2 = ral2.Phi() / TMath::Pi() * 180;
528  fPosSPU2 = ral2.Theta() / TMath::Pi() * 180;
529  }
530  } else { // SVD digits/clusters:
531  const SVDCluster& clusterSVD2 = *storeSVDClusters[i2 - storePXDClusters.getEntries()];
532  iLayer2 = clusterSVD2.getSensorID().getLayerNumber();
533  if ((iLayer2 < firstSVDLayer) || (iLayer2 > lastSVDLayer)) continue;
534  index2 = iLayer2 - firstVXDLayer;
535  float fCharge2 = clusterSVD2.getCharge();
536  fTime2 = clusterSVD2.getClsTime();
537  VxdID sensorID2 = clusterSVD2.getSensorID();
538  auto info = dynamic_cast<const SVD::SensorInfo&>(VXD::GeoCache::get(sensorID2));
539  if (clusterSVD2.isUCluster()) {
540  if (fCharge2 < m_CutCorrelationSigUSVD * 200) continue; // in electrons
541  TVector3 rLocal2(clusterSVD2.getPosition(), 0 , 0);
542  TVector3 ral2 = info.pointToGlobal(rLocal2);
543  iIsU2 = 1;
544  fPosSPU2 = ral2.Phi() / TMath::Pi() * 180;
545  } else {
546  if (fCharge2 < m_CutCorrelationSigVSVD * 200) continue; // in electrons
547  TVector3 rLocal2(0, clusterSVD2.getPosition(), 0);
548  TVector3 ral2 = info.pointToGlobal(rLocal2);
549  iIsV2 = 1;
550  fPosSPV2 = ral2.Theta() / TMath::Pi() * 180;
551  }
552  }
553  }
554  if ((iIsPXD1 == 0) && (iIsPXD2 == 0))
555  if ((fabs(fTime1 - fTime2)) > m_CutCorrelationTimeSVD) continue;
556  // ready to fill correlation histograms and hit maps:
557  if ((index1 == index2) && (iIsU1 == 1) && (iIsV2 == 1) && (iIsPXD1 == 0) && (iIsPXD2 == 0)) {
558  // hit maps for SVD:
559  if (m_correlationsSP[nVXDLayers * index2 + index1] != NULL)
560  m_correlationsSP[nVXDLayers * index2 + index1]->Fill(fPosSPU1, fPosSPV2);
561  if (m_correlationsSP1DPhi[nVXDLayers * index2 + index1] != NULL)
562  m_correlationsSP1DPhi[nVXDLayers * index2 + index1]->Fill(fPosSPU1);
563  if (m_correlationsSP1DTheta[nVXDLayers * index2 + index1] != NULL)
564  m_correlationsSP1DTheta[nVXDLayers * index2 + index1]->Fill(fPosSPV2);
565  } else if ((index1 < index2) && (iIsU1 == iIsU2) && (iIsU1 == 1)) {
566  // correlations for u
567  if (m_correlationsSP[nVXDLayers * index2 + index1] != NULL)
568  m_correlationsSP[nVXDLayers * index2 + index1]->Fill(fPosSPU1, fPosSPU2);
569  if (m_correlationsSP1DPhi[nVXDLayers * index2 + index1] != NULL)
570  m_correlationsSP1DPhi[nVXDLayers * index2 + index1]->Fill(fPosSPU2 - fPosSPU1);
571  } else if ((index1 > index2) && (iIsV1 == iIsV2) && (iIsV1 == 1)) {
572  // correlations for v
573  if (m_correlationsSP[nVXDLayers * index2 + index1] != NULL)
574  m_correlationsSP[nVXDLayers * index2 + index1]->Fill(fPosSPV2, fPosSPV1);
575  if (m_correlationsSP1DTheta[nVXDLayers * index2 + index1] != NULL)
576  m_correlationsSP1DTheta[nVXDLayers * index2 + index1]->Fill(fPosSPV2 - fPosSPV1);
577  }
578  }
579  }
580 
581 }
Belle2::SVDCluster::getCharge
float getCharge() const
Get collected charge.
Definition: SVDCluster.h:152
Belle2::RelationArray
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:72
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::SVDShaperDigit::getSamples
APVFloatSamples getSamples() const
Get array of samples.
Definition: SVDShaperDigit.h:137
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::SVDShaperDigit::getSensorID
VxdID getSensorID() const
Get the sensor ID.
Definition: SVDShaperDigit.h:116
Belle2::PXDCluster::getU
float getU() const
Get u coordinate of hit position.
Definition: PXDCluster.h:136
Belle2::StoreAccessorBase::getName
const std::string & getName() const
Return name under which the object is saved in the DataStore.
Definition: StoreAccessorBase.h:130
Belle2::PXDDigit::getCharge
unsigned short getCharge() const
Get collected charge.
Definition: PXDDigit.h:90
Belle2::SVD::SensorInfo
Specific implementation of SensorInfo for SVD Sensors which provides additional sensor specific infor...
Definition: SensorInfo.h:35
Belle2::VXD::GeoCache::getLayers
const std::set< Belle2::VxdID > getLayers(SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
Return a set of all known Layers.
Definition: GeoCache.cc:177
Belle2::SVDShaperDigit::getFADCTime
float getFADCTime() const
Get digit FADCTime estimate.
Definition: SVDShaperDigit.h:174
Belle2::PXDDigit
The PXD digit class.
Definition: PXDDigit.h:38
Belle2::SVDShaperDigit
The SVD ShaperDigit class.
Definition: SVDShaperDigit.h:46
Belle2::PXDDigit::getUCellID
unsigned short getUCellID() const
Get cell ID in u.
Definition: PXDDigit.h:80
Belle2::SVDShaperDigit::APVFloatSamples
std::array< APVFloatSampleType, c_nAPVSamples > APVFloatSamples
array of APVFloatSampleType objects
Definition: SVDShaperDigit.h:63
Belle2::PXDCluster::getCharge
unsigned short getCharge() const
Get collected charge.
Definition: PXDCluster.h:161
Belle2::PXDDigit::getSensorID
VxdID getSensorID() const
Get the sensor ID.
Definition: PXDDigit.h:75
Belle2::PXD::SensorInfo
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Definition: SensorInfo.h:34
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PXDCluster
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:41
Belle2::SVDCluster::isUCluster
bool isUCluster() const
Get the direction of strips.
Definition: SVDCluster.h:118
Belle2::SVDCluster::getSensorID
VxdID getSensorID() const
Get the sensor ID.
Definition: SVDCluster.h:110
Belle2::SVDCluster::getPosition
float getPosition(double v=0) const
Get the coordinate of reconstructed hit.
Definition: SVDCluster.h:125
Belle2::PXDCluster::getSensorID
VxdID getSensorID() const
Get the sensor ID.
Definition: PXDCluster.h:131
Belle2::SVDCluster
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:38
Belle2::VXD::GeoCache
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Definition: GeoCache.h:41
Belle2::SVDShaperDigit::getCellID
short int getCellID() const
Get strip ID.
Definition: SVDShaperDigit.h:132
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::VxdID::getLayerNumber
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:106
Belle2::SVDShaperDigit::isUStrip
bool isUStrip() const
Get strip direction.
Definition: SVDShaperDigit.h:127
Belle2::Unit
The Unit class.
Definition: Unit.h:50
Belle2::PXDCluster::getV
float getV() const
Get v coordinate of hit position.
Definition: PXDCluster.h:141
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226
Belle2::SVDCluster::getClsTime
float getClsTime() const
Get average of waveform maximum times of cluster strip signals.
Definition: SVDCluster.h:142
Belle2::PXDDigit::getVCellID
unsigned short getVCellID() const
Get cell ID in v.
Definition: PXDDigit.h:85
Belle2::VXDDQMExpressRecoModule
VXD DQM Module.
Definition: VXDDQMExpressRecoModule.h:39
Belle2::HistoModule
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29