Skip to content

Commit 9a01fcb

Browse files
author
CORONA Luigi
committed
removing number of plots from SVDROIDQM, and including SVDROIDQM in the common dqm script. This is needed only for VXD commissioning, so it should be put only in release-06-02
1 parent 173952d commit 9a01fcb

File tree

3 files changed

+2
-253
lines changed

3 files changed

+2
-253
lines changed

dqm/scripts/daqdqm/commondqm.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def add_common_dqm(path, components=None, dqm_environment="expressreco", dqm_mod
9292
path.add_module('SVDDQMClustersOnTrack')
9393
# SVD DOSE
9494
add_svd_dqm_dose(path, 'SVDShaperDigitsZS5')
95+
# SVD ROI
96+
path.add_module('SVDROIDQM', plotRecoDigits=False)
9597

9698
# Event time measuring detectors
9799
if components is None or 'CDC' in components or 'ECL' in components or 'TOP' in components:

tracking/modules/svdROIFinder/include/SVDROIDQMModule.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <svd/dataobjects/SVDShaperDigit.h>
1717
#include <svd/dataobjects/SVDRecoDigit.h>
1818
#include <svd/dataobjects/SVDCluster.h>
19-
#include <tracking/dataobjects/ROIid.h>
2019
#include <tracking/dataobjects/SVDIntercept.h>
2120

2221
#include <unordered_map>
@@ -48,51 +47,30 @@ namespace Belle2 {
4847
std::string m_SVDRecoDigitsName; /**< reco digit list name*/
4948
std::string m_SVDClustersName; /**< cluster list name*/
5049

51-
StoreArray<ROIid> m_ROIs; /**< ROis store array*/
5250
StoreArray<SVDIntercept> m_Intercepts; /**< SVDIntercept Store Arrays*/
5351
StoreArray<SVDShaperDigit> m_SVDShaperDigits; /**< shaper digit store array */
5452
StoreArray<SVDRecoDigit> m_SVDRecoDigits; /**< reco digit store array */
5553
StoreArray<SVDCluster> m_SVDClusters; /**< svd cluster store array*/
5654

5755
VXD::GeoCache& m_geoCache = VXD::GeoCache::getInstance(); /**< the geo cache instance*/
5856

59-
std::string m_ROIsName; /**< Name of the ROIid StoreArray */
6057
std::string m_InterceptsName; /**< Name of the SVDIntercept StoreArray */
6158

6259
TDirectory* m_InterDir; /**< intercepts directory in the root file */
63-
TDirectory* m_ROIDir; /**< ROI directory in the root file */
6460

6561
/** typedef: histograms to be filled once per intercept + filling function*/
6662
typedef std::pair< TH1*, std::function< void(TH1*, const SVDIntercept*) > > InterHistoAndFill;
6763
/** map of histograms to be filled once per intercept */
6864
std::unordered_multimap<Belle2::VxdID, InterHistoAndFill, std::function<size_t (const Belle2::VxdID&)> > hInterDictionary;
6965

70-
/** typedef: histograms to be filled once per roi + filling function*/
71-
typedef std::pair< TH1*, std::function< void(TH1*, const ROIid*) > > ROIHistoAndFill;
72-
/** map of histograms to be filled once per roi */
73-
std::unordered_multimap<Belle2::VxdID, ROIHistoAndFill, std::function<size_t (const Belle2::VxdID&)> > hROIDictionary;
74-
75-
/** struct: histograms to be filled once per event + filling fucntion + accumulate function*/
76-
struct ROIHistoAccumulateAndFill {
77-
TH1* hPtr; /**< histogram pointer */
78-
std::function< void (const ROIid*, double&) > accumulate; /**< accumulate function*/
79-
std::function< void (TH1*, double&) > fill; /**< fill function */
80-
double value; /**< value used to fill*/
81-
};
82-
/** map of histograms to be filled once per event */
83-
std::unordered_multimap<Belle2::VxdID, ROIHistoAccumulateAndFill&, std::function<size_t (const Belle2::VxdID&) > >
84-
hROIDictionaryEvt;
85-
8666
void createHistosDictionaries(); /**< create the dictionary*/
87-
void fillSensorROIHistos(const ROIid* roi); /**< fill histograms per sensor, filled once per ROI */
8867
void fillSensorInterHistos(const SVDIntercept* inter); /**< fill histograms per sensor, filled once per intercept */
8968

9069
int m_numModules; /**< number of hardware modules*/
9170
int m_specificLayer =
9271
-1; /**< specific layer selected for which to produce the plots. If it is not a SVD layer (3, 4, 5, 6) than the plots for all layers are produced. Default is (-1), i.e. plots for all SVD layers are produced.*/
9372
bool m_plotRecoDigits = false; /**< Produce plots for SVDRecoDigits when True */
9473

95-
TH1F* hnROIs; /**< number of ROIs*/
9674
TH1F* hnInter; /**< number of intercpets*/
9775
TH1F* harea; /**< ROis area */
9876
TH1F* hredFactor; /**< reduction factor*/

tracking/modules/svdROIFinder/src/SVDROIDQMModule.cc

Lines changed: 0 additions & 231 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@ REG_MODULE(SVDROIDQM);
2525
SVDROIDQMModule::SVDROIDQMModule()
2626
: HistoModule()
2727
, m_InterDir(nullptr)
28-
, m_ROIDir(nullptr)
2928
, hInterDictionary(172, [](const Belle2::VxdID & vxdid) {return (size_t)vxdid.getID(); })
30-
, hROIDictionary(172, [](const Belle2::VxdID& vxdid) {return (size_t)vxdid.getID(); })
31-
, hROIDictionaryEvt(172, [](const Belle2::VxdID& vxdid) {return (size_t)vxdid.getID(); })
3229
, m_numModules(0)
33-
, hnROIs(nullptr)
3430
, hnInter(nullptr)
3531
, harea(nullptr)
3632
, hredFactor(nullptr)
@@ -52,9 +48,6 @@ SVDROIDQMModule::SVDROIDQMModule()
5248
addParam("InterceptsName", m_InterceptsName,
5349
"name of the list of interceptions", std::string(""));
5450

55-
addParam("ROIsName", m_ROIsName,
56-
"name of the list of ROIs", std::string(""));
57-
5851
addParam("specificLayer", m_specificLayer,
5952
"Layer number, if you want the plots only for a specific SVD layer. If it is not a SVD layer (3, 4, 5, 6) than the plots for all SVD layers are produced. Default is (-1), i.e. plots for all SVD layers are produced.",
6053
m_specificLayer);
@@ -71,7 +64,6 @@ void SVDROIDQMModule::defineHisto()
7164
TDirectory* oldDir = gDirectory;
7265
TDirectory* roiDir = oldDir->mkdir("SVDROIs");
7366
m_InterDir = roiDir->mkdir("intercept");
74-
m_ROIDir = roiDir->mkdir("roi");
7567

7668
hCellU = new TH1F("hCellU", "CellID U", 769, -0.5, 768.5);
7769
hCellU->GetXaxis()->SetTitle("U cell ID");
@@ -81,12 +73,6 @@ void SVDROIDQMModule::defineHisto()
8173
m_InterDir->cd();
8274
hnInter = new TH1F("hnInter", "number of intercepts", 100, 0, 100);
8375

84-
m_ROIDir->cd();
85-
hnROIs = new TH1F("hnROIs", "number of ROIs", 100, 0, 100);
86-
harea = new TH1F("harea", "ROIs area", 100, 0, 100000);
87-
hredFactor = new TH1F("hredFactor", "ROI reduction factor", 1000, 0, 1);
88-
89-
9076
createHistosDictionaries();
9177

9278
oldDir->cd();
@@ -100,7 +86,6 @@ void SVDROIDQMModule::initialize()
10086
m_SVDShaperDigits.isOptional(m_SVDShaperDigitsName);
10187
m_SVDRecoDigits.isOptional(m_SVDRecoDigitsName);
10288
m_SVDClusters.isOptional(m_SVDClustersName);
103-
m_ROIs.isRequired(m_ROIsName);
10489
m_Intercepts.isRequired(m_InterceptsName);
10590

10691
n_events = 0;
@@ -124,44 +109,6 @@ void SVDROIDQMModule::event()
124109
for (auto& it : m_Intercepts)
125110
fillSensorInterHistos(&it);
126111

127-
128-
for (auto it = hROIDictionaryEvt.begin(); it != hROIDictionaryEvt.end(); ++it)
129-
(it->second).value = 0;
130-
131-
int ROIarea = 0;
132-
double redFactor = 0;
133-
134-
for (auto& it : m_ROIs) {
135-
136-
fillSensorROIHistos(&it);
137-
138-
const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
139-
const int nPixelsU = aSensorInfo.getUCells();
140-
const int nPixelsV = aSensorInfo.getVCells();
141-
142-
int minU = it.getMinUid();
143-
int minV = it.getMinVid();
144-
int maxU = it.getMaxUid();
145-
int maxV = it.getMaxVid();
146-
147-
int tmpROIarea = (maxU - minU) * (maxV - minV);
148-
ROIarea += tmpROIarea;
149-
redFactor += (double)tmpROIarea / (nPixelsU * nPixelsV * m_numModules);
150-
151-
}
152-
153-
hnROIs->Fill(m_ROIs.getEntries());
154-
155-
harea->Fill((double)ROIarea);
156-
157-
hredFactor->Fill((double)redFactor);
158-
159-
160-
for (auto it = hROIDictionaryEvt.begin(); it != hROIDictionaryEvt.end(); ++it) {
161-
ROIHistoAccumulateAndFill aROIHistoAccumulateAndFill = it->second;
162-
aROIHistoAccumulateAndFill.fill(aROIHistoAccumulateAndFill.hPtr, aROIHistoAccumulateAndFill.value);
163-
}
164-
165112
}
166113

167114
void SVDROIDQMModule::createHistosDictionaries()
@@ -203,32 +150,11 @@ void SVDROIDQMModule::createHistosDictionaries()
203150

204151
m_numModules++; //counting the total number of modules
205152

206-
const VXD::SensorInfoBase& wSensorInfo = m_geoCache.getSensorInfo(*itSvdSensors);
207-
208-
const int nPixelsU = wSensorInfo.getUCells();
209-
const int nPixelsV = wSensorInfo.getVCells();
210153
std::string sensorid = std::to_string(itSvdSensors->getLayerNumber()) + "_" + std::to_string(
211154
itSvdSensors->getLadderNumber()) + "_" +
212155
std::to_string(itSvdSensors->getSensorNumber());
213156

214157

215-
// ------ HISTOGRAMS WITH AN ACCUMULATE PER ROI AND A FILL PER EVENT -------
216-
m_ROIDir->cd();
217-
218-
name = "hNROIs_" + sensorid;
219-
title = "number of ROIs for sensor " + sensorid;
220-
double value = 0;
221-
ROIHistoAccumulateAndFill* aHAAF = new ROIHistoAccumulateAndFill {
222-
new TH1F(name.c_str(), title.c_str(), 25, 0, 25),
223-
[](const ROIid*, double & val) {val++;},
224-
[](TH1 * hPtr, double & val) { hPtr->Fill(val); },
225-
value
226-
};
227-
hROIDictionaryEvt.insert(std::pair< Belle2::VxdID, ROIHistoAccumulateAndFill& > ((Belle2::VxdID)*itSvdSensors, *aHAAF));
228-
229-
230-
231-
232158
// ------ HISTOGRAMS WITH A FILL PER INTERCEPT -------
233159
m_InterDir->cd();
234160

@@ -576,50 +502,6 @@ void SVDROIDQMModule::createHistosDictionaries()
576502
)
577503
);
578504

579-
// residual vs time for clusters
580-
name = "hClusterResidU_vs_time_" + sensorid;
581-
title = "Cluster U residual (cm) vs time " + sensorid;
582-
tmp2D = new TH2F(name.c_str(), title.c_str(), 400, -200, 200, 100, -5, 5);
583-
tmp2D->GetYaxis()->SetTitle("U resid (cm)");
584-
tmp2D->GetXaxis()->SetTitle("time (ns)");
585-
hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
586-
(
587-
(Belle2::VxdID)*itSvdSensors,
588-
InterHistoAndFill(
589-
tmp2D,
590-
[this](TH1 * hPtr, const SVDIntercept * inter) {
591-
592-
for (auto& it : this->m_SVDClusters)
593-
if (((int)it.getSensorID() == (int)inter->getSensorID()) && (it.isUCluster())) {
594-
double resid = inter->getCoorU() - it.getPosition(inter->getCoorV());
595-
hPtr->Fill(it.getClsTime(), resid);
596-
}
597-
}
598-
)
599-
)
600-
);
601-
602-
name = "hClusterResidV_vs_time_" + sensorid;
603-
title = "Cluster V residual (cm) vs time " + sensorid;
604-
tmp2D = new TH2F(name.c_str(), title.c_str(), 400, -200, 200, 100, -5, 5);
605-
tmp2D->GetYaxis()->SetTitle("Cluster V resid (cm)");
606-
tmp2D->GetXaxis()->SetTitle("time (ns)");
607-
hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
608-
(
609-
(Belle2::VxdID)*itSvdSensors,
610-
InterHistoAndFill(
611-
tmp2D,
612-
[this](TH1 * hPtr, const SVDIntercept * inter) {
613-
614-
for (auto& it : this->m_SVDClusters)
615-
if (((int)it.getSensorID() == (int)inter->getSensorID()) && (!it.isUCluster())) {
616-
double resid = inter->getCoorV() - it.getPosition();
617-
hPtr->Fill(it.getClsTime(), resid);
618-
}
619-
}
620-
)
621-
)
622-
);
623505

624506
// scatter plot: U,V intercept in cm VS U,V cell position
625507
name = "hCoorU_vs_UDigit_" + sensorid;
@@ -670,102 +552,6 @@ void SVDROIDQMModule::createHistosDictionaries()
670552
);
671553

672554

673-
674-
675-
676-
677-
// ------ HISTOGRAMS WITH A FILL PER ROI -------
678-
m_ROIDir->cd();
679-
680-
// MIN in U and V
681-
name = "hminU_" + sensorid;
682-
title = "ROI min in U for sensor " + sensorid;
683-
hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
684-
(
685-
(Belle2::VxdID)*itSvdSensors,
686-
ROIHistoAndFill(
687-
new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
688-
[](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMinUid()); }
689-
)
690-
)
691-
);
692-
name = "hminV_" + sensorid;
693-
title = "ROI min in V for sensor " + sensorid;
694-
hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
695-
(
696-
(Belle2::VxdID)*itSvdSensors,
697-
ROIHistoAndFill(
698-
new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
699-
[](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMinVid()); }
700-
)
701-
)
702-
);
703-
//--------------------------
704-
// MAX in U and V
705-
name = "hmaxU_" + sensorid;
706-
title = "ROI max in U for sensor " + sensorid;
707-
hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
708-
(
709-
(Belle2::VxdID)*itSvdSensors,
710-
ROIHistoAndFill(
711-
new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
712-
[](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxUid()); }
713-
)
714-
)
715-
);
716-
name = "hmaxV_" + sensorid;
717-
title = "ROI max in V for sensor " + sensorid;
718-
hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
719-
(
720-
(Belle2::VxdID)*itSvdSensors,
721-
ROIHistoAndFill(
722-
new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
723-
[](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxVid()); }
724-
)
725-
)
726-
);
727-
//--------------------------
728-
729-
// WIDTH in U and V
730-
name = "hwidthU_" + sensorid;
731-
title = "ROI width in U for sensor " + sensorid;
732-
hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
733-
(
734-
(Belle2::VxdID)*itSvdSensors,
735-
ROIHistoAndFill(
736-
new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
737-
[](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxUid() - roi->getMinUid()); }
738-
)
739-
)
740-
);
741-
name = "hwidthV_" + sensorid;
742-
title = "ROI width in V for sensor " + sensorid;
743-
hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
744-
(
745-
(Belle2::VxdID)*itSvdSensors,
746-
ROIHistoAndFill(
747-
new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
748-
[](TH1 * hPtr, const ROIid * roi) { hPtr->Fill(roi->getMaxVid() - roi->getMinVid()); }
749-
)
750-
)
751-
);
752-
753-
// ROI center
754-
name = "hROIcenter_" + sensorid;
755-
title = "ROI center " + sensorid;
756-
tmp2D = new TH2F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU, nPixelsV, 0, nPixelsV);
757-
tmp2D->GetXaxis()->SetTitle(" U (ID)");
758-
tmp2D->GetYaxis()->SetTitle(" V (ID)");
759-
hROIDictionary.insert(std::pair< Belle2::VxdID, ROIHistoAndFill >
760-
(
761-
(Belle2::VxdID)*itSvdSensors,
762-
ROIHistoAndFill(
763-
tmp2D,
764-
[](TH1 * hPtr, const ROIid * roi) { hPtr->Fill((roi->getMaxUid() + roi->getMinUid()) / 2, (roi->getMaxVid() + roi->getMinVid()) / 2); }
765-
)
766-
)
767-
);
768-
769555
//--------------------------
770556

771557
++itSvdSensors;
@@ -789,27 +575,10 @@ void SVDROIDQMModule::fillSensorInterHistos(const SVDIntercept* inter)
789575

790576
}
791577

792-
void SVDROIDQMModule::fillSensorROIHistos(const ROIid* roi)
793-
{
794-
795-
auto its = hROIDictionary.equal_range(roi->getSensorID());
796-
797-
for (auto it = its.first; it != its.second; ++it) {
798-
ROIHistoAndFill aROIHistoAndFill = it->second;
799-
aROIHistoAndFill.second(aROIHistoAndFill.first, roi);
800-
}
801-
802-
auto itsEvt = hROIDictionaryEvt.equal_range(roi->getSensorID());
803-
for (auto it = itsEvt.first; it != itsEvt.second; ++it)
804-
(it->second).accumulate(roi, (it->second).value);
805-
}
806578

807579
void SVDROIDQMModule::endRun()
808580
{
809581

810582
hCellU->Scale((double)1 / n_events);
811583
hCellV->Scale((double)1 / n_events);
812-
813-
for (auto it = hROIDictionaryEvt.begin(); it != hROIDictionaryEvt.end(); ++it)
814-
delete &(it->second);
815584
}

0 commit comments

Comments
 (0)