9#include <pxd/modules/pxdHelper/PXDEventPlotModule.h>
32 setDescription(
"Plot Events on PXD Hit/Charge Maps and write pictures");
44 for (
VxdID& avxdid : sensors) {
48 m_histos[avxdid] =
new TH2F(
"Chargemap for " + TString((std::string)avxdid),
49 "PXD Module Chargemap for " + TString((std::string)avxdid) +
" ;VCell;UCell", 768, 0, 768, 250, 0, 256);
52 m_histos_gm[avxdid] =
new TH2F(
"Chargemap for " + TString((std::string)avxdid),
53 "PXD Module Chargemap for GM " + TString((std::string)avxdid) +
" ;VCell-GM;UCell", 768, 0, 768, 250, 0, 256);
55 m_histos_gm2[avxdid] =
new TH2F(
"Chargemap for " + TString((std::string)avxdid),
56 "PXD Module Chargemap for GM2 " + TString((std::string)avxdid) +
" ;VCell+GM;UCell", 768, 0, 768, 250, 0, 256);
60 m_c =
new TCanvas(
"c1",
"c1", 4000, 3000);
61 m_l1 =
new TLine(0, 62, 768, 62);
62 m_l2 =
new TLine(0, 125, 768, 125);
63 m_l3 =
new TLine(0, 187, 768, 187);
64 m_l1->SetLineColor(kMagenta);
65 m_l2->SetLineColor(kMagenta);
66 m_l3->SetLineColor(kMagenta);
74 for (
auto h :
m_histos)
if (h.second) h.second->Reset();
75 for (
auto h :
m_histos_gm)
if (h.second) h.second->Reset();
76 for (
auto h :
m_histos_gm2)
if (h.second) h.second->Reset();
78 std::map <VxdID, bool> cm_map;
81 for (
auto& dhc : pkt) {
82 for (
auto& dhe : dhc) {
83 for (
auto cm = dhe.cm_begin(); cm < dhe.cm_end(); ++cm) {
85 if (std::get<2>(*cm) == 63) {
86 m_histos[dhe.getSensorID()]->Fill(std::get<1>(*cm), 252 + std::get<0>(*cm), std::get<2>(*cm));
88 cm_map[dhe.getSensorID()] =
true;
97 int tinj = -1, rgate = -1;
100 auto difference = it.GetTimeSinceLastInjection(0);
102 if (difference != 0x7FFFFFFF) {
104 float diff2 = difference / (508.877 / 4.);
105 int bunch_trg = it.GetBunchNumber(0);
106 int time_inj = it.GetTimeSinceLastInjection(0);
107 int bunch_inj = (bunch_trg - time_inj) % 1280;
108 if (bunch_inj < 0) bunch_inj += 1280;
109 rgate = bunch_inj / (1280. / 96.);
117 m_histos[pix.getSensorID()]->Fill(pix.getRow(), pix.getColumn(), pix.getCharge());
121 int v = int(pix.getVCellID()) - rgate * 4;
123 m_histos_gm[pix.getSensorID()]->Fill(v, pix.getColumn(), pix.getCharge());
126 int v = int(pix.getVCellID()) + rgate * 4;
127 if (v >= 768) v -= 768;
128 m_histos_gm2[pix.getSensorID()]->Fill(v, pix.getColumn(), pix.getCharge());
134 canvasname = std::string(Form(
"Run_%d_Evt_%d", evtRun, evtNr));
136 gStyle->SetPalette(55);
137 gStyle->SetOptStat(0);
144 m_c->Pad()->SetFrameLineColor(kRed);
145 m_c->Pad()->SetFrameBorderSize(4);
146 m_c->Pad()->SetFrameBorderMode(4);
147 m_c->SetFrameLineColor(kRed);
148 m_c->SetFrameBorderSize(4);
149 m_c->SetFrameBorderMode(4);
156 string abc = string(h.first);
157 auto dhe = (*m_storeDAQEvtStats).findDHE(h.first);
160 auto tg = dhe->getTriggerGate();
161 auto fn = dhe->getFrameNr();
162 auto err = dhe->getEndErrorInfo();
164 abc += Form(
" ERR: $%X TG: %d FN: %d IN: %d GA: %d", err, tg, fn, tinj, rgate);
165 for (
auto itdhp = dhe->cbegin(); itdhp != dhe->cend(); ++itdhp) {
166 abc += Form(
"(%d) %d ", itdhp->getChipID(), itdhp->getFrameNr());
169 m_c->Pad()->SetFillColor(kYellow);
171 if (cm_map[h.first]) {
172 m_c->Pad()->SetFillColor(kRed);
173 m_c->Pad()->SetFrameFillColor(kWhite);
176 h.second->SetTitle(abc.data());
177 h.second->Draw(
"colz");
184 m_c->Print((canvasname +
".png").data());
185 m_c->Print((canvasname +
".pdf").data());
186 m_c->Print((canvasname +
".root").data());
193 m_c->Pad()->SetFrameLineColor(kRed);
194 m_c->Pad()->SetFrameBorderSize(4);
195 m_c->Pad()->SetFrameBorderMode(4);
196 m_c->SetFrameLineColor(kRed);
197 m_c->SetFrameBorderSize(4);
198 m_c->SetFrameBorderMode(4);
205 string abc = string(h.first);
206 auto dhe = (*m_storeDAQEvtStats).findDHE(h.first);
209 auto tg = dhe->getTriggerGate();
210 auto fn = dhe->getFrameNr();
211 auto err = dhe->getEndErrorInfo();
213 abc += Form(
" ERR: $%X TG: %d FN: %d IN: %d GA: %d", err, tg, fn, tinj, rgate);
214 for (
auto itdhp = dhe->cbegin(); itdhp != dhe->cend(); ++itdhp) {
215 abc += Form(
"(%d) %d ", itdhp->getChipID(), itdhp->getFrameNr());
218 m_c->Pad()->SetFillColor(kYellow);
220 if (cm_map[h.first]) {
221 m_c->Pad()->SetFillColor(kRed);
222 m_c->Pad()->SetFrameFillColor(kWhite);
225 h.second->SetTitle(abc.data());
226 h.second->Draw(
"colz");
233 m_c->Print((canvasname +
"_gm.png").data());
234 m_c->Print((canvasname +
"_gm.pdf").data());
235 m_c->Print((canvasname +
"_gm.root").data());
241 m_c->Pad()->SetFrameLineColor(kRed);
242 m_c->Pad()->SetFrameBorderSize(4);
243 m_c->Pad()->SetFrameBorderMode(4);
244 m_c->SetFrameLineColor(kRed);
245 m_c->SetFrameBorderSize(4);
246 m_c->SetFrameBorderMode(4);
253 string abc = string(h.first);
254 auto dhe = (*m_storeDAQEvtStats).findDHE(h.first);
257 auto tg = dhe->getTriggerGate();
258 auto fn = dhe->getFrameNr();
259 auto err = dhe->getEndErrorInfo();
261 abc += Form(
" ERR: $%X TG: %d FN: %d IN: %d GA: %d", err, tg, fn, tinj, rgate);
262 for (
auto itdhp = dhe->cbegin(); itdhp != dhe->cend(); ++itdhp) {
263 abc += Form(
"(%d) %d ", itdhp->getChipID(), itdhp->getFrameNr());
266 m_c->Pad()->SetFillColor(kYellow);
268 if (cm_map[h.first]) {
269 m_c->Pad()->SetFillColor(kRed);
270 m_c->Pad()->SetFrameFillColor(kWhite);
273 h.second->SetTitle(abc.data());
274 h.second->Draw(
"colz");
281 m_c->Print((canvasname +
"_gm2.png").data());
282 m_c->Print((canvasname +
"_gm2.pdf").data());
283 m_c->Print((canvasname +
"_gm2.root").data());
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
bool m_gateModeFlag
Flag for creating extra GM plots.
TLine * m_l1
Lines to guide the eye in plots/canvases.
void initialize() override final
Initialize.
StoreObjPtr< PXDDAQStatus > m_storeDAQEvtStats
Input array for DAQ Status.
StoreArray< RawFTSW > m_rawTTD
Input array for DAQ Status.
std::map< VxdID, TH2F * > m_histos_gm2
map for plots per modules with gm-
PXDEventPlotModule()
Constructor defining the parameters.
std::string m_storeRawHitsName
PXDRawHits StoreArray name.
TLine * m_l3
Lines to guide the eye in plots/canvases.
std::map< VxdID, TH2F * > m_histos
map for plots per modules
StoreObjPtr< EventMetaData > m_eventMetaData
Event Metadata StorePtr.
void event() override final
Event.
std::map< VxdID, TH2F * > m_histos_gm
map for plots per modules with gm+
VXD::GeoCache & m_vxdGeometry
the geometry
TCanvas * m_c
list of canvases
StoreArray< PXDRawHit > m_storeRawHits
Storearray for raw pixels
TLine * m_l2
Lines to guide the eye in plots/canvases.
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#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.