9 #include "pxd/modules/pxdDQM/PXDDQMExpressRecoModule.h"
11 #include <pxd/geometry/SensorInfo.h>
12 #include <vxd/geometry/GeoCache.h>
13 #include <vxd/geometry/SensorInfoBase.h>
14 #include <vxd/geometry/GeoTools.h>
15 #include <pxd/unpacking/PXDMappingLookup.h>
17 #include <boost/format.hpp>
19 #include "TDirectory.h"
39 setDescription(
"PXD DQM module for Express Reco "
40 "Recommended Number of events for monitor is 40 kEvents or more to fill all histograms "
43 setPropertyFlags(c_ParallelProcessingCertified);
44 addParam(
"CutMinCharge", m_CutMinCharge,
45 "cut on pixel charge for accepting good pixel, default >= 12", 12);
46 addParam(
"CutMinSeedCharge", m_CutMinSeedCharge,
47 "cut on cluster seed for accepting good cluster, default >= 12", 12);
48 addParam(
"CutMaxClusterSize", m_CutMaxClusterSize,
49 "cut on cluster size accepting good cluster, default <= 4", 4);
50 addParam(
"CutMinClusterCharge", m_CutMinClusterCharge,
51 "cut on cluster charge for accepting good cluster, default >= 12", 12);
52 addParam(
"histogramDirectoryName", m_histogramDirectoryName,
"Name of the directory where histograms will be placed",
53 std::string(
"PXDER"));
61 void PXDDQMExpressRecoModule::defineHisto()
63 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
64 if (gTools->getNumberOfLayers() == 0) {
65 B2FATAL(
"Missing geometry for VXD, check steering file.");
67 if (gTools->getNumberOfPXDLayers() == 0) {
68 B2WARNING(
"Missing geometry for PXD, PXD-DQM is skipped.");
73 TDirectory* oldDir = gDirectory;
74 if (m_histogramDirectoryName !=
"") {
75 oldDir->mkdir(m_histogramDirectoryName.c_str());
76 oldDir->cd(m_histogramDirectoryName.c_str());
80 int nPXDSensors = gTools->getNumberOfPXDSensors();
81 int nPXDChips = gTools->getTotalPXDChips();
84 m_hitMapCounts =
new TH1D(
"DQMER_PXD_PixelHitmapCounts",
"PXD Integrated number of fired pixels per sensor",
85 nPXDSensors, 0, nPXDSensors);
86 m_hitMapCounts->GetXaxis()->SetTitle(
"Sensor ID");
87 m_hitMapCounts->GetYaxis()->SetTitle(
"counts");
89 m_hitMapFilterCounts =
new TH1D(
"DQMER_PXD_PixelHitmapFilterCounts",
"PXD Integrated number of filtered pixels per sensor",
90 nPXDSensors, 0, nPXDSensors);
91 m_hitMapFilterCounts->GetXaxis()->SetTitle(
"Sensor ID");
92 m_hitMapFilterCounts->GetYaxis()->SetTitle(
"counts");
94 m_hitMapClCounts =
new TH1D(
"DQMER_PXD_ClusterHitmapCounts",
"PXD Integrated number of clusters per sensor",
95 nPXDSensors, 0, nPXDSensors);
96 m_hitMapClCounts->GetXaxis()->SetTitle(
"Sensor ID");
97 m_hitMapClCounts->GetYaxis()->SetTitle(
"counts");
99 m_hitMapClFilterCounts =
new TH1D(
"DQMER_PXD_ClusterHitmapFilterCounts",
"PXD Integrated number of filtered clusters per sensor",
100 nPXDSensors, 0, nPXDSensors);
101 m_hitMapClFilterCounts->GetXaxis()->SetTitle(
"Sensor ID");
102 m_hitMapClFilterCounts->GetYaxis()->SetTitle(
"counts");
105 m_hitMapCountsChip =
new TH1D(
"DQMER_PXD_PixelHitmapCountsChip",
"PXD Integrated number of fired pixels per chip",
106 nPXDChips, 0, nPXDChips);
107 m_hitMapCountsChip->GetXaxis()->SetTitle(
"Chip ID");
108 m_hitMapCountsChip->GetYaxis()->SetTitle(
"counts");
109 m_hitMapClCountsChip =
new TH1D(
"DQMER_PXD_ClusterHitmapCountsChip",
"PXD Integrated number of clusters per chip",
110 nPXDChips, 0, nPXDChips);
111 m_hitMapClCountsChip->GetXaxis()->SetTitle(
"Chip ID");
112 m_hitMapClCountsChip->GetYaxis()->SetTitle(
"counts");
113 for (
int i = 0; i < nPXDChips; i++) {
114 VxdID id = gTools->getChipIDFromPXDIndex(i);
116 int iLadder =
id.getLadderNumber();
117 int iSensor =
id.getSensorNumber();
118 int iChip = gTools->getPXDChipNumber(
id);
119 int IsU = gTools->isPXDSideU(
id);
120 TString AxisTicks = Form(
"%i_%i_%i_u%iDCD", iLayer, iLadder, iSensor, iChip);
122 AxisTicks = Form(
"%i_%i_%i_v%iSWB", iLayer, iLadder, iSensor, iChip);
123 m_hitMapCountsChip->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
124 m_hitMapClCountsChip->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
127 for (
int i = 0; i < nPXDSensors; i++) {
128 VxdID id = gTools->getSensorIDFromPXDIndex(i);
130 int iLadder =
id.getLadderNumber();
131 int iSensor =
id.getSensorNumber();
132 TString AxisTicks = Form(
"%i_%i_%i", iLayer, iLadder, iSensor);
133 m_hitMapCounts->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
134 m_hitMapClCounts->GetXaxis()->SetBinLabel(i + 1, AxisTicks.Data());
137 m_fired.resize(nPXDSensors);
138 m_goodfired.resize(nPXDSensors);
139 m_clusters.resize(nPXDSensors);
140 m_goodclusters.resize(nPXDSensors);
145 m_clusterCharge.resize(nPXDSensors);
146 m_pixelSignal.resize(nPXDSensors);
147 m_clusterSizeU.resize(nPXDSensors);
148 m_clusterSizeV.resize(nPXDSensors);
149 m_clusterSizeUV.resize(nPXDSensors);
150 for (
int i = 0; i < nPXDSensors; i++) {
151 VxdID id = gTools->getSensorIDFromPXDIndex(i);
153 int iLadder =
id.getLadderNumber();
154 int iSensor =
id.getSensorNumber();
155 VxdID sensorID(iLayer, iLadder, iSensor);
157 string sensorDescr = str(format(
"%1%_%2%_%3%") % iLayer % iLadder % iSensor);
161 string name = str(format(
"DQMER_PXD_%1%_Fired") % sensorDescr);
162 string title = str(format(
"PXD Sensor %1% Fired pixels") % sensorDescr);
163 m_fired[i] =
new TH1D(name.c_str(), title.c_str(), 200, 0, 200);
164 m_fired[i]->SetCanExtend(TH1::kAllAxes);
165 m_fired[i]->GetXaxis()->SetTitle(
"# of fired pixels");
166 m_fired[i]->GetYaxis()->SetTitle(
"counts");
170 name = str(format(
"DQMER_PXD_%1%_GoodFired") % sensorDescr);
171 title = str(format(
"PXD Sensor %1% Good pixels") % sensorDescr);
172 m_goodfired[i] =
new TH1D(name.c_str(), title.c_str(), 200, 0, 200);
173 m_goodfired[i]->SetCanExtend(TH1::kAllAxes);
174 m_goodfired[i]->GetXaxis()->SetTitle(
"# of fired pixels");
175 m_goodfired[i]->GetYaxis()->SetTitle(
"counts");
179 name = str(format(
"DQMER_PXD_%1%_Clusters") % sensorDescr);
180 title = str(format(
"PXD Sensor %1% Clusters") % sensorDescr);
181 m_clusters[i] =
new TH1D(name.c_str(), title.c_str(), 200, 0, 200);
182 m_clusters[i]->SetCanExtend(TH1::kAllAxes);
183 m_clusters[i]->GetXaxis()->SetTitle(
"# of clusters");
184 m_clusters[i]->GetYaxis()->SetTitle(
"counts");
188 name = str(format(
"DQMER_PXD_%1%_GoodClusters") % sensorDescr);
189 title = str(format(
"PXD Sensor %1% Good clusters") % sensorDescr);
190 m_goodclusters[i] =
new TH1D(name.c_str(), title.c_str(), 200, 0, 200);
191 m_goodclusters[i]->SetCanExtend(TH1::kAllAxes);
192 m_goodclusters[i]->GetXaxis()->SetTitle(
"# of clusters");
193 m_goodclusters[i]->GetYaxis()->SetTitle(
"counts");
222 name = str(format(
"DQMER_PXD_%1%_ClusterCharge") % sensorDescr);
223 title = str(format(
"PXD Sensor %1% Cluster Charge") % sensorDescr);
224 m_clusterCharge[i] =
new TH1D(name.c_str(), title.c_str(), 256, 0, 256);
225 m_clusterCharge[i]->GetXaxis()->SetTitle(
"charge of clusters [ADU]");
226 m_clusterCharge[i]->GetYaxis()->SetTitle(
"counts");
230 name = str(format(
"DQMER_PXD_%1%_PixelSignal") % sensorDescr);
231 title = str(format(
"PXD Sensor %1% Pixel Signal") % sensorDescr);
232 m_pixelSignal[i] =
new TH1D(name.c_str(), title.c_str(), 256, 0, 256);
233 m_pixelSignal[i]->GetXaxis()->SetTitle(
"signal of pixels [ADU]");
234 m_pixelSignal[i]->GetYaxis()->SetTitle(
"counts");
238 name = str(format(
"DQMER_PXD_%1%_ClusterSizeU") % sensorDescr);
239 title = str(format(
"PXD Sensor %1% Cluster Size U") % sensorDescr);
240 m_clusterSizeU[i] =
new TH1D(name.c_str(), title.c_str(), 10, 0, 10);
241 m_clusterSizeU[i]->GetXaxis()->SetTitle(
"size of u clusters");
242 m_clusterSizeU[i]->GetYaxis()->SetTitle(
"counts");
246 name = str(format(
"DQMER_PXD_%1%_ClusterSizeV") % sensorDescr);
247 title = str(format(
"PXD Sensor %1% Cluster Size V") % sensorDescr);
248 m_clusterSizeV[i] =
new TH1D(name.c_str(), title.c_str(), 10, 0, 10);
249 m_clusterSizeV[i]->GetXaxis()->SetTitle(
"size of v clusters");
250 m_clusterSizeV[i]->GetYaxis()->SetTitle(
"counts");
254 name = str(format(
"DQMER_PXD_%1%_ClusterSizeUV") % sensorDescr);
255 title = str(format(
"PXD Sensor %1% Cluster Size U+V") % sensorDescr);
256 m_clusterSizeUV[i] =
new TH1D(name.c_str(), title.c_str(), 10, 0, 10);
257 m_clusterSizeUV[i]->GetXaxis()->SetTitle(
"size of u+v clusters");
258 m_clusterSizeUV[i]->GetYaxis()->SetTitle(
"counts");
265 void PXDDQMExpressRecoModule::initialize()
270 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
271 if (gTools->getNumberOfPXDLayers() != 0) {
273 m_storePXDDigits.isOptional(m_storePXDDigitsName);
274 m_storePXDClusters.isOptional(m_storePXDClustersName);
278 void PXDDQMExpressRecoModule::beginRun()
280 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
281 if (gTools->getNumberOfPXDLayers() == 0)
return;
283 if (m_hitMapCounts !=
nullptr) m_hitMapCounts->Reset();
284 if (m_hitMapFilterCounts !=
nullptr) m_hitMapFilterCounts->Reset();
285 if (m_hitMapClCounts !=
nullptr) m_hitMapClCounts->Reset();
286 if (m_hitMapClFilterCounts !=
nullptr) m_hitMapClFilterCounts->Reset();
287 if (m_hitMapCountsChip !=
nullptr) m_hitMapCountsChip->Reset();
288 if (m_hitMapClCountsChip !=
nullptr) m_hitMapClCountsChip->Reset();
290 for (
int i = 0; i < gTools->getNumberOfPXDSensors(); i++) {
291 if (m_fired[i] !=
nullptr) m_fired[i]->Reset();
292 if (m_goodfired[i] !=
nullptr) m_goodfired[i]->Reset();
293 if (m_clusters[i] !=
nullptr) m_clusters[i]->Reset();
294 if (m_goodclusters[i] !=
nullptr) m_goodclusters[i]->Reset();
299 if (m_clusterCharge[i] !=
nullptr) m_clusterCharge[i]->Reset();
300 if (m_pixelSignal[i] !=
nullptr) m_pixelSignal[i]->Reset();
301 if (m_clusterSizeU[i] !=
nullptr) m_clusterSizeU[i]->Reset();
302 if (m_clusterSizeV[i] !=
nullptr) m_clusterSizeV[i]->Reset();
303 if (m_clusterSizeUV[i] !=
nullptr) m_clusterSizeUV[i]->Reset();
309 void PXDDQMExpressRecoModule::event()
311 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
312 if (gTools->getNumberOfPXDLayers() == 0)
return;
315 if (!m_storePXDDigits || !m_storePXDDigits.getEntries())
return;
317 int nPXDSensors = gTools->getNumberOfPXDSensors();
321 vector< int > Pixels(nPXDSensors);
322 vector< int > GoodPixels(nPXDSensors);
323 for (
const PXDDigit& digit : m_storePXDDigits) {
324 int iLayer = digit.getSensorID().getLayerNumber();
325 int iLadder = digit.getSensorID().getLadderNumber();
326 int iSensor = digit.getSensorID().getSensorNumber();
327 VxdID sensorID(iLayer, iLadder, iSensor);
328 int index = gTools->getPXDSensorIndex(sensorID);
331 int iChip = PXDMappingLookup::getDCDID(digit.getUCellID(), digit.getVCellID(), sensorID);
332 int indexChip = gTools->getPXDChipIndex(sensorID, kTRUE, iChip);
333 if (m_hitMapCountsChip !=
nullptr) m_hitMapCountsChip->Fill(indexChip);
334 iChip = PXDMappingLookup::getSWBID(digit.getVCellID());
335 indexChip = gTools->getPXDChipIndex(sensorID, kFALSE, iChip);
336 if (m_hitMapCountsChip !=
nullptr) m_hitMapCountsChip->Fill(indexChip);
337 if (m_pixelSignal[index] !=
nullptr) m_pixelSignal[index]->Fill(digit.getCharge());
338 if (m_hitMapCounts !=
nullptr) m_hitMapCounts->Fill(index);
340 if (digit.getCharge() >= m_CutMinCharge && digit.getCharge() < 255) {
342 if (m_hitMapFilterCounts !=
nullptr) m_hitMapFilterCounts->Fill(index);
345 for (
int i = 0; i < nPXDSensors; i++) {
346 if (m_fired[i] !=
nullptr && Pixels[i] > 0) m_fired[i]->Fill(Pixels[i]);
347 if (m_goodfired[i] !=
nullptr && GoodPixels[i] > 0) m_goodfired[i]->Fill(GoodPixels[i]);
351 vector< int > Clusters(nPXDSensors);
352 vector< int > GoodClusters(nPXDSensors);
353 for (
const PXDCluster& cluster : m_storePXDClusters) {
354 int iLayer = cluster.getSensorID().getLayerNumber();
355 int iLadder = cluster.getSensorID().getLadderNumber();
356 int iSensor = cluster.getSensorID().getSensorNumber();
357 VxdID sensorID(iLayer, iLadder, iSensor);
358 int index = gTools->getPXDSensorIndex(sensorID);
362 int indexChip = gTools->getPXDChipIndex(sensorID, kTRUE, iChip);
363 if (m_hitMapClCountsChip !=
nullptr) m_hitMapClCountsChip->Fill(indexChip);
365 indexChip = gTools->getPXDChipIndex(sensorID, kFALSE, iChip);
366 if (m_hitMapClCountsChip !=
nullptr) m_hitMapClCountsChip->Fill(indexChip);
367 if (m_hitMapClCounts !=
nullptr) m_hitMapClCounts->Fill(index);
368 if (m_clusterCharge[index] !=
nullptr) m_clusterCharge[index]->Fill(cluster.getCharge());
369 if (m_clusterSizeU[index] !=
nullptr) m_clusterSizeU[index]->Fill(cluster.getUSize());
370 if (m_clusterSizeV[index] !=
nullptr) m_clusterSizeV[index]->Fill(cluster.getVSize());
371 if (m_clusterSizeUV[index] !=
nullptr) m_clusterSizeUV[index]->Fill(cluster.getSize());
373 if (cluster.getSize() <= m_CutMaxClusterSize && cluster.getCharge() >= m_CutMinClusterCharge
374 && cluster.getSeedCharge() >= m_CutMinSeedCharge && cluster.getSeedCharge() < 255) {
375 GoodClusters[index]++;
376 if (m_hitMapClFilterCounts !=
nullptr) m_hitMapClFilterCounts->Fill(index);
379 for (
int i = 0; i < nPXDSensors; i++) {
380 if (m_clusters[i] !=
nullptr && Clusters[i] > 0) m_clusters[i]->Fill(Clusters[i]);
381 if (m_goodclusters[i] !=
nullptr && GoodClusters[i] > 0) m_goodclusters[i]->Fill(GoodClusters[i]);
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Specific implementation of SensorInfo for PXD Sensors which provides additional pixel specific inform...
int getVCellID(double v, bool clamp=false) const
Return the corresponding pixel/strip ID of a given v coordinate.
int getUCellID(double u, double v=0, bool clamp=false) const
Return the corresponding pixel/strip ID of a given u coordinate.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getLayerNumber() const
Get the layer id.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Abstract base class for different kinds of events.