ATLAS Offline Software
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 
7 #include "IdDict/IdDictField.h"
8 #include "IdDict/IdDictGroup.h"
9 #include "IdDict/IdDictMgr.h"
10 #include "IdDict/IdDictRegion.h"
12 
13 MdtIdHelper::MdtIdHelper() : MuonIdHelper("MdtIdHelper", "mdt") {
14  //m_detectorElement_hashes
15  m_module_hashes.fill(-1);
16  m_detectorElement_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  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  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->regions()[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 
103 
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 
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 
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) {
166  if (field.match((ExpandedIdentifier::element_type)mdtField)) {
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) {
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) {
188  if (field.match((ExpandedIdentifier::element_type)mdtField)) {
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();
249 
250  // Setup hash tables for finding neighbors
251 
252  ATH_MSG_INFO("Initializing MDT hash indices for finding 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;
282  m_BME_stat = stationNameIndex("BME");
283  m_BMG_stat = stationNameIndex("BMG");
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 }
311 inline 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 }
321 inline 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));
343  return result;
344 }
345 
346 Identifier MdtIdHelper::multilayerID(const Identifier& moduleID, int multilayer) const {
347  Identifier result{moduleID};
349  return result;
350 }
351 
352 Identifier MdtIdHelper::multilayerID(const Identifier& moduleID, int multilayer, bool& isValid) const {
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 }
360 void 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];
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 
412 int MdtIdHelper::tubeMin(const Identifier& id) const
413 {
414  return tubeMinMax(id).first;
415 }
416 int MdtIdHelper::tubeMax(const Identifier& id) const
417 {
418  return tubeMinMax(id).second;
419 }
420 
421 std::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 
447 std::pair<int, int>
450 }
451 
452 std::pair<int, int>
455 }
456 
457 std::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()) {
476  eta_field.get_minimum());
477  }
478  if (not eta_field.empty()) {
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()) {
487  phi_field.get_minimum());
488  }
489  if (not phi_field.empty()) {
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 
519 std::pair<int, int>
522 }
523 
524 std::pair<int, int>
527 }
528 
529 std::pair<int, int>
532 }
533 
535 
536 bool 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 }
561 bool MdtIdHelper::isStNameInTech(const std::string& name) const { return 'B' == name[0] || 'E' == name[0]; }
562 bool MdtIdHelper::validElement(const Identifier& id) const {
563  int station = stationName(id);
564  if (!validStation(station)) {
565  ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(station));
566  return false;
567  }
568 
570  stationEtaPhiMinMax (id);
571  int eta = stationEta(id);
572  if (eta < stationEtaMin || eta > stationEtaMax) {
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);
579  if (phi < stationPhiMin || phi > stationPhiMax) {
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 
590  if (!validStation(stationName)) {
591  ATH_MSG_DEBUG("Invalid stationName=" << stationNameString(stationName));
592  return false;
593  }
594 
596  stationEtaPhiMinMax (id);
597  if (stationEta < stationEtaMin || stationEta > stationEtaMax) {
598  ATH_MSG_DEBUG("Invalid stationEta=" << stationEta << " for stationName=" << stationNameString(stationName)
599  << " stationEtaMin=" << stationEtaMin << " stationEtaMax=" << stationEtaMax);
600  return false;
601  }
602 
603  if (stationPhi < stationPhiMin || stationPhi > stationPhiMax) {
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 
611 bool MdtIdHelper::validChannel(const Identifier& id, int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer,
612  int tube) const {
613  if (!validElement(id, stationName, stationEta, stationPhi)) return false;
614 
616  if (multilayer < multilayerMin || multilayer > multilayerMax) {
617  ATH_MSG_DEBUG("Invalid multilayer=" << multilayer << " multilayerMin=" << multilayerMin
618  << " multilayerMax=" << multilayerMax);
619  return false;
620  }
621 
623  if (tubeLayer < tubeLayerMin || tubeLayer > tubeLayerMax) {
624  ATH_MSG_DEBUG("Invalid tubeLayer=" << tubeLayer << " tubeLayerMin=" << tubeLayerMin << " tubeLayerMax=" << tubeLayerMax);
625  return false;
626  }
627  auto [tubeMin, tubeMax ] = tubeMinMax (id);
628  if (tube < tubeMin || tube > tubeMax) {
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
644  return result;
645 }
647  try {
650  return result;
651  } catch (const std::out_of_range&) { isValid = false; }
652  return Identifier{0};
653 }
654 
655 Identifier MdtIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi) const {
656  return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi);
657 }
658 Identifier MdtIdHelper::elementID(const std::string& stationNameStr, int stationEta, int stationPhi, bool& isValid) const {
659  return elementID(stationNameIndex(stationNameStr), stationEta, stationPhi, isValid);
660 }
661 
662 Identifier MdtIdHelper::elementID(const Identifier& id) const { return parentID(id); }
663 
664 Identifier MdtIdHelper::channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const {
665  if (stationName < 0) { return Identifier{-1}; }
666 
667  // pack fields independently
677  return result;
678 }
679 Identifier MdtIdHelper::channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube,
680  bool& isValid) const {
681  try{
684  return result;
685  } catch (const std::out_of_range&) { isValid = false; }
686  return Identifier{0};
687 }
688 
689 Identifier MdtIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int tubeLayer,
690  int tube) const {
692 }
693 Identifier MdtIdHelper::channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int multilayer, int tubeLayer,
694  int tube, bool& isValid) const {
696 }
697 
698 Identifier MdtIdHelper::channelID(const Identifier& id, int multilayer, int tubeLayer, int tube) const {
699  Identifier result(id);
703  return result;
704 }
705 Identifier MdtIdHelper::channelID(const Identifier& id, int multilayer, int tubeLayer, int tube, bool& isValid) const {
706  try {
708  isValid = valid(result);
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);
722  return result;
723 }
724 
726 
727 int MdtIdHelper::multilayer(const Identifier& id) const { return m_mla_impl.unpack(id); }
728 
729 int MdtIdHelper::tubeLayer(const Identifier& id) const { return m_lay_impl.unpack(id); }
730 
731 int MdtIdHelper::tube(const Identifier& id) const { return m_tub_impl.unpack(id); }
732 
733 int MdtIdHelper::gasGap(const Identifier& id) const { return tubeLayer(id); }
734 
735 bool MdtIdHelper::measuresPhi(const Identifier& /*id*/) const { return false; }
736 
737 bool MdtIdHelper::isBME(const Identifier& id) const { return m_BME_stat == stationName(id); }
738 
739 bool MdtIdHelper::isBMG(const Identifier& id) const { return m_BMG_stat == stationName(id); }
740 
741 int MdtIdHelper::channel(const Identifier& id) const { return tube(id); }
742 
744 
745 int MdtIdHelper::stationEtaMin(bool barrel) {
746  if (barrel) {
747  return StationEtaBarrelMin;
748  } else {
749  return StationEtaEndcapMin;
750  }
751 }
752 
753 int MdtIdHelper::stationEtaMax(bool barrel) {
754  if (barrel) {
755  return StationEtaBarrelMax;
756  } else {
757  return StationEtaEndcapMax;
758  }
759 }
760 
762 
764 
766 
768 
770 
772 
773 int MdtIdHelper::tubeMin() { return TubeMin; }
774 
775 int MdtIdHelper::tubeMax() const { return m_tubesMax; }
777 
779  int mdtField = technologyIndex("MDT");
780  if (m_dict) { mdtField = mdt_field_value(); }
781  return mdtField;
782 }
MdtIdHelper::isBMG
bool isBMG(const Identifier &id) const
is this a BMG chamber
Definition: MdtIdHelper.cxx:739
IdDictMgr.h
MdtIdHelper::multilayer
int multilayer(const Identifier &id) const
Access to components of the ID.
Definition: MdtIdHelper.cxx:727
MuonIdHelper::validStation
bool validStation(int stationName, int technology) const
Definition: MuonIdHelper.cxx:777
MuonIdHelper::stationNameIndex
int stationNameIndex(const std::string &name) const
Definition: MuonIdHelper.cxx:852
beamspotman.r
def r
Definition: beamspotman.py:672
MdtIdHelper::validElement
bool validElement(const Identifier &id) const
Definition: MdtIdHelper.cxx:562
ConstRangeIterator
Definition: RangeIterator.h:46
Muon::nsw::STGTPSegments::moduleIDBits::stationPhi
constexpr uint8_t stationPhi
station Phi 1 to 8
Definition: NSWSTGTPDecodeBitmaps.h:161
IdDictDictionary::build_multirange
MultiRange build_multirange() const
Get MultiRange for full dictionary.
Definition: IdDictDictionary.cxx:290
MdtIdHelper::m_lay_impl
IdDictFieldImplementation m_lay_impl
Definition: MdtIdHelper.h:194
MuonIdHelper::initLevelsFromDict
int initLevelsFromDict()
Definition: MuonIdHelper.cxx:249
MdtIdHelper::tubeMax
int tubeMax() const
Definition: MdtIdHelper.cxx:775
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
AtlasDetectorID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
Definition: AtlasDetectorID.cxx:255
MuonIdHelper::m_init
bool m_init
Definition: MuonIdHelper.h:339
get_generator_info.result
result
Definition: get_generator_info.py:21
MdtIdHelper::stationEtaMin
static int stationEtaMin(bool barrel)
Access to min and max of level ranges.
Definition: MdtIdHelper.cxx:745
IdDictGroup
Definition: IdDictGroup.h:25
MdtIdHelper::numberOfMultilayers
int numberOfMultilayers(const Identifier &id) const
Definition: MdtIdHelper.cxx:501
MdtIdHelper::MultilayerMax
@ MultilayerMax
Definition: MdtIdHelper.h:220
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
MuonIdHelper::get_id
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)
Definition: MuonIdHelper.cxx:74
MuonIdHelper::technologyIndex
int technologyIndex(const std::string &name) const
Definition: MuonIdHelper.cxx:858
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
MdtIdHelper::StationPhiMax
@ StationPhiMax
Definition: MdtIdHelper.h:218
IdDictFieldImplementation::show_to_string
std::string show_to_string(void) const
Definition: IdDictFieldImplementation.cxx:32
AtlasDetectorID::muon_field_value
int muon_field_value() const
Definition: AtlasDetectorID.h:615
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
MuonIdHelper::channel_context
IdContext channel_context() const
id for channel
Definition: MuonIdHelper.cxx:751
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
MuonIdHelper::is_mdt
bool is_mdt(const Identifier &id) const
Definition: MuonIdHelper.cxx:792
IdDictDictionary::region
const IdDictRegion & region(size_t i) const
Region at index i.
Definition: IdDictDictionary.h:350
MdtIdHelper::StationEtaEndcapMax
@ StationEtaEndcapMax
Definition: MdtIdHelper.h:216
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonIdHelper::detectorElement_hash_max
size_type detectorElement_hash_max() const
Definition: MuonIdHelper.h:183
MultiRange::add
void add(const Range &range)
Definition: MultiRange.cxx:22
IdentifierField::get_minimum
element_type get_minimum() const
Query the values.
Definition: IdentifierField.h:121
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
IdDictDictionary.h
MdtIdHelper::s_etaDim
static constexpr unsigned s_etaDim
Definition: MdtIdHelper.h:179
MuonIdHelper::m_sta_impl
IdDictFieldImplementation m_sta_impl
Definition: MuonIdHelper.h:286
MdtIdHelper::m_module_hashes
std::array< unsigned int, s_modHash > m_module_hashes
Definition: MdtIdHelper.h:188
DMTest::C
C_v1 C
Definition: C.h:26
MdtIdHelper::StationPhiMin
@ StationPhiMin
Definition: MdtIdHelper.h:217
ExpandedIdentifier::add
void add(element_type value)
Append a value into a new field.
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
IdDictFieldImplementation::pack
void pack(int value, Identifier &id) const
Definition: IdDictFieldImplementation.h:173
MdtIdHelper::tubeLayer
int tubeLayer(const Identifier &id) const
Definition: MdtIdHelper.cxx:729
IdentifierField::get_maximum
element_type get_maximum() const
Definition: IdentifierField.h:130
MdtIdHelper::TubeMin
@ TubeMin
Definition: MdtIdHelper.h:223
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
MuonIdHelper::stationName
int stationName(const Identifier &id) const
Definition: MuonIdHelper.cxx:810
IdDictDictionary::name
const std::string & name() const
Dictionary name.
Definition: IdDictDictionary.h:332
isValid
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition: AtlasPID.h:878
MuonIdHelper::m_phi_impl
IdDictFieldImplementation m_phi_impl
Definition: MuonIdHelper.h:288
MdtIdHelper::multilayerMinMax
std::pair< int, int > multilayerMinMax(const Identifier &id) const
Definition: MdtIdHelper.cxx:520
IdDictFieldImplementation::unpack
int unpack(Identifier id) const
Identifier manipulation methods.
Definition: IdDictFieldImplementation.h:147
MuonIdHelper::m_full_channel_range
MultiRange m_full_channel_range
Definition: MuonIdHelper.h:271
MdtIdHelper::m_TUBELAYER_INDEX
size_type m_TUBELAYER_INDEX
Definition: MdtIdHelper.h:192
MdtIdHelper::TubeLayerMax
@ TubeLayerMax
Definition: MdtIdHelper.h:222
MdtIdHelper::m_detectorElement_hashes
std::array< unsigned int, s_detDim > m_detectorElement_hashes
Definition: MdtIdHelper.h:189
MdtIdHelper::moduleHashIdx
unsigned int moduleHashIdx(const Identifier &id) const
Definition: MdtIdHelper.cxx:311
IdDictGroup.h
MdtIdHelper::findMinMax
std::pair< int, int > findMinMax(const Identifier &id, const size_type field_index, const ranges_by_station_t &ranges_by_station) const
Definition: MdtIdHelper.cxx:422
IdDictDictionary::find_field
IdDictField * find_field(const std::string &name) const
Definition: IdDictDictionary.cxx:47
CalibDbCompareRT.region_id
region_id
Definition: CalibDbCompareRT.py:67
IdDictRegion
Definition: IdDictRegion.h:20
MdtIdHelper::measuresPhi
bool measuresPhi(const Identifier &id) const override
always false for MDTs
Definition: MdtIdHelper.cxx:735
MdtIdHelper::multilayerMax
static int multilayerMax()
Definition: MdtIdHelper.cxx:767
IdDictFieldImplementation::reset
void reset(Identifier &id) const
Definition: IdDictFieldImplementation.h:183
MdtIdHelper::tubeMinMax
std::pair< int, int > tubeMinMax(const Identifier &id) const
Definition: MdtIdHelper.cxx:530
MdtIdHelper::StationEtaEndcapMin
@ StationEtaEndcapMin
Definition: MdtIdHelper.h:215
MdtIdHelper::s_phiDim
static constexpr unsigned s_phiDim
Definition: MdtIdHelper.h:180
MdtIdHelper::multilayerMin
static int multilayerMin()
Definition: MdtIdHelper.cxx:765
MdtIdHelper::tubeLayerMinMax
std::pair< int, int > tubeLayerMinMax(const Identifier &id) const
Definition: MdtIdHelper.cxx:525
AtlasDetectorID::size_type
Identifier::size_type size_type
Definition: AtlasDetectorID.h:385
Execution.tb
tb
Definition: Execution.py:15
IdDictRegion::implementation
const IdDictFieldImplementation & implementation(size_t i) const
Definition: IdDictRegion.cxx:34
MdtIdHelper::tubeLayerMax
static int tubeLayerMax()
Definition: MdtIdHelper.cxx:771
IdDictMgr
Definition: IdDictMgr.h:15
MdtIdHelper::m_BMG_stat
int m_BMG_stat
Definition: MdtIdHelper.h:229
MdtIdHelper::m_BME_stat
int m_BME_stat
Definition: MdtIdHelper.h:228
IdDictDictionary::find_group
IdDictGroup * find_group(const std::string &group_name) const
Definition: IdDictDictionary.cxx:115
IdDictMgr::find_dictionary
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
Definition: IdDictMgr.cxx:124
MuonIdHelper
Definition: MuonIdHelper.h:77
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AtlasDetectorID::mdt_field_value
int mdt_field_value() const
Definition: AtlasDetectorID.h:648
IdentifierField::empty
bool empty() const
If true, this field does not have any constraints, and may hold any value representable by element_ty...
Definition: IdentifierField.h:182
lumiFormat.i
int i
Definition: lumiFormat.py:85
MdtIdHelper::stationEtaMax
static int stationEtaMax(bool barrel)
Definition: MdtIdHelper.cxx:753
MuonIdHelper::m_module_vec
id_vec m_module_vec
Definition: MuonIdHelper.h:268
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MdtIdHelper::channel
int channel(const Identifier &id) const override
Definition: MdtIdHelper.cxx:741
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MdtIdHelper::TubeLayerMin
@ TubeLayerMin
Definition: MdtIdHelper.h:221
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
MdtIdHelper::tube
int tube(const Identifier &id) const
Definition: MdtIdHelper.cxx:731
test_pyathena.parent
parent
Definition: test_pyathena.py:15
MuonIdHelper::m_full_detectorElement_range
MultiRange m_full_detectorElement_range
Definition: MuonIdHelper.h:276
MdtIdHelper::StationEtaBarrelMin
@ StationEtaBarrelMin
Definition: MdtIdHelper.h:213
MdtIdHelper.h
MdtIdHelper::validChannel
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Definition: MdtIdHelper.cxx:611
MdtIdHelper::s_mlDim
static constexpr unsigned s_mlDim
Definition: MdtIdHelper.h:181
MuonIdHelper::m_full_module_range
MultiRange m_full_module_range
Definition: MuonIdHelper.h:266
MdtIdHelper::init_id_to_hashes
int init_id_to_hashes()
Definition: MdtIdHelper.cxx:287
MdtIdHelper::stationEtaPhiMinMax
std::tuple< int, int, int, int > stationEtaPhiMinMax(const Identifier &id) const
Definition: MdtIdHelper.cxx:458
MuonIdHelper::get_expanded_id
int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
Create expanded id from compact id (return == 0 for OK)
Definition: MuonIdHelper.cxx:164
MdtIdHelper::stationEtaMinMax
std::pair< int, int > stationEtaMinMax(const Identifier &id) const
Definition: MdtIdHelper.cxx:448
IdDictGroup::regions
const std::vector< IdDictRegion * > & regions()
Definition: IdDictGroup.cxx:46
MuonIdHelper::m_eta_impl
IdDictFieldImplementation m_eta_impl
Definition: MuonIdHelper.h:287
MuonIdHelper::init_hashes
int init_hashes()
Definition: MuonIdHelper.cxx:356
MuonIdHelper::m_NAME_INDEX
size_type m_NAME_INDEX
Definition: MuonIdHelper.h:256
MuonIdHelper::m_muon_impl
IdDictFieldImplementation m_muon_impl
Definition: MuonIdHelper.h:285
MuonIdHelper::m_GROUP_INDEX
size_t m_GROUP_INDEX
Definition: MuonIdHelper.h:255
MdtIdHelper::tubeMin
static int tubeMin()
Definition: MdtIdHelper.cxx:773
MuonIdHelper::nStationNames
int nStationNames() const
Definition: MuonIdHelper.cxx:878
AtlasDetectorID::register_dict_tag
int register_dict_tag(const IdDictMgr &dict_mgr, const std::string &dict_name)
Register the file and tag names for a particular IdDict dictionary.
Definition: AtlasDetectorID.cxx:201
MuonIdHelper::stationPhi
int stationPhi(const Identifier &id) const
Definition: MuonIdHelper.cxx:820
MdtIdHelper::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
Definition: MdtIdHelper.cxx:20
IdDictDictionary::get_label_value
int get_label_value(const std::string &field, const std::string &label, int &value) const
Definition: IdDictDictionary.cxx:75
MuonIdHelper::stationNameString
const std::string & stationNameString(const int &index) const
Definition: MuonIdHelper.cxx:864
MdtIdHelper::stationPhiMinMax
std::pair< int, int > stationPhiMinMax(const Identifier &id) const
Definition: MdtIdHelper.cxx:453
MuonIdHelper::init_neighbors
int init_neighbors()
Definition: MuonIdHelper.cxx:528
MdtIdHelper::detEleHashIdx
unsigned int detEleHashIdx(const Identifier &id) const
Definition: MdtIdHelper.cxx:321
MultiRange
A MultiRange combines several Ranges.
Definition: MultiRange.h:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MdtIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Definition: MdtIdHelper.cxx:664
MdtIdHelper::m_module_ranges_by_station
ranges_by_station_t m_module_ranges_by_station
Definition: MdtIdHelper.h:234
RangeIterator.h
MuonIdHelper::m_detectorElement_vec
id_vec m_detectorElement_vec
Definition: MuonIdHelper.h:278
MuonIdHelper::stationEta
int stationEta(const Identifier &id) const
Definition: MuonIdHelper.cxx:815
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
MuonIdHelper::module_hash_max
size_type module_hash_max() const
the maximum hash value
Definition: MuonIdHelper.cxx:758
MdtIdHelper::isBME
bool isBME(const Identifier &id) const
is this a BME chamber
Definition: MdtIdHelper.cxx:737
IdDictDictionary
Definition: IdDictDictionary.h:30
MuonIdHelper::m_ETA_INDEX
size_type m_ETA_INDEX
Definition: MuonIdHelper.h:257
MdtIdHelper::MdtIdHelper
MdtIdHelper()
Definition: MdtIdHelper.cxx:13
MdtIdHelper::m_tub_impl
IdDictFieldImplementation m_tub_impl
Definition: MdtIdHelper.h:195
MuonIdHelper::init_detectorElement_hashes
virtual int init_detectorElement_hashes()
Definition: MuonIdHelper.cxx:402
MdtIdHelper::valid
bool valid(const Identifier &id) const
Public validation of levels.
Definition: MdtIdHelper.cxx:536
MdtIdHelper::MultilayerMin
@ MultilayerMin
Definition: MdtIdHelper.h:219
MdtIdHelper::elementID
Identifier elementID(int stationName, int stationEta, int stationPhi) const
Definition: MdtIdHelper.cxx:635
AtlasDetectorID::reinitialize
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
Definition: AtlasDetectorID.cxx:221
IdDictField.h
MuonIdHelper::m_TECHNOLOGY_INDEX
size_type m_TECHNOLOGY_INDEX
Definition: MuonIdHelper.h:259
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:365
MdtIdHelper::get_detectorElement_hash
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: MdtIdHelper.cxx:331
MultiRange::size
size_type size() const
Definition: MultiRange.cxx:70
IdentifierField
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
Definition: IdentifierField.h:83
DetectorZone::barrel
@ barrel
MuonIdHelper::resetAndSet
void resetAndSet(const IdDictFieldImplementation &dict, const int new_val, Identifier &id) const
Definition: MuonIdHelper.h:306
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
MuonIdHelper::m_DETECTORELEMENT_INDEX
size_type m_DETECTORELEMENT_INDEX
Definition: MuonIdHelper.h:261
MdtIdHelper::stationPhiMax
static int stationPhiMax()
Definition: MdtIdHelper.cxx:763
MuonIdHelper::m_tec_impl
IdDictFieldImplementation m_tec_impl
Definition: MuonIdHelper.h:289
MdtIdHelper::multilayerID
Identifier multilayerID(const Identifier &channeldID) const
Definition: MdtIdHelper.cxx:338
Identifier::value_type
unsigned long long value_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:27
merge.status
status
Definition: merge.py:16
MdtIdHelper::gasGap
int gasGap(const Identifier &id) const override
the gas-gap function for the MDT's returns the tube layer
Definition: MdtIdHelper.cxx:733
MdtIdHelper::StationEtaBarrelMax
@ StationEtaBarrelMax
Definition: MdtIdHelper.h:214
IdDictRegion.h
MdtIdHelper::m_mla_impl
IdDictFieldImplementation m_mla_impl
Definition: MdtIdHelper.h:193
MdtIdHelper::get_module_hash
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: MdtIdHelper.cxx:324
IdDictField
Definition: IdDictField.h:15
Muon::nsw::STGTPSegments::moduleIDBits::stationEta
constexpr uint8_t stationEta
1 to 3
Definition: NSWSTGTPDecodeBitmaps.h:159
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
MdtIdHelper::ranges_by_station_t
std::vector< std::vector< const Range * > > ranges_by_station_t
Definition: MdtIdHelper.h:233
ExpandedIdentifier::element_type
int element_type
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:106
MdtIdHelper::stationPhiMin
static int stationPhiMin()
Definition: MdtIdHelper.cxx:761
MdtIdHelper::mdtTechnology
int mdtTechnology() const
Utility methods.
Definition: MdtIdHelper.cxx:778
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
MuonIdHelper::m_PHI_INDEX
size_type m_PHI_INDEX
Definition: MuonIdHelper.h:258
calibdata.tube
tube
Definition: calibdata.py:30
MdtIdHelper::m_channel_ranges_by_station
ranges_by_station_t m_channel_ranges_by_station
Definition: MdtIdHelper.h:235
MuonIdHelper::technology_context
IdContext technology_context() const
access to IdContext's which define which levels or fields are contained in the Muon id
Definition: MuonIdHelper.cxx:736
MdtIdHelper::tubeLayerMin
static int tubeLayerMin()
Definition: MdtIdHelper.cxx:769
MdtIdHelper::isStNameInTech
bool isStNameInTech(const std::string &stationName) const override
The valid element checks converted the identifier to a stationName string in order to assess whether ...
Definition: MdtIdHelper.cxx:561
fitman.k
k
Definition: fitman.py:528
MdtIdHelper::parentID
Identifier parentID(const Identifier &id) const
get parent id from channel id
Definition: MdtIdHelper.cxx:716
MdtIdHelper::idChannels
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
Definition: MdtIdHelper.cxx:360
MuonIdHelper::m_CHANNEL_INDEX
size_type m_CHANNEL_INDEX
Definition: MuonIdHelper.h:262
Identifier
Definition: IdentifierFieldParser.cxx:14
MdtIdHelper::m_tubesMax
unsigned int m_tubesMax
Definition: MdtIdHelper.h:226
MuonIdHelper::m_dict
const IdDictDictionary * m_dict
Definition: MuonIdHelper.h:263