ATLAS Offline Software
Loading...
Searching...
No Matches
MdtIdHelper.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
13MdtIdHelper::MdtIdHelper() : MuonIdHelper("MdtIdHelper", "mdt") {
14 //m_detectorElement_hashes
15 m_module_hashes.fill(-1);
17}
18
21 int status = 0;
22
23 // Check whether this helper should be reinitialized
24 if (!reinitialize(dict_mgr)) {
25 ATH_MSG_INFO("Request to reinitialize not satisfied - tags have not changed");
26 return 0;
27 } else {
28 ATH_MSG_DEBUG("(Re)initialize");
29 }
30
32 if (AtlasDetectorID::initialize_from_dictionary(dict_mgr)) return 1;
33
34 // Register version of the MuonSpectrometer dictionary
35 if (register_dict_tag(dict_mgr, "MuonSpectrometer")) return 1;
36
37 m_dict = dict_mgr.find_dictionary("MuonSpectrometer");
38
39 if (!m_dict) {
40 ATH_MSG_ERROR(" initialize_from_dict - cannot access MuonSpectrometer dictionary ");
41 return 1;
42 }
43
45
46 if (initLevelsFromDict()) return 1;
47
48 const IdDictField* field = m_dict->find_field("multiLayer");
49 if (field) {
50 m_DETECTORELEMENT_INDEX = field->index();
51 } else {
52 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'multiLayer' field ");
53 status = 1;
54 }
55
56 field = m_dict->find_field("tubeLayer");
57 if (field) {
58 m_TUBELAYER_INDEX = field->index();
59 } else {
60 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'tubeLayer' field ");
61 status = 1;
62 }
63
64 field = m_dict->find_field("tube");
65 if (field) {
66 m_CHANNEL_INDEX = field->index();
67 } else {
68 ATH_MSG_ERROR("initLevelsFromDict - unable to find 'tube' field ");
69 status = 1;
70 }
71
72 // save an index to the first region of mdt
73
74 const IdDictGroup* mdtGroup = m_dict->find_group("mdt");
75 if (!mdtGroup) {
76 ATH_MSG_ERROR("Cannot find mdt group");
77 } else {
78 m_GROUP_INDEX = mdtGroup->region(0).index();
79 }
80
81 const IdDictRegion& region = m_dict->region(m_GROUP_INDEX);
88
89 ATH_MSG_DEBUG(" MDT decode index and bit fields for each level: " << std::endl
90 << " muon " << m_muon_impl.show_to_string() << std::endl
91 << " station " << m_sta_impl.show_to_string() << std::endl
92 << " eta " << m_eta_impl.show_to_string() << std::endl
93 << " phi " << m_phi_impl.show_to_string() << std::endl
94 << " technology " << m_tec_impl.show_to_string() << std::endl
95 << " multilayer " << m_mla_impl.show_to_string() << std::endl
96 << " layer " << m_lay_impl.show_to_string() << std::endl
97 << " tube " << m_tub_impl.show_to_string() << std::endl);
98
102
104
105 int muonField = -1;
106 const IdDictDictionary* atlasDict = dict_mgr.find_dictionary("ATLAS");
107 if (atlasDict->get_label_value("subdet", "MuonSpectrometer", muonField)) {
108 ATH_MSG_ERROR("Could not get value for label 'MuonSpectrometer' of field "
109 << "'subdet' in dictionary " << atlasDict->name());
110 return 1;
111 }
112
113 // Build MultiRange down to "technology" for all (muon) regions
114
115 ExpandedIdentifier region_id;
116 region_id.add(muonField);
117 Range prefix;
118 MultiRange muon_range = m_dict->build_multirange(region_id, prefix, "technology");
119 if (muon_range.size() > 0) {
120 ATH_MSG_INFO("MultiRange built successfully to Technology: "
121 << "MultiRange size is " << muon_range.size());
122 } else {
123 ATH_MSG_ERROR("Muon MultiRange is empty");
124 }
125
126 // Build MultiRange down to "detector element" for all mdt regions
127
128 ExpandedIdentifier detectorElement_region;
129 detectorElement_region.add(muonField);
130 Range detectorElement_prefix;
131 MultiRange muon_detectorElement_range = m_dict->build_multirange(detectorElement_region, detectorElement_prefix, "multiLayer");
132 if (muon_detectorElement_range.size() > 0) {
133 ATH_MSG_INFO("MultiRange built successfully to detector element: "
134 << "Multilayer MultiRange size is " << muon_detectorElement_range.size());
135 } else {
136 ATH_MSG_ERROR("Muon MDT detector element MultiRange is empty");
137 }
138
139 // Build MultiRange down to "tube" for all mdt regions
140
141 ExpandedIdentifier mdt_region;
142 mdt_region.add(muonField);
143 Range mdt_prefix;
144 MultiRange muon_channel_range = m_dict->build_multirange(mdt_region, mdt_prefix, "tube");
145 if (muon_channel_range.size() > 0) {
146 ATH_MSG_INFO("MultiRange built successfully to tube: "
147 << "MultiRange size is " << muon_channel_range.size());
148 } else {
149 ATH_MSG_ERROR("Muon MDT channel MultiRange is empty");
150 }
151
158
159 int mdtField = -1;
160 status = m_dict->get_label_value("technology", "MDT", mdtField);
161
162 for (int i = 0; i < (int)muon_range.size(); ++i) {
163 const Range& range = muon_range[i];
164 if (range.fields() > m_TECHNOLOGY_INDEX) {
165 const Range::field& field = range[m_TECHNOLOGY_INDEX];
166 if (field.match((ExpandedIdentifier::element_type)mdtField)) {
167 m_full_module_range.add(range);
168 ATH_MSG_DEBUG("module field size is " << (int)range.cardinality() << " field index = " << i);
169 }
170 }
171 }
172
173 for (int j = 0; j < (int)muon_detectorElement_range.size(); ++j) {
174 const Range& range = muon_detectorElement_range[j];
175 if (range.fields() > m_TECHNOLOGY_INDEX) {
176 const Range::field& field = range[m_TECHNOLOGY_INDEX];
177 if (field.match((ExpandedIdentifier::element_type)mdtField)) {
179 ATH_MSG_DEBUG("detector element field size is " << (int)range.cardinality() << " field index = " << j);
180 }
181 }
182 }
183
184 for (int k = 0; k < (int)muon_channel_range.size(); ++k) {
185 const Range& range = muon_channel_range[k];
186 if (range.fields() > m_TECHNOLOGY_INDEX) {
187 const Range::field& field = range[m_TECHNOLOGY_INDEX];
188 if (field.match((ExpandedIdentifier::element_type)mdtField)) {
189 m_full_channel_range.add(range);
190 ATH_MSG_DEBUG("channel field size is " << (int)range.cardinality() << " field index = " << k);
191 }
192 }
193 }
194
196
197 if (m_full_module_range.size() == 0) {
198 ATH_MSG_ERROR("MDT MultiRange ID is empty for modules");
199 status = 1;
200 }
201
203
204 if (m_full_detectorElement_range.size() == 0) {
205 ATH_MSG_ERROR("MDT MultiRange ID is empty for detector elements");
206 status = 1;
207 }
208
210
211 if (m_full_channel_range.size() == 0) {
212 ATH_MSG_ERROR("MDT MultiRange ID is empty for channels");
213 status = 1;
214 }
215
216 // To speed up the range scans needed by the MinMax functions,
217 // keep indices of ranges by station name.
218
220 for (const Range& r : m_full_module_range) {
221 const Range::field& station_f = r[m_NAME_INDEX];
222 assert (not station_f.empty() &&
223 station_f.get_minimum() == station_f.get_maximum());
224 unsigned int station = station_f.get_minimum();
225 if (station >= m_module_ranges_by_station.size()) {
226 m_module_ranges_by_station.resize (station+1);
227 }
228 m_module_ranges_by_station[station].push_back (&r);
229 }
230
232 for (const Range& r : m_full_channel_range) {
233 const Range::field& station_f = r[m_NAME_INDEX];
234 assert (not station_f.empty() &&
235 station_f.get_minimum() == station_f.get_maximum());
236 unsigned int station = station_f.get_minimum();
237 if (station >= m_channel_ranges_by_station.size()) {
238 m_channel_ranges_by_station.resize (station+1);
239 }
240 m_channel_ranges_by_station[station].push_back (&r);
241 }
242
243 // Setup the hash tables for MDT
244
245 ATH_MSG_INFO("Initializing MDT hash indices ... ");
246 status = init_hashes();
248 status = init_id_to_hashes();
249
250 // Setup hash tables for finding neighbors
251
252 ATH_MSG_INFO("Initializing MDT hash indices for finding neighbors ... ");
253 status = init_neighbors();
254
255 // retrieve the maximum number of tubes in any chamber
256 ExpandedIdentifier expId;
258 for (const auto& id : m_detectorElement_vec) {
259 if (!get_expanded_id(id, expId, &channel_context)) {
260 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
261 const Range& range = m_full_channel_range[i];
262 if (range.match(expId)) {
263 const Range::field& channel_field = range[m_CHANNEL_INDEX];
264 if (not channel_field.empty()) {
265 unsigned int max = channel_field.get_maximum();
266 if (m_tubesMax == UINT_MAX)
267 m_tubesMax = max;
268 else if (max > m_tubesMax)
269 m_tubesMax = max;
270 }
271 }
272 }
273 }
274 }
275 if (m_tubesMax == UINT_MAX) {
276 ATH_MSG_ERROR("No maximum number of MDT tubes was retrieved");
277 status = 1;
278 } else {
279 ATH_MSG_DEBUG(" Maximum number of MDT tubes is " << m_tubesMax);
280 }
281 m_init = true;
284 return status;
285}
286
288 unsigned int hash_max = this->module_hash_max();
289 for (unsigned int i = 0; i < hash_max; ++i) {
290 const Identifier& id = m_module_vec[i];
291 const unsigned int idx = moduleHashIdx(id);
292 if (idx >= m_module_hashes.size() || m_module_hashes[idx] < hash_max){
293 ATH_MSG_FATAL("Failed to initialize module hash dict for "<<show_to_string(id)<<" index: "<<idx<<"/"<<m_module_hashes.size());
294 return 1;
295 }
296 m_module_hashes[idx] = i;
297 }
298
299 hash_max = this->detectorElement_hash_max();
300 for (unsigned int i = 0; i < hash_max; ++i) {
301 const Identifier& id = m_detectorElement_vec[i];
302 const unsigned int idx = detEleHashIdx(id);
303 if (idx >= m_detectorElement_hashes.size() || m_detectorElement_hashes[idx] < hash_max){
304 ATH_MSG_FATAL("Failed to initialize detector element hash dict for "<<show_to_string(id));
305 return 1;
306 }
308 }
309 return 0;
310}
311inline unsigned int MdtIdHelper::moduleHashIdx(const Identifier& id) const {
314 constexpr unsigned int C = s_phiDim;
315 constexpr unsigned int BxC = C*s_etaDim;
317 const int stEta = stationEta(id);
318 return stationName(id)*BxC + (stEta + (s_etaDim/2))*C + (stationPhi(id)-1);
319
320}
321inline unsigned int MdtIdHelper::detEleHashIdx(const Identifier& id) const {
322 return moduleHashIdx(id) *s_mlDim + (multilayer(id) -1);
323}
325 const unsigned int idx = moduleHashIdx(id);
326 if (idx >= m_module_hashes.size()) return -1;
327 hash_id = m_module_hashes[idx];
328 return 0;
329}
330
332 const unsigned int idx = detEleHashIdx(id);
333 if (idx >= m_detectorElement_hashes.size()) return -1;
334 hash_id = m_detectorElement_hashes[idx];
335 return 0;
336}
337
339 assert(is_mdt(channelID));
341 m_lay_impl.reset(result);
342 m_tub_impl.reset(result);
343 return result;
344}
345
347 Identifier result{moduleID};
349 return result;
350}
351
353 try {
354 const Identifier result = multilayerID(moduleID, multilayer);
356 return result;
357 } catch (const std::out_of_range&) { isValid = false; }
358 return Identifier{0};
359}
360void MdtIdHelper::idChannels(const Identifier& id, std::vector<Identifier>& vect) const {
361 vect.clear();
362 Identifier parent = parentID(id);
363 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
364 const Range& range = m_full_channel_range[i];
365 ConstRangeIterator rit(range);
366 for (const auto & expId: rit) {
367 Identifier child;
368 get_id(expId, child);
369 if (parentID(child) == parent) vect.push_back(child);
370 }
371 }
372}
373
375
377{
378 return stationEtaMinMax(id).first;
379}
381{
382 return stationEtaMinMax(id).second;
383}
384
386{
387 return stationPhiMinMax(id).first;
388}
390{
391 return stationPhiMinMax(id).second;
392}
393
395{
396 return multilayerMinMax(id).first;
397}
399{
400 return multilayerMinMax(id).second;
401}
402
404{
405 return tubeLayerMinMax(id).first;
406}
408{
409 return tubeLayerMinMax(id).second;
410}
411
413{
414 return tubeMinMax(id).first;
415}
417{
418 return tubeMinMax(id).second;
419}
420
421std::pair<int, int>
423 const size_type field_index,
424 const ranges_by_station_t& ranges_by_station) const {
425 int resultMin = 999;
426 int resultMax = -999;
427 ExpandedIdentifier expId;
428 IdContext eta_context(expId, 0, field_index);
429 if (!get_expanded_id(id, expId, &eta_context)) {
430 unsigned int station = expId[m_NAME_INDEX];
431 for (const Range* range : ranges_by_station.at (station)) {
432 if (range->match(expId)) {
433 const Range::field& field = (*range)[field_index];
434 if (not field.empty()) {
435 resultMin = std::min (resultMin, field.get_minimum());
436 }
437 if (not field.empty()) {
438 resultMax = std::max (resultMax, field.get_maximum());
439 }
440 }
441 }
442 }
443 return std::make_pair (resultMin, resultMax);
444}
445
446
447std::pair<int, int>
451
452std::pair<int, int>
456
457std::tuple<int, int, int, int>
459 int stationEtaMin = 999;
460 int stationEtaMax = -999;
461 int stationPhiMin = 999;
462 int stationPhiMax = -999;
463
464 ExpandedIdentifier expIdEta;
465 ExpandedIdentifier expIdPhi;
466 IdContext contextEta(expIdEta, 0, m_ETA_INDEX);
467 IdContext contextPhi(expIdPhi, 0, m_PHI_INDEX);
468 if (!get_expanded_id(id, expIdEta, &contextEta) &&
469 !get_expanded_id(id, expIdPhi, &contextPhi)) {
470 unsigned int station = expIdEta[m_NAME_INDEX];
471 for (const Range* range : m_module_ranges_by_station.at (station)) {
472 if (range->match(expIdEta)) {
473 const Range::field& eta_field = (*range)[m_ETA_INDEX];
474 if (not eta_field.empty()) {
475 stationEtaMin = std::min (stationEtaMin,
476 eta_field.get_minimum());
477 }
478 if (not eta_field.empty()) {
479 stationEtaMax = std::max (stationEtaMax,
480 eta_field.get_maximum());
481 }
482
483 if (range->match(expIdPhi)) {
484 const Range::field& phi_field = (*range)[m_PHI_INDEX];
485 if (not phi_field.empty()) {
486 stationPhiMin = std::min (stationPhiMin,
487 phi_field.get_minimum());
488 }
489 if (not phi_field.empty()) {
490 stationPhiMax = std::max (stationPhiMax,
491 phi_field.get_maximum());
492 }
493 }
494 }
495 }
496 }
497 return std::make_tuple (stationEtaMin, stationEtaMax,
499}
500
502 int result = -999;
503 ExpandedIdentifier expId;
504 IdContext context = technology_context();
505 if (!get_expanded_id(id, expId, &context)) {
506 unsigned int station = expId[m_NAME_INDEX];
507 for (const Range* range : m_channel_ranges_by_station.at (station)) {
508 if (range->match(expId)) {
509 const Range::field& multilayer_field = (*range)[m_DETECTORELEMENT_INDEX];
510 if (not multilayer_field.empty()) {
511 result = std::max (result, multilayer_field.get_maximum());
512 }
513 }
514 }
515 }
516 return result;
517}
518
519std::pair<int, int>
523
524std::pair<int, int>
528
529std::pair<int, int>
533
535
536bool MdtIdHelper::valid(const Identifier& id) const {
537 if (!validElement(id)) return false;
538
539 int mlayer = multilayer(id);
541 if (mlayer < multilayerMin || mlayer > multilayerMax) {
542 ATH_MSG_DEBUG("Invalid multilayer=" << mlayer << " multilayerMin=" << multilayerMin << " multilayerMax=" << multilayerMax);
543 return false;
544 }
545
546 int layer = tubeLayer(id);
548 if (layer < tubeLayerMin || layer > tubeLayerMax) {
549 ATH_MSG_DEBUG("Invalid tubeLayer=" << layer << " tubeLayerMin=" << tubeLayerMin << " tubeLayerMax=" << tubeLayerMax);
550 return false;
551 }
552
553 int tb = tube(id);
554 auto [tubeMin, tubeMax ] = tubeMinMax (id);
555 if (tb < tubeMin || tb > tubeMax) {
556 ATH_MSG_DEBUG("Invalid tube=" << tb << " tubeMin=" << tubeMin << " tubeMax=" << tubeMax);
557 return false;
558 }
559 return true;
560}
561bool MdtIdHelper::isStNameInTech(const std::string& name) const { return 'B' == name[0] || 'E' == name[0]; }
563 int station = stationName(id);
564 if (!validStation(station)) {
565 ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(station));
566 return false;
567 }
568
571 int eta = stationEta(id);
573 ATH_MSG_DEBUG("Invalid stationEta=" << eta << " for stationName=" << stationNameString(station)
574 << " stationEtaMin=" << stationEtaMin << " stationEtaMax=" << stationEtaMax);
575 return false;
576 }
577
578 int phi = stationPhi(id);
580 ATH_MSG_DEBUG("Invalid stationPhi=" << phi << " for stationName=" << stationNameString(station)
581 << " stationPhiMin=" << stationPhiMin << " stationPhiMax=" << stationPhiMax);
582 return false;
583 }
584 return true;
585}
586
588
591 ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(stationName));
592 return false;
593 }
594
598 ATH_MSG_DEBUG("Invalid stationEta=" << stationEta << " for stationName=" << stationNameString(stationName)
599 << " stationEtaMin=" << stationEtaMin << " stationEtaMax=" << stationEtaMax);
600 return false;
601 }
602
604 ATH_MSG_DEBUG("Invalid stationPhi=" << stationPhi << " for stationName=" << stationNameString(stationName)
605 << " stationPhiMin=" << stationPhiMin << " stationPhiMax=" << stationPhiMax);
606 return false;
607 }
608 return true;
609}
610
612 int tube) const {
613 if (!validElement(id, stationName, stationEta, stationPhi)) return false;
614
617 ATH_MSG_DEBUG("Invalid multilayer=" << multilayer << " multilayerMin=" << multilayerMin
618 << " multilayerMax=" << multilayerMax);
619 return false;
620 }
621
624 ATH_MSG_DEBUG("Invalid tubeLayer=" << tubeLayer << " tubeLayerMin=" << tubeLayerMin << " tubeLayerMax=" << tubeLayerMax);
625 return false;
626 }
627 auto [tubeMin, tubeMax ] = tubeMinMax (id);
629 ATH_MSG_DEBUG("Invalid tube=" << tube << " tubeMin=" << tubeMin << " tubeMax=" << tubeMax);
630 return false;
631 }
632 return true;
633}
634
636 if (stationName < 0) { return Identifier{-1}; }
637 // pack fields independently
638 Identifier result((Identifier::value_type)0);
644 return result;
645}
647 try {
650 return result;
651 } catch (const std::out_of_range&) { isValid = false; }
652 return Identifier{0};
653}
654
655Identifier MdtIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const {
656 return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi);
657}
658Identifier MdtIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const {
659 return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi, isValid);
660}
661
662Identifier MdtIdHelper::elementID(const Identifier& id) const { return parentID(id); }
663
665 if (stationName < 0) { return Identifier{-1}; }
666
667 // pack fields independently
668 Identifier result((Identifier::value_type)0);
676 m_tub_impl.pack(tube, result);
677 return result;
678}
680 bool& isValid) const {
681 try{
684 return result;
685 } catch (const std::out_of_range&) { isValid = false; }
686 return Identifier{0};
687}
688
689Identifier MdtIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int tubeLayer,
690 int tube) const {
692}
693Identifier MdtIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int tubeLayer,
694 int tube, bool& isValid) const {
696}
697
706 try {
709 return result;
710 } catch (const std::out_of_range&) { isValid = false; }
711 return Identifier{0};
712}
713
715
717 assert(is_mdt(id));
718 Identifier result(id);
719 m_mla_impl.reset(result);
720 m_lay_impl.reset(result);
721 m_tub_impl.reset(result);
722 return result;
723}
724
726
727int MdtIdHelper::multilayer(const Identifier& id) const { return m_mla_impl.unpack(id); }
728
729int MdtIdHelper::tubeLayer(const Identifier& id) const { return m_lay_impl.unpack(id); }
730
731int MdtIdHelper::tube(const Identifier& id) const { return m_tub_impl.unpack(id); }
732
733int MdtIdHelper::gasGap(const Identifier& id) const { return tubeLayer(id); }
734
735bool MdtIdHelper::measuresPhi(const Identifier& /*id*/) const { return false; }
736
737bool MdtIdHelper::isBME(const Identifier& id) const { return m_BME_stat == stationName(id); }
738
739bool MdtIdHelper::isBMG(const Identifier& id) const { return m_BMG_stat == stationName(id); }
740
741int MdtIdHelper::channel(const Identifier& id) const { return tube(id); }
742
744
746 if (barrel) {
747 return StationEtaBarrelMin;
748 } else {
749 return StationEtaEndcapMin;
750 }
751}
752
754 if (barrel) {
755 return StationEtaBarrelMax;
756 } else {
757 return StationEtaEndcapMax;
758 }
759}
760
762
764
766
768
770
772
774
775int MdtIdHelper::tubeMax() const { return m_tubesMax; }
777
779 int mdtField = technologyIndex("MDT");
780 if (m_dict) { mdtField = mdt_field_value(); }
781 return mdtField;
782}
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
#define max(a, b)
Definition cfImp.cxx:41
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 mdt_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.
Identifier multilayerID(const Identifier &channeldID) const
std::pair< int, int > tubeLayerMinMax(const Identifier &id) const
static int stationPhiMin()
static int stationEtaMax(bool barrel)
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
ranges_by_station_t m_module_ranges_by_station
unsigned int detEleHashIdx(const Identifier &id) const
std::array< unsigned int, s_detDim > m_detectorElement_hashes
int multilayer(const Identifier &id) const
Access to components of the ID.
Identifier parentID(const Identifier &id) const
get parent id from channel id
Identifier elementID(int stationName, int stationEta, int stationPhi) const
bool validElement(const Identifier &id) const
std::tuple< int, int, int, int > stationEtaPhiMinMax(const Identifier &id) const
static int stationPhiMax()
std::pair< int, int > tubeMinMax(const Identifier &id) const
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
bool isBME(const Identifier &id) const
is this a BME chamber
static int multilayerMin()
bool valid(const Identifier &id) const
Public validation of levels.
std::pair< int, int > stationPhiMinMax(const Identifier &id) const
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
bool isStNameInTech(const std::string &stationName) const override
The valid element checks converted the identifier to a stationName string in order to assess whether ...
ranges_by_station_t m_channel_ranges_by_station
int mdtTechnology() const
Utility methods.
int tube(const Identifier &id) const
static constexpr unsigned s_mlDim
std::pair< int, int > stationEtaMinMax(const Identifier &id) const
int init_id_to_hashes()
IdDictFieldImplementation m_lay_impl
static int tubeLayerMax()
static constexpr unsigned s_etaDim
int tubeLayer(const Identifier &id) const
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
IdDictFieldImplementation m_tub_impl
static int stationEtaMin(bool barrel)
Access to min and max of level ranges.
int channel(const Identifier &id) const override
unsigned int moduleHashIdx(const Identifier &id) const
std::array< unsigned int, s_modHash > m_module_hashes
std::pair< int, int > multilayerMinMax(const Identifier &id) const
unsigned int m_tubesMax
static constexpr unsigned s_phiDim
std::pair< int, int > findMinMax(const Identifier &id, const size_type field_index, const ranges_by_station_t &ranges_by_station) const
static int multilayerMax()
size_type m_TUBELAYER_INDEX
int numberOfMultilayers(const Identifier &id) const
IdDictFieldImplementation m_mla_impl
int tubeMax() const
bool isBMG(const Identifier &id) const
is this a BMG chamber
static int tubeLayerMin()
bool measuresPhi(const Identifier &id) const override
always false for MDTs
int gasGap(const Identifier &id) const override
the gas-gap function for the MDT's returns the tube layer
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
static int tubeMin()
std::vector< std::vector< const Range * > > ranges_by_station_t
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
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
size_type m_NAME_INDEX
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 nStationNames() const
IdContext technology_context() const
access to IdContext's which define which levels or fields are contained in the Muon id
int stationPhi(const Identifier &id) const
size_type m_DETECTORELEMENT_INDEX
int stationName(const Identifier &id) const
int initLevelsFromDict()
id_vec m_detectorElement_vec
virtual int init_detectorElement_hashes()
bool is_mdt(const Identifier &id) const
size_type detectorElement_hash_max() const
IdDictFieldImplementation m_muon_impl
void resetAndSet(const IdDictFieldImplementation &dict, const int new_val, Identifier &id) const
bool validStation(int stationName, int technology) const
Identifier::size_type size_type
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.
int r
Definition globals.cxx:22
struct color C