ATLAS Offline Software
Loading...
Searching...
No Matches
InDetPerfPlot_HitResidual.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
9
12
13using namespace TMath;
14
15InDetPerfPlot_HitResidual::InDetPerfPlot_HitResidual(InDetPlotBase* pParent, const std::string& sDir, bool isITk) : InDetPlotBase(pParent, sDir), m_isITk{isITk} {
16}
17
18void
20 // const bool prependDirectory(false);
21 // x residuals
22 book(m_residualx.at(L0PIXBARR).at(BARREL), "residualx_l0pix_barrel");
23 book(m_residualx_1hit.at(L0PIXBARR).at(BARREL), "residualx_l0pix_barrel_1hit");
24 book(m_residualx_2ormorehits.at(L0PIXBARR).at(BARREL), "residualx_l0pix_barrel_2ormorehits");
25 //
26 book(m_residualx.at(PIXEL).at(BARREL), "residualx_pixel_barrel");
27 book(m_residualx_1hit.at(PIXEL).at(BARREL), "residualx_pixel_barrel_1hit");
28 book(m_residualx_2ormorehits.at(PIXEL).at(BARREL), "residualx_pixel_barrel_2ormorehits");
29 //
30 book(m_residualx.at(SCT).at(BARREL), "residualx_sct_barrel");
31 book(m_residualx_1hit.at(SCT).at(BARREL), "residualx_sct_barrel_1hit");
32 book(m_residualx_2ormorehits.at(SCT).at(BARREL), "residualx_sct_barrel_2ormorehits");
33 //
34 if(!m_isITk) book(m_residualx.at(TRT).at(BARREL), "residualx_trt_barrel");
35 // ..now endcaps
36 book(m_residualx.at(PIXEL).at(ENDCAP), "residualx_pixel_endcap");
37 book(m_residualx_1hit.at(PIXEL).at(ENDCAP), "residualx_pixel_endcap_1hit");
38 book(m_residualx_2ormorehits.at(PIXEL).at(ENDCAP), "residualx_pixel_endcap_2ormorehits");
39 //
40 book(m_residualx.at(SCT).at(ENDCAP), "residualx_sct_endcap");
41 book(m_residualx_1hit.at(SCT).at(ENDCAP), "residualx_sct_endcap_1hit");
42 book(m_residualx_2ormorehits.at(SCT).at(ENDCAP), "residualx_sct_endcap_2ormorehits");
43 //
44 if(!m_isITk) book(m_residualx.at(TRT).at(ENDCAP), "residualx_trt_endcap");
45 //
46
47 // y residuals
48 book(m_residualy.at(L0PIXBARR).at(BARREL), "residualy_l0pix_barrel");
49 book(m_residualy_1hit.at(L0PIXBARR).at(BARREL), "residualy_l0pix_barrel_1hit");
50 book(m_residualy_2ormorehits.at(L0PIXBARR).at(BARREL), "residualy_l0pix_barrel_2ormorehits");
51 //
52 book(m_residualy.at(PIXEL).at(BARREL), "residualy_pixel_barrel");
53 book(m_residualy_1hit.at(PIXEL).at(BARREL), "residualy_pixel_barrel_1hit");
54 book(m_residualy_2ormorehits.at(PIXEL).at(BARREL), "residualy_pixel_barrel_2ormorehits");
55 //
56 // SCT and TRT do not have y-residuals/pulls
57 // ..now endcaps
58 book(m_residualy.at(PIXEL).at(ENDCAP), "residualy_pixel_endcap");
59 book(m_residualy_1hit.at(PIXEL).at(ENDCAP), "residualy_pixel_endcap_1hit");
60 book(m_residualy_2ormorehits.at(PIXEL).at(ENDCAP), "residualy_pixel_endcap_2ormorehits");
61 //
62 // SCT and TRT do not have y-residuals/pulls
63 // pulls
64 // barrel
65 book(m_pullx.at(L0PIXBARR).at(BARREL), "pullx_l0pix_barrel");
66 book(m_pullx.at(PIXEL).at(BARREL), "pullx_pixel_barrel");
67 book(m_pullx.at(SCT).at(BARREL), "pullx_sct_barrel");
68 if(!m_isITk) book(m_pullx.at(TRT).at(BARREL), "pullx_trt_barrel");
69 //
70 book(m_pullx.at(PIXEL).at(ENDCAP), "pullx_pixel_endcap");
71 book(m_pullx.at(SCT).at(ENDCAP), "pullx_sct_endcap");
72 if(!m_isITk) book(m_pullx.at(TRT).at(ENDCAP), "pullx_trt_endcap");
73 //
74 // barrel
75 book(m_pully.at(L0PIXBARR).at(BARREL), "pully_l0pix_barrel");
76 book(m_pully.at(PIXEL).at(BARREL), "pully_pixel_barrel");
77 //
78 // SCT and TRT do not have y-residuals/pulls
79 book(m_pully.at(PIXEL).at(ENDCAP), "pully_pixel_endcap");
80 //
82 // introduce cluster width histograms
83 book(m_etaWidth.at(PIXEL).at(BARREL), "clusterEtaWidth_pixel_barrel");
84 book(m_etaWidth.at(PIXEL).at(ENDCAP), "clusterEtaWidth_pixel_endcap");
85 book(m_phiWidth.at(PIXEL).at(BARREL), "clusterPhiWidth_pixel_barrel");
86 book(m_phiWidth.at(PIXEL).at(ENDCAP), "clusterPhiWidth_pixel_endcap");
87 //
88 book(m_phiWidth.at(SCT).at(BARREL), "clusterPhiWidth_sct_barrel");
89 book(m_phiWidth.at(SCT).at(ENDCAP), "clusterPhiWidth_sct_endcap");
90
91 book(m_phiWidthEta.at(PIXEL), "clusterPhiWidth_eta_pixel");
92 book(m_etaWidthEta.at(PIXEL), "clusterEtaWidth_eta_pixel");
93 //
94 book(m_phiWidthEta.at(SCT), "clusterPhiWidth_eta_sct");
95
96 // additional histograms booked if high detail level is specified
97 // all additional histograms for residuals, pull and cluster size vs eta
98 if(m_iDetailLevel > 200) {
99 book(m_residualx_eta.at(L0PIXBARR).at(BARREL), "residualx_l0pix_barrel_eta");
100 book(m_residualx_eta.at(PIXEL).at(BARREL), "residualx_pixel_barrel_eta");
101 book(m_residualx_eta.at(SCT).at(BARREL), "residualx_sct_barrel_eta");
102 book(m_residualx_eta.at(PIXEL).at(ENDCAP), "residualx_pixel_endcap_eta");
103 book(m_residualx_eta.at(SCT).at(ENDCAP), "residualx_sct_endcap_eta");
104 book(m_residualy_eta.at(L0PIXBARR).at(BARREL), "residualy_l0pix_barrel_eta");
105 book(m_residualy_eta.at(PIXEL).at(BARREL), "residualy_pixel_barrel_eta");
106 book(m_residualy_eta.at(PIXEL).at(ENDCAP), "residualy_pixel_endcap_eta");
107 book(m_pullx_eta.at(L0PIXBARR).at(BARREL), "pullx_l0pix_barrel_eta");
108 book(m_pullx_eta.at(PIXEL).at(BARREL), "pullx_pixel_barrel_eta");
109 book(m_pullx_eta.at(SCT).at(BARREL), "pullx_sct_barrel_eta");
110 book(m_pullx_eta.at(PIXEL).at(ENDCAP), "pullx_pixel_endcap_eta");
111 book(m_pullx_eta.at(SCT).at(ENDCAP), "pullx_sct_endcap_eta");
112 book(m_pully_eta.at(L0PIXBARR).at(BARREL), "pully_l0pix_barrel_eta");
113 book(m_pully_eta.at(PIXEL).at(BARREL), "pully_pixel_barrel_eta");
114 book(m_pully_eta.at(PIXEL).at(ENDCAP), "pully_pixel_endcap_eta");
115 book(m_phiWidth_eta.at(L0PIXBARR).at(BARREL), "clusterPhiWidth_l0pix_barrel_eta");
116 book(m_phiWidth_eta.at(PIXEL).at(BARREL), "clusterPhiWidth_pixel_barrel_eta");
117 book(m_phiWidth_eta.at(SCT).at(BARREL), "clusterPhiWidth_sct_barrel_eta");
118 book(m_phiWidth_eta.at(PIXEL).at(ENDCAP), "clusterPhiWidth_pixel_endcap_eta");
119 book(m_phiWidth_eta.at(SCT).at(ENDCAP), "clusterPhiWidth_sct_endcap_eta");
120 book(m_etaWidth_eta.at(L0PIXBARR).at(BARREL), "clusterEtaWidth_l0pix_barrel_eta");
121 book(m_etaWidth_eta.at(PIXEL).at(BARREL), "clusterEtaWidth_pixel_barrel_eta");
122 book(m_etaWidth_eta.at(PIXEL).at(ENDCAP), "clusterEtaWidth_pixel_endcap_eta");
123 }
124}
125
126
127void
130 measurement_regionAcc("measurement_region");
131 const static bool hitDetailsAvailable = measurement_regionAcc.isAvailable(trkprt);
132
133 if (!hitDetailsAvailable) {
134 if (m_warnCount++ < 10) {
135 ATH_MSG_WARNING("The hit res plots dont see any data (note:only 10 warnings issued)");
136 }
137 } else {
138 static const SG::ConstAccessor< std::vector<int> > measurement_detAcc("measurement_det");
139 const std::vector<int>& result_det = measurement_detAcc(trkprt);
140
141 if (!result_det.empty()) {
142 static const SG::ConstAccessor< std::vector<int> > measurement_typeAcc("measurement_type");
143 static const SG::ConstAccessor< std::vector<int> > measurement_regionAcc("measurement_region");
144 static const SG::ConstAccessor< std::vector<float> > hitResiduals_residualLocXAcc("hitResiduals_residualLocX");
145 static const SG::ConstAccessor< std::vector<float> > hitResiduals_pullLocXAcc("hitResiduals_pullLocX");
146 static const SG::ConstAccessor< std::vector<float> > hitResiduals_residualLocYAcc("hitResiduals_residualLocY");
147 static const SG::ConstAccessor< std::vector<float> > hitResiduals_pullLocYAcc("hitResiduals_pullLocY");
148 static const SG::ConstAccessor< std::vector<int> > hitResiduals_phiWidthAcc("hitResiduals_phiWidth");
149 static const SG::ConstAccessor< std::vector<int> > hitResiduals_etaWidthAcc("hitResiduals_etaWidth");
150
151 const std::vector<int>& result_measureType = measurement_typeAcc(trkprt);
152 const std::vector<int>& result_region = measurement_regionAcc(trkprt);
153 const std::vector<float>& result_residualLocX = hitResiduals_residualLocXAcc(trkprt);
154 const std::vector<float>& result_pullLocX = hitResiduals_pullLocXAcc(trkprt);
155 const std::vector<float>& result_residualLocY = hitResiduals_residualLocYAcc(trkprt);
156 const std::vector<float>& result_pullLocY = hitResiduals_pullLocYAcc(trkprt);
157 const std::vector<int>& result_phiWidth = hitResiduals_phiWidthAcc(trkprt);
158 const std::vector<int>& result_etaWidth = hitResiduals_etaWidthAcc(trkprt);
159
160 const float eta = trkprt.eta();
161
162 // NP: this should be fine... resiudal filled with -1 if not hit
163 if (result_det.size() != result_residualLocX.size()) {
164 ATH_MSG_WARNING("Vectors of results are not matched in size!");
165 }
166 const auto resultSize = result_region.size();
167 for (unsigned int idx = 0; idx < resultSize; ++idx) {
168 const int measureType = result_measureType[idx];
169 if (measureType != 4) {
170 continue; // NP: Only use unbiased hits for the hit residuals ;)
171 }
172 const int det = result_det[idx];
173 const int region = result_region[idx];
174 const int width = result_phiWidth[idx];
175 const int etaWidth = result_etaWidth[idx];
176 const float residualLocX = result_residualLocX[idx];
177 const float pullLocX = result_pullLocX[idx];
178 const float residualLocY = result_residualLocY[idx];
179 const float pullLocY = result_pullLocY[idx];
180 if ((det == INVALID_DETECTOR)or(region == INVALID_REGION)) {
181 continue;
182 }
183 if ((width > 0) or (det ==TRT)){//TRT does not have defined cluster width
184 // introduce cluster width histograms
185 fillHisto(m_phiWidth.at(det).at(region), width, weight);
186 fillHisto(m_etaWidth.at(det).at(region), etaWidth, weight);
187
188 // cluster width eta profiles
189 fillHisto(m_phiWidthEta.at(det), eta, width, weight);
190 fillHisto(m_etaWidthEta.at(det), eta, etaWidth, weight);
191
192 fillHisto(m_residualx.at(det).at(region), residualLocX, weight);
193
194 if(m_iDetailLevel > 200) {
195 fillHisto(m_phiWidth_eta.at(det).at(region), eta, width, weight);
196 fillHisto(m_etaWidth_eta.at(det).at(region), eta, etaWidth, weight);
197 fillHisto(m_residualx_eta.at(det).at(region), eta, residualLocX, weight);
198 }
199
200 const bool hasYCoordinate = (det != SCT)and(det != TRT); // SCT & TRT do not have LocY
201 fillHisto(m_pullx.at(det).at(region), pullLocX, weight);
202 if(m_iDetailLevel > 200)
203 fillHisto(m_pullx_eta.at(det).at(region), eta, pullLocX, weight);
204
205 // SCT & TRT do not have LocY
206 if (hasYCoordinate) {
207 fillHisto(m_residualy.at(det).at(region), residualLocY, weight);
208 fillHisto(m_pully.at(det).at(region), pullLocY, weight);
209 if(m_iDetailLevel > 200) {
210 fillHisto(m_residualy_eta.at(det).at(region), eta, residualLocY, weight);
211 fillHisto(m_pully_eta.at(det).at(region), eta, pullLocY, weight);
212 }
213 }
214 if ((det == TRT) or (width < 0)) {
215 continue;
216 }
217 if (width == 1) {
218 fillHisto(m_residualx_1hit.at(det).at(region), residualLocX, weight);
219 if (hasYCoordinate) {
220 fillHisto(m_residualy_1hit.at(det).at(region), residualLocY, weight);
221 }
222 } else {
223 fillHisto(m_residualx_2ormorehits.at(det).at(region), residualLocX, weight);
224 if (hasYCoordinate) {
225 fillHisto(m_residualy_2ormorehits.at(det).at(region), residualLocY, weight);
226 }
227 }
228 }
229 }
230 }
231 }
232}
Scalar eta() const
pseudorapidity method
#define ATH_MSG_WARNING(x)
Helper class to provide constant type-safe access to aux data.
const double width
std::vector< std::vector< TH1 * > > m_etaWidth
std::vector< std::vector< TH2 * > > m_etaWidth_eta
std::vector< std::vector< TH2 * > > m_pullx_eta
std::vector< std::vector< TH2 * > > m_pully_eta
std::vector< std::vector< TH1 * > > m_residualy
std::vector< std::vector< TH1 * > > m_residualy_2ormorehits
std::vector< std::vector< TH1 * > > m_residualy_1hit
std::vector< std::vector< TH1 * > > m_residualx_2ormorehits
std::vector< TProfile * > m_phiWidthEta
std::vector< TProfile * > m_etaWidthEta
std::vector< std::vector< TH1 * > > m_pully
std::vector< std::vector< TH2 * > > m_phiWidth_eta
std::vector< std::vector< TH1 * > > m_phiWidth
InDetPerfPlot_HitResidual(InDetPlotBase *pParent, const std::string &dirName, bool isITk)
std::vector< std::vector< TH1 * > > m_residualx_1hit
std::vector< std::vector< TH1 * > > m_pullx
std::vector< std::vector< TH1 * > > m_residualx
std::vector< std::vector< TH2 * > > m_residualy_eta
void fill(const xAOD::TrackParticle &trkprt, float weight)
std::vector< std::vector< TH2 * > > m_residualx_eta
static void fillHisto(TProfile *pTprofile, const float bin, const float weight, const float weight2=1.0)
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.
InDetPlotBase(InDetPlotBase *pParent, const std::string &dirName)
Constructor taking parent node and directory name for plots.
int m_iDetailLevel
Definition PlotBase.h:101
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition HitInfo.h:33
TrackParticle_v1 TrackParticle
Reference the current persistent version: