9 #include <tracking/modules/pxdDataReduction/ROIDQMModule.h>
10 #include <vxd/geometry/GeoCache.h>
12 #include <TDirectory.h>
26 ROIDQMModule::ROIDQMModule()
30 , m_hInterDictionary(40, [](const
Belle2::
VxdID & vxdid) {
return (
size_t)vxdid.getID(); })
31 , m_hROIDictionary(40, [](
const Belle2::VxdID& vxdid) {
return (
size_t)vxdid.getID(); })
32 , m_hROIDictionaryEvt(40, [](
const Belle2::VxdID& vxdid) {
return (
size_t)vxdid.getID(); })
37 , m_hredFactor(
nullptr)
40 setDescription(
"Monitor of the ROI creation on HLT");
41 setPropertyFlags(c_ParallelProcessingCertified);
43 addParam(
"PXDDigitsName", m_PXDDigitsName,
44 "name of the list of PXDDigits", std::string(
""));
46 addParam(
"InterceptsName", m_InterceptsName,
47 "name of the list of Interceptions", std::string(
""));
49 addParam(
"ROIsName", m_ROIsName,
50 "name of the list of ROIs", std::string(
""));
58 TDirectory* oldDir = gDirectory;
59 oldDir->mkdir(
"intercept");
60 oldDir->cd(
"intercept");
67 m_hnInter =
new TH1F(
"hnInter",
"number of intercepts", 100, 0, 100);
70 m_hnROIs =
new TH1F(
"hnROIs",
"number of ROIs", 100, 0, 100);
71 m_harea =
new TH1F(
"harea",
"ROI area", 100, 0, 100000);
72 m_hredFactor =
new TH1F(
"hredFactor",
"ROI reduction factor", 1000, 0, 1);
100 (it->second).value = 0;
103 double redFactor = 0;
109 const int nPixelsU = aSensorInfo.
getUCells();
110 const int nPixelsV = aSensorInfo.
getVCells();
112 const int minU = it.getMinUid();
113 const int minV = it.getMinVid();
114 const int maxU = it.getMaxUid();
115 const int maxV = it.getMaxVid();
117 int tmpROIarea = (maxU - minU) * (maxV - minV);
118 ROIarea += tmpROIarea;
119 redFactor += (double)tmpROIarea / (nPixelsU * nPixelsV *
m_numModules);
125 m_harea->Fill((
double)ROIarea);
132 aROIHistoAccumulateAndFill.
fill(aROIHistoAccumulateAndFill.
hPtr, aROIHistoAccumulateAndFill.
value);
150 std::set<Belle2::VxdID>::iterator itPxdLayers = pxdLayers.begin();
152 while (itPxdLayers != pxdLayers.end()) {
155 std::set<Belle2::VxdID>::iterator itPxdLadders = pxdLadders.begin();
157 while (itPxdLadders != pxdLadders.end()) {
160 std::set<Belle2::VxdID>::iterator itPxdSensors = pxdSensors.begin();
162 while (itPxdSensors != pxdSensors.end()) {
168 const int nPixelsU = wSensorInfo.
getUCells();
169 const int nPixelsV = wSensorInfo.
getVCells();
170 std::string sensorid = std::to_string(itPxdSensors->getLayerNumber()) +
"_" + std::to_string(
171 itPxdSensors->getLadderNumber()) +
"_" +
172 std::to_string(itPxdSensors->getSensorNumber());
178 name =
"hNROIs_" + sensorid;
179 title =
"number of m_roiIDs for sensor " + sensorid;
182 new TH1F(name.c_str(), title.c_str(), 25, 0, 25),
183 [](
const ROIid*,
double & val) {val++;},
184 [](TH1 * hPtr,
double & val) { hPtr->Fill(val); },
196 name =
"hCoorU_" + sensorid;
197 title =
"U coordinate of the extrapolation in U for sensor " + sensorid;
202 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
203 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getCoorU()); }
208 name =
"hCoorV_" + sensorid;
209 title =
"V coordinate of the extrapolation in V for sensor " + sensorid;
214 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
215 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getCoorV()); }
221 name =
"hCoorU_vs_CoorV_" + sensorid;
222 title =
"U vs V intercept (cm) " + sensorid;
223 tmp2D =
new TH2F(name.c_str(), title.c_str(), 100, -5, 5, 100, -5, 5);
224 tmp2D->GetXaxis()->SetTitle(
"intercept U coor (cm)");
225 tmp2D->GetYaxis()->SetTitle(
"intercept V coor (cm)");
238 name =
"hStatErrU_" + sensorid;
239 title =
"stat error of the extrapolation in U for sensor " + sensorid;
244 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
245 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getSigmaU()); }
249 name =
"hStatErrV_" + sensorid;
250 title =
"stat error of the extrapolation in V for sensor " + sensorid;
255 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
256 [](TH1 * hPtr,
const PXDIntercept * inter) { hPtr->Fill(inter->getSigmaV()); }
262 name =
"hResidU_" + sensorid;
263 title =
"U residuals = intercept - digit, for sensor " + sensorid;
264 tmp1D =
new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
272 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
273 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
274 hPtr->Fill(inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID()));
281 name =
"hResidV_" + sensorid;
282 title =
"V residuals = intercept - digit, for sensor " + sensorid;
283 tmp1D =
new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
291 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
292 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
293 hPtr->Fill(inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID()));
300 name =
"hResidV_vs_ResidU_" + sensorid;
301 title =
"V vs U residuals = intercept - digit, for sensor " + sensorid;
302 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
303 tmp2D->GetXaxis()->SetTitle(
"U resid (cm)");
304 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
312 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
313 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
314 double residU = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
315 double residV = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
316 hPtr->Fill(residU, residV);
323 name =
"hResidVm_vs_ResidU_" + sensorid;
324 title =
"V vs U residuals = intercept - digit, for sensor " + sensorid;
325 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
326 tmp2D->GetXaxis()->SetTitle(
"U resid (cm)");
327 tmp2D->GetYaxis()->SetTitle(
"V* resid (cm)");
335 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
336 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
337 double residU = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
338 double residV = inter->getCoorV() + aSensorInfo.getVCellPosition(it.getVCellID());
339 hPtr->Fill(residU, residV);
346 name =
"hResidV_vs_ResidUm_" + sensorid;
347 title =
"V vs U residuals = intercept - digit, for sensor " + sensorid;
348 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
349 tmp2D->GetXaxis()->SetTitle(
"U* resid (cm)");
350 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
358 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
359 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
360 double residU = inter->getCoorU() + aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
361 double residV = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
362 hPtr->Fill(residU, residV);
369 name =
"hResidVm_vs_ResidUm_" + sensorid;
370 title =
"V vs U residuals = intercept - digit, for sensor " + sensorid;
371 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
372 tmp2D->GetXaxis()->SetTitle(
"U* resid (cm)");
373 tmp2D->GetYaxis()->SetTitle(
"V* resid (cm)");
381 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
382 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
383 double residU = inter->getCoorU() + aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
384 double residV = inter->getCoorV() + aSensorInfo.getVCellPosition(it.getVCellID());
385 hPtr->Fill(residU, residV);
393 name =
"hResidU_vs_CoorU_" + sensorid;
394 title =
"U residual (cm) vs coor U (cm) " + sensorid;
395 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
396 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
397 tmp2D->GetXaxis()->SetTitle(
"U coor (cm)");
405 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
406 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
407 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
408 hPtr->Fill(inter->getCoorU(), resid);
415 name =
"hResidV_vs_CoorV_" + sensorid;
416 title =
"V residual (cm) vs coor V (cm) " + sensorid;
417 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
418 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
419 tmp2D->GetXaxis()->SetTitle(
"V coor (cm)");
427 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
428 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
429 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
430 hPtr->Fill(inter->getCoorV(), resid);
438 name =
"hResidU_vs_CoorV_" + sensorid;
439 title =
"U residual (cm) vs coor V (cm) " + sensorid;
440 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
441 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
442 tmp2D->GetXaxis()->SetTitle(
"V coor (cm)");
450 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
451 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
452 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
453 hPtr->Fill(inter->getCoorV(), resid);
460 name =
"hResidV_vs_CoorU_" + sensorid;
461 title =
"V residual (cm) vs coor U (cm) " + sensorid;
462 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
463 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
464 tmp2D->GetXaxis()->SetTitle(
"U coor (cm)");
472 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
473 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
474 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
475 hPtr->Fill(inter->getCoorU(), resid);
485 name =
"hResidU_vs_charge_" + sensorid;
486 title =
"U residual (cm) vs charge " + sensorid;
487 tmp2D =
new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
488 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
489 tmp2D->GetXaxis()->SetTitle(
"charge");
497 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
498 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
499 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID());
500 hPtr->Fill(it.getCharge(), resid);
507 name =
"hResidV_vs_charge_" + sensorid;
508 title =
"V residual (cm) vs charge " + sensorid;
509 tmp2D =
new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
510 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
511 tmp2D->GetXaxis()->SetTitle(
"charge");
519 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
520 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
521 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getVCellID());
522 hPtr->Fill(it.getCharge(), resid);
531 name =
"hCoorU_vs_UDigit_" + sensorid;
532 title =
"U intercept (cm) vs U Digit (ID) " + sensorid;
533 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
534 tmp2D->GetXaxis()->SetTitle(
"intercept U coor (cm)");
535 tmp2D->GetYaxis()->SetTitle(
"digit U coor (cm)");
543 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
544 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
545 hPtr->Fill(inter->getCoorU(), aSensorInfo.getUCellPosition(it.getUCellID(), it.getVCellID()));
553 name =
"hCoorV_vs_VDigit_" + sensorid;
554 title =
"V intercept (cm) vs V Digit (ID) " + sensorid;
555 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
556 tmp2D->GetXaxis()->SetTitle(
"intercept V coor (cm)");
557 tmp2D->GetYaxis()->SetTitle(
"digi V coor (cm)");
565 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
566 const VXD::SensorInfoBase& aSensorInfo = m_aGeometry.getSensorInfo(it.getSensorID());
567 hPtr->Fill(inter->getCoorV(), aSensorInfo.getVCellPosition(it.getVCellID()));
582 name =
"hminU_" + sensorid;
583 title =
"ROI min in U for sensor " + sensorid;
588 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
589 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMinUid()); }
593 name =
"hminV_" + sensorid;
594 title =
"ROI min in V for sensor " + sensorid;
599 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
600 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMinVid()); }
606 name =
"hmaxU_" + sensorid;
607 title =
"ROI max in U for sensor " + sensorid;
612 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
613 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMaxUid()); }
617 name =
"hmaxV_" + sensorid;
618 title =
"ROI max in V for sensor " + sensorid;
623 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
624 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMaxVid()); }
631 name =
"hwidthU_" + sensorid;
632 title =
"ROI width in U for sensor " + sensorid;
637 new TH1F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU),
638 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMaxUid() - roi->getMinUid()); }
642 name =
"hwidthV_" + sensorid;
643 title =
"ROI width in V for sensor " + sensorid;
648 new TH1F(name.c_str(), title.c_str(), nPixelsV, 0, nPixelsV),
649 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill(roi->getMaxVid() - roi->getMinVid()); }
655 name =
"hROIcenter_" + sensorid;
656 title =
"ROI center " + sensorid;
657 tmp2D =
new TH2F(name.c_str(), title.c_str(), nPixelsU, 0, nPixelsU, nPixelsV, 0, nPixelsV);
658 tmp2D->GetXaxis()->SetTitle(
" U (ID)");
659 tmp2D->GetYaxis()->SetTitle(
" V (ID)");
665 [](TH1 * hPtr,
const ROIid * roi) { hPtr->Fill((roi->getMaxUid() + roi->getMinUid()) / 2, (roi->getMaxVid() + roi->getMinVid()) / 2); }
686 for (
auto it = its.first; it != its.second; ++it) {
688 aInterHistoAndFill.second(aInterHistoAndFill.first, inter);
698 for (
auto it = its.first; it != its.second; ++it) {
700 aROIHistoAndFill.second(aROIHistoAndFill.first, roi);
704 for (
auto it = itsEvt.first; it != itsEvt.second; ++it)
705 (it->second).accumulate(roi, (it->second).value);
711 delete &(it->second);
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
PXDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an PXD ...
void terminate(void) override final
This method is called at the end of the event processing.
int m_numModules
number of modules
StoreArray< PXDIntercept > m_pxdIntercept
the PXDIntercepts dataobjects collection
std::string m_InterceptsName
Name of the PXDIntercept StoreArray.
VXD::GeoCache & m_aGeometry
the geometry
TDirectory * m_ROIDir
ROI directory in the root file.
void fillSensorInterHistos(const PXDIntercept *inter)
fill histograms per sensor, filled once per intercept
void createHistosDictionaries()
create the dictionary
void initialize(void) override final
Initializer.
void fillSensorROIHistos(const ROIid *roi)
fill histograms per sensor, filled once per ROI
std::unordered_multimap< Belle2::VxdID, ROIHistoAndFill, std::function< size_t(const Belle2::VxdID &)> > m_hROIDictionary
map of histograms to be filled once per roi
void defineHisto() override final
define histograms
std::pair< TH1 *, std::function< void(TH1 *, const PXDIntercept *) > > InterHistoAndFill
typedef: histograms to be filled once per intercept + filling function
std::pair< TH1 *, std::function< void(TH1 *, const ROIid *) > > ROIHistoAndFill
typedef: histograms to be filled once per roi + filling function
TH1F * m_hnROIs
number of ROIs
std::string m_ROIsName
Name of the ROIid StoreArray.
StoreArray< ROIid > m_roiIDs
the ROIids dataobjects collection
TH1F * m_hredFactor
reduction factor
std::unordered_multimap< Belle2::VxdID, InterHistoAndFill, std::function< size_t(const Belle2::VxdID &)> > m_hInterDictionary
map of histograms to be filled once per intercept
TDirectory * m_InterDir
intercepts directory in the root file
std::unordered_multimap< Belle2::VxdID, ROIHistoAccumulateAndFill &, std::function< size_t(const Belle2::VxdID &) > > m_hROIDictionaryEvt
map of histograms to be filled once per event
TH1F * m_hnInter
number of intercpets
StoreArray< PXDDigit > m_pxdDigits
the PXDDigits dataobjects collection
void event(void) override final
This method is called for each event.
ROIid stores the U and V ids and the sensor id of the Region Of Interest.
double getCoorV() const
return the V coordinate of the intercept
VxdID::baseType getSensorID() const
return the sensor ID
double getCoorU() const
return the U coordinate of the intercept
const std::set< Belle2::VxdID > getLayers(SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
Return a set of all known Layers.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
const std::set< Belle2::VxdID > & getSensors(Belle2::VxdID ladder) const
Return a set of all sensor IDs belonging to a given ladder.
const std::set< Belle2::VxdID > & getLadders(Belle2::VxdID layer) const
Return a set of all ladder IDs belonging to a given layer.
Base class to provide Sensor Information for PXD and SVD.
int getVCells() const
Return number of pixel/strips in v direction.
int getUCells() const
Return number of pixel/strips in u direction.
Class to uniquely identify a any structure of the PXD and SVD.
REG_MODULE(arichBtest)
Register the Module.
Abstract base class for different kinds of events.
struct: histograms to be filled once per event + filling fucntion + accumulate function
std::function< void(TH1 *, double &) > fill
fill function
TH1 * hPtr
histogram pointer
double value
value used to fill