This is the actual function that decorates truth muons with hit counts.
For each truth muon, we loop over the detector technologies and over the recorded hits. If a hit originated by that muon is found, we store the hit ID into a map (=ids), which contains all hits corresponding to truth muons classified by the chamber that recorded them. In addition, we update the following counters: -* nprecHitsPerChamberLayer[] counts the hits recorded by precision chambers (MDTs, MM, sTGCs with no phi
measurement), classified by chamber layer (eg. BIS, BML, ...); -* nphiHitsPerChamberLayer[] counts the hits recorded by chambers providing phi-measurement (sSTGs+trigger+others chambers with phi measurement), classified by phi chamber layer (e.g. BM1, BM2, BO1, ...); -* ntrigEtaHitsPerChamberLayer[] counts the hits recorded by trigger chambers (RPC, TGC) with only eta measurement, classified by phi chamber layer. At the end, we use this information to perfom further classification and save results (i.e. resulting counters) to decorators: – hits from precision chambers classified by inner/middle/outer/extended stations and small/large sectors – hits with phi-measurment classified by 1/2/3/4 phi chamber layers – hits from trigger chambers with only-eta measurement classified by 1/2/3/4 phi chamber layers – coincidences between chamber layers (> 2-3) considering hits from precision chambers – coincidences between phi chamber layers (> 0-2-3) considering hits with phi-measurement – coincidences between phi chamber layers (> 0-2-3) considering hits from trigger chambers with only-eta measurement
68 {
69
70 std::vector<unsigned int> nprecHitsPerChamberLayer;
71 std::vector<unsigned int> nphiHitsPerChamberLayer;
72 std::vector<unsigned int> ntrigEtaHitsPerChamberLayer;
73
74 ntrigEtaHitsPerChamberLayer.resize(
toInt(PhiIndex::PhiIndexMax));
75 nprecHitsPerChamberLayer.resize(
toInt(ChIndex::ChIndexMax));
76 nphiHitsPerChamberLayer.resize(
toInt(PhiIndex::PhiIndexMax));
77
80
81 for (SG::ReadHandle<PRD_MultiTruthCollection>& col :
m_PRD_TruthNames.makeHandles(ctx)) {
83
84
85 for (const std::pair<Identifier, HepMcParticleLink> trajectory : *col) {
86
87 if (std::ranges::find(truthParticleHistory,
HepMC::uniqueID(trajectory.second)) == truthParticleHistory.end()) {
88 continue;
89 }
90 const Identifier& id = trajectory.first;
94
95
98 if (index == PhiIndex::T4) {
99 ids[ChIndex::EIS].push_back(
id);
100 ids[ChIndex::EIL].push_back(
id);
101 } else {
102 ids[ChIndex::EMS].push_back(
id);
103 ids[ChIndex::EML].push_back(
id);
104 }
105 } else {
107 }
109 if (measPhi) {
111 ++nphiHitsPerChamberLayer.at(
toInt(index));
112 } else {
114 }
119 if (index != PhiIndex::PhiUnknown) {
120 if (measPhi)
121 ++nphiHitsPerChamberLayer.at(
toInt(index));
122 else
123 ++ntrigEtaHitsPerChamberLayer.at(
toInt(index));
124 }
125 } else {
126 if (measPhi) {
128 ++nphiHitsPerChamberLayer.at(
toInt(index));
129 } else {
131 }
132 }
133 }
134 }
135
137 nprecHitsPerChamberLayer[
toInt(ChIndex::EIS)] +
138 nprecHitsPerChamberLayer[
toInt(ChIndex::CSS)];
139
141 nprecHitsPerChamberLayer[
toInt(ChIndex::EIL)] +
142 nprecHitsPerChamberLayer[
toInt(ChIndex::CSL)];
143
145 nprecHitsPerChamberLayer[
toInt(ChIndex::EMS)];
146
148 nprecHitsPerChamberLayer[
toInt(ChIndex::EML)];
149
151 nprecHitsPerChamberLayer[
toInt(ChIndex::EOS)];
152
154 nprecHitsPerChamberLayer[
toInt(ChIndex::EOL)];
155
157 nprecHitsPerChamberLayer[
toInt(ChIndex::BEE)];
158
160
162 nphiHitsPerChamberLayer[
toInt(PhiIndex::T4)] +
163 nphiHitsPerChamberLayer[
toInt(PhiIndex::CSC)] +
164 nphiHitsPerChamberLayer[
toInt(PhiIndex::STGC1)] +
165 nphiHitsPerChamberLayer[
toInt(PhiIndex::STGC2)];
166
168 nphiHitsPerChamberLayer[
toInt(PhiIndex::T1)];
169
171 nphiHitsPerChamberLayer[
toInt(PhiIndex::T2)];
172
174 nphiHitsPerChamberLayer[
toInt(PhiIndex::T3)];
175
177 ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::T4)]+
178 ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::CSC)] +
179 ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::STGC1)] +
180 ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::STGC2)];
181
183 ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::T1)];
184
186 ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::T2)];
187
189 ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::T3)];
190
192 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::BIS)] + nprecHitsPerChamberLayer[
toInt(ChIndex::BIL)] > 3);
193 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::BMS)] + nprecHitsPerChamberLayer[
toInt(ChIndex::BML)] > 2);
194 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::BOS)] + nprecHitsPerChamberLayer[
toInt(ChIndex::BOL)] > 2);
195 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::EIS)] + nprecHitsPerChamberLayer[
toInt(ChIndex::EIL)] > 3);
196 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::EMS)] + nprecHitsPerChamberLayer[
toInt(ChIndex::EML)] > 2);
197 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::EOS)] + nprecHitsPerChamberLayer[
toInt(ChIndex::EOL)] > 2);
198 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::EES)] + nprecHitsPerChamberLayer[
toInt(ChIndex::EEL)] > 3);
199 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::CSS)] + nprecHitsPerChamberLayer[
toInt(ChIndex::CSL)] > 2);
200 nprecLayers += (nprecHitsPerChamberLayer[
toInt(ChIndex::BEE)] > 3);
201
203 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::BM1)] > 0);
204 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::BM2)] > 0);
205 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::BO1)] > 0);
206 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::BO2)] > 0);
207 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::T1)] > 0);
208 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::T2)] > 0);
209 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::T3)] > 0);
210 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::T4)] > 0);
211 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::CSC)] > 2);
212 nphiLayers += (nphiHitsPerChamberLayer[
toInt(PhiIndex::STGC1)] + nphiHitsPerChamberLayer[
toInt(PhiIndex::STGC2)] > 3);
213
215 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::BM1)] > 0);
216 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::BM2)] > 0);
217 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::BO1)] > 0);
218 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::BO2)] > 0);
219 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::T1)] > 0);
220 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::T2)] > 0);
221 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::T3)] > 0);
222 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::T4)] > 0);
223 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::CSC)] > 2);
224 ntrigEtaLayers += (ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::STGC1)] + ntrigEtaHitsPerChamberLayer[
toInt(PhiIndex::STGC2)] > 3);
225
226 (*myDecors.nprecLayersDecor)(truthParticle) = nprecLayers;
227 (*myDecors.nphiLayersDecor)(truthParticle) = nphiLayers;
228 (*myDecors.ntrigEtaLayersDecor)(truthParticle) = ntrigEtaLayers;
237
238 (*myDecors.phiLayer1HitsDecor)(truthParticle) =
phiLayer1Hits;
239 (*myDecors.phiLayer2HitsDecor)(truthParticle) =
phiLayer2Hits;
240 (*myDecors.phiLayer3HitsDecor)(truthParticle) =
phiLayer3Hits;
241 (*myDecors.phiLayer4HitsDecor)(truthParticle) =
phiLayer4Hits;
242
243 (*myDecors.etaLayer1HitsDecor)(truthParticle) =
etaLayer1Hits;
244 (*myDecors.etaLayer2HitsDecor)(truthParticle) =
etaLayer2Hits;
245 (*myDecors.etaLayer3HitsDecor)(truthParticle) =
etaLayer3Hits;
246 (*myDecors.etaLayer4HitsDecor)(truthParticle) =
etaLayer4Hits;
247
248
250 ATH_MSG_DEBUG(
"Precision layers " <<
static_cast<int>(nprecLayers) <<
" phi layers " <<
static_cast<int>(nphiLayers)
251 << " triggerEta layers " << static_cast<int>(ntrigEtaLayers));
252
253 if (nprecLayers > 0) {
254 msg(MSG::VERBOSE) <<
" Precision chambers ";
255
256 for (
int index = 0; index < static_cast<int>(nprecHitsPerChamberLayer.size()); ++
index) {
257 if (nprecHitsPerChamberLayer[index] > 0)
259 <<
" hits " << nprecHitsPerChamberLayer[
index];
260 }
261 }
262 if (nphiLayers > 0) {
263 msg(MSG::VERBOSE) <<
endmsg <<
" Phi chambers ";
264 for (
int index = 0; index < static_cast<int>(nphiHitsPerChamberLayer.size()); ++
index) {
265 if (nphiHitsPerChamberLayer[index] > 0)
267 <<
" hits " << nphiHitsPerChamberLayer[
index];
268 }
269 }
270
271 if (ntrigEtaLayers > 0) {
272 msg(MSG::VERBOSE) <<
endmsg <<
" Trigger Eta ";
273 for (
int index = 0; index < static_cast<int>(ntrigEtaHitsPerChamberLayer.size()); ++
index) {
274 if (ntrigEtaHitsPerChamberLayer[index] > 0)
276 <<
" hits " << ntrigEtaHitsPerChamberLayer[
index];
277 }
278 }
280 }
281 return StatusCode::SUCCESS;
282 }
#define ATH_CHECK
Evaluate an expression and check for errors.
bool msgLvl(const MSG::Level lvl) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Handle for muonIdHelper service.
SG::ReadHandleKeyArray< PRD_MultiTruthCollection > m_PRD_TruthNames
Keys for the containers of truth hits, grouped by detector technology.
std::deque< int > simulation_history(const T &p, const int direction)
Function to calculate all the descendants(direction=1)/ancestors(direction=-1) of the particle.
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
PhiIndex
enum to classify the different phi layers in the muon spectrometer
constexpr int toInt(const EnumType enumVal)
const std::string & chName(ChIndex index)
convert ChIndex into a string
const std::string & phiName(PhiIndex index)
convert PhiIndex into a string
ChIndex
enum to classify the different chamber layers in the muon spectrometer
@ phiLayer3Hits
number of phi hits in the third trigger layer (BOL1 ot T2)
@ outerSmallHits
number of precision hits in the outer small layer
@ phiLayer2Hits
number of phi hits in the second trigger layer (BML2 ot T1)
@ middleSmallHits
number of precision hits in the middle small layer
@ outerLargeHits
number of precision hits in the outer large layer
@ etaLayer3Hits
number of eta hits in the third trigger layer (BOL1 ot T2)
@ middleLargeHits
number of precision hits in the middle large layer
@ etaLayer1Hits
number of eta hits in the first trigger layer (BML1 ot T4)
@ phiLayer1Hits
number of phi hits in the first trigger layer (BML1 ot T4)
@ extendedSmallHits
number of precision hits in the extended small layer
@ extendedLargeHits
number of precision hits in the extended large layer
@ phiLayer4Hits
number of phi hits in the fourth trigger layer (T3)
@ innerLargeHits
number of precision hits in the inner large layer
@ etaLayer4Hits
number of eta hits in the fourth trigger layer (T3)
@ etaLayer2Hits
number of eta hits in the second trigger layer (BML2 ot T1)
@ innerSmallHits
number of precision hits in the inner small layer