ATLAS Offline Software
Loading...
Searching...
No Matches
MuonTruthHitPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
8
9namespace Muon {
12
13MuonTruthHitPlots::MuonTruthHitPlots(PlotBase* pParent, const std::string& sDir)
14 : PlotBase(pParent, sDir)
15
16{
18 Book1D("precMatchedHitsSummed",
19 "summed precision hits matched to truth (all chambers)", 21,
20 -0.5, 20.5);
22 Book1D("precMatchedHitsBIS",
23 "BIS precision hits matched to truth;matched hits;entries", 21,
24 -0.5, 20.5);
26 Book1D("precMatchedHitsBIL",
27 "BIL precision hits matched to truth;matched hits;entries", 21,
28 -0.5, 20.5);
30 Book1D("precMatchedHitsBMS",
31 "BMS precision hits matched to truth;matched hits;entries", 21,
32 -0.5, 20.5);
34 Book1D("precMatchedHitsBML",
35 "BML precision hits matched to truth;matched hits;entries", 21,
36 -0.5, 20.5);
38 Book1D("precMatchedHitsBOS",
39 "BOS precision hits matched to truth;matched hits;entries", 21,
40 -0.5, 20.5);
42 Book1D("precMatchedHitsBOL",
43 "BOL precision hits matched to truth;matched hits;entries", 21,
44 -0.5, 20.5);
46 Book1D("precMatchedHitsBEE",
47 "BEE precision hits matched to truth;matched hits;entries", 21,
48 -0.5, 20.5);
50 Book1D("precMatchedHitsEIS",
51 "EIS precision hits matched to truth;matched hits;entries", 21,
52 -0.5, 20.5);
54 Book1D("precMatchedHitsEIL",
55 "EIL precision hits matched to truth;matched hits;entries", 21,
56 -0.5, 20.5);
58 Book1D("precMatchedHitsEMS",
59 "EMS precision hits matched to truth;matched hits;entries", 21,
60 -0.5, 20.5);
62 Book1D("precMatchedHitsEML",
63 "EML precision hits matched to truth;matched hits;entries", 21,
64 -0.5, 20.5);
66 Book1D("precMatchedHitsEOS",
67 "EOS precision hits matched to truth;matched hits;entries", 21,
68 -0.5, 20.5);
70 Book1D("precMatchedHitsEOL",
71 "EOL precision hits matched to truth;matched hits;entries", 21,
72 -0.5, 20.5);
74 Book1D("precMatchedHitsEES",
75 "EES precision hits matched to truth;matched hits;entries", 21,
76 -0.5, 20.5);
78 Book1D("precMatchedHitsEEL",
79 "EEL precision hits matched to truth;matched hits;entries", 21,
80 -0.5, 20.5);
82 Book1D("precMatchedHitsCSS",
83 "CSS precision hits matched to truth;matched hits;entries", 21,
84 -0.5, 20.5);
86 Book1D("precMatchedHitsCSL",
87 "CSL precision hits matched to truth;matched hits;entries", 21,
88 -0.5, 20.5);
89
91 "phiMatchedHitsSummed",
92 "summed phi hits matched to truth (all chambers)", 21, -0.5, 20.5);
94 "phiMatchedHitsBM1",
95 "BM1 phi hits matched to truth;matched hits;entries", 21, -0.5, 20.5);
97 "phiMatchedHitsBM2",
98 "BM2 phi hits matched to truth;matched hits;entries", 21, -0.5, 20.5);
100 "phiMatchedHitsBO1",
101 "BO1 phi hits matched to truth;matched hits;entries", 21, -0.5, 20.5);
103 "phiMatchedHitsBO2",
104 "BO2 phi hits matched to truth;matched hits;entries", 21, -0.5, 20.5);
106 "phiMatchedHitsT1", "T1 phi hits matched to truth;matched hits;entries",
107 21, -0.5, 20.5);
109 "phiMatchedHitsT2", "T2 phi hits matched to truth;matched hits;entries",
110 21, -0.5, 20.5);
112 "phiMatchedHitsT3", "T3 phi hits matched to truth;matched hits;entries",
113 21, -0.5, 20.5);
115 "phiMatchedHitsT4", "T4 phi hits matched to truth;matched hits;entries",
116 21, -0.5, 20.5);
118 "phiMatchedHitsCSC",
119 "CSC phi hits matched to truth;matched hits;entries", 21, -0.5, 20.5);
120
122 "trigEtaMatchedHitsSummed",
123 "summed trigEta hits matched to truth (all chambers)", 21, -0.5, 20.5);
125 Book1D("trigEtaMatchedHitsBM1",
126 "BM1 trigEta hits matched to truth;matched hits;entries", 21,
127 -0.5, 20.5);
129 Book1D("trigEtaMatchedHitsBM2",
130 "BM2 trigEta hits matched to truth;matched hits;entries", 21,
131 -0.5, 20.5);
133 Book1D("trigEtaMatchedHitsBO1",
134 "BO1 trigEta hits matched to truth;matched hits;entries", 21,
135 -0.5, 20.5);
137 Book1D("trigEtaMatchedHitsBO2",
138 "BO2 trigEta hits matched to truth;matched hits;entries", 21,
139 -0.5, 20.5);
141 Book1D("trigEtaMatchedHitsT1",
142 "T1 trigEta hits matched to truth;matched hits;entries", 21,
143 -0.5, 20.5);
145 Book1D("trigEtaMatchedHitsT2",
146 "T2 trigEta hits matched to truth;matched hits;entries", 21,
147 -0.5, 20.5);
149 Book1D("trigEtaMatchedHitsT3",
150 "T3 trigEta hits matched to truth;matched hits;entries", 21,
151 -0.5, 20.5);
153 Book1D("trigEtaMatchedHitsT4",
154 "T4 trigEta hits matched to truth;matched hits;entries", 21,
155 -0.5, 20.5);
156 // trigEtaMatchedHitsCSC=Book1D("trigEtaMatchedHitsCSC","CSC trigEta hits
157 // matched to truth;matched hits;entries",21,-0.5,20.5 );
158}
159
160void MuonTruthHitPlots::fill(const xAOD::Muon& muon, float weight) {
161
162 fillPlot(precMatchedHitsSummed, "nprecMatchedHitsPerChamberLayer", muon,
163 weight);
164 fillPlot(precMatchedHitsBIS, "nprecMatchedHitsPerChamberLayer", ChIdx::BIS,
165 muon, weight);
166 fillPlot(precMatchedHitsBIL, "nprecMatchedHitsPerChamberLayer", ChIdx::BIL,
167 muon, weight);
168 fillPlot(precMatchedHitsBMS, "nprecMatchedHitsPerChamberLayer", ChIdx::BMS,
169 muon, weight);
170 fillPlot(precMatchedHitsBML, "nprecMatchedHitsPerChamberLayer", ChIdx::BML,
171 muon, weight);
172 fillPlot(precMatchedHitsBOS, "nprecMatchedHitsPerChamberLayer", ChIdx::BOS,
173 muon, weight);
174 fillPlot(precMatchedHitsBOL, "nprecMatchedHitsPerChamberLayer", ChIdx::BOL,
175 muon, weight);
176 fillPlot(precMatchedHitsBEE, "nprecMatchedHitsPerChamberLayer", ChIdx::BEE,
177 muon, weight);
178 fillPlot(precMatchedHitsEIS, "nprecMatchedHitsPerChamberLayer", ChIdx::EIS,
179 muon, weight);
180 fillPlot(precMatchedHitsEIL, "nprecMatchedHitsPerChamberLayer", ChIdx::EIL,
181 muon, weight);
182 fillPlot(precMatchedHitsEMS, "nprecMatchedHitsPerChamberLayer", ChIdx::EMS,
183 muon, weight);
184 fillPlot(precMatchedHitsEML, "nprecMatchedHitsPerChamberLayer", ChIdx::EML,
185 muon, weight);
186 fillPlot(precMatchedHitsEOS, "nprecMatchedHitsPerChamberLayer", ChIdx::EOS,
187 muon, weight);
188 fillPlot(precMatchedHitsEOL, "nprecMatchedHitsPerChamberLayer", ChIdx::EOL,
189 muon, weight);
190 fillPlot(precMatchedHitsEES, "nprecMatchedHitsPerChamberLayer", ChIdx::EES,
191 muon, weight);
192 fillPlot(precMatchedHitsEEL, "nprecMatchedHitsPerChamberLayer", ChIdx::EEL,
193 muon, weight);
194 fillPlot(precMatchedHitsCSS, "nprecMatchedHitsPerChamberLayer", ChIdx::CSS,
195 muon, weight);
196 fillPlot(precMatchedHitsCSL, "nprecMatchedHitsPerChamberLayer", ChIdx::CSL,
197 muon, weight);
198
199 fillPlot(phiMatchedHitsSummed, "nphiMatchedHitsPerChamberLayer", muon,
200 weight);
201 fillPlot(phiMatchedHitsBM1, "nphiMatchedHitsPerChamberLayer", PhiIdx::BM1,
202 muon, weight);
203 fillPlot(phiMatchedHitsBM2, "nphiMatchedHitsPerChamberLayer", PhiIdx::BM2,
204 muon, weight);
205 fillPlot(phiMatchedHitsBO1, "nphiMatchedHitsPerChamberLayer", PhiIdx::BO1,
206 muon, weight);
207 fillPlot(phiMatchedHitsBO2, "nphiMatchedHitsPerChamberLayer", PhiIdx::BO2,
208 muon, weight);
209 fillPlot(phiMatchedHitsT1, "nphiMatchedHitsPerChamberLayer", PhiIdx::T1,
210 muon, weight);
211 fillPlot(phiMatchedHitsT2, "nphiMatchedHitsPerChamberLayer", PhiIdx::T2,
212 muon, weight);
213 fillPlot(phiMatchedHitsT3, "nphiMatchedHitsPerChamberLayer", PhiIdx::T3,
214 muon, weight);
215 fillPlot(phiMatchedHitsT4, "nphiMatchedHitsPerChamberLayer", PhiIdx::T4,
216 muon, weight);
217 fillPlot(phiMatchedHitsCSC, "nphiMatchedHitsPerChamberLayer", PhiIdx::CSC,
218 muon, weight);
219
220 fillPlot(trigEtaMatchedHitsSummed, "ntrigEtaMatchedHitsPerChamberLayer",
221 muon, weight);
222 fillPlot(trigEtaMatchedHitsBM1, "ntrigEtaMatchedHitsPerChamberLayer",
223 PhiIdx::BM1, muon, weight);
224 fillPlot(trigEtaMatchedHitsBM2, "ntrigEtaMatchedHitsPerChamberLayer",
225 PhiIdx::BM2, muon, weight);
226 fillPlot(trigEtaMatchedHitsBO1, "ntrigEtaMatchedHitsPerChamberLayer",
227 PhiIdx::BO1, muon, weight);
228 fillPlot(trigEtaMatchedHitsBO2, "ntrigEtaMatchedHitsPerChamberLayer",
229 PhiIdx::BO2, muon, weight);
230 fillPlot(trigEtaMatchedHitsT1, "ntrigEtaMatchedHitsPerChamberLayer",
231 PhiIdx::T1, muon, weight);
232 fillPlot(trigEtaMatchedHitsT2, "ntrigEtaMatchedHitsPerChamberLayer",
233 PhiIdx::T2, muon, weight);
234 fillPlot(trigEtaMatchedHitsT3, "ntrigEtaMatchedHitsPerChamberLayer",
235 PhiIdx::T3, muon, weight);
236 fillPlot(trigEtaMatchedHitsT4, "ntrigEtaMatchedHitsPerChamberLayer",
237 PhiIdx::T4, muon, weight);
238 // fillPlot(trigEtaMatchedHitsCSC, "ntrigEtaMatchedHitsPerChamberLayer",
239 // PhiIdx::CSC, muon);
240}
241
242void MuonTruthHitPlots::fillPlot(TH1* hitPlots, const std::string& sInfo,
243 const xAOD::Muon& muon, float weight) {
244 // protection
245 if (muon.author() != xAOD::Muon::Author::MuidCo &&
246 muon.author() != xAOD::Muon::Author::MuidSA &&
247 muon.author() != xAOD::Muon::Author::MuGirl) {
248 return;
249 }
250
252 if (!acc.isAvailable(muon)) {
253 return;
254 }
255 std::vector<unsigned int> vec = acc(muon);
256 for (unsigned int i = 0; i < vec.size(); i++) {
257 hitPlots->Fill(vec[i], weight);
258 }
259}
260
261void MuonTruthHitPlots::fillPlot(TH1* hitPlots, const std::string& sInfo,
263 const xAOD::Muon& muon, float weight) {
264 // protection
265 if (muon.author() != xAOD::Muon::Author::MuidCo &&
266 muon.author() != xAOD::Muon::Author::MuidSA &&
267 muon.author() != xAOD::Muon::Author::MuGirl) {
268 return;
269 }
270 using namespace Muon::MuonStationIndex;
272 if (!acc.isAvailable(muon)) {
273 return;
274 }
275 const std::vector<unsigned int>& vec = acc(muon);
276 if (vec.size()) {
277 hitPlots->Fill(vec[toInt(index)], weight);
278 }
279}
280void MuonTruthHitPlots::fillPlot(TH1* hitPlots, const std::string& sInfo,
282 const xAOD::Muon& muon, float weight) {
283 // protection
284 if (muon.author() != xAOD::Muon::Author::MuidCo &&
285 muon.author() != xAOD::Muon::Author::MuidSA &&
286 muon.author() != xAOD::Muon::Author::MuGirl) {
287 return;
288 }
289 using namespace Muon::MuonStationIndex;
291 if (!acc.isAvailable(muon)) {
292 return;
293 }
294 const std::vector<unsigned int>& vec = acc(muon);
295 if (vec.size()) {
296 hitPlots->Fill(vec[toInt(index)], weight);
297 }
298}
299
300} // namespace Muon
std::vector< size_t > vec
Helper class to provide constant type-safe access to aux data.
MuonTruthHitPlots(PlotBase *pParent, const std::string &sDir)
void fill(const xAOD::Muon &muon, float weight=1.0)
void fillPlot(TH1 *hitPlots, const std::string &sInfo, const Muon::MuonStationIndex::ChIndex &index, const xAOD::Muon &muon, float weight=1.0)
TH1D * Book1D(std::string_view name, std::string_view labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, std::string_view sDir)
Definition PlotBase.cxx:29
Helper class to provide constant type-safe access to aux data.
PhiIndex
enum to classify the different phi layers in the muon spectrometer
constexpr int toInt(const EnumType enumVal)
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
MuonStationIndex::PhiIndex PhiIdx
MuonStationIndex::ChIndex ChIdx
Definition index.py:1
Muon_v1 Muon
Reference the current persistent version: