11 #include <tracking/modules/pxdDataReduction/ROIDQMModule.h>
12 #include <vxd/geometry/GeoCache.h>
14 #include <TDirectory.h>
29 ROIDQMModule::ROIDQMModule()
33 , m_hInterDictionary(40, [](const
Belle2::
VxdID & vxdid) {
return (
size_t)vxdid.getID(); })
34 , m_hROIDictionary(40, [](
const Belle2::VxdID& vxdid) {
return (
size_t)vxdid.getID(); })
35 , m_hROIDictionaryEvt(40, [](
const Belle2::VxdID& vxdid) {
return (
size_t)vxdid.getID(); })
43 setDescription(
"Monitor of the ROI creation on HLT");
44 setPropertyFlags(c_ParallelProcessingCertified);
46 addParam(
"PXDDigitsName", m_PXDDigitsName,
47 "name of the list of PXDDigits", std::string(
""));
49 addParam(
"InterceptsName", m_InterceptsName,
50 "name of the list of Interceptions", std::string(
""));
52 addParam(
"ROIsName", m_ROIsName,
53 "name of the list of ROIs", std::string(
""));
61 TDirectory* oldDir = gDirectory;
62 oldDir->mkdir(
"intercept");
63 oldDir->cd(
"intercept");
70 m_hnInter =
new TH1F(
"hnInter",
"number of intercepts", 100, 0, 100);
73 m_hnROIs =
new TH1F(
"hnROIs",
"number of ROIs", 100, 0, 100);
74 m_harea =
new TH1F(
"harea",
"ROI area", 100, 0, 100000);
75 m_hredFactor =
new TH1F(
"hredFactor",
"ROI reduction factor", 1000, 0, 1);
103 (it->second).value = 0;
106 double redFactor = 0;
112 const int nPixelsU = aSensorInfo.
getUCells();
113 const int nPixelsV = aSensorInfo.
getVCells();
115 const int minU = it.getMinUid();
116 const int minV = it.getMinVid();
117 const int maxU = it.getMaxUid();
118 const int maxV = it.getMaxVid();
120 int tmpROIarea = (maxU - minU) * (maxV - minV);
121 ROIarea += tmpROIarea;
122 redFactor += (double)tmpROIarea / (nPixelsU * nPixelsV *
m_numModules);
128 m_harea->Fill((
double)ROIarea);
135 aROIHistoAccumulateAndFill.
fill(aROIHistoAccumulateAndFill.
hPtr, aROIHistoAccumulateAndFill.
value);
153 std::set<Belle2::VxdID>::iterator itPxdLayers = pxdLayers.begin();
155 while (itPxdLayers != pxdLayers.end()) {
158 std::set<Belle2::VxdID>::iterator itPxdLadders = pxdLadders.begin();
160 while (itPxdLadders != pxdLadders.end()) {
163 std::set<Belle2::VxdID>::iterator itPxdSensors = pxdSensors.begin();
165 while (itPxdSensors != pxdSensors.end()) {
171 const int nPixelsU = wSensorInfo.
getUCells();
172 const int nPixelsV = wSensorInfo.
getVCells();
173 string sensorid = std::to_string(itPxdSensors->getLayerNumber()) +
"_" + std::to_string(itPxdSensors->getLadderNumber()) +
"_" +
174 std::to_string(itPxdSensors->getSensorNumber());
180 name =
"hNROIs_" + sensorid;
181 title =
"number of m_roiIDs for sensor " + sensorid;
184 new TH1F(name.c_str(), title.c_str(), 25, 0, 25),
185 [](
const ROIid*,
double & val) {val++;},
186 [](TH1 * hPtr,
double & val) { hPtr->Fill(val); },
198 name =
"hCoorU_" + sensorid;
199 title =
"U coordinate of the extrapolation in U for sensor " + sensorid;
204 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
205 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getCoorU()); }
210 name =
"hCoorV_" + sensorid;
211 title =
"V coordinate of the extrapolation in V for sensor " + sensorid;
216 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
217 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getCoorV()); }
223 name =
"hCoorU_vs_CoorV_" + sensorid;
224 title =
"U vs V intercept (cm) " + sensorid;
225 tmp2D =
new TH2F(name.c_str(), title.c_str(), 100, -5, 5, 100, -5, 5);
226 tmp2D->GetXaxis()->SetTitle(
"intercept U coor (cm)");
227 tmp2D->GetYaxis()->SetTitle(
"intercept V coor (cm)");
233 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getCoorU(), inter->getCoorV()); }
240 name =
"hStatErrU_" + sensorid;
241 title =
"stat error of the extrapolation in U for sensor " + sensorid;
246 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
247 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getSigmaU()); }
251 name =
"hStatErrV_" + sensorid;
252 title =
"stat error of the extrapolation in V for sensor " + sensorid;
257 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
258 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getSigmaV()); }
264 name =
"hResidU_" + sensorid;
265 title =
"U residuals = intercept - digit, for sensor " + sensorid;
266 tmp1D =
new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
274 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
275 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
276 hPtr->Fill(inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID()));
283 name =
"hResidV_" + sensorid;
284 title =
"V residuals = intercept - digit, for sensor " + sensorid;
285 tmp1D =
new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
293 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
294 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
295 hPtr->Fill(inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID()));
302 name =
"hResidV_vs_ResidU_" + sensorid;
303 title =
"V vs U residuals = intercept - digit, for sensor " + sensorid;
304 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
305 tmp2D->GetXaxis()->SetTitle(
"U resid (cm)");
306 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
314 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
315 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
316 double residU = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
317 double residV = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
318 hPtr->Fill(residU, residV);
325 name =
"hResidVm_vs_ResidU_" + sensorid;
326 title =
"V vs U residuals = intercept - digit, for sensor " + sensorid;
327 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
328 tmp2D->GetXaxis()->SetTitle(
"U resid (cm)");
329 tmp2D->GetYaxis()->SetTitle(
"V* resid (cm)");
337 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
338 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
339 double residU = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
340 double residV = inter->getCoorV() + aSensorInfo.getVCellPosition(it.getVCellID());
341 hPtr->Fill(residU, residV);
348 name =
"hResidV_vs_ResidUm_" + sensorid;
349 title =
"V vs U residuals = intercept - digit, for sensor " + sensorid;
350 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
351 tmp2D->GetXaxis()->SetTitle(
"U* resid (cm)");
352 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
360 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
361 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
362 double residU = inter->getCoorU() + aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
363 double residV = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
364 hPtr->Fill(residU, residV);
371 name =
"hResidVm_vs_ResidUm_" + sensorid;
372 title =
"V vs U residuals = intercept - digit, for sensor " + sensorid;
373 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
374 tmp2D->GetXaxis()->SetTitle(
"U* resid (cm)");
375 tmp2D->GetYaxis()->SetTitle(
"V* resid (cm)");
383 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
384 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
385 double residU = inter->getCoorU() + aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
386 double residV = inter->getCoorV() + aSensorInfo.getVCellPosition(it.getVCellID());
387 hPtr->Fill(residU, residV);
395 name =
"hResidU_vs_CoorU_" + sensorid;
396 title =
"U residual (cm) vs coor U (cm) " + sensorid;
397 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
398 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
399 tmp2D->GetXaxis()->SetTitle(
"U coor (cm)");
407 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
408 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
409 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
410 hPtr->Fill(inter->getCoorU(), resid);
417 name =
"hResidV_vs_CoorV_" + sensorid;
418 title =
"V residual (cm) vs coor V (cm) " + sensorid;
419 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
420 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
421 tmp2D->GetXaxis()->SetTitle(
"V coor (cm)");
429 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
430 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
431 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
432 hPtr->Fill(inter->getCoorV(), resid);
440 name =
"hResidU_vs_CoorV_" + sensorid;
441 title =
"U residual (cm) vs coor V (cm) " + sensorid;
442 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
443 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
444 tmp2D->GetXaxis()->SetTitle(
"V coor (cm)");
452 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
453 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
454 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
455 hPtr->Fill(inter->getCoorV(), resid);
462 name =
"hResidV_vs_CoorU_" + sensorid;
463 title =
"V residual (cm) vs coor U (cm) " + sensorid;
464 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
465 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
466 tmp2D->GetXaxis()->SetTitle(
"U coor (cm)");
474 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
475 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
476 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
477 hPtr->Fill(inter->getCoorU(), resid);
487 name =
"hResidU_vs_charge_" + sensorid;
488 title =
"U residual (cm) vs charge " + sensorid;
489 tmp2D =
new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
490 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
491 tmp2D->GetXaxis()->SetTitle(
"charge");
499 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
500 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
501 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
502 hPtr->Fill(it.getCharge(), resid);
509 name =
"hResidV_vs_charge_" + sensorid;
510 title =
"V residual (cm) vs charge " + sensorid;
511 tmp2D =
new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
512 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
513 tmp2D->GetXaxis()->SetTitle(
"charge");
521 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
522 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
523 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
524 hPtr->Fill(it.getCharge(), resid);
533 name =
"hCoorU_vs_UDigit_" + sensorid;
534 title =
"U intercept (cm) vs U Digit (ID) " + sensorid;
535 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
536 tmp2D->GetXaxis()->SetTitle(
"intercept U coor (cm)");
537 tmp2D->GetYaxis()->SetTitle(
"digit U coor (cm)");
545 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
546 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
547 hPtr->Fill(inter->getCoorU(), aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID()));
555 name =
"hCoorV_vs_VDigit_" + sensorid;
556 title =
"V intercept (cm) vs V Digit (ID) " + sensorid;
557 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
558 tmp2D->GetXaxis()->SetTitle(
"intercept V coor (cm)");
559 tmp2D->GetYaxis()->SetTitle(
"digi V coor (cm)");
567 if ((
int)it.getSensorID() == (
int)inter->getSensorID()) {
568 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
569 hPtr->Fill(inter->getCoorV(), aSensorInfo.getVCellPosition(it.getVCellID()));
584 name =
"hminU_" + sensorid;
585 title =
"ROI min in U for sensor " + sensorid;
590 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
591 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMinUid()); }
595 name =
"hminV_" + sensorid;
596 title =
"ROI min in V for sensor " + sensorid;
601 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
602 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMinVid()); }
608 name =
"hmaxU_" + sensorid;
609 title =
"ROI max in U for sensor " + sensorid;
614 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
615 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMaxUid()); }
619 name =
"hmaxV_" + sensorid;
620 title =
"ROI max in V for sensor " + sensorid;
625 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
626 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMaxVid()); }
633 name =
"hwidthU_" + sensorid;
634 title =
"ROI width in U for sensor " + sensorid;
639 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
640 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMaxUid() - roi->getMinUid()); }
644 name =
"hwidthV_" + sensorid;
645 title =
"ROI width in V for sensor " + sensorid;
650 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
651 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMaxVid() - roi->getMinVid()); }
657 name =
"hROIcenter_" + sensorid;
658 title =
"ROI center " + sensorid;
659 tmp2D =
new TH2F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU, nPixelsV, 0, nPixelsV);
660 tmp2D->GetXaxis()->SetTitle(
" U (ID)");
661 tmp2D->GetYaxis()->SetTitle(
" V (ID)");
667 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill((roi->getMaxUid() + roi->getMinUid()) / 2, (roi->getMaxVid() + roi->getMinVid()) / 2); }
688 for (
auto it = its.first; it != its.second; ++it) {
690 aInterHistoAndFill.second(aInterHistoAndFill.first, inter);
700 for (
auto it = its.first; it != its.second; ++it) {
702 aROIHistoAndFill.second(aROIHistoAndFill.first, roi);
706 for (
auto it = itsEvt.first; it != itsEvt.second; ++it)
707 (it->second).accumulate(roi, (it->second).value);
713 delete &(it->second);