9 #include <tracking/modules/svdROIFinder/SVDROIDQMModule.h>
11 #include <TDirectory.h>
28 , hInterDictionary(172, [](const
Belle2::
VxdID & vxdid) {
return (
size_t)vxdid.getID(); })
38 setDescription(
"Monitor of the ROIs creation on HLT");
39 setPropertyFlags(c_ParallelProcessingCertified);
41 addParam(
"SVDShaperDigitsName", m_SVDShaperDigitsName,
42 "name of the list of SVDShaperDigits", std::string(
""));
43 addParam(
"SVDRecoDigitsName", m_SVDRecoDigitsName,
44 "name of the list of SVDRecoDigits", std::string(
""));
45 addParam(
"SVDClustersName", m_SVDClustersName,
46 "name of the list of SVDClusters", std::string(
""));
48 addParam(
"InterceptsName", m_InterceptsName,
49 "name of the list of interceptions", std::string(
""));
51 addParam(
"specificLayer", m_specificLayer,
52 "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.",
55 addParam(
"plotRecoDigits", m_plotRecoDigits,
56 "Set true to produce the plots for RecoDigits (false by default)", m_plotRecoDigits);
64 TDirectory* oldDir = gDirectory;
65 TDirectory* roiDir = oldDir->mkdir(
"SVDROIs");
68 hCellU =
new TH1F(
"hCellU",
"CellID U", 769, -0.5, 768.5);
69 hCellU->GetXaxis()->SetTitle(
"U cell ID");
70 hCellV =
new TH1F(
"hCellV",
"CellID V", 769, -0.5, 768.5);
71 hCellV->GetXaxis()->SetTitle(
"V cell ID");
74 hnInter =
new TH1F(
"hnInter",
"number of intercepts", 100, 0, 100);
103 hCellU->Fill(it.getCellID());
105 hCellV->Fill(it.getCellID());
127 std::set<Belle2::VxdID>::iterator itSvdLayers = svdLayers.begin();
133 itSvdLayers = svdLayers.begin();
135 B2INFO(
"No specific SVD layer (3,4,5,6) selected (m_specificLayer = " <<
m_specificLayer <<
136 "). Producing plots for all SVD layers.");
139 while (itSvdLayers != svdLayers.end()) {
142 std::set<Belle2::VxdID>::iterator itSvdLadders = svdLadders.begin();
144 while (itSvdLadders != svdLadders.end()) {
147 std::set<Belle2::VxdID>::iterator itSvdSensors = svdSensors.begin();
149 while (itSvdSensors != svdSensors.end()) {
153 std::string sensorid = std::to_string(itSvdSensors->getLayerNumber()) +
"_" + std::to_string(
154 itSvdSensors->getLadderNumber()) +
"_" +
155 std::to_string(itSvdSensors->getSensorNumber());
162 name =
"hCoorU_" + sensorid;
163 title =
"U coordinate of the extrapolation in U for sensor " + sensorid;
168 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
169 [](TH1 * hPtr,
const SVDIntercept * inter) { hPtr->Fill(inter->getCoorU()); }
174 name =
"hCoorV_" + sensorid;
175 title =
"V coordinate of the extrapolation in V for sensor " + sensorid;
180 new TH1F(name.c_str(), title.c_str(), 100, -5, 5),
181 [](TH1 * hPtr,
const SVDIntercept * inter) { hPtr->Fill(inter->getCoorV()); }
187 name =
"hCoorU_vs_CoorV_" + sensorid;
188 title =
"U vs V intercept (cm) " + sensorid;
189 tmp2D =
new TH2F(name.c_str(), title.c_str(), 100, -5, 5, 100, -5, 5);
190 tmp2D->GetXaxis()->SetTitle(
"intercept U coor (cm)");
191 tmp2D->GetYaxis()->SetTitle(
"intercept V coor (cm)");
204 name =
"hStatErrU_" + sensorid;
205 title =
"stat error of the extrapolation in U for sensor " + sensorid;
210 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
211 [](TH1 * hPtr,
const SVDIntercept * inter) { hPtr->Fill(inter->getSigmaU()); }
215 name =
"hStatErrV_" + sensorid;
216 title =
"stat error of the extrapolation in V for sensor " + sensorid;
221 new TH1F(name.c_str(), title.c_str(), 100, 0, 0.35),
222 [](TH1 * hPtr,
const SVDIntercept * inter) { hPtr->Fill(inter->getSigmaV()); }
228 name =
"hResidU_" + sensorid;
229 title =
"U residuals = intercept - digit, for sensor " + sensorid;
230 tmp1D =
new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
239 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
241 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
242 hPtr->Fill(inter->getCoorU() - aSensorInfo.getUCellPosition(it.getCellID()));
250 name =
"hResidV_" + sensorid;
251 title =
"V residuals = intercept - digit, for sensor " + sensorid;
252 tmp1D =
new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
261 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
262 if (!it.isUStrip()) {
263 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
264 hPtr->Fill(inter->getCoorV() - aSensorInfo.getVCellPosition(it.getCellID()));
274 name =
"hResidU_vs_CoorU_" + sensorid;
275 title =
"U residual (cm) vs coor U (cm) " + sensorid;
276 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
277 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
278 tmp2D->GetXaxis()->SetTitle(
"U coor (cm)");
287 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && it.isUStrip()) {
288 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
289 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getCellID());
290 hPtr->Fill(inter->getCoorU(), resid);
297 name =
"hResidV_vs_CoorV_" + sensorid;
298 title =
"V residual (cm) vs coor V (cm) " + sensorid;
299 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
300 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
301 tmp2D->GetXaxis()->SetTitle(
"V coor (cm)");
310 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && (!it.isUStrip())) {
311 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
312 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getCellID());
313 hPtr->Fill(inter->getCoorV(), resid);
324 name =
"hResidU_vs_charge_" + sensorid;
325 title =
"U residual (cm) vs charge " + sensorid;
326 tmp2D =
new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
327 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
328 tmp2D->GetXaxis()->SetTitle(
"charge");
337 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && (it.isUStrip())) {
338 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
339 double resid = inter->getCoorU() - aSensorInfo.getUCellPosition(it.getCellID());
340 hPtr->Fill(it.getCharge(), resid);
347 name =
"hResidV_vs_charge_" + sensorid;
348 title =
"V residual (cm) vs charge " + sensorid;
349 tmp2D =
new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
350 tmp2D->GetYaxis()->SetTitle(
"V resid (cm)");
351 tmp2D->GetXaxis()->SetTitle(
"charge");
360 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && (!it.isUStrip())) {
361 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
362 double resid = inter->getCoorV() - aSensorInfo.getVCellPosition(it.getCellID());
363 hPtr->Fill(it.getCharge(), resid);
372 name =
"hClusterResidU_" + sensorid;
373 title =
"Cluster U residuals = intercept - cluster, for sensor " + sensorid;
374 tmp1D =
new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
383 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
384 if (it.isUCluster()) {
385 hPtr->Fill(inter->getCoorU() - it.getPosition(inter->getCoorV()));
393 name =
"hClusterResidV_" + sensorid;
394 title =
"Cluster V residuals = intercept - cluster, for sensor " + sensorid;
395 tmp1D =
new TH1F(name.c_str(), title.c_str(), 1000, -5, 5);
404 if ((
int)it.getSensorID() == (
int)inter->
getSensorID()) {
405 if (!it.isUCluster()) {
406 hPtr->Fill(inter->getCoorV() - it.getPosition());
415 name =
"hClusterResidU_vs_CoorU_" + sensorid;
416 title =
"Cluster U residual (cm) vs coor U (cm) " + sensorid;
417 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
418 tmp2D->GetYaxis()->SetTitle(
"Cluster U resid (cm)");
419 tmp2D->GetXaxis()->SetTitle(
"U coor (cm)");
420 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
427 for (
auto& it : this->m_SVDClusters)
428 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && it.isUCluster()) {
429 double resid = inter->getCoorU() - it.getPosition(inter->getCoorV());
430 hPtr->Fill(inter->getCoorU(), resid);
437 name =
"hClusterResidV_vs_CoorV_" + sensorid;
438 title =
"Cluster V residual (cm) vs coor V (cm) " + sensorid;
439 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
440 tmp2D->GetYaxis()->SetTitle(
"Cluster V resid (cm)");
441 tmp2D->GetXaxis()->SetTitle(
"V coor (cm)");
442 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
449 for (
auto& it : this->m_SVDClusters)
450 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && (!it.isUCluster())) {
451 double resid = inter->getCoorV() - it.getPosition();
452 hPtr->Fill(inter->getCoorV(), resid);
461 name =
"hClusterResidU_vs_charge_" + sensorid;
462 title =
"Cluster U residual (cm) vs charge " + sensorid;
463 tmp2D =
new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
464 tmp2D->GetYaxis()->SetTitle(
"U resid (cm)");
465 tmp2D->GetXaxis()->SetTitle(
"charge (ke-)");
466 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
473 for (
auto& it : this->m_SVDClusters)
474 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && (it.isUCluster())) {
475 double resid = inter->getCoorU() - it.getPosition(inter->getCoorV());
476 hPtr->Fill(it.getCharge() / 1000., resid);
483 name =
"hClusterResidV_vs_charge_" + sensorid;
484 title =
"Cluster V residual (cm) vs charge " + sensorid;
485 tmp2D =
new TH2F(name.c_str(), title.c_str(), 250, 0, 250, 100, -5, 5);
486 tmp2D->GetYaxis()->SetTitle(
"Cluster V resid (cm)");
487 tmp2D->GetXaxis()->SetTitle(
"charge (ke-)");
488 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
495 for (
auto& it : this->m_SVDClusters)
496 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && (!it.isUCluster())) {
497 double resid = inter->getCoorV() - it.getPosition();
498 hPtr->Fill(it.getCharge() / 1000., resid);
507 name =
"hCoorU_vs_UDigit_" + sensorid;
508 title =
"U intercept (cm) vs U Digit (ID) " + sensorid;
509 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
510 tmp2D->GetXaxis()->SetTitle(
"intercept U coor (cm)");
511 tmp2D->GetYaxis()->SetTitle(
"digit U coor (cm)");
512 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
519 for (
auto& it : this->m_SVDShaperDigits)
520 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && (it.isUStrip())) {
521 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
522 hPtr->Fill(inter->getCoorU(), aSensorInfo.getUCellPosition(it.getCellID()));
530 name =
"hCoorV_vs_VDigit_" + sensorid;
531 title =
"V intercept (cm) vs V Digit (ID) " + sensorid;
532 tmp2D =
new TH2F(name.c_str(), title.c_str(), 1000, -5, 5, 1000, -5, 5);
533 tmp2D->GetXaxis()->SetTitle(
"intercept V coor (cm)");
534 tmp2D->GetYaxis()->SetTitle(
"digi V coor (cm)");
535 hInterDictionary.insert(std::pair< Belle2::VxdID, InterHistoAndFill >
542 for (
auto& it : this->m_SVDShaperDigits) {
543 if (((
int)it.getSensorID() == (
int)inter->
getSensorID()) && (!it.isUStrip())) {
544 const VXD::SensorInfoBase& aSensorInfo = m_geoCache.getSensorInfo(it.getSensorID());
545 hPtr->Fill(inter->getCoorV(), aSensorInfo.getVCellPosition(it.getCellID()));
571 for (
auto it = its.first; it != its.second; ++it) {
573 aInterHistoAndFill.second(aInterHistoAndFill.first, inter);
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
SVDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an SVD ...
int m_numModules
number of hardware modules
std::unordered_multimap< Belle2::VxdID, InterHistoAndFill, std::function< size_t(const Belle2::VxdID &)> > hInterDictionary
map of histograms to be filled once per intercept
std::pair< TH1 *, std::function< void(TH1 *, const SVDIntercept *) > > InterHistoAndFill
typedef: histograms to be filled once per intercept + filling function
std::string m_InterceptsName
Name of the SVDIntercept StoreArray.
StoreArray< SVDCluster > m_SVDClusters
svd cluster store array
bool m_plotRecoDigits
Produce plots for SVDRecoDigits when True.
VXD::GeoCache & m_geoCache
the geo cache instance
int n_events
number of events
void initialize() override
register histograms
void fillSensorInterHistos(const SVDIntercept *inter)
fill histograms per sensor, filled once per intercept
void createHistosDictionaries()
create the dictionary
std::string m_SVDRecoDigitsName
reco digit list name
std::string m_SVDClustersName
cluster list name
void event() override
fill per-event histograms
void endRun() override
fill per-run histograms
SVDROIDQMModule()
Constructor defining the parameters.
int m_specificLayer
specific layer selected for which to produce the plots.
StoreArray< SVDShaperDigit > m_SVDShaperDigits
shaper digit store array
StoreArray< SVDRecoDigit > m_SVDRecoDigits
reco digit store array
TH1F * hnInter
number of intercpets
TDirectory * m_InterDir
intercepts directory in the root file
StoreArray< SVDIntercept > m_Intercepts
SVDIntercept Store Arrays.
std::string m_SVDShaperDigitsName
shaper digit list name
void defineHisto() override
define histograms
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
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 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.
Class to uniquely identify a any structure of the PXD and SVD.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.