11 #include <pxd/modules/pxdHotPixelMaskCollector/PXDRawHotPixelMaskCollectorModule.h>
12 #include <vxd/geometry/GeoCache.h>
14 #include <boost/format.hpp>
35 setDescription(
"Calibration Collector Module for PXD hot pixel masking from rawhits");
36 setPropertyFlags(c_ParallelProcessingCertified);
38 addParam(
"zeroSuppressionCut", m_0cut,
"Minimum charge (in ADU) for detecting a hit", 0);
39 addParam(
"rawHits", m_storeRawHitsName,
"PXDRawHit collection name",
string(
""));
42 void PXDRawHotPixelMaskCollectorModule::prepare()
44 m_pxdRawHit.isRequired();
45 m_storeDaqStatus.isRequired();
47 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
49 if (gTools->getNumberOfPXDLayers() == 0) {
50 B2WARNING(
"Missing geometry for PXD, PXD-masking is skiped.");
56 auto hPXDHits =
new TH1I(
"hPXDHits",
57 "Number of hits in PXD per events used for masking, distribution parameters found by PXDRawHotPixelMaskCollectorModule", 200000, 0,
59 hPXDHits->GetXaxis()->SetTitle(
"Number of hits");
60 hPXDHits->GetYaxis()->SetTitle(
"Events");
61 registerObject<TH1I>(
"PXDHits", hPXDHits);
66 int nPXDSensors = gTools->getNumberOfPXDSensors();
67 auto hPXDHitCounts =
new TH1I(
"hPXDHitCounts",
68 "Number of hits in PXD sensors for masking, distribution parameters found by PXDRawHotPixelMaskCollectorModule", nPXDSensors, 0,
71 hPXDHitCounts->GetXaxis()->SetTitle(
"SensorID");
72 hPXDHitCounts->GetYaxis()->SetTitle(
"Number of hits");
73 for (
int i = 0; i < nPXDSensors; i++) {
74 VxdID id = gTools->getSensorIDFromPXDIndex(i);
75 string sensorDescr = id;
76 hPXDHitCounts->GetXaxis()->SetBinLabel(i + 1, str(format(
"%1%") % sensorDescr).c_str());
78 registerObject<TH1I>(
"PXDHitCounts", hPXDHitCounts);
81 for (
int i = 0; i < nPXDSensors; i++) {
82 VxdID id = gTools->getSensorIDFromPXDIndex(i);
83 string sensorDescr = id;
88 string name = str(format(
"PXD_%1%_PixelHitmap") %
id.
getID());
89 string title = str(format(
"PXD Sensor %1% Pixel Hitmap from PXDRawHotPixelMaskCollector") % sensorDescr);
92 auto hsensorhitmap =
new TH1I(name.c_str(), title.c_str(), 250 * 768, 0, 250 * 768);
93 registerObject<TH1I>(name.c_str(), hsensorhitmap);
97 void PXDRawHotPixelMaskCollectorModule::collect()
100 TH1I* collector_hits = getObjectPtr<TH1I>(
"PXDHits");
104 collector_hits->Fill(0);
106 collector_hits->Fill(m_pxdRawHit.getEntries());
108 auto& geo = VXD::GeoCache::getInstance();
109 auto gTools = geo.getGeoTools();
112 auto usability = m_storeDaqStatus->getUsable();
114 TH1I* collector_pxdhitcounts = getObjectPtr<TH1I>(
"PXDHitCounts");
116 for (
auto& rawhit : m_pxdRawHit) {
117 VxdID sensorID = rawhit.getSensorID();
118 if (!geo.validSensorID(sensorID)) {
119 B2WARNING(
"Malformed PXDRawHit, VxdID $" << hex << sensorID.
getID() <<
", dropping. (" << sensorID <<
")");
122 if (!usability[sensorID])
continue;
125 if (!goodHit(rawhit))
continue;
128 if (rawhit.getCharge() < m_0cut)
continue;
131 if (sensorID.getLayerNumber() && sensorID.getLadderNumber() && sensorID.getSensorNumber()) {
132 string name = str(format(
"PXD_%1%_PixelHitmap") % sensorID.getID());
133 TH1I* collector_sensorhitmap = getObjectPtr<TH1I>(name.c_str());
134 collector_sensorhitmap->Fill(rawhit.getColumn() * 768 + rawhit.getRow());
135 collector_pxdhitcounts->Fill(gTools->getPXDSensorIndex(sensorID));