9 #include <pxd/modules/pxdDQM/PXDGatedModeDQMModule.h>
10 #include "TDirectory.h"
29 setDescription(
"Monitor GatedMode");
30 setPropertyFlags(c_ParallelProcessingCertified);
31 addParam(
"histogramDirectoryName", m_histogramDirectoryName,
"Name of the directory where histograms will be placed",
32 std::string(
"PXDINJ"));
33 addParam(
"PXDRawHitsName", m_PXDRawHitsName,
"Name of PXD raw hits", std::string(
""));
34 addParam(
"perGate", m_perGate,
"Make plots per GM Start Gate",
true);
35 addParam(
"minTimeCutLER", m_minTimeCutLER,
"minimum time cut in us after LER kick", 20);
36 addParam(
"maxTimeCutLER", m_maxTimeCutLER,
"maximum time cut in us after LER kick", 4980);
37 addParam(
"minTimeCutHER", m_minTimeCutHER,
"minimum time cut in us after HER kick", 20);
38 addParam(
"maxTimeCutHER", m_maxTimeCutHER,
"maximum time cut in us after HER kick", 4980);
39 addParam(
"outsideTimeCut", m_outsideTimeCut,
"outside GM time cut in us after kick", 20000);
40 addParam(
"chargeCut", m_chargeCut,
"minimum pixel ADU charge cut", 5);
41 addParam(
"chargeCutHigh", m_chargeCutHigh,
"minimum pixel ADU charge cut for second set of histograms", 20);
44 void PXDGatedModeDQMModule::defineHisto()
46 TDirectory* oldDir = gDirectory;
47 oldDir->mkdir(m_histogramDirectoryName.c_str());
48 oldDir->cd(m_histogramDirectoryName.c_str());
50 hBunchInjHER =
new TH1F(
"hBunchInjHER",
"Last Inj Bunch HER;Counts;BunchNr/4", 1280, 0, 1280);
51 hBunchInjLER =
new TH1F(
"hBunchInjLER",
"Last Inj Bunch LER;Counts;BunchNr/4", 1280, 0, 1280);
52 hBunchTrg =
new TH1F(
"hBunchTrg",
"Triggered Bunch;Counts;BunchNr/4", 1280, 0, 1280);
55 std::vector<VxdID> sensors = m_vxdGeometry.getListOfSensors();
56 for (
VxdID& avxdid : sensors) {
58 if (info.getType() != VXD::SensorInfoBase::PXD)
continue;
61 TString buff = (std::string)avxdid;
62 TString bufful = buff;
63 bufful.ReplaceAll(
".",
"_");
65 for (
int rgate = m_perGate ? 0 : 96; rgate <= 96; rgate++) {
66 hGatedModeMapLER[std::make_pair(avxdid, rgate)] =
new TH2F(Form(
"PXDGatedModeMapLER_%d_", rgate) + bufful,
67 Form(
"PXDGatedModeMapLER %d ", rgate) + buff +
";U;V", 25, 0, 250, 192, 0, 768);
68 hGatedModeMapHER[std::make_pair(avxdid, rgate)] =
new TH2F(Form(
"PXDGatedModeMapHER_%d_", rgate) + bufful,
69 Form(
"PXDGatedModeMapHER %d ", rgate) + buff +
";U;V", 25, 0, 250, 192, 0, 768);
70 hGatedModeMapCutLER[std::make_pair(avxdid, rgate)] =
new TH2F(Form(
"PXDGatedModeMapCutLER_%d_", rgate) + bufful,
71 Form(
"PXDGatedModeMapCutLER %d ", rgate) + buff +
";U;V", 25, 0, 250, 192, 0, 768);
72 hGatedModeMapCutHER[std::make_pair(avxdid, rgate)] =
new TH2F(Form(
"PXDGatedModeMapCutHER_%d_", rgate) + bufful,
73 Form(
"PXDGatedModeMapCutHER %d ", rgate) + buff +
";U;V", 25, 0, 250, 192, 0, 768);
75 hGatedModeMapADCLER[std::make_pair(avxdid, rgate)] =
new TH2F(Form(
"PXDGatedModeMapADCLER_%d_", rgate) + bufful,
76 Form(
"PXDGatedModeMapADCLER %d ", rgate) + buff +
";U;V", 25, 0, 250, 192, 0, 768);
77 hGatedModeMapADCHER[std::make_pair(avxdid, rgate)] =
new TH2F(Form(
"PXDGatedModeMapADCHER_%d_", rgate) + bufful,
78 Form(
"PXDGatedModeMapADCHER %d ", rgate) + buff +
";U;V", 25, 0, 250, 192, 0, 768);
79 hGatedModeMapCutADCLER[std::make_pair(avxdid, rgate)] =
new TH2F(Form(
"PXDGatedModeMapCutADCLER_%d_", rgate) + bufful,
80 Form(
"PXDGatedModeMapCutADCLER %d ", rgate) + buff +
";U;V", 25, 0, 250, 192, 0, 768);
81 hGatedModeMapCutADCHER[std::make_pair(avxdid, rgate)] =
new TH2F(Form(
"PXDGatedModeMapCutADCHER_%d_", rgate) + bufful,
82 Form(
"PXDGatedModeMapCutADCHER %d ", rgate) + buff +
";U;V", 25, 0, 250, 192, 0, 768);
84 hGatedModeProjLER[avxdid] =
new TH2F(
"PXDGatedModeProjLER_" + bufful,
85 "PXDGatedModeProjLER " + buff +
";Gate;V", 96, 0, 96, 192, 0, 768);
86 hGatedModeProjHER[avxdid] =
new TH2F(
"PXDGatedModeProjHER_" + bufful,
87 "PXDGatedModeProjHER " + buff +
";Gate;V", 96, 0, 96, 192, 0, 768);
89 hGatedModeMapSubLER[avxdid] =
new TH2F(
"PXDGatedModeMapSubLER_" + bufful,
90 "PXDGatedModeMapSubLER " + buff +
";U;V-G", 25, 0, 250, 192, 0, 768);
91 hGatedModeMapSubHER[avxdid] =
new TH2F(
"PXDGatedModeMapSubHER_" + bufful,
92 "PXDGatedModeMapSubHER " + buff +
";U;V-G", 25, 0, 250, 192, 0, 768);
93 hGatedModeMapAddLER[avxdid] =
new TH2F(
"PXDGatedModeMapAddLER_" + bufful,
94 "PXDGatedModeMapAddLER " + buff +
";U;V+G", 25, 0, 250, 192, 0, 768);
95 hGatedModeMapAddHER[avxdid] =
new TH2F(
"PXDGatedModeMapAddHER_" + bufful,
96 "PXDGatedModeMapAddHER " + buff +
";U;V+G", 25, 0, 250, 192, 0, 768);
98 hGatedModeProjADCLER[avxdid] =
new TH2F(
"PXDGatedModeProjADCLER_" + bufful,
99 "PXDGatedModeProjADCLER " + buff +
";Gate;V", 96, 0, 96, 192, 0, 768);
100 hGatedModeProjADCHER[avxdid] =
new TH2F(
"PXDGatedModeProjADCHER_" + bufful,
101 "PXDGatedModeProjADCHER " + buff +
";Gate;V", 96, 0, 96, 192, 0, 768);
103 hGatedModeMapSubADCLER[avxdid] =
new TH2F(
"PXDGatedModeMapSubADCLER_" + bufful,
104 "PXDGatedModeMapSubADCLER " + buff +
";U;V-G", 25, 0, 250, 192, 0, 768);
105 hGatedModeMapSubADCHER[avxdid] =
new TH2F(
"PXDGatedModeMapSubADCHER_" + bufful,
106 "PXDGatedModeMapSubADCHER " + buff +
";U;V-G", 25, 0, 250, 192, 0, 768);
107 hGatedModeMapAddADCLER[avxdid] =
new TH2F(
"PXDGatedModeMapAddADCLER_" + bufful,
108 "PXDGatedModeMapAddADCLER " + buff +
";U;V+G", 25, 0, 250, 192, 0, 768);
109 hGatedModeMapAddADCHER[avxdid] =
new TH2F(
"PXDGatedModeMapAddADCHER_" + bufful,
110 "PXDGatedModeMapAddADCHER " + buff +
";U;V+G", 25, 0, 250, 192, 0, 768);
117 void PXDGatedModeDQMModule::initialize()
120 m_rawTTD.isOptional();
121 m_storeRawHits.isRequired(m_PXDRawHitsName);
124 void PXDGatedModeDQMModule::beginRun()
127 hBunchInjHER->Reset();
128 hBunchInjLER->Reset();
131 for (
auto& it : hGatedModeMapLER)
if (it.second) it.second->Reset();
132 for (
auto& it : hGatedModeMapHER)
if (it.second) it.second->Reset();
133 for (
auto& it : hGatedModeMapCutLER)
if (it.second) it.second->Reset();
134 for (
auto& it : hGatedModeMapCutHER)
if (it.second) it.second->Reset();
135 for (
auto& it : hGatedModeMapADCLER)
if (it.second) it.second->Reset();
136 for (
auto& it : hGatedModeMapADCHER)
if (it.second) it.second->Reset();
137 for (
auto& it : hGatedModeMapCutADCLER)
if (it.second) it.second->Reset();
138 for (
auto& it : hGatedModeMapCutADCHER)
if (it.second) it.second->Reset();
140 for (
auto& it : hGatedModeProjLER)
if (it.second) it.second->Reset();
141 for (
auto& it : hGatedModeProjHER)
if (it.second) it.second->Reset();
142 for (
auto& it : hGatedModeMapSubLER)
if (it.second) it.second->Reset();
143 for (
auto& it : hGatedModeMapSubHER)
if (it.second) it.second->Reset();
144 for (
auto& it : hGatedModeMapAddLER)
if (it.second) it.second->Reset();
145 for (
auto& it : hGatedModeMapAddHER)
if (it.second) it.second->Reset();
146 for (
auto& it : hGatedModeProjADCLER)
if (it.second) it.second->Reset();
147 for (
auto& it : hGatedModeProjADCHER)
if (it.second) it.second->Reset();
148 for (
auto& it : hGatedModeMapSubADCLER)
if (it.second) it.second->Reset();
149 for (
auto& it : hGatedModeMapSubADCHER)
if (it.second) it.second->Reset();
150 for (
auto& it : hGatedModeMapAddADCLER)
if (it.second) it.second->Reset();
151 for (
auto& it : hGatedModeMapAddADCHER)
if (it.second) it.second->Reset();
154 void PXDGatedModeDQMModule::event()
157 for (
auto& it : m_rawTTD) {
158 B2DEBUG(29,
"TTD FTSW : " << hex << it.GetTTUtime(0) <<
" " << it.GetTTCtime(0) <<
" EvtNr " << it.GetEveNo(0) <<
" Type " <<
159 (it.GetTTCtimeTRGType(0) & 0xF) <<
" TimeSincePrev " << it.GetTimeSincePrevTrigger(0) <<
" TimeSinceInj " <<
160 it.GetTimeSinceLastInjection(0) <<
" IsHER " << it.GetIsHER(0) <<
" Bunch " << it.GetBunchNumber(0));
163 auto difference = it.GetTimeSinceLastInjection(0);
165 if (difference != 0x7FFFFFFF) {
166 auto isher = it.GetIsHER(0);
167 float diff2 = difference / (508.877 / 4.);
168 int bunch_trg = it.GetBunchNumber(0);
169 int time_inj = it.GetTimeSinceLastInjection(0);
170 int bunch_inj = (bunch_trg - time_inj) % 1280;
171 if (bunch_inj < 0) bunch_inj += 1280;
172 int rgate = bunch_inj / (1280. / 96.);
173 if ((isher && diff2 >= m_minTimeCutHER && diff2 <= m_maxTimeCutHER) ||
174 (!isher && diff2 >= m_minTimeCutLER && diff2 <= m_maxTimeCutLER)
176 hBunchTrg->Fill(it.GetBunchNumber(0) & 0x7FF);
177 if (isher) hBunchInjHER->Fill(bunch_inj);
178 else hBunchInjLER->Fill(bunch_inj);
179 for (
auto& p : m_storeRawHits) {
180 auto charge = p.getCharge();
181 if (charge > m_chargeCut) {
182 int v = int(p.getVCellID()) - rgate * 4;
184 int v2 = int(p.getVCellID()) + rgate * 4;
185 if (v2 >= 768) v2 -= 768;
187 auto h = hGatedModeMapHER[std::make_pair(p.getSensorID(), rgate)];
189 h->Fill(p.getUCellID(), p.getVCellID());
191 auto h2 = hGatedModeProjHER[p.getSensorID()];
193 h2->Fill(rgate, p.getVCellID());
195 auto h3 = hGatedModeMapSubHER[p.getSensorID()];
197 h3->Fill(p.getUCellID(), v);
199 auto h4 = hGatedModeMapAddHER[p.getSensorID()];
201 h4->Fill(p.getUCellID(), v2);
203 auto h5 = hGatedModeMapADCHER[std::make_pair(p.getSensorID(), rgate)];
205 h5->Fill(p.getUCellID(), p.getVCellID(), p.getCharge());
207 auto h6 = hGatedModeProjADCHER[p.getSensorID()];
209 h6->Fill(rgate, p.getVCellID(), p.getCharge());
211 auto h7 = hGatedModeMapSubADCHER[p.getSensorID()];
213 h7->Fill(p.getUCellID(), v, p.getCharge());
215 auto h8 = hGatedModeMapAddADCHER[p.getSensorID()];
217 h8->Fill(p.getUCellID(), v2, p.getCharge());
220 auto h = hGatedModeMapLER[std::make_pair(p.getSensorID(), rgate)];
222 h->Fill(p.getUCellID(), p.getVCellID());
224 auto h2 = hGatedModeProjLER[p.getSensorID()];
226 h2->Fill(rgate, p.getVCellID());
228 auto h3 = hGatedModeMapSubLER[p.getSensorID()];
230 h3->Fill(p.getUCellID(), v);
232 auto h4 = hGatedModeMapAddLER[p.getSensorID()];
234 h4->Fill(p.getUCellID(), v2);
236 auto h5 = hGatedModeMapADCLER[std::make_pair(p.getSensorID(), rgate)];
238 h5->Fill(p.getUCellID(), p.getVCellID(), p.getCharge());
240 auto h6 = hGatedModeProjADCLER[p.getSensorID()];
242 h6->Fill(rgate, p.getVCellID(), p.getCharge());
244 auto h7 = hGatedModeMapSubADCLER[p.getSensorID()];
246 h7->Fill(p.getUCellID(), v, p.getCharge());
248 auto h8 = hGatedModeMapAddADCLER[p.getSensorID()];
250 h8->Fill(p.getUCellID(), v2, p.getCharge());
254 if (m_chargeCutHigh > 30) {
257 auto h = hGatedModeMapCutHER[std::make_pair(p.getSensorID(), rgate)];
259 h->Fill(p.getUCellID(), p.getVCellID());
261 auto h2 = hGatedModeMapCutADCHER[std::make_pair(p.getSensorID(), rgate)];
263 h2->Fill(p.getUCellID(), p.getVCellID(), p.getCharge());
266 auto h = hGatedModeMapCutLER[std::make_pair(p.getSensorID(), rgate)];
268 h->Fill(p.getUCellID(), p.getVCellID());
270 auto h2 = hGatedModeMapCutADCLER[std::make_pair(p.getSensorID(), rgate)];
272 h2->Fill(p.getUCellID(), p.getVCellID(), p.getCharge());
277 }
else if (diff2 > m_outsideTimeCut) {
279 for (
auto& p : m_storeRawHits) {
281 auto h = hGatedModeMapHER[std::make_pair(p.getSensorID(), rgate)];
283 h->Fill(p.getUCellID(), p.getVCellID());
285 auto h2 = hGatedModeMapADCHER[std::make_pair(p.getSensorID(), rgate)];
287 h2->Fill(p.getUCellID(), p.getVCellID(), p.getCharge());
290 auto h = hGatedModeMapLER[std::make_pair(p.getSensorID(), rgate)];
292 h->Fill(p.getUCellID(), p.getVCellID());
294 auto h2 = hGatedModeMapADCLER[std::make_pair(p.getSensorID(), rgate)];
296 h2->Fill(p.getUCellID(), p.getVCellID(), p.getCharge());
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
The PXD for GatedMode DQM module.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
#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.