9 #include <pxd/modules/pxdHotPixelMaskCollector/PXDRawHotPixelMaskCollectorModule.h>
10 #include <vxd/geometry/GeoCache.h>
12 #include <boost/format.hpp>
33 setDescription(
"Calibration Collector Module for PXD hot pixel masking from rawhits");
34 setPropertyFlags(c_ParallelProcessingCertified);
36 addParam(
"zeroSuppressionCut", m_0cut,
"Minimum charge (in ADU) for detecting a hit", 0);
37 addParam(
"rawHits", m_storeRawHitsName,
"PXDRawHit collection name",
string(
""));
40 void PXDRawHotPixelMaskCollectorModule::prepare()
42 m_pxdRawHit.isRequired();
43 m_storeDaqStatus.isRequired();
45 auto gTools = VXD::GeoCache::getInstance().getGeoTools();
47 if (gTools->getNumberOfPXDLayers() == 0) {
48 B2WARNING(
"Missing geometry for PXD, PXD-masking is skiped.");
54 auto hPXDHits =
new TH1I(
"hPXDHits",
55 "Number of hits in PXD per events used for masking, distribution parameters found by PXDRawHotPixelMaskCollectorModule", 200000, 0,
57 hPXDHits->GetXaxis()->SetTitle(
"Number of hits");
58 hPXDHits->GetYaxis()->SetTitle(
"Events");
59 registerObject<TH1I>(
"PXDHits", hPXDHits);
64 int nPXDSensors = gTools->getNumberOfPXDSensors();
65 auto hPXDHitCounts =
new TH1I(
"hPXDHitCounts",
66 "Number of hits in PXD sensors for masking, distribution parameters found by PXDRawHotPixelMaskCollectorModule", nPXDSensors, 0,
69 hPXDHitCounts->GetXaxis()->SetTitle(
"SensorID");
70 hPXDHitCounts->GetYaxis()->SetTitle(
"Number of hits");
71 for (
int i = 0; i < nPXDSensors; i++) {
72 VxdID id = gTools->getSensorIDFromPXDIndex(i);
73 string sensorDescr = id;
74 hPXDHitCounts->GetXaxis()->SetBinLabel(i + 1, str(format(
"%1%") % sensorDescr).c_str());
76 registerObject<TH1I>(
"PXDHitCounts", hPXDHitCounts);
79 for (
int i = 0; i < nPXDSensors; i++) {
80 VxdID id = gTools->getSensorIDFromPXDIndex(i);
81 string sensorDescr = id;
86 string name = str(format(
"PXD_%1%_PixelHitmap") %
id.
getID());
87 string title = str(format(
"PXD Sensor %1% Pixel Hitmap from PXDRawHotPixelMaskCollector") % sensorDescr);
90 auto hsensorhitmap =
new TH1I(name.c_str(), title.c_str(), 250 * 768, 0, 250 * 768);
91 registerObject<TH1I>(name.c_str(), hsensorhitmap);
95 void PXDRawHotPixelMaskCollectorModule::collect()
98 TH1I* collector_hits = getObjectPtr<TH1I>(
"PXDHits");
102 collector_hits->Fill(0);
104 collector_hits->Fill(m_pxdRawHit.getEntries());
106 auto& geo = VXD::GeoCache::getInstance();
107 auto gTools = geo.getGeoTools();
110 auto usability = m_storeDaqStatus->getUsable();
112 TH1I* collector_pxdhitcounts = getObjectPtr<TH1I>(
"PXDHitCounts");
114 for (
auto& rawhit : m_pxdRawHit) {
115 VxdID sensorID = rawhit.getSensorID();
116 if (!geo.validSensorID(sensorID)) {
117 B2WARNING(
"Malformed PXDRawHit, VxdID $" << hex << sensorID.
getID() <<
", dropping. (" << sensorID <<
")");
120 if (!usability[sensorID])
continue;
123 if (!goodHit(rawhit))
continue;
126 if (rawhit.getCharge() < m_0cut)
continue;
130 string name = str(format(
"PXD_%1%_PixelHitmap") % sensorID.
getID());
131 TH1I* collector_sensorhitmap = getObjectPtr<TH1I>(name.c_str());
132 collector_sensorhitmap->Fill(rawhit.getColumn() * 768 + rawhit.getRow());
133 collector_pxdhitcounts->Fill(gTools->getPXDSensorIndex(sensorID));
Calibration collector module base class.
Calibration Collector Module for PXD hot pixel masking from PXDRawHits.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getID() const
Get the unique id.
baseType getSensorNumber() const
Get the sensor id.
baseType getLadderNumber() const
Get the ladder id.
baseType getLayerNumber() const
Get the layer id.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
int getID(const std::vector< double > &breaks, double t)
get id of the time point t
Abstract base class for different kinds of events.