ATLAS Offline Software
InDetPerfPlot_HitEfficiency.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
14 #include "TProfile.h"
15 #include "TEfficiency.h"
16 #include <vector>
17 #include <cmath> // for std::fabs
18 
19 
20 
21 
23  InDetPlotBase(pParent, sDir), m_isITk{isITk}, m_HitEfficiencyVsEta{}, m_debug{false} {
24  //
25 }
26 
27 void
29  // const bool prependDirectory(false);
30  // eff plots for L0PIXBARR, PIXEL, SCT, TRT
31  // Barrel
32  book(m_HitEfficiencyVsEta[L0PIXBARR][BARREL], "eff_hit_vs_eta_l0pix_barrel");
33  book(m_HitEfficiencyVsEta[PIXEL][BARREL], "eff_hit_vs_eta_pix_barrel");
34  book(m_HitEfficiencyVsEta[SCT][BARREL], "eff_hit_vs_eta_sct_barrel");
35  if(!m_isITk) book(m_HitEfficiencyVsEta[TRT][BARREL], "eff_hit_vs_eta_trt_barrel");
36 
37  book(m_HitEfficiencyVsEta[PIXEL][ENDCAP], "eff_hit_vs_eta_pix_endcap");
38  book(m_HitEfficiencyVsEta[SCT][ENDCAP], "eff_hit_vs_eta_sct_endcap");
39  if(!m_isITk) book(m_HitEfficiencyVsEta[TRT][ENDCAP], "eff_hit_vs_eta_trt_endcap");
40 }
41 
42 void
44  if (m_debug) {
45  ATH_MSG_INFO("Filling HitEfficiency");
46  }
47 
48  static const SG::ConstAccessor< std::vector<int> > measurement_regionAcc("measurement_region");
49  const bool hitDetailsAvailable = measurement_regionAcc.isAvailable(trkprt);
50  if (!hitDetailsAvailable) {
51  if (m_warnCount++ < 10) {
52  ATH_MSG_WARNING("The HitEff plots dont see any data (note: only 10 warnings issued)");
53  }
54  } else {
55  static const SG::ConstAccessor< std::vector<int> > measurement_detAcc("measurement_det");
56  const std::vector<int>& result_det = measurement_detAcc(trkprt);
57  if (!result_det.empty()) {
58  static const SG::ConstAccessor< std::vector<int> > measurement_typeAcc("measurement_type");
59  const std::vector<int>& result_measureType = measurement_typeAcc(trkprt);
60  const std::vector<int>& result_region = measurement_regionAcc(trkprt);
61  // NP: this should be fine... residual filled with -1 if not hit
62 
63  for (unsigned int idx = 0; idx < result_region.size(); ++idx) {
64  const int measureType = result_measureType[idx];
65  const bool isHit((measureType == 0)or(measureType == 4));
66  const int det = result_det[idx]; // LAYER TYPE L0PIXBARR / PIXEL / ...
67  const int region = result_region[idx]; // BARREL OR ENDCAP
68  float eta = std::fabs(trkprt.eta());
69 
70  fillHisto(m_HitEfficiencyVsEta[det][region], eta, isHit, weight);
71  }
72  }
73  }
74 }
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
InDetPlotBase::book
void book(Htype *&pHisto, const std::string &histoIdentifier, const std::string &nameOverride="", const std::string &folder="default")
Helper method to book histograms using an identifier string.
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
python.copyTCTOutput.sDir
sDir
Definition: copyTCTOutput.py:60
xAOD::TrackParticle_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: TrackParticle_v1.cxx:77
InDetPerfPlot_HitEfficiency::PIXEL
@ PIXEL
Definition: InDetPerfPlot_HitEfficiency.h:43
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
InDetPlotBase
Mixin class to give extra capabilities to plots such as ATH_MSG and an easier booking interface,...
Definition: InDetPlotBase.h:33
InDetPerfPlot_HitEfficiency::m_isITk
bool m_isITk
Definition: InDetPerfPlot_HitEfficiency.h:51
TRT
Definition: HitInfo.h:33
InDetPerfPlot_HitEfficiency::ENDCAP
@ ENDCAP
Definition: InDetPerfPlot_HitEfficiency.h:46
InDetPerfPlot_HitEfficiency::L0PIXBARR
@ L0PIXBARR
Definition: InDetPerfPlot_HitEfficiency.h:43
InDetPerfPlot_HitEfficiency.h
SCT
Definition: SCT_ChipUtils.h:14
InDetPerfPlot_HitEfficiency::m_debug
bool m_debug
Definition: InDetPerfPlot_HitEfficiency.h:55
InDetPerfPlot_HitEfficiency::m_warnCount
std::atomic< int > m_warnCount
Definition: InDetPerfPlot_HitEfficiency.h:57
TrackParticle.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
InDetPhysHitDecoratorAlg.h
InDetPerfPlot_HitEfficiency::InDetPerfPlot_HitEfficiency
InDetPerfPlot_HitEfficiency(InDetPlotBase *pParent, const std::string &dirName, bool isITk)
Definition: InDetPerfPlot_HitEfficiency.cxx:22
InDetPerfPlot_HitEfficiency::initializePlots
void initializePlots()
Definition: InDetPerfPlot_HitEfficiency.cxx:28
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ConstAccessor.h
Helper class to provide constant type-safe access to aux data.
InDetPlotBase::fillHisto
static void fillHisto(TProfile *pTprofile, const float bin, const float weight, const float weight2=1.0)
Definition: InDetPlotBase.cxx:82
InDetPerfPlot_HitEfficiency::fill
void fill(const xAOD::TrackParticle &trkprt, float weight)
Definition: InDetPerfPlot_HitEfficiency.cxx:43
InDetPerfPlot_HitEfficiency::m_HitEfficiencyVsEta
TEfficiency * m_HitEfficiencyVsEta[N_SUBDETECTORS][N_REGIONS]
Definition: InDetPerfPlot_HitEfficiency.h:54
InDetPerfPlot_HitEfficiency::BARREL
@ BARREL
Definition: InDetPerfPlot_HitEfficiency.h:46