9#include "vxd/modules/vxdDQM/VXDDQMExpressRecoModule.h"
11#include <framework/datastore/StoreArray.h>
12#include <framework/datastore/RelationArray.h>
14#include <svd/dataobjects/SVDShaperDigit.h>
15#include <svd/dataobjects/SVDCluster.h>
16#include <svd/geometry/SensorInfo.h>
18#include <pxd/dataobjects/PXDDigit.h>
19#include <pxd/dataobjects/PXDCluster.h>
20#include <pxd/geometry/SensorInfo.h>
22#include <vxd/geometry/SensorInfoBase.h>
23#include <vxd/geometry/GeoTools.h>
26#include <Math/Vector3D.h>
28#include <boost/format.hpp>
30#include "TDirectory.h"
50 "Recommended Number of events for monitor is 40 kEvents or more to fill all histograms "
55 "flag <0,1> for using digits only, no cluster information will be required, default = 0 ",
m_UseDigits);
57 "Set granulation of histogram plots, default is 1 degree, min = 0.02 degree, max = 1 degree ",
m_CorrelationGranulation);
69 std::string(
"VXDExpReco"));
73VXDDQMExpressRecoModule::~VXDDQMExpressRecoModule()
84 if (gTools->getNumberOfLayers() == 0) {
85 B2WARNING(
"Missing geometry for VXD, check steering file.");
88 if (gTools->getNumberOfPXDLayers() == 0) {
89 B2WARNING(
"Missing geometry for PXD.");
91 if (gTools->getNumberOfSVDLayers() == 0) {
92 B2WARNING(
"Missing geometry for SVD.");
96 TDirectory* oldDir = gDirectory;
106 int h_MaxBins = 2000;
111 int nVXDLayers = gTools->getNumberOfLayers();
119 for (
int i = 0; i < nVXDLayers; i++) {
120 for (
int j = 0; j < nVXDLayers; j++) {
127 string Diru = str(format(
"Phi"));
128 string Dirv = str(format(
"Theta"));
129 string Unit = str(format(
"degree"));
130 string AxisTitPhi = str(format(
"%1% position [%2%]") % Diru.c_str() %
Unit.c_str());
131 string AxisTitTheta = str(format(
"%1% position [%2%]") % Dirv.c_str() %
Unit.c_str());
133 AxisTitPhi = str(format(
"From digits: %1%") % AxisTitPhi);
134 AxisTitTheta = str(format(
"From digits: %1%") % AxisTitTheta);
137 int i = layer1.getLayerNumber() - gTools->getFirstLayer();
138 float uSize1s, uSize1e;
139 float vSize1s, vSize1e;
140 int nStripsU1, nStripsV1;
146 if (nStripsU1 > h_MaxBins) nStripsU1 = h_MaxBins;
147 nStripsV1 = nStripsU1;
149 int j = layer2.getLayerNumber() - gTools->getFirstLayer();
150 float uSize2s, uSize2e;
151 float vSize2s, vSize2e;
152 int nStripsU2, nStripsV2;
157 nStripsU2 = nStripsU1;
158 nStripsV2 = nStripsV1;
161 string nameSP = str(format(
"DQMER_VXD_Hitmap_L%1%") % layer2.getLayerNumber());
162 string titleSP = str(format(
"DQM ER VXD Hitmap, layer %1%") % layer2.getLayerNumber());
163 m_correlationsSP[nVXDLayers * j + i] =
new TH2F(nameSP.c_str(), titleSP.c_str(),
164 nStripsU2, uSize2s, uSize2e,
165 nStripsV2, vSize2s, vSize2e);
166 m_correlationsSP[nVXDLayers * j + i]->GetXaxis()->SetTitle(AxisTitPhi.c_str());
167 m_correlationsSP[nVXDLayers * j + i]->GetYaxis()->SetTitle(AxisTitTheta.c_str());
170 nameSP = str(format(
"DQMER_VXD_Hitmap_%1%_L%2%") % Diru.c_str() % layer2.getLayerNumber());
171 titleSP = str(format(
"DQM ER VXD Hitmap in %1%, layer %2%") % Diru.c_str() % layer2.getLayerNumber());
173 nStripsU2, uSize2s, uSize2e);
177 nameSP = str(format(
"DQMER_VXD_Hitmap_%1%_L%2%") % Dirv.c_str() % layer2.getLayerNumber());
178 titleSP = str(format(
"DQM ER VXD Hitmap in %1%, layer %2%") % Dirv.c_str() % layer2.getLayerNumber());
180 nStripsV2, vSize2s, vSize2e);
185 string nameSP = str(format(
"DQMER_VXD_Correlations_%1%_L%2%_L%3%") % Diru.c_str() % layer1.getLayerNumber() %
186 layer2.getLayerNumber());
187 string titleSP = str(format(
"DQM ER VXD Correlations in %1%, layers %2% %3%") % Diru.c_str() % layer1.getLayerNumber() %
188 layer2.getLayerNumber());
189 m_correlationsSP[nVXDLayers * j + i] =
new TH2F(nameSP.c_str(), titleSP.c_str(),
190 nStripsU1, uSize1s, uSize1e,
191 nStripsU2, uSize2s, uSize2e);
192 string axisxtitle = str(format(
"%1%, layer %2%") % AxisTitPhi.c_str() % layer1.getLayerNumber());
193 string axisytitle = str(format(
"%1%, layer %2%") % AxisTitPhi.c_str() % layer2.getLayerNumber());
194 m_correlationsSP[nVXDLayers * j + i]->GetXaxis()->SetTitle(axisxtitle.c_str());
195 m_correlationsSP[nVXDLayers * j + i]->GetYaxis()->SetTitle(axisytitle.c_str());
198 nameSP = str(format(
"DQMER_VXD_1D_Correlations_%1%_L%2%_L%3%") % Diru.c_str() % layer1.getLayerNumber() % layer2.getLayerNumber());
199 titleSP = str(format(
"DQM ER VXD 1D Correlations in %1%, layers %2% %3%") % Diru.c_str() % layer1.getLayerNumber() %
200 layer2.getLayerNumber());
202 nStripsU1, uSize1s, uSize1e);
203 axisxtitle = str(format(
"%1%, layer %2% - %3%") % AxisTitPhi.c_str() % layer1.getLayerNumber() % layer2.getLayerNumber());
207 string nameSP = str(format(
"DQMER_VXD_Correlations_%1%_L%2%_L%3%") % Dirv.c_str() % layer1.getLayerNumber() %
208 layer2.getLayerNumber());
209 string titleSP = str(format(
"DQM ER VXD Correlations in %1%, layers %2% %3%") % Dirv.c_str() % layer1.getLayerNumber() %
210 layer2.getLayerNumber());
211 m_correlationsSP[nVXDLayers * j + i] =
new TH2F(nameSP.c_str(), titleSP.c_str(),
212 nStripsV1, vSize1s, vSize1e,
213 nStripsV2, vSize2s, vSize2e);
214 string axisxtitle = str(format(
"%1%, layer %2%") % AxisTitTheta.c_str() % layer1.getLayerNumber());
215 string axisytitle = str(format(
"%1%, layer %2%") % AxisTitTheta.c_str() % layer2.getLayerNumber());
216 m_correlationsSP[nVXDLayers * j + i]->GetXaxis()->SetTitle(axisxtitle.c_str());
217 m_correlationsSP[nVXDLayers * j + i]->GetYaxis()->SetTitle(axisytitle.c_str());
220 nameSP = str(format(
"DQMER_VXD_1D_Correlations_%1%_L%2%_L%3%") % Dirv.c_str() % layer1.getLayerNumber() % layer2.getLayerNumber());
221 titleSP = str(format(
"DQM ER VXD 1D Correlations in %1%, layers %2% %3%") % Dirv.c_str() % layer1.getLayerNumber() %
222 layer2.getLayerNumber());
224 nStripsV1, -vSize1e, vSize1e);
225 axisxtitle = str(format(
"%1%, layer %2% - %3%") % AxisTitTheta.c_str() % layer1.getLayerNumber() % layer2.getLayerNumber());
242 if (gTools->getNumberOfLayers() != 0) {
248 RelationArray relPXDClusterDigits(storePXDClusters, storePXDDigits);
249 RelationArray relSVDClusterDigits(storeSVDClusters, storeSVDShaperDigits);
267 if (gTools->getNumberOfLayers() == 0)
return;
271 for (
int i = 0; i < nVXDLayers; i++) {
272 for (
int j = 0; j < nVXDLayers; j++) {
284 if (gTools->getNumberOfLayers() == 0)
return;
296 if (!storePXDDigits && !storeSVDShaperDigits)
return;
299 int nVXDLayers = gTools->getNumberOfLayers();
300 int firstVXDLayer = gTools->getFirstLayer();
301 int firstPXDLayer = gTools->getFirstPXDLayer();
302 int lastPXDLayer = gTools->getLastPXDLayer();
303 int firstSVDLayer = gTools->getFirstSVDLayer();
304 int lastSVDLayer = gTools->getLastSVDLayer();
314 if (MaxHits == 0)
return;
316 for (
int i1 = 0; i1 < MaxHits; i1++) {
319 float fPosSPU1 = 0.0;
320 float fPosSPV1 = 0.0;
328 const PXDDigit& digitPXD1 = *storePXDDigits[i1];
330 if ((iLayer1 < firstPXDLayer) || (iLayer1 > lastPXDLayer))
continue;
331 index1 = iLayer1 - firstVXDLayer;
336 ROOT::Math::XYZVector rLocal1(info.getUCellPosition(digitPXD1.
getUCellID()), info.getVCellPosition(digitPXD1.
getVCellID()), 0);
337 ROOT::Math::XYZVector ral1 = info.pointToGlobal(rLocal1);
341 fPosSPU1 = ral1.Phi() / TMath::Pi() * 180;
342 fPosSPV1 = ral1.Theta() / TMath::Pi() * 180;
344 fPosSPV1 = ral1.Phi() / TMath::Pi() * 180;
345 fPosSPU1 = ral1.Theta() / TMath::Pi() * 180;
350 if ((iLayer1 < firstSVDLayer) || (iLayer1 > lastSVDLayer))
continue;
351 index1 = iLayer1 - firstVXDLayer;
359 float fCharge1 = samples[i];
362 if (iCont == 0)
continue;
363 float possi = info.getUCellPosition(digitSVD1.
getCellID());
364 ROOT::Math::XYZVector rLocal1(possi, 0, 0);
365 ROOT::Math::XYZVector ral1 = info.pointToGlobal(rLocal1);
367 fPosSPU1 = ral1.Phi() / TMath::Pi() * 180;
371 float fCharge1 = samples[i];
374 if (iCont == 0)
continue;
377 float possi = info.getVCellPosition(digitSVD1.
getCellID());
379 ROOT::Math::XYZVector rLocal1(0, possi, 0);
380 ROOT::Math::XYZVector ral1 = info.pointToGlobal(rLocal1);
382 fPosSPV1 = ral1.Theta() / TMath::Pi() * 180;
387 const PXDCluster& clusterPXD1 = *storePXDClusters[i1];
389 if ((iLayer1 < firstPXDLayer) || (iLayer1 > lastPXDLayer))
continue;
390 index1 = iLayer1 - firstVXDLayer;
391 float fCharge1 = clusterPXD1.
getCharge();
395 ROOT::Math::XYZVector rLocal1(clusterPXD1.
getU(), clusterPXD1.
getV(), 0);
396 ROOT::Math::XYZVector ral1 = info.pointToGlobal(rLocal1);
400 fPosSPU1 = ral1.Phi() / TMath::Pi() * 180;
401 fPosSPV1 = ral1.Theta() / TMath::Pi() * 180;
403 fPosSPV1 = ral1.Phi() / TMath::Pi() * 180;
404 fPosSPU1 = ral1.Theta() / TMath::Pi() * 180;
409 if ((iLayer1 < firstSVDLayer) || (iLayer1 > lastSVDLayer))
continue;
410 index1 = iLayer1 - firstVXDLayer;
411 float fCharge1 = clusterSVD1.
getCharge();
417 ROOT::Math::XYZVector rLocal1(clusterSVD1.
getPosition(), 0, 0);
418 ROOT::Math::XYZVector ral1 = info.pointToGlobal(rLocal1);
420 fPosSPU1 = ral1.Phi() / TMath::Pi() * 180;
423 ROOT::Math::XYZVector rLocal1(0, clusterSVD1.
getPosition(), 0);
424 ROOT::Math::XYZVector ral1 = info.pointToGlobal(rLocal1);
426 fPosSPV1 = ral1.Theta() / TMath::Pi() * 180;
431 if ((iIsU1 == 1) && (iIsV1 == 1)) {
439 for (
int i2 = 0; i2 < MaxHits; i2++) {
442 float fPosSPU2 = 0.0;
443 float fPosSPV2 = 0.0;
451 const PXDDigit& digitPXD2 = *storePXDDigits[i2];
453 if ((iLayer2 < firstPXDLayer) || (iLayer2 > lastPXDLayer))
continue;
454 index2 = iLayer2 - firstVXDLayer;
459 ROOT::Math::XYZVector rLocal2(info.getUCellPosition(digitPXD2.
getUCellID()), info.getVCellPosition(digitPXD2.
getVCellID()), 0);
460 ROOT::Math::XYZVector ral2 = info.pointToGlobal(rLocal2);
464 fPosSPU2 = ral2.Phi() / TMath::Pi() * 180;
465 fPosSPV2 = ral2.Theta() / TMath::Pi() * 180;
467 fPosSPV2 = ral2.Phi() / TMath::Pi() * 180;
468 fPosSPU2 = ral2.Theta() / TMath::Pi() * 180;
473 if ((iLayer2 < firstSVDLayer) || (iLayer2 > lastSVDLayer))
continue;
474 index2 = iLayer2 - firstVXDLayer;
483 float fCharge2 = samples[i];
486 if (iCont == 0)
continue;
487 float possi = info.getUCellPosition(digitSVD2.
getCellID());
488 ROOT::Math::XYZVector rLocal2(possi, 0, 0);
489 ROOT::Math::XYZVector ral2 = info.pointToGlobal(rLocal2);
491 fPosSPU2 = ral2.Phi() / TMath::Pi() * 180;
495 float fCharge2 = samples[i];
498 if (iCont == 0)
continue;
499 float possi = info.getVCellPosition(digitSVD2.
getCellID());
500 ROOT::Math::XYZVector rLocal2(0, possi, 0);
501 ROOT::Math::XYZVector ral2 = info.pointToGlobal(rLocal2);
503 fPosSPV2 = ral2.Theta() / TMath::Pi() * 180;
508 const PXDCluster& clusterPXD2 = *storePXDClusters[i2];
510 if ((iLayer2 < firstPXDLayer) || (iLayer2 > lastPXDLayer))
continue;
511 index2 = iLayer2 - firstVXDLayer;
512 float fCharge2 = clusterPXD2.
getCharge();
516 ROOT::Math::XYZVector rLocal2(clusterPXD2.
getU(), clusterPXD2.
getV(), 0);
517 ROOT::Math::XYZVector ral2 = info.pointToGlobal(rLocal2);
521 fPosSPU2 = ral2.Phi() / TMath::Pi() * 180;
522 fPosSPV2 = ral2.Theta() / TMath::Pi() * 180;
524 fPosSPV2 = ral2.Phi() / TMath::Pi() * 180;
525 fPosSPU2 = ral2.Theta() / TMath::Pi() * 180;
530 if ((iLayer2 < firstSVDLayer) || (iLayer2 > lastSVDLayer))
continue;
531 index2 = iLayer2 - firstVXDLayer;
532 float fCharge2 = clusterSVD2.
getCharge();
538 ROOT::Math::XYZVector rLocal2(clusterSVD2.
getPosition(), 0, 0);
539 ROOT::Math::XYZVector ral2 = info.pointToGlobal(rLocal2);
541 fPosSPU2 = ral2.Phi() / TMath::Pi() * 180;
544 ROOT::Math::XYZVector rLocal2(0, clusterSVD2.
getPosition(), 0);
545 ROOT::Math::XYZVector ral2 = info.pointToGlobal(rLocal2);
547 fPosSPV2 = ral2.Theta() / TMath::Pi() * 180;
551 if ((iIsPXD1 == 0) && (iIsPXD2 == 0))
554 if ((index1 == index2) && (iIsU1 == 1) && (iIsV2 == 1) && (iIsPXD1 == 0) && (iIsPXD2 == 0)) {
562 }
else if ((index1 < index2) && (iIsU1 == iIsU2) && (iIsU1 == 1)) {
568 }
else if ((index1 > index2) && (iIsV1 == iIsV2) && (iIsV1 == 1)) {
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
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 PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
float getV() const
Get v coordinate of hit position.
unsigned short getCharge() const
Get collected charge.
VxdID getSensorID() const
Get the sensor ID.
float getU() const
Get u coordinate of hit position.
unsigned short getVCellID() const
Get cell ID in v.
unsigned short getUCellID() const
Get cell ID in u.
unsigned short getCharge() const
Get collected charge.
VxdID getSensorID() const
Get the sensor ID.
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
Low-level class to create/modify relations between StoreArrays.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
float getClsTime() const
Get average of waveform maximum times of cluster strip signals.
float getCharge() const
Get collected charge.
VxdID getSensorID() const
Get the sensor ID.
bool isUCluster() const
Get the direction of strips.
float getPosition(double v=0) const
Get the coordinate of reconstructed hit.
The SVD ShaperDigit class.
static const std::size_t c_nAPVSamples
Number of APV samples stored.
std::array< APVFloatSampleType, c_nAPVSamples > APVFloatSamples
array of APVFloatSampleType objects
VxdID getSensorID() const
Get the sensor ID.
APVFloatSamples getSamples() const
Get array of samples.
short int getCellID() const
Get strip ID.
bool isUStrip() const
Get strip direction.
float getFADCTime() const
Get digit FADCTime estimate.
Specific implementation of SensorInfo for SVD Sensors which provides additional sensor specific infor...
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
TH2F ** m_correlationsSP
Correlations and hit maps from space points.
void initialize() override final
Initialize.
std::string m_relPXDClusterDigitName
PXDClustersToPXDDigits RelationArray name.
int m_SwapPXD
flag <0,1> very special case for swap of u-v coordinates
float m_CorrelationGranulation
set granulation of histogram plots, default is 1 deg (1 mm), min = 0.02, max = 5.0
std::string m_storePXDClustersName
PXDClusters StoreArray name.
VXDDQMExpressRecoModule()
Constructor.
void defineHisto() override final
Histogram definitions such as TH1(), TH2(), TNtuple(), TTree()....
void event() override final
Event.
std::string m_relSVDClusterDigitName
SVDClustersToSVDDigits RelationArray name.
float m_CutCorrelationTimeSVD
Cut threshold of SVD time window for accepting to correlations, default = 70 ns.
float m_CutCorrelationSigVSVD
Cut threshold of SVD signal for accepting to correlations in v, default = 0 ADU.
std::string m_storeSVDShaperDigitsName
SVDShaperDigits StoreArray name.
std::string m_histogramDirectoryName
Name of the histogram directory in ROOT file.
TH1F ** m_correlationsSP1DPhi
Correlations and hit maps from space points - differencies in Phi.
float m_CutCorrelationSigPXD
Cut threshold of PXD signal for accepting to correlations, default = 0 ADU.
int m_UseDigits
flag <0,1> for using digits only, no clusters will be required, default = 0
float m_CutCorrelationSigUSVD
Cut threshold of SVD signal for accepting to correlations in u, default = 0 ADU.
void beginRun() override final
Begin run.
TH1F ** m_correlationsSP1DTheta
Correlations and hit maps from space points - differencies in Theta.
std::string m_storeSVDClustersName
SVDClusters StoreArray name.
std::string m_storePXDDigitsName
PXDDigits StoreArray name.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
const std::set< Belle2::VxdID > getLayers(SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
Return a set of all known Layers.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
const GeoTools * getGeoTools()
Return a raw pointer to a GeoTools object.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getLayerNumber() const
Get the layer id.
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.