ATLAS Offline Software
Loading...
Searching...
No Matches
MdtIdHelper.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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 return 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 return 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 return 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: " << "\n muon " << m_muon_impl
90 << "\n station " << m_sta_impl
91 << "\n eta " << m_eta_impl
92 << "\n phi " << m_phi_impl
93 << "\n technology " << m_tec_impl
94 << "\n multilayer " << m_mla_impl
95 << "\n layer " << m_lay_impl
96 << "\n tube " << m_tub_impl <<"\n");
97
101
103
104 int muonField = -1;
105 const IdDictDictionary* atlasDict = dict_mgr.find_dictionary("ATLAS");
106 if (atlasDict->get_label_value("subdet", "MuonSpectrometer", muonField)) {
107 ATH_MSG_ERROR("Could not get value for label 'MuonSpectrometer' of field "
108 << "'subdet' in dictionary " << atlasDict->name());
109 return 1;
110 }
111
112 // Build MultiRange down to "technology" for all (muon) regions
113
114 ExpandedIdentifier region_id;
115 region_id.add(muonField);
116 Range prefix;
117 MultiRange muon_range = m_dict->build_multirange(region_id, prefix, "technology");
118 if (muon_range.size() > 0) {
119 ATH_MSG_INFO("MultiRange built successfully to Technology: "
120 << "MultiRange size is " << muon_range.size());
121 } else {
122 ATH_MSG_ERROR("Muon MultiRange is empty");
123 }
124
125 // Build MultiRange down to "detector element" for all mdt regions
126
127 ExpandedIdentifier detectorElement_region;
128 detectorElement_region.add(muonField);
129 Range detectorElement_prefix;
130 MultiRange muon_detectorElement_range = m_dict->build_multirange(detectorElement_region, detectorElement_prefix, "multiLayer");
131 if (muon_detectorElement_range.size() > 0) {
132 ATH_MSG_INFO("MultiRange built successfully to detector element: "
133 << "Multilayer MultiRange size is " << muon_detectorElement_range.size());
134 } else {
135 ATH_MSG_ERROR("Muon MDT detector element MultiRange is empty");
136 }
137
138 // Build MultiRange down to "tube" for all mdt regions
139
140 ExpandedIdentifier mdt_region;
141 mdt_region.add(muonField);
142 Range mdt_prefix;
143 MultiRange muon_channel_range = m_dict->build_multirange(mdt_region, mdt_prefix, "tube");
144 if (muon_channel_range.size() > 0) {
145 ATH_MSG_INFO("MultiRange built successfully to tube: "
146 << "MultiRange size is " << muon_channel_range.size());
147 } else {
148 ATH_MSG_ERROR("Muon MDT channel MultiRange is empty");
149 }
150
157
158 int mdtField = -1;
159 status = m_dict->get_label_value("technology", "MDT", mdtField);
160
161 for (int i = 0; i < (int)muon_range.size(); ++i) {
162 const Range& range = muon_range[i];
163 if (range.fields() > m_TECHNOLOGY_INDEX) {
164 const Range::field& field = range[m_TECHNOLOGY_INDEX];
165 if (field.match((ExpandedIdentifier::element_type)mdtField)) {
166 m_full_module_range.add(range);
167 ATH_MSG_DEBUG("module field size is " << (int)range.cardinality() << " field index = " << i);
168 }
169 }
170 }
171
172 for (int j = 0; j < (int)muon_detectorElement_range.size(); ++j) {
173 const Range& range = muon_detectorElement_range[j];
174 if (range.fields() > m_TECHNOLOGY_INDEX) {
175 const Range::field& field = range[m_TECHNOLOGY_INDEX];
176 if (field.match((ExpandedIdentifier::element_type)mdtField)) {
178 ATH_MSG_DEBUG("detector element field size is " << (int)range.cardinality() << " field index = " << j);
179 }
180 }
181 }
182
183 for (int k = 0; k < (int)muon_channel_range.size(); ++k) {
184 const Range& range = muon_channel_range[k];
185 if (range.fields() > m_TECHNOLOGY_INDEX) {
186 const Range::field& field = range[m_TECHNOLOGY_INDEX];
187 if (field.match((ExpandedIdentifier::element_type)mdtField)) {
188 m_full_channel_range.add(range);
189 ATH_MSG_DEBUG("channel field size is " << (int)range.cardinality() << " field index = " << k);
190 }
191 }
192 }
193
195
196 if (m_full_module_range.size() == 0) {
197 ATH_MSG_ERROR("MDT MultiRange ID is empty for modules");
198 return 1;
199 }
200
202
203 if (m_full_detectorElement_range.size() == 0) {
204 ATH_MSG_ERROR("MDT MultiRange ID is empty for detector elements");
205 return 1;
206 }
207
209
210 if (m_full_channel_range.size() == 0) {
211 ATH_MSG_ERROR("MDT MultiRange ID is empty for channels");
212 return 1;
213 }
214
215 // To speed up the range scans needed by the MinMax functions,
216 // keep indices of ranges by station name.
217
219 for (const Range& r : m_full_module_range) {
220 const Range::field& station_f = r[m_NAME_INDEX];
221 assert (not station_f.empty() &&
222 station_f.get_minimum() == station_f.get_maximum());
223 unsigned int station = station_f.get_minimum();
224 if (station >= m_module_ranges_by_station.size()) {
225 m_module_ranges_by_station.resize (station+1);
226 }
227 m_module_ranges_by_station[station].push_back (&r);
228 }
229
231 for (const Range& r : m_full_channel_range) {
232 const Range::field& station_f = r[m_NAME_INDEX];
233 assert (not station_f.empty() &&
234 station_f.get_minimum() == station_f.get_maximum());
235 unsigned int station = station_f.get_minimum();
236 if (station >= m_channel_ranges_by_station.size()) {
237 m_channel_ranges_by_station.resize (station+1);
238 }
239 m_channel_ranges_by_station[station].push_back (&r);
240 }
241
242 // Setup the hash tables for MDT
243
244 ATH_MSG_INFO("Initializing MDT hash indices ... ");
245 status = init_hashes();
247 status = init_id_to_hashes();
248
249 // Setup hash tables for finding neighbors
250
251 ATH_MSG_INFO("Initializing MDT hash indices for finding neighbors ... ");
252 status = init_neighbors();
253
254 // retrieve the maximum number of tubes in any chamber
255 ExpandedIdentifier expId;
257 for (const auto& id : m_detectorElement_vec) {
258 if (!get_expanded_id(id, expId, &channel_context)) {
259 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
260 const Range& range = m_full_channel_range[i];
261 if (range.match(expId)) {
262 const Range::field& channel_field = range[m_CHANNEL_INDEX];
263 if (not channel_field.empty()) {
264 unsigned int max = channel_field.get_maximum();
265 if (m_tubesMax == UINT_MAX)
266 m_tubesMax = max;
267 else if (max > m_tubesMax)
268 m_tubesMax = max;
269 }
270 }
271 }
272 }
273 }
274 if (m_tubesMax == UINT_MAX) {
275 ATH_MSG_ERROR("No maximum number of MDT tubes was retrieved");
276 status = 1;
277 } else {
278 ATH_MSG_DEBUG(" Maximum number of MDT tubes is " << m_tubesMax);
279 }
280 m_init = true;
283 return status;
284}
285
287 unsigned int hash_max = this->module_hash_max();
288 for (unsigned int i = 0; i < hash_max; ++i) {
289 const Identifier& id = m_module_vec[i];
290 const unsigned int idx = moduleHashIdx(id);
291 if (idx >= m_module_hashes.size() || m_module_hashes[idx] < hash_max){
292 ATH_MSG_FATAL("Failed to initialize module hash dict for "<<show_to_string(id)<<" index: "<<idx<<"/"<<m_module_hashes.size());
293 return 1;
294 }
295 m_module_hashes[idx] = i;
296 }
297
298 hash_max = this->detectorElement_hash_max();
299 for (unsigned int i = 0; i < hash_max; ++i) {
300 const Identifier& id = m_detectorElement_vec[i];
301 const unsigned int idx = detEleHashIdx(id);
302 if (idx >= m_detectorElement_hashes.size() || m_detectorElement_hashes[idx] < hash_max){
303 ATH_MSG_FATAL("Failed to initialize detector element hash dict for "<<show_to_string(id));
304 return 1;
305 }
307 }
308 return 0;
309}
310inline unsigned int MdtIdHelper::moduleHashIdx(const Identifier& id) const {
313 constexpr unsigned int C = s_phiDim;
314 constexpr unsigned int BxC = C*s_etaDim;
316 const int stEta = stationEta(id);
317 return stationName(id)*BxC + (stEta + (s_etaDim/2))*C + (stationPhi(id)-1);
318
319}
320inline unsigned int MdtIdHelper::detEleHashIdx(const Identifier& id) const {
321 return moduleHashIdx(id) *s_mlDim + (multilayer(id) -1);
322}
324 const unsigned int idx = moduleHashIdx(id);
325 if (idx >= m_module_hashes.size()) return -1;
326 hash_id = m_module_hashes[idx];
327 return 0;
328}
329
331 const unsigned int idx = detEleHashIdx(id);
332 if (idx >= m_detectorElement_hashes.size()) return -1;
333 hash_id = m_detectorElement_hashes[idx];
334 return 0;
335}
336
338 assert(is_mdt(channelID));
339 Identifier result(channelID);
340 m_lay_impl.reset(result);
341 m_tub_impl.reset(result);
342 return result;
343}
344
346 Identifier result{moduleID};
348 return result;
349}
350
352 try {
353 const Identifier result = multilayerID(moduleID, multilayer);
354 isValid = validElement(result);
355 return result;
356 } catch (const std::out_of_range&) { isValid = false; }
357 return Identifier{0};
358}
359void MdtIdHelper::idChannels(const Identifier& id, std::vector<Identifier>& vect) const {
360 vect.clear();
361 Identifier parent = parentID(id);
362 for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
363 const Range& range = m_full_channel_range[i];
364 ConstRangeIterator rit(range);
365 for (const auto & expId: rit) {
366 Identifier child;
367 get_id(expId, child);
368 if (parentID(child) == parent) vect.push_back(child);
369 }
370 }
371}
372
374
376{
377 return stationEtaMinMax(id).first;
378}
380{
381 return stationEtaMinMax(id).second;
382}
383
385{
386 return stationPhiMinMax(id).first;
387}
389{
390 return stationPhiMinMax(id).second;
391}
392
394{
395 return multilayerMinMax(id).first;
396}
398{
399 return multilayerMinMax(id).second;
400}
401
403{
404 return tubeLayerMinMax(id).first;
405}
407{
408 return tubeLayerMinMax(id).second;
409}
410
412{
413 return tubeMinMax(id).first;
414}
416{
417 return tubeMinMax(id).second;
418}
419
420std::pair<int, int>
422 const size_type field_index,
423 const ranges_by_station_t& ranges_by_station) const {
424 int resultMin = 999;
425 int resultMax = -999;
426 ExpandedIdentifier expId;
427 IdContext eta_context(expId, 0, field_index);
428 if (!get_expanded_id(id, expId, &eta_context)) {
429 unsigned int station = expId[m_NAME_INDEX];
430 for (const Range* range : ranges_by_station.at (station)) {
431 if (range->match(expId)) {
432 const Range::field& field = (*range)[field_index];
433 if (not field.empty()) {
434 resultMin = std::min (resultMin, field.get_minimum());
435 }
436 if (not field.empty()) {
437 resultMax = std::max (resultMax, field.get_maximum());
438 }
439 }
440 }
441 }
442 return std::make_pair (resultMin, resultMax);
443}
444
445
446std::pair<int, int>
450
451std::pair<int, int>
455
456std::tuple<int, int, int, int>
458 int stationEtaMin = 999;
459 int stationEtaMax = -999;
460 int stationPhiMin = 999;
461 int stationPhiMax = -999;
462
463 ExpandedIdentifier expIdEta;
464 ExpandedIdentifier expIdPhi;
465 IdContext contextEta(expIdEta, 0, m_ETA_INDEX);
466 IdContext contextPhi(expIdPhi, 0, m_PHI_INDEX);
467 if (!get_expanded_id(id, expIdEta, &contextEta) &&
468 !get_expanded_id(id, expIdPhi, &contextPhi)) {
469 unsigned int station = expIdEta[m_NAME_INDEX];
470 for (const Range* range : m_module_ranges_by_station.at (station)) {
471 if (range->match(expIdEta)) {
472 const Range::field& eta_field = (*range)[m_ETA_INDEX];
473 if (not eta_field.empty()) {
474 stationEtaMin = std::min (stationEtaMin,
475 eta_field.get_minimum());
476 }
477 if (not eta_field.empty()) {
478 stationEtaMax = std::max (stationEtaMax,
479 eta_field.get_maximum());
480 }
481
482 if (range->match(expIdPhi)) {
483 const Range::field& phi_field = (*range)[m_PHI_INDEX];
484 if (not phi_field.empty()) {
485 stationPhiMin = std::min (stationPhiMin,
486 phi_field.get_minimum());
487 }
488 if (not phi_field.empty()) {
489 stationPhiMax = std::max (stationPhiMax,
490 phi_field.get_maximum());
491 }
492 }
493 }
494 }
495 }
496 return std::make_tuple (stationEtaMin, stationEtaMax,
498}
499
501 int result = -999;
502 ExpandedIdentifier expId;
503 IdContext context = technology_context();
504 if (!get_expanded_id(id, expId, &context)) {
505 unsigned int station = expId[m_NAME_INDEX];
506 for (const Range* range : m_channel_ranges_by_station.at (station)) {
507 if (range->match(expId)) {
508 const Range::field& multilayer_field = (*range)[m_DETECTORELEMENT_INDEX];
509 if (not multilayer_field.empty()) {
510 result = std::max (result, multilayer_field.get_maximum());
511 }
512 }
513 }
514 }
515 return result;
516}
517
518std::pair<int, int>
522
523std::pair<int, int>
527
528std::pair<int, int>
532
534
535bool MdtIdHelper::valid(const Identifier& id) const {
536 if (!validElement(id)) return false;
537
538 int mlayer = multilayer(id);
540 if (mlayer < multilayerMin || mlayer > multilayerMax) {
541 ATH_MSG_DEBUG("Invalid multilayer=" << mlayer << " multilayerMin=" << multilayerMin << " multilayerMax=" << multilayerMax);
542 return false;
543 }
544
545 int layer = tubeLayer(id);
547 if (layer < tubeLayerMin || layer > tubeLayerMax) {
548 ATH_MSG_DEBUG("Invalid tubeLayer=" << layer << " tubeLayerMin=" << tubeLayerMin << " tubeLayerMax=" << tubeLayerMax);
549 return false;
550 }
551
552 int tb = tube(id);
553 auto [tubeMin, tubeMax ] = tubeMinMax (id);
554 if (tb < tubeMin || tb > tubeMax) {
555 ATH_MSG_DEBUG("Invalid tube=" << tb << " tubeMin=" << tubeMin << " tubeMax=" << tubeMax);
556 return false;
557 }
558 return true;
559}
560bool MdtIdHelper::isStNameInTech(const std::string& name) const { return 'B' == name[0] || 'E' == name[0]; }
562 int station = stationName(id);
563 if (!validStation(station)) {
564 ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(station));
565 return false;
566 }
567
570 int eta = stationEta(id);
572 ATH_MSG_DEBUG("Invalid stationEta=" << eta << " for stationName=" << stationNameString(station)
573 << " stationEtaMin=" << stationEtaMin << " stationEtaMax=" << stationEtaMax);
574 return false;
575 }
576
577 int phi = stationPhi(id);
579 ATH_MSG_DEBUG("Invalid stationPhi=" << phi << " for stationName=" << stationNameString(station)
580 << " stationPhiMin=" << stationPhiMin << " stationPhiMax=" << stationPhiMax);
581 return false;
582 }
583 return true;
584}
585
587
590 ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(stationName));
591 return false;
592 }
593
597 ATH_MSG_DEBUG("Invalid stationEta=" << stationEta << " for stationName=" << stationNameString(stationName)
598 << " stationEtaMin=" << stationEtaMin << " stationEtaMax=" << stationEtaMax);
599 return false;
600 }
601
603 ATH_MSG_DEBUG("Invalid stationPhi=" << stationPhi << " for stationName=" << stationNameString(stationName)
604 << " stationPhiMin=" << stationPhiMin << " stationPhiMax=" << stationPhiMax);
605 return false;
606 }
607 return true;
608}
609
611 int tube) const {
612 if (!validElement(id, stationName, stationEta, stationPhi)) return false;
613
616 ATH_MSG_DEBUG("Invalid multilayer=" << multilayer << " multilayerMin=" << multilayerMin
617 << " multilayerMax=" << multilayerMax);
618 return false;
619 }
620
623 ATH_MSG_DEBUG("Invalid tubeLayer=" << tubeLayer << " tubeLayerMin=" << tubeLayerMin << " tubeLayerMax=" << tubeLayerMax);
624 return false;
625 }
626 auto [tubeMin, tubeMax ] = tubeMinMax (id);
628 ATH_MSG_DEBUG("Invalid tube=" << tube << " tubeMin=" << tubeMin << " tubeMax=" << tubeMax);
629 return false;
630 }
631 return true;
632}
633
635 if (stationName < 0) { return Identifier{-1}; }
636 // pack fields independently
637 Identifier result((Identifier::value_type)0);
638 m_muon_impl.pack(muon_field_value(), result);
639 m_sta_impl.pack(stationName, result);
640 m_eta_impl.pack(stationEta, result);
641 m_phi_impl.pack(stationPhi, result);
642 m_tec_impl.pack(mdt_field_value(), result);
643 return result;
644}
646 try {
649 return result;
650 } catch (const std::out_of_range&) { isValid = false; }
651 return Identifier{0};
652}
653
654Identifier MdtIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const {
655 return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi);
656}
657Identifier MdtIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const {
658 return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi, isValid);
659}
660
661Identifier MdtIdHelper::elementID(const Identifier& id) const { return parentID(id); }
662
664 if (stationName < 0) { return Identifier{-1}; }
665
666 // pack fields independently
667 Identifier result((Identifier::value_type)0);
668 m_muon_impl.pack(muon_field_value(), result);
669 m_sta_impl.pack(stationName, result);
670 m_eta_impl.pack(stationEta, result);
671 m_phi_impl.pack(stationPhi, result);
672 m_tec_impl.pack(mdt_field_value(), result);
673 m_mla_impl.pack(multilayer, result);
674 m_lay_impl.pack(tubeLayer, result);
675 m_tub_impl.pack(tube, result);
676 return result;
677}
679 bool& isValid) const {
680 try{
683 return result;
684 } catch (const std::out_of_range&) { isValid = false; }
685 return Identifier{0};
686}
687
688Identifier MdtIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int tubeLayer,
689 int tube) const {
691}
692Identifier MdtIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int tubeLayer,
693 int tube, bool& isValid) const {
695}
696
698 Identifier result(id);
701 resetAndSet(m_tub_impl, tube, result);
702 return result;
703}
705 try {
706 const Identifier result = channelID(id, multilayer, tubeLayer, tube);
707 isValid = valid(result);
708 return result;
709 } catch (const std::out_of_range&) { isValid = false; }
710 return Identifier{0};
711}
712
714
716 assert(is_mdt(id));
717 Identifier result(id);
718 m_mla_impl.reset(result);
719 m_lay_impl.reset(result);
720 m_tub_impl.reset(result);
721 return result;
722}
723
725
726int MdtIdHelper::multilayer(const Identifier& id) const { return m_mla_impl.unpack(id); }
727
728int MdtIdHelper::tubeLayer(const Identifier& id) const { return m_lay_impl.unpack(id); }
729
730int MdtIdHelper::tube(const Identifier& id) const { return m_tub_impl.unpack(id); }
731
732int MdtIdHelper::gasGap(const Identifier& id) const { return tubeLayer(id); }
733
734bool MdtIdHelper::measuresPhi(const Identifier& /*id*/) const { return false; }
735
736bool MdtIdHelper::isBME(const Identifier& id) const { return m_BME_stat == stationName(id); }
737
738bool MdtIdHelper::isBMG(const Identifier& id) const { return m_BMG_stat == stationName(id); }
739
740int MdtIdHelper::channel(const Identifier& id) const { return tube(id); }
741
743
745 if (barrel) {
746 return StationEtaBarrelMin;
747 } else {
748 return StationEtaEndcapMin;
749 }
750}
751
753 if (barrel) {
754 return StationEtaBarrelMax;
755 } else {
756 return StationEtaEndcapMax;
757 }
758}
759
761
763
765
767
769
771
773
774int MdtIdHelper::tubeMax() const { return m_tubesMax; }
776
778 int mdtField = technologyIndex("MDT");
779 if (m_dict) { mdtField = mdt_field_value(); }
780 return mdtField;
781}
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.
bool is_mdt(Identifier id) const
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)
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
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()
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
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