9 #include <pxd/modules/pxdDQM/PXDRawDQMChipsModule.h>
10 #include <vxd/geometry/GeoCache.h>
12 #include <TDirectory.h>
13 #include <boost/format.hpp>
35 setDescription(
"Monitor raw PXD");
36 setPropertyFlags(c_ParallelProcessingCertified);
37 addParam(
"histogramDirectoryName", m_histogramDirectoryName,
"Name of the directory where histograms will be placed",
38 std::string(
"pxdraw"));
40 addParam(
"PXDRawHitsName", m_storeRawHitsName,
"The name of the StoreArray of PXDRawHits to be processed",
string(
""));
43 void PXDRawDQMChipsModule::defineHisto()
46 TDirectory* oldDir = gDirectory;
47 if (m_histogramDirectoryName !=
"") {
48 oldDir->mkdir(m_histogramDirectoryName.c_str());
49 oldDir->cd(m_histogramDirectoryName.c_str());
53 for (
auto i = 0; i < 64; i++) {
54 auto layer = (((i >> 5) & 0x1) + 1);
55 auto ladder = ((i >> 1) & 0xF);
56 auto sensor = ((i & 0x1) + 1);
60 for (
auto j = 0; j < eNumSwitcher; j++) {
61 for (
auto k = 0; k < eNumDCD; k++) {
62 string s = str(format(
"Sensor %d:%d:%d (DHH ID %02Xh) Switcher %d DCD %d") % layer % ladder % sensor % i % j % k);
63 string s2 = str(format(
"_%d.%d.%d_%d_%d") % layer % ladder % sensor % j % k);
65 hrawPxdHitsCount[i][j][k] =
new TH1F((
"hrawPxdCount" + s2).c_str(), (
"Pxd Raw Count " + s +
";Nr per Event").c_str(), 8192, 0,
67 hrawPxdHitsCharge[i][j][k] =
new TH1F((
"hrawPxdHitsCharge" + s2).c_str(),
68 (
"Pxd Raw Hit Charge, " + s +
";Charge").c_str(), 256, 0, 256);
72 for (
auto j = 0; j < eNumSwitcher; j++) {
73 for (
auto k = 0; k < eNumDCD; k++) {
74 hrawPxdHitsCount[i][j][k] = NULL;
75 hrawPxdHitsCharge[i][j][k] = NULL;
85 void PXDRawDQMChipsModule::initialize()
88 m_storeRawHits.isRequired(m_storeRawHitsName);
91 void PXDRawDQMChipsModule::beginRun()
94 for (
auto i = 0; i < eNumSensors; i++) {
95 for (
auto j = 0; j < eNumSwitcher; j++) {
96 for (
auto k = 0; k < eNumDCD; k++) {
97 if (hrawPxdHitsCount[i][j][k]) hrawPxdHitsCount[i][j][k]->Reset();
98 if (hrawPxdHitsCharge[i][j][k]) hrawPxdHitsCharge[i][j][k]->Reset();
104 void PXDRawDQMChipsModule::event()
106 uint nhits[eNumSensors][eNumSwitcher][eNumDCD] = {};
108 for (
auto& it : m_storeRawHits) {
111 unsigned int layer, ladder, sensor;
113 currentVxdId = it.getSensorID();
118 dhh_id = ((layer - 1) << 5) | ((ladder) << 1) | (sensor - 1);
119 if (dhh_id <= 0 || dhh_id >= 64) {
120 B2ERROR(
"SensorId (DHH ID) out of range: " << dhh_id);
123 int switcher = it.getRow() / 128;
124 int dcd = it.getColumn() / 64;
126 nhits[dhh_id][switcher][dcd]++;
127 if (hrawPxdHitsCharge[dhh_id][switcher][dcd]) hrawPxdHitsCharge[dhh_id][switcher][dcd]->Fill(it.getCharge());
129 for (
auto i = 0; i < eNumSensors; i++) {
130 for (
auto j = 0; j < eNumSwitcher; j++) {
131 for (
auto k = 0; k < eNumDCD; k++) {
132 if (hrawPxdHitsCount[i][j][k]) hrawPxdHitsCount[i][j][k]->Fill(nhits[i][j][k]);
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
static GeoCache & getInstance()
Return a reference to the singleton instance.
bool validSensorID(Belle2::VxdID id) const
Check that id is a valid sensor number.
Class to uniquely identify a any structure of the PXD and SVD.
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.
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Namespace to provide code needed by both Vertex Detectors, PXD and SVD, and also testbeam telescopes.
Abstract base class for different kinds of events.