ATLAS Offline Software
Loading...
Searching...
No Matches
TgcIdHelper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
9#include "IdDict/IdDictMgr.h"
10#include "IdDict/IdDictRegion.h"
12
13TgcIdHelper::TgcIdHelper() : MuonIdHelper("TgcIdHelper", "tgc") {
14 m_module_hashes.fill(-1);
15}
16
17// Initialize dictionary
19 int status = 0;
20
21 // Check whether this helper should be reinitialized
22 if (!reinitialize(dict_mgr)) {
23 ATH_MSG_INFO("Request to reinitialize not satisfied - tags have not changed");
24 return 0;
25 } else {
26 ATH_MSG_DEBUG("(Re)initialize");
27 }
28
29 // init base object
30 if (AtlasDetectorID::initialize_from_dictionary(dict_mgr)) return (1);
31
32 // Register version of the MuonSpectrometer dictionary
33 if (register_dict_tag(dict_mgr, "MuonSpectrometer")) return (1);
34
35 m_dict = dict_mgr.find_dictionary("MuonSpectrometer");
36 if (!m_dict) {
37 ATH_MSG_ERROR(" initialize_from_dict - cannot access MuonSpectrometer dictionary ");
38 return 1;
39 }
40
41 // Initialize some of the field indices
42 if (initLevelsFromDict()) return (1);
43
44 const IdDictField* field = m_dict->find_field("tgcGasGap");
45 if (field) {
46 m_GASGAP_INDEX = field->index();
47 } else {
48 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'tgcGasGap' field ");
49 return 1;
50 }
51
52 field = m_dict->find_field("isStrip");
53 if (field) {
54 m_ISSTRIP_INDEX = field->index();
55 } else {
56 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'isStrip' field ");
57 return 1;
58 }
59
60 field = m_dict->find_field("channel");
61 if (field) {
62 m_CHANNEL_INDEX = field->index();
63 } else {
64 ATH_MSG_ERROR("initLevelsFromDict - unable to find channel' field ");
65 return 1;
66 }
67
68 // reinitialize the module ndex
70
71 // save an index to the first region of tgc
72 const IdDictGroup* tgcGroup = m_dict->find_group("tgc");
73 if (!tgcGroup) {
74 ATH_MSG_ERROR("Cannot find tgc group");
75 return 1;
76 } else {
77 m_GROUP_INDEX = tgcGroup->region(0).index();
78 }
79
80 const IdDictRegion& region = m_dict->region(m_GROUP_INDEX);
87
88 ATH_MSG_DEBUG(" TGC decode index and bit fields for each level: " << std::endl
89 << " muon " << m_muon_impl.show_to_string() << std::endl
90 << " station " << m_sta_impl.show_to_string() << std::endl
91 << " eta " << m_eta_impl.show_to_string() << std::endl
92 << " phi " << m_phi_impl.show_to_string() << std::endl
93 << " technology " << m_tec_impl.show_to_string() << std::endl
94 << " gas gap " << m_gap_impl.show_to_string() << std::endl
95 << " is strip " << m_ist_impl.show_to_string() << std::endl
96 << " channel " << m_cha_impl.show_to_string());
97 // Build multirange for the valid set of identifiers
98 //
99
100 // Find value for the field MuonSpectrometer
101 int muonField = -1;
102 const IdDictDictionary* atlasDict = dict_mgr.find_dictionary("ATLAS");
103 if (atlasDict->get_label_value("subdet", "MuonSpectrometer", muonField)) {
104 ATH_MSG_ERROR("Could not get value for label 'MuonSpectrometer' of field 'subdet' in dictionary " << atlasDict->name());
105 return 1;
106 }
107
108 // Build MultiRange down to "technology" for all (muon) regions
109 ExpandedIdentifier region_id;
110 region_id.add(muonField);
111 Range prefix;
112 MultiRange muon_range = m_dict->build_multirange(region_id, prefix, "technology");
113 if (muon_range.size() > 0) {
114 ATH_MSG_INFO("MultiRange built successfully to Technology: "
115 << "MultiRange size is " << muon_range.size());
116 } else {
117 ATH_MSG_ERROR("Muon MultiRange is empty");
118 return 1;
119 }
120
121 // Build MultiRange down to "detector element" for all mdt regions
122
123 ExpandedIdentifier detectorElement_region;
124 detectorElement_region.add(muonField);
125 Range detectorElement_prefix;
126 MultiRange muon_detectorElement_range = m_dict->build_multirange(detectorElement_region, detectorElement_prefix, "technology");
127 if (muon_detectorElement_range.size() > 0) {
128 ATH_MSG_INFO("MultiRange built successfully to detector element: "
129 << "Multilayer MultiRange size is " << muon_detectorElement_range.size());
130 } else {
131 ATH_MSG_ERROR("Muon TGC detector element MultiRange is empty");
132 return 1;
133 }
134
135 // Build MultiRange down to "channel" for all TGC regions
136 ExpandedIdentifier tgc_region;
137 tgc_region.add(muonField);
138 Range tgc_prefix;
139 MultiRange muon_channel_range = m_dict->build_multirange(tgc_region, tgc_prefix, "channel");
140 if (muon_channel_range.size() > 0) {
141 ATH_MSG_INFO("MultiRange built successfully to channel: "
142 << "MultiRange size is " << muon_channel_range.size());
143 } else {
144 ATH_MSG_ERROR("Muon MultiRange is empty for channels");
145 return 1;
146 }
147
148 // build TGC module ranges
149 // Find the regions that have a "technology field" that matches the TGC and save them
150 int tgcField = -1;
151 status += m_dict->get_label_value("technology", "TGC", tgcField);
152
153 for (int i = 0; i < (int)muon_range.size(); ++i) {
154 const Range& range = muon_range[i];
155 if (range.fields() > m_TECHNOLOGY_INDEX) {
156 const Range::field& field = range[m_TECHNOLOGY_INDEX];
157 if (field.match((ExpandedIdentifier::element_type)tgcField)) {
158 m_full_module_range.add(range);
159 ATH_MSG_DEBUG("field size is " << (int)range.cardinality() << " field index = " << i);
160 }
161 }
162 }
163
164 for (int j = 0; j < (int)muon_detectorElement_range.size(); ++j) {
165 const Range& range = muon_detectorElement_range[j];
166 if (range.fields() > m_TECHNOLOGY_INDEX) {
167 const Range::field& field = range[m_TECHNOLOGY_INDEX];
168 if (field.match((ExpandedIdentifier::element_type)tgcField)) {
170 ATH_MSG_DEBUG("detector element field size is " << (int)range.cardinality() << " field index = " << j);
171 }
172 }
173 }
174
175 for (int j = 0; j < (int)muon_channel_range.size(); ++j) {
176 const Range& range = muon_channel_range[j];
177 if (range.fields() > m_TECHNOLOGY_INDEX) {
178 const Range::field& field = range[m_TECHNOLOGY_INDEX];
179 if (field.match((ExpandedIdentifier::element_type)tgcField)) {
180 m_full_channel_range.add(range);
181 ATH_MSG_DEBUG("channel field size is " << (int)range.cardinality() << " field index = " << j);
182 }
183 }
184 }
185
186 // test to see that the multi range is not empty
187 if (m_full_module_range.size() == 0) {
188 ATH_MSG_ERROR("TGC MultiRange ID is empty for modules");
189 return 1;
190 }
191
193
194 if (m_full_detectorElement_range.size() == 0) {
195 ATH_MSG_ERROR("TGC MultiRange ID is empty for detector elements");
196 return 1;
197 }
198
199 // test to see that the multi range is not empty
200 if (m_full_channel_range.size() == 0) {
201 ATH_MSG_ERROR("TGC MultiRange ID is empty for channels");
202 return 1;
203 }
204
205 // Setup the hash tables for TGC
206 ATH_MSG_INFO("Initializing TGC hash indices ... ");
207 status += init_hashes();
208 status += init_detectorElement_hashes(); // same as module hash
209 status += init_id_to_hashes();
210
211 // Setup hash tables for finding neighbors
212 ATH_MSG_INFO("Initializing TGC hash indices for finding neighbors ... ");
213 status += init_neighbors();
214
215 m_init = true;
216 return (status);
217}
218
219inline unsigned int TgcIdHelper::moduleHashIdx(const Identifier& id) const{
222 constexpr unsigned int C = s_phiDim;
223 constexpr unsigned int BxC = C*s_etaDim;
224 const int stEta = stationEta(id);
225 return (stationName(id) - m_stationShift)*BxC + (stEta + s_etaDim/2 - (stEta>0))*C + (stationPhi(id) -1);
226}
228 for (const Identifier& id : m_module_vec) m_stationShift = std::min(m_stationShift, 1u* stationName(id));
229
230 unsigned int hash_max = module_hash_max();
231 for (unsigned int i = 0; i < hash_max; ++i) {
232 const Identifier& id = m_module_vec[i];
233 const unsigned idx = moduleHashIdx(id);
234 if (idx >= m_module_hashes.size() || m_module_hashes[idx] < hash_max){
235 ATH_MSG_FATAL("Failed to assign module hash to "<<show_to_string(id));
236 return 1;
237 }
238 m_module_hashes[idx] = i;
239 }
240 return 0;
241}
242
244 const unsigned int idx = moduleHashIdx(id);
245 if (idx >= m_module_hashes.size()) return 1;
246 hash_id = m_module_hashes[idx];
247 return 0;
248}
249
251 return get_module_hash(id, hash_id);
252}
253
254void TgcIdHelper::idChannels(const Identifier& id, std::vector<Identifier>& vect) const {
255 vect.clear();
256 Identifier parent = parentID(id);
257 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
258 const Range& range = m_full_channel_range[i];
259 ConstRangeIterator rit(range);
260 for (const auto &expId : rit) {
261 Identifier child;
262 get_id(expId, child);
263 if (parentID(child) == parent) vect.push_back(child);
264 }
265 }
266}
267
269 ExpandedIdentifier expId;
270 IdContext eta_context(expId, 0, m_ETA_INDEX);
271 if (!get_expanded_id(id, expId, &eta_context)) {
272 int result = -999;
273 for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
274 const Range& range = m_full_module_range[i];
275 if (range.match(expId)) {
276 const Range::field& eta_field = range[m_ETA_INDEX];
277 if (not eta_field.empty()) {
278 int etamin = eta_field.get_minimum();
279 if (-999 == result) {
280 result = etamin;
281 } else {
282 if (etamin < result) result = etamin;
283 }
284 }
285 }
286 }
287 return (result);
288 }
289 return (999); // default
290}
291
293 ExpandedIdentifier expId;
294 IdContext eta_context(expId, 0, m_ETA_INDEX);
295 if (!get_expanded_id(id, expId, &eta_context)) {
296 int result = -999;
297 for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
298 const Range& range = m_full_module_range[i];
299 if (range.match(expId)) {
300 const Range::field& eta_field = range[m_ETA_INDEX];
301 if (not eta_field.empty()) {
302 int etamax = eta_field.get_maximum();
303 if (result < etamax) result = etamax;
304 }
305 }
306 }
307 return (result);
308 }
309 return (-999);
310}
311
313 ExpandedIdentifier expId;
314 IdContext phi_context(expId, 0, m_PHI_INDEX);
315 if (!get_expanded_id(id, expId, &phi_context)) {
316 for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
317 const Range& range = m_full_module_range[i];
318 if (range.match(expId)) {
319 const Range::field& phi_field = range[m_PHI_INDEX];
320 if (not phi_field.empty()) { return (phi_field.get_minimum()); }
321 }
322 }
323 }
324 // Failed to find the min
325 return (999);
326}
327
329 ExpandedIdentifier expId;
330 IdContext phi_context(expId, 0, m_PHI_INDEX);
331 if (!get_expanded_id(id, expId, &phi_context)) {
332 for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
333 const Range& range = m_full_module_range[i];
334 if (range.match(expId)) {
335 const Range::field& phi_field = range[m_PHI_INDEX];
336 if (not phi_field.empty()) { return (phi_field.get_maximum()); }
337 }
338 }
339 }
340 // Failed to find the max
341 return (-999);
342}
343
344int TgcIdHelper::gasGapMin(const Identifier& id) const {
345 ExpandedIdentifier expId;
346 IdContext gasgap_context(expId, 0, m_GASGAP_INDEX);
347 if (!get_expanded_id(id, expId, &gasgap_context)) {
348 int result = -999;
349 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
350 const Range& range = m_full_channel_range[i];
351 if (range.match(expId)) {
352 const Range::field& gasgap_field = range[m_GASGAP_INDEX];
353 if (not gasgap_field.empty()) {
354 int gasgapmin = gasgap_field.get_minimum();
355 if (-999 == result) {
356 result = gasgapmin;
357 } else {
358 if (gasgapmin < result) result = gasgapmin;
359 }
360 }
361 }
362 }
363 return (result);
364 }
365 return (999);
366}
367
368int TgcIdHelper::gasGapMax(const Identifier& id) const {
369 ExpandedIdentifier expId;
370 IdContext gasgap_context(expId, 0, m_GASGAP_INDEX);
371 if (!get_expanded_id(id, expId, &gasgap_context)) {
372 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
373 const Range& range = m_full_channel_range[i];
374 if (range.match(expId)) {
375 const Range::field& gasgap_field = range[m_GASGAP_INDEX];
376 if (not gasgap_field.empty()) { return (gasgap_field.get_maximum()); }
377 }
378 }
379 }
380 // Failed to find the max
381 return (-999);
382}
383
385 ExpandedIdentifier expId;
386 IdContext isstrip_context(expId, 0, m_ISSTRIP_INDEX);
387 if (!get_expanded_id(id, expId, &isstrip_context)) {
388 int result = -999;
389 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
390 const Range& range = m_full_channel_range[i];
391 if (range.match(expId)) {
392 const Range::field& isstrip_field = range[m_ISSTRIP_INDEX];
393 if (not isstrip_field.empty()) {
394 int isstripmin = isstrip_field.get_minimum();
395 if (-999 == result) {
396 result = isstripmin;
397 } else {
398 if (isstripmin < result) result = isstripmin;
399 }
400 }
401 }
402 }
403 return (result);
404 }
405 return (999);
406}
407
409 ExpandedIdentifier expId;
410 IdContext isstrip_context(expId, 0, m_ISSTRIP_INDEX);
411 if (!get_expanded_id(id, expId, &isstrip_context)) {
412 int result = -999;
413 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
414 const Range& range = m_full_channel_range[i];
415 if (range.match(expId)) {
416 const Range::field& isstrip_field = range[m_ISSTRIP_INDEX];
417 if (not isstrip_field.empty()) {
418 int isstripmax = isstrip_field.get_maximum();
419 if (result < isstripmax) result = isstripmax;
420 }
421 }
422 }
423 return (result);
424 }
425 return (-999);
426}
427
429 ExpandedIdentifier expId;
431 if (!get_expanded_id(id, expId, &channel_context)) {
432 int result = -999;
433 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
434 const Range& range = m_full_channel_range[i];
435 if (range.match(expId)) {
436 const Range::field& channel_field = range[m_CHANNEL_INDEX];
437 if (not channel_field.empty()) {
438 int channelmin = channel_field.get_minimum();
439 if (-999 == result) {
440 result = channelmin;
441 } else {
442 if (channelmin < result) result = channelmin;
443 }
444 }
445 }
446 }
447 return (result);
448 }
449 return (999);
450}
451
453 ExpandedIdentifier expId;
455 if (!get_expanded_id(id, expId, &channel_context)) {
456 int result = -999;
457 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
458 const Range& range = m_full_channel_range[i];
459 if (range.match(expId)) {
460 const Range::field& channel_field = range[m_CHANNEL_INDEX];
461 if (not channel_field.empty()) {
462 int channelmax = channel_field.get_maximum();
463 if (result < channelmax) result = channelmax;
464 }
465 }
466 }
467 return (result);
468 }
469 return (-999);
470}
471
472// validation of levels
473
474bool TgcIdHelper::valid(const Identifier& id) const {
475 if (!validElement(id)) return false;
476
477 int station = stationName(id);
478 int gasG = gasGap(id);
479 if (gasG < gasGapMin() || gasG > gasGapMax(tripletChamber(station))) {
480 ATH_MSG_DEBUG("Invalid gasGap=" << gasG << " gasGapMin=" << gasGapMin(id) << " gasGapMax=" << gasGapMax(tripletChamber(station)));
481 return false;
482 }
483
484 int isstrip = isStrip(id);
485 if (isstrip < isStripMin(id) || isstrip > isStripMax(id)) {
486 ATH_MSG_DEBUG("Invalid isStrip=" << isstrip << " isStripMin=" << isStripMin(id) << " isStripMax=" << isStripMax(id));
487 return false;
488 }
489
490 int element = channel(id);
491 if (element < channelMin(id) || element > channelMax(id)) {
492 ATH_MSG_DEBUG("Invalid channel=" << element << " channelMin=" << channelMin(id) << " channelMax=" << channelMax(id));
493 return false;
494 }
495 return true;
496}
497bool TgcIdHelper::isStNameInTech(const std::string& name) const { return 'T' == name[0]; }
499 int station = stationName(id);
500 if (!validStation(station)) {
501 ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(station));
502 return false;
503 }
504
505 int eta = stationEta(id);
506 if (eta < stationEtaMin(id) || eta > stationEtaMax(id)) {
507 ATH_MSG_DEBUG("Invalid stationEta=" << eta << " for stationName=" << stationNameString(station) << " stationIndex=" << station
508 << " stationEtaMin=" << stationEtaMin(id) << " stationEtaMax=" << stationEtaMax(id));
509 return false;
510 }
511
512 int phi = stationPhi(id);
513 if (phi < stationPhiMin(id) || phi > stationPhiMax(id)) {
514 ATH_MSG_DEBUG("Invalid stationPhi=" << phi << " for stationName=" << stationNameString(station) << " stationIndex=" << station
515 << " stationPhiMin=" << stationPhiMin(id) << " stationPhiMax=" << stationPhiMax(id));
516 return false;
517 }
518 return true;
519}
520
521// Private validation of levels
522
525 ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(stationName));
526 return false;
527 }
529 ATH_MSG_DEBUG("Invalid stationEta=" << stationEta << " for stationName=" << stationNameString(stationName)
530 << " stationIndex=" << stationName << " stationEtaMin=" << stationEtaMin(id)
531 << " stationEtaMax=" << stationEtaMax(id));
532 return false;
533 }
535 ATH_MSG_DEBUG("Invalid stationPhi=" << stationPhi << " for stationName=" << stationNameString(stationName)
536 << " stationIndex=" << stationName << " stationPhiMin=" << stationPhiMin(id)
537 << " stationPhiMax=" << stationPhiMax(id));
538 return false;
539 }
540 return true;
541}
542
543// Check values down to readout channel level
544
546 int channel) const {
547 if (!validElement(id, stationName, stationEta, stationPhi)) return false;
548
550 ATH_MSG_DEBUG("Invalid gasGap=" << gasGap << " gasGapMin=" << gasGapMin(id)
551 << " gasGapMax=" << gasGapMax(tripletChamber(stationName)));
552 return false;
553 }
554 if (isStrip < isStripMin(id) || isStrip > isStripMax(id)) {
555 ATH_MSG_DEBUG("Invalid isStrip=" << isStrip << " isStripMin=" << isStripMin(id) << " isStripMax=" << isStripMax(id));
556 return false;
557 }
558 if (channel < channelMin(id) || channel > channelMax(id)) {
559 ATH_MSG_DEBUG("Invalid channel=" << channel << " channelMin=" << channelMin(id) << " channelMax=" << channelMax(id));
560 return false;
561 }
562 return true;
563}
564
566 // pack fields independently
567 Identifier result((Identifier::value_type)0);
573 return result;
574}
576 try {
579 return result;
580 } catch (const std::out_of_range&) { isValid = false; }
581 return Identifier{0};
582}
583
584Identifier TgcIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const {
585 return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi);
586}
587Identifier TgcIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const {
588 return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi, isValid);
589}
590Identifier TgcIdHelper::elementID(const Identifier& id) const { return parentID(id); }
591
593 // pack fields independently
594 Identifier result((Identifier::value_type)0);
600 m_gap_impl.pack(gasGap, result);
603 return result;
604}
606 bool& isValid) const {
607 try {
610 return result;
611 } catch (const std::out_of_range&) { isValid = false; }
612 return Identifier{0};
613}
614Identifier TgcIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int gasGap, int isStrip,
615 int channel) const {
617}
618Identifier TgcIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int gasGap, int isStrip, int channel,
619 bool& isValid) const {
621}
622
631 try {
634 return result;
635 } catch (const std::out_of_range&) { isValid = false; }
636 return Identifier{0};
637}
638
639// get parent id from strip or gang identifier
641 assert(is_tgc(id));
642 Identifier result(id);
643 m_gap_impl.reset(result);
644 m_ist_impl.reset(result);
645 m_cha_impl.reset(result);
646 return result;
647}
648
649// Access to components of the ID
650
651int TgcIdHelper::gasGap(const Identifier& id) const { return m_gap_impl.unpack(id); }
652
654int TgcIdHelper::isStrip(const Identifier& id) const { return m_ist_impl.unpack(id); }
655
656bool TgcIdHelper::measuresPhi(const Identifier& id) const { return isStrip(id); }
657
658int TgcIdHelper::channel(const Identifier& id) const { return m_cha_impl.unpack(id); }
659
660// Access to min and max of level ranges
661
663
665
667
669
671
672int TgcIdHelper::gasGapMax(bool triplet) { return triplet ? GasGapTripletMax : GasGapDoubletMax; }
673
675
677
679
682
684 int tgcField = technologyIndex("TGC");
685 if (m_dict) { tgcField = tgc_field_value(); }
686 return tgcField;
687}
688
690 const std::string& name = stationNameString(stationName);
691 return ('E' == name[2]);
692}
693
695 const std::string& name = stationNameString(stationName);
696 return ('1' == name[1]) || ('4' == name[1]);
697}
698
699int TgcIdHelper::chamberType(const std::string& stationName, int stationEta) {
700 if ('1' == stationName[1]) {
701 if ('F' == stationName[2])
702 return 1;
703 else
704 return (std::abs(stationEta) + 1);
705 } else if ('2' == stationName[1]) {
706 if ('F' == stationName[2])
707 return 6;
708 else
709 return (std::abs(stationEta) + 6);
710 } else if ('3' == stationName[1]) {
711 if ('F' == stationName[2])
712 return 12;
713 else
714 return (std::abs(stationEta) + 12);
715 } else if ('4' == stationName[1]) {
716 if ('F' == stationName[2])
717 return 18;
718 else
719 return (std::abs(stationEta) + 18);
720 }
721 assert(0);
722 return -1;
723}
724
726 const std::string& name = stationNameString(stationName);
727 return chamberType(name, stationEta);
728}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
int muon_field_value() const
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
int register_dict_tag(const IdDictMgr &dict_mgr, const std::string &dict_name)
Register the file and tag names for a particular IdDict dictionary.
int tgc_field_value() const
bool is_tgc(Identifier id) const
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
void add(element_type value)
Append a value into a new field.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
int get_label_value(const std::string &field, const std::string &label, int &value) const
const std::string & name() const
Dictionary name.
const IdDictRegion & region(size_t index) const
const IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
size_t index() const
const IdDictFieldImplementation & implementation(size_t i) const
element_type get_minimum() const
Query the values.
bool empty() const
If true, this field does not have any constraints, and may hold any value representable by element_ty...
element_type get_maximum() const
This is a "hash" representation of an Identifier.
A MultiRange combines several Ranges.
Definition MultiRange.h:17
size_type size() const
int stationNameIndex(const std::string &name) const
int stationEta(const Identifier &id) const
IdDictFieldImplementation m_phi_impl
size_t m_GROUP_INDEX
IdDictFieldImplementation m_tec_impl
int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
Create expanded id from compact id (return == 0 for OK)
const std::string & stationNameString(const Identifier &id) const
size_type m_PHI_INDEX
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override
Create compact id from hash id (return == 0 for OK)
size_type m_CHANNEL_INDEX
int technologyIndex(const std::string &name) const
IdDictFieldImplementation m_sta_impl
MultiRange m_full_module_range
IdDictFieldImplementation m_eta_impl
size_type module_hash_max() const
the maximum hash value
MultiRange m_full_detectorElement_range
size_type m_ETA_INDEX
const IdDictDictionary * m_dict
int stationPhi(const Identifier &id) const
size_type m_DETECTORELEMENT_INDEX
int stationName(const Identifier &id) const
int initLevelsFromDict()
virtual int init_detectorElement_hashes()
IdDictFieldImplementation m_muon_impl
void resetAndSet(const IdDictFieldImplementation &dict, const int new_val, Identifier &id) const
size_type m_MODULE_INDEX
bool validStation(int stationName, int technology) const
MultiRange m_full_channel_range
IdContext channel_context() const
id for channel
MuonIdHelper(const std::string &logName, const std::string &group)
id_vec m_module_vec
size_type m_TECHNOLOGY_INDEX
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
static int channelMin()
Identifier elementID(int stationName, int stationEta, int stationPhi) const
bool tripletChamber(int stationName) const
static int stationEtaMin()
int tgcTechnology() const
Utility methods.
Identifier parentID(const Identifier &id) const
static int channelMax()
IdDictFieldImplementation m_ist_impl
int channel(const Identifier &id) const override
unsigned int m_stationShift
Minimal station index found.
static int gasGapMax(bool triplet)
static int stationPhiMin(bool endcap)
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
int gasGap(const Identifier &id) const override
get the hashes
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
static constexpr unsigned int s_etaDim
Except T2E all stations have 4 associated eta stations.
static int isStripMax()
bool valid(const Identifier &id) const
size_type m_GASGAP_INDEX
IdDictFieldImplementation m_cha_impl
bool measuresPhi(const Identifier &id) const override
IdDictFieldImplementation m_gap_impl
bool endcapChamber(int stationName) const
static int stationPhiMax(bool endcap)
size_type m_ISSTRIP_INDEX
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
std::array< unsigned int, s_modHashDim > m_module_hashes
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
static int isStripMin()
unsigned int moduleHashIdx(const Identifier &id) const
static int chamberType(const std::string &stationName, int stationEta)
int isStrip(const Identifier &id) const
isStrip corresponds to measuresPhi
static constexpr unsigned int s_phiDim
48 phi stations
static int stationEtaMax()
static int gasGapMin()
int init_id_to_hashes()
Identifier channelID(int stationName, int stationEta, int stationPhi, int gasGap, int isStrip, int channel) const
bool validElement(const Identifier &id) const
bool isStNameInTech(const std::string &stationName) const override
The valid element checks converted the identifier to a stationName string in order to assess whether ...
struct color C