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 status = 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 status = 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 status = 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 } else {
76 m_GROUP_INDEX = tgcGroup->region(0).index();
77 }
78
79 const IdDictRegion& region = m_dict->region(m_GROUP_INDEX);
86
87 ATH_MSG_DEBUG(" TGC decode index and bit fields for each level: " << std::endl
88 << " muon " << m_muon_impl.show_to_string() << std::endl
89 << " station " << m_sta_impl.show_to_string() << std::endl
90 << " eta " << m_eta_impl.show_to_string() << std::endl
91 << " phi " << m_phi_impl.show_to_string() << std::endl
92 << " technology " << m_tec_impl.show_to_string() << std::endl
93 << " gas gap " << m_gap_impl.show_to_string() << std::endl
94 << " is strip " << m_ist_impl.show_to_string() << std::endl
95 << " channel " << m_cha_impl.show_to_string());
96 // Build multirange for the valid set of identifiers
97 //
98
99 // Find value for the field MuonSpectrometer
100 int muonField = -1;
101 const IdDictDictionary* atlasDict = dict_mgr.find_dictionary("ATLAS");
102 if (atlasDict->get_label_value("subdet", "MuonSpectrometer", muonField)) {
103 ATH_MSG_ERROR("Could not get value for label 'MuonSpectrometer' of field 'subdet' in dictionary " << atlasDict->name());
104 return (1);
105 }
106
107 // Build MultiRange down to "technology" for all (muon) regions
108 ExpandedIdentifier region_id;
109 region_id.add(muonField);
110 Range prefix;
111 MultiRange muon_range = m_dict->build_multirange(region_id, prefix, "technology");
112 if (muon_range.size() > 0) {
113 ATH_MSG_INFO("MultiRange built successfully to Technology: "
114 << "MultiRange size is " << muon_range.size());
115 } else {
116 ATH_MSG_ERROR("Muon MultiRange is empty");
117 }
118
119 // Build MultiRange down to "detector element" for all mdt regions
120
121 ExpandedIdentifier detectorElement_region;
122 detectorElement_region.add(muonField);
123 Range detectorElement_prefix;
124 MultiRange muon_detectorElement_range = m_dict->build_multirange(detectorElement_region, detectorElement_prefix, "technology");
125 if (muon_detectorElement_range.size() > 0) {
126 ATH_MSG_INFO("MultiRange built successfully to detector element: "
127 << "Multilayer MultiRange size is " << muon_detectorElement_range.size());
128 } else {
129 ATH_MSG_ERROR("Muon TGC detector element MultiRange is empty");
130 }
131
132 // Build MultiRange down to "channel" for all TGC regions
133 ExpandedIdentifier tgc_region;
134 tgc_region.add(muonField);
135 Range tgc_prefix;
136 MultiRange muon_channel_range = m_dict->build_multirange(tgc_region, tgc_prefix, "channel");
137 if (muon_channel_range.size() > 0) {
138 ATH_MSG_INFO("MultiRange built successfully to channel: "
139 << "MultiRange size is " << muon_channel_range.size());
140 } else {
141 ATH_MSG_ERROR("Muon MultiRange is empty for channels");
142 }
143
144 // build TGC module ranges
145 // Find the regions that have a "technology field" that matches the TGC and save them
146 int tgcField = -1;
147 status = m_dict->get_label_value("technology", "TGC", tgcField);
148
149 for (int i = 0; i < (int)muon_range.size(); ++i) {
150 const Range& range = muon_range[i];
151 if (range.fields() > m_TECHNOLOGY_INDEX) {
152 const Range::field& field = range[m_TECHNOLOGY_INDEX];
153 if (field.match((ExpandedIdentifier::element_type)tgcField)) {
154 m_full_module_range.add(range);
155 ATH_MSG_DEBUG("field size is " << (int)range.cardinality() << " field index = " << i);
156 }
157 }
158 }
159
160 for (int j = 0; j < (int)muon_detectorElement_range.size(); ++j) {
161 const Range& range = muon_detectorElement_range[j];
162 if (range.fields() > m_TECHNOLOGY_INDEX) {
163 const Range::field& field = range[m_TECHNOLOGY_INDEX];
164 if (field.match((ExpandedIdentifier::element_type)tgcField)) {
166 ATH_MSG_DEBUG("detector element field size is " << (int)range.cardinality() << " field index = " << j);
167 }
168 }
169 }
170
171 for (int j = 0; j < (int)muon_channel_range.size(); ++j) {
172 const Range& range = muon_channel_range[j];
173 if (range.fields() > m_TECHNOLOGY_INDEX) {
174 const Range::field& field = range[m_TECHNOLOGY_INDEX];
175 if (field.match((ExpandedIdentifier::element_type)tgcField)) {
176 m_full_channel_range.add(range);
177 ATH_MSG_DEBUG("channel field size is " << (int)range.cardinality() << " field index = " << j);
178 }
179 }
180 }
181
182 // test to see that the multi range is not empty
183 if (m_full_module_range.size() == 0) {
184 ATH_MSG_ERROR("TGC MultiRange ID is empty for modules");
185 status = 1;
186 }
187
189
190 if (m_full_detectorElement_range.size() == 0) {
191 ATH_MSG_ERROR("TGC MultiRange ID is empty for detector elements");
192 status = 1;
193 }
194
195 // test to see that the multi range is not empty
196 if (m_full_channel_range.size() == 0) {
197 ATH_MSG_ERROR("TGC MultiRange ID is empty for channels");
198 status = 1;
199 }
200
201 // Setup the hash tables for TGC
202 ATH_MSG_INFO("Initializing TGC hash indices ... ");
203 status = init_hashes();
204 status = init_detectorElement_hashes(); // same as module hash
205 status = init_id_to_hashes();
206
207 // Setup hash tables for finding neighbors
208 ATH_MSG_INFO("Initializing TGC hash indices for finding neighbors ... ");
209 status = init_neighbors();
210
211 m_init = true;
212 return (status);
213}
214
215inline unsigned int TgcIdHelper::moduleHashIdx(const Identifier& id) const{
218 constexpr unsigned int C = s_phiDim;
219 constexpr unsigned int BxC = C*s_etaDim;
220 const int stEta = stationEta(id);
221 return (stationName(id) - m_stationShift)*BxC + (stEta + s_etaDim/2 - (stEta>0))*C + (stationPhi(id) -1);
222}
224 for (const Identifier& id : m_module_vec) m_stationShift = std::min(m_stationShift, 1u* stationName(id));
225
226 unsigned int hash_max = module_hash_max();
227 for (unsigned int i = 0; i < hash_max; ++i) {
228 const Identifier& id = m_module_vec[i];
229 const unsigned idx = moduleHashIdx(id);
230 if (idx >= m_module_hashes.size() || m_module_hashes[idx] < hash_max){
231 ATH_MSG_FATAL("Failed to assign module hash to "<<show_to_string(id));
232 return 1;
233 }
234 m_module_hashes[idx] = i;
235 }
236 return 0;
237}
238
240 const unsigned int idx = moduleHashIdx(id);
241 if (idx >= m_module_hashes.size()) return 1;
242 hash_id = m_module_hashes[idx];
243 return 0;
244}
245
247 return get_module_hash(id, hash_id);
248}
249
250void TgcIdHelper::idChannels(const Identifier& id, std::vector<Identifier>& vect) const {
251 vect.clear();
252 Identifier parent = parentID(id);
253 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
254 const Range& range = m_full_channel_range[i];
255 ConstRangeIterator rit(range);
256 for (const auto &expId : rit) {
257 Identifier child;
258 get_id(expId, child);
259 if (parentID(child) == parent) vect.push_back(child);
260 }
261 }
262}
263
265 ExpandedIdentifier expId;
266 IdContext eta_context(expId, 0, m_ETA_INDEX);
267 if (!get_expanded_id(id, expId, &eta_context)) {
268 int result = -999;
269 for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
270 const Range& range = m_full_module_range[i];
271 if (range.match(expId)) {
272 const Range::field& eta_field = range[m_ETA_INDEX];
273 if (not eta_field.empty()) {
274 int etamin = eta_field.get_minimum();
275 if (-999 == result) {
276 result = etamin;
277 } else {
278 if (etamin < result) result = etamin;
279 }
280 }
281 }
282 }
283 return (result);
284 }
285 return (999); // default
286}
287
289 ExpandedIdentifier expId;
290 IdContext eta_context(expId, 0, m_ETA_INDEX);
291 if (!get_expanded_id(id, expId, &eta_context)) {
292 int result = -999;
293 for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
294 const Range& range = m_full_module_range[i];
295 if (range.match(expId)) {
296 const Range::field& eta_field = range[m_ETA_INDEX];
297 if (not eta_field.empty()) {
298 int etamax = eta_field.get_maximum();
299 if (result < etamax) result = etamax;
300 }
301 }
302 }
303 return (result);
304 }
305 return (-999);
306}
307
309 ExpandedIdentifier expId;
310 IdContext phi_context(expId, 0, m_PHI_INDEX);
311 if (!get_expanded_id(id, expId, &phi_context)) {
312 for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
313 const Range& range = m_full_module_range[i];
314 if (range.match(expId)) {
315 const Range::field& phi_field = range[m_PHI_INDEX];
316 if (not phi_field.empty()) { return (phi_field.get_minimum()); }
317 }
318 }
319 }
320 // Failed to find the min
321 return (999);
322}
323
325 ExpandedIdentifier expId;
326 IdContext phi_context(expId, 0, m_PHI_INDEX);
327 if (!get_expanded_id(id, expId, &phi_context)) {
328 for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
329 const Range& range = m_full_module_range[i];
330 if (range.match(expId)) {
331 const Range::field& phi_field = range[m_PHI_INDEX];
332 if (not phi_field.empty()) { return (phi_field.get_maximum()); }
333 }
334 }
335 }
336 // Failed to find the max
337 return (-999);
338}
339
340int TgcIdHelper::gasGapMin(const Identifier& id) const {
341 ExpandedIdentifier expId;
342 IdContext gasgap_context(expId, 0, m_GASGAP_INDEX);
343 if (!get_expanded_id(id, expId, &gasgap_context)) {
344 int result = -999;
345 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
346 const Range& range = m_full_channel_range[i];
347 if (range.match(expId)) {
348 const Range::field& gasgap_field = range[m_GASGAP_INDEX];
349 if (not gasgap_field.empty()) {
350 int gasgapmin = gasgap_field.get_minimum();
351 if (-999 == result) {
352 result = gasgapmin;
353 } else {
354 if (gasgapmin < result) result = gasgapmin;
355 }
356 }
357 }
358 }
359 return (result);
360 }
361 return (999);
362}
363
364int TgcIdHelper::gasGapMax(const Identifier& id) const {
365 ExpandedIdentifier expId;
366 IdContext gasgap_context(expId, 0, m_GASGAP_INDEX);
367 if (!get_expanded_id(id, expId, &gasgap_context)) {
368 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
369 const Range& range = m_full_channel_range[i];
370 if (range.match(expId)) {
371 const Range::field& gasgap_field = range[m_GASGAP_INDEX];
372 if (not gasgap_field.empty()) { return (gasgap_field.get_maximum()); }
373 }
374 }
375 }
376 // Failed to find the max
377 return (-999);
378}
379
381 ExpandedIdentifier expId;
382 IdContext isstrip_context(expId, 0, m_ISSTRIP_INDEX);
383 if (!get_expanded_id(id, expId, &isstrip_context)) {
384 int result = -999;
385 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
386 const Range& range = m_full_channel_range[i];
387 if (range.match(expId)) {
388 const Range::field& isstrip_field = range[m_ISSTRIP_INDEX];
389 if (not isstrip_field.empty()) {
390 int isstripmin = isstrip_field.get_minimum();
391 if (-999 == result) {
392 result = isstripmin;
393 } else {
394 if (isstripmin < result) result = isstripmin;
395 }
396 }
397 }
398 }
399 return (result);
400 }
401 return (999);
402}
403
405 ExpandedIdentifier expId;
406 IdContext isstrip_context(expId, 0, m_ISSTRIP_INDEX);
407 if (!get_expanded_id(id, expId, &isstrip_context)) {
408 int result = -999;
409 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
410 const Range& range = m_full_channel_range[i];
411 if (range.match(expId)) {
412 const Range::field& isstrip_field = range[m_ISSTRIP_INDEX];
413 if (not isstrip_field.empty()) {
414 int isstripmax = isstrip_field.get_maximum();
415 if (result < isstripmax) result = isstripmax;
416 }
417 }
418 }
419 return (result);
420 }
421 return (-999);
422}
423
425 ExpandedIdentifier expId;
427 if (!get_expanded_id(id, expId, &channel_context)) {
428 int result = -999;
429 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
430 const Range& range = m_full_channel_range[i];
431 if (range.match(expId)) {
432 const Range::field& channel_field = range[m_CHANNEL_INDEX];
433 if (not channel_field.empty()) {
434 int channelmin = channel_field.get_minimum();
435 if (-999 == result) {
436 result = channelmin;
437 } else {
438 if (channelmin < result) result = channelmin;
439 }
440 }
441 }
442 }
443 return (result);
444 }
445 return (999);
446}
447
449 ExpandedIdentifier expId;
451 if (!get_expanded_id(id, expId, &channel_context)) {
452 int result = -999;
453 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
454 const Range& range = m_full_channel_range[i];
455 if (range.match(expId)) {
456 const Range::field& channel_field = range[m_CHANNEL_INDEX];
457 if (not channel_field.empty()) {
458 int channelmax = channel_field.get_maximum();
459 if (result < channelmax) result = channelmax;
460 }
461 }
462 }
463 return (result);
464 }
465 return (-999);
466}
467
468// validation of levels
469
470bool TgcIdHelper::valid(const Identifier& id) const {
471 if (!validElement(id)) return false;
472
473 int station = stationName(id);
474 int gasG = gasGap(id);
475 if (gasG < gasGapMin() || gasG > gasGapMax(tripletChamber(station))) {
476 ATH_MSG_DEBUG("Invalid gasGap=" << gasG << " gasGapMin=" << gasGapMin(id) << " gasGapMax=" << gasGapMax(tripletChamber(station)));
477 return false;
478 }
479
480 int isstrip = isStrip(id);
481 if (isstrip < isStripMin(id) || isstrip > isStripMax(id)) {
482 ATH_MSG_DEBUG("Invalid isStrip=" << isstrip << " isStripMin=" << isStripMin(id) << " isStripMax=" << isStripMax(id));
483 return false;
484 }
485
486 int element = channel(id);
487 if (element < channelMin(id) || element > channelMax(id)) {
488 ATH_MSG_DEBUG("Invalid channel=" << element << " channelMin=" << channelMin(id) << " channelMax=" << channelMax(id));
489 return false;
490 }
491 return true;
492}
493bool TgcIdHelper::isStNameInTech(const std::string& name) const { return 'T' == name[0]; }
495 int station = stationName(id);
496 if (!validStation(station)) {
497 ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(station));
498 return false;
499 }
500
501 int eta = stationEta(id);
502 if (eta < stationEtaMin(id) || eta > stationEtaMax(id)) {
503 ATH_MSG_DEBUG("Invalid stationEta=" << eta << " for stationName=" << stationNameString(station) << " stationIndex=" << station
504 << " stationEtaMin=" << stationEtaMin(id) << " stationEtaMax=" << stationEtaMax(id));
505 return false;
506 }
507
508 int phi = stationPhi(id);
509 if (phi < stationPhiMin(id) || phi > stationPhiMax(id)) {
510 ATH_MSG_DEBUG("Invalid stationPhi=" << phi << " for stationName=" << stationNameString(station) << " stationIndex=" << station
511 << " stationPhiMin=" << stationPhiMin(id) << " stationPhiMax=" << stationPhiMax(id));
512 return false;
513 }
514 return true;
515}
516
517// Private validation of levels
518
521 ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(stationName));
522 return false;
523 }
525 ATH_MSG_DEBUG("Invalid stationEta=" << stationEta << " for stationName=" << stationNameString(stationName)
526 << " stationIndex=" << stationName << " stationEtaMin=" << stationEtaMin(id)
527 << " stationEtaMax=" << stationEtaMax(id));
528 return false;
529 }
531 ATH_MSG_DEBUG("Invalid stationPhi=" << stationPhi << " for stationName=" << stationNameString(stationName)
532 << " stationIndex=" << stationName << " stationPhiMin=" << stationPhiMin(id)
533 << " stationPhiMax=" << stationPhiMax(id));
534 return false;
535 }
536 return true;
537}
538
539// Check values down to readout channel level
540
542 int channel) const {
543 if (!validElement(id, stationName, stationEta, stationPhi)) return false;
544
546 ATH_MSG_DEBUG("Invalid gasGap=" << gasGap << " gasGapMin=" << gasGapMin(id)
547 << " gasGapMax=" << gasGapMax(tripletChamber(stationName)));
548 return false;
549 }
550 if (isStrip < isStripMin(id) || isStrip > isStripMax(id)) {
551 ATH_MSG_DEBUG("Invalid isStrip=" << isStrip << " isStripMin=" << isStripMin(id) << " isStripMax=" << isStripMax(id));
552 return false;
553 }
554 if (channel < channelMin(id) || channel > channelMax(id)) {
555 ATH_MSG_DEBUG("Invalid channel=" << channel << " channelMin=" << channelMin(id) << " channelMax=" << channelMax(id));
556 return false;
557 }
558 return true;
559}
560
562 // pack fields independently
563 Identifier result((Identifier::value_type)0);
569 return result;
570}
572 try {
575 return result;
576 } catch (const std::out_of_range&) { isValid = false; }
577 return Identifier{0};
578}
579
580Identifier TgcIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const {
581 return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi);
582}
583Identifier TgcIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const {
584 return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi, isValid);
585}
586Identifier TgcIdHelper::elementID(const Identifier& id) const { return parentID(id); }
587
589 // pack fields independently
590 Identifier result((Identifier::value_type)0);
596 m_gap_impl.pack(gasGap, result);
599 return result;
600}
602 bool& isValid) const {
603 try {
606 return result;
607 } catch (const std::out_of_range&) { isValid = false; }
608 return Identifier{0};
609}
610Identifier TgcIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int gasGap, int isStrip,
611 int channel) const {
613}
614Identifier TgcIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int gasGap, int isStrip, int channel,
615 bool& isValid) const {
617}
618
627 try {
630 return result;
631 } catch (const std::out_of_range&) { isValid = false; }
632 return Identifier{0};
633}
634
635// get parent id from strip or gang identifier
637 assert(is_tgc(id));
638 Identifier result(id);
639 m_gap_impl.reset(result);
640 m_ist_impl.reset(result);
641 m_cha_impl.reset(result);
642 return result;
643}
644
645// Access to components of the ID
646
647int TgcIdHelper::gasGap(const Identifier& id) const { return m_gap_impl.unpack(id); }
648
650int TgcIdHelper::isStrip(const Identifier& id) const { return m_ist_impl.unpack(id); }
651
652bool TgcIdHelper::measuresPhi(const Identifier& id) const { return isStrip(id); }
653
654int TgcIdHelper::channel(const Identifier& id) const { return m_cha_impl.unpack(id); }
655
656// Access to min and max of level ranges
657
659
661
663
665
667
668int TgcIdHelper::gasGapMax(bool triplet) { return triplet ? GasGapTripletMax : GasGapDoubletMax; }
669
671
673
675
678
680 int tgcField = technologyIndex("TGC");
681 if (m_dict) { tgcField = tgc_field_value(); }
682 return tgcField;
683}
684
686 const std::string& name = stationNameString(stationName);
687 return ('E' == name[2]);
688}
689
691 const std::string& name = stationNameString(stationName);
692 return ('1' == name[1]);
693}
694
695int TgcIdHelper::chamberType(const std::string& stationName, int stationEta) {
696 if ('1' == stationName[1]) {
697 if ('F' == stationName[2])
698 return 1;
699 else
700 return (std::abs(stationEta) + 1);
701 } else if ('2' == stationName[1]) {
702 if ('F' == stationName[2])
703 return 6;
704 else
705 return (std::abs(stationEta) + 6);
706 } else if ('3' == stationName[1]) {
707 if ('F' == stationName[2])
708 return 12;
709 else
710 return (std::abs(stationEta) + 12);
711 } else if ('4' == stationName[1]) {
712 if ('F' == stationName[2])
713 return 18;
714 else
715 return (std::abs(stationEta) + 18);
716 }
717 assert(0);
718 return -1;
719}
720
722 const std::string& name = stationNameString(stationName);
723 return chamberType(name, stationEta);
724}
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
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)
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
bool is_tgc(const Identifier &id) const
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
const std::string & stationNameString(const int &index) const
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