11 #include <pxd/modules/pxdHelper/PXDROIPlotModule.h>
16 #include <boost/format.hpp>
34 setDescription(
"Plot ROIs on PXD Hit/Charge Maps and write pictures");
35 setPropertyFlags(c_ParallelProcessingCertified);
36 addParam(
"PXDRawHitsName", m_storeRawHitsName,
"The name of the StoreArray of PXDRawHits to be processed",
string(
""));
38 addParam(
"ROIsName", m_ROIsName,
"name of the list of ROIs (plotted in red)",
string(
"__unusedROIs__"));
39 addParam(
"DCROIsName", m_DCROIsName,
"name of the list of DatCon ROIs (optional, plotted in blue)",
string(
"__unusedROIs__"));
40 addParam(
"HLTROIsName", m_HLTROIsName,
"name of the list of HLT ROIs (optional, plotted in green)",
string(
"__unusedROIs__"));
43 void PXDROIPlotModule::initialize()
45 m_eventMetaData.isRequired();
46 m_storeRawHits.isRequired(m_storeRawHitsName);
48 m_storeROIs.isOptional(m_ROIsName);
49 m_storeDCROIs.isOptional(m_DCROIsName);
50 m_storeHLTROIs.isOptional(m_HLTROIsName);
53 void PXDROIPlotModule::event()
55 unsigned int evtNr = m_eventMetaData->getEvent();
56 unsigned int evtRun = m_eventMetaData->getRun();
57 map <VxdID, bool> flag;
58 map <VxdID, vector <ROIid>> list;
59 map <VxdID, vector <ROIid>> listDC;
60 map <VxdID, vector <ROIid>> listHLT;
63 gStyle->SetPalette(55);
64 gStyle->SetOptStat(0);
65 c1 =
new TCanvas(
"c1",
"c1", 1200, 600);
66 TH2F* h =
new TH2F(
"ChargemapWithROIs",
"PXD Module Chargemap;VCell;UCell", 768, 0, 768, 250, 0, 250);
68 for (
auto& it : m_storeROIs) {
69 list[it.getSensorID()].push_back(it);
70 flag[it.getSensorID()] =
true;
72 for (
auto& it : m_storeDCROIs) {
73 listDC[it.getSensorID()].push_back(it);
74 flag[it.getSensorID()] =
true;
76 for (
auto& it : m_storeHLTROIs) {
77 listHLT[it.getSensorID()].push_back(it);
78 flag[it.getSensorID()] =
true;
81 for (
auto& f : flag) {
86 VxdID currentVxdId = f.first;
87 histoname = boost::str(boost::format(
"Run_%d_Evt_%d_") % evtRun % evtNr) + string(currentVxdId);
88 h->SetTitle(histoname.data());
90 for (
auto& pix : m_storeRawHits) {
92 if (currentVxdId != pix.getSensorID())
continue;
93 h->Fill(pix.getRow(), pix.getColumn(), pix.getCharge());
101 for (
auto& it : list[currentVxdId]) {
103 b =
new TBox(it.getMinVid(), it.getMinUid(), it.getMaxVid(), it.getMaxUid());
104 b->SetLineColorAlpha(kRed, 0.3);
110 for (
auto& it : listDC[currentVxdId]) {
112 b =
new TBox(it.getMinVid() + 0.7, it.getMinUid() + 0.7, it.getMaxVid() + 0.7, it.getMaxUid() + 0.7);
113 b->SetLineColorAlpha(kBlue, 0.3);
121 for (
auto& it : listHLT[currentVxdId]) {
123 b =
new TBox(it.getMinVid() - 0.7, it.getMinUid() - 0.7, it.getMaxVid() - 0.7, it.getMaxUid() - 0.7);
124 b->SetLineColorAlpha(kGreen, 0.3);
130 c1->Print((histoname +
".png").data());
131 c1->Print((histoname +
".root").data());