ATLAS Offline Software
TRT_ID.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 /***************************************************************************
6  Inner Detector identifier package
7  -------------------------------------------
8 ***************************************************************************/
9 
10 
11 //<<<<<< INCLUDES >>>>>>
12 #include "GaudiKernel/MsgStream.h"
13 
14 #include "InDetIdentifier/TRT_ID.h"
17 #include "IdDict/IdDictDefs.h"
18 #include <set>
19 #include <algorithm>
20 #include <iostream>
21 #include <cassert>
22 
23 
25 
27  :
28  m_is_valid(true),
29  m_trt_region_index(0),
30  m_INDET_INDEX(0),
31  m_TRT_INDEX(1),
32  m_BARREL_EC_INDEX(2),
33  m_PHI_MODULE_INDEX(3),
34  m_LAYER_OR_WHEEL_INDEX(4),
35  m_STRAW_LAYER_INDEX(5),
36  m_STRAW_INDEX(6),
37  m_dict(nullptr),
38  m_module_hash_max(0),
39  m_straw_layer_hash_max(0),
40  m_straw_hash_max(0) {
43 }
44 
45 TRT_ID::~TRT_ID() = default;
46 
47 void
48 TRT_ID::barrel_ec_id_checks(int barrel_ec) const {
49  // Check that id is within allowed range
50 
51  // Fill expanded id
53 
55 
56  if (!m_full_module_range.match(id)) { // module range check is sufficient
57  MsgStream log(m_msgSvc, "TRT_ID");
58  if (m_msgSvc) {
59  log << MSG::ERROR << " TRT_ID::barrel_ec_id result is NOT ok. ID, range "
60  << (std::string) id << " "
61  << (std::string) m_full_module_range << endmsg;
62  } else {
63  std::cout << " ERROR TRT_ID::barrel_ec_id result is NOT ok. ID, range "
64  << (std::string) id << " "
65  << (std::string) m_full_module_range << std::endl;
66  }
67  }
68 }
69 
70 void
72  int phi_module,
73  int layer_or_wheel) const {
74  // Check that id is within allowed range
75 
76  // Fill expanded id
78 
81 
82  if (!m_full_module_range.match(id)) { // module range check is sufficient
83  MsgStream log(m_msgSvc, "TRT_ID");
84  if (m_msgSvc) {
85  log << MSG::ERROR << " TRT_ID::module_id result is NOT ok. ID, range "
86  << (std::string) id << " "
87  << (std::string) m_full_module_range << endmsg;
88  } else {
89  std::cout << " ERROR TRT_ID::module_id result is NOT ok. ID, range "
90  << (std::string) id << " "
91  << (std::string) m_full_module_range << std::endl;
92  }
93  }
94 }
95 
96 void
98  int phi_module,
99  int layer_or_wheel,
100  int straw_layer,
101  int straw) const {
102  // Check that id is within allowed range
103 
104  // Build identifier
106 
109 
110  if (!m_full_straw_range.match(id)) {
111  MsgStream log(m_msgSvc, "TRT_ID");
112  if (m_msgSvc) {
113  log << MSG::ERROR << " TRT_ID::straw_id result is NOT ok. ID, range "
114  << (std::string) id << " "
115  << (std::string) m_full_straw_range << endmsg;
116  } else {
117  log << MSG::ERROR << " TRT_ID::straw_id result is NOT ok. ID, range "
118  << (std::string) id << " "
119  << (std::string) m_full_straw_range << std::endl;
120  }
121  }
122 }
123 
124 void
126  int phi_module,
127  int layer_or_wheel,
128  int straw_layer) const {
129  // Check that id is within allowed range
130 
131  // Build identifier
133 
136 
137  if (!m_full_straw_layer_range.match(id)) {
138  MsgStream log(m_msgSvc, "TRT_ID");
139  if (m_msgSvc) {
140  log << MSG::ERROR << " TRT_ID::layer_id result is NOT ok. ID, range "
141  << (std::string) id << " "
142  << (std::string) m_full_straw_layer_range << endmsg;
143  } else {
144  std::cout << " ERROR TRT_ID::layer_id result is NOT ok. ID, range "
145  << (std::string) id << " "
146  << (std::string) m_full_straw_layer_range << std::endl;
147  }
148  }
149 }
150 
151 
152 int
154  MsgStream log(m_msgSvc, "TRT_ID");
155 
156  if (m_msgSvc) {
157  log << MSG::INFO << "Initialize from dictionary msgSvc " << m_msgSvc << endmsg;
158  } else {
159  std::cout << "INFO Initialize from dictionary cout " << m_msgSvc << std::endl;
160  }
161 
162 
163  // Check whether this helper should be reinitialized
164  if (!reinitialize(dict_mgr)) {
165  if (m_msgSvc) {
166  log << MSG::INFO << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
167  } else {
168  std::cout << " INFO Request to reinitialize not satisfied - tags have not changed" << std::endl;
169  }
170  return(0);
171  } else {
172  if (m_msgSvc) {
173  log << MSG::DEBUG << "(Re)initialize" << endmsg;
174  } else {
175  std::cout << " DEBUG (Re)initialize" << std::endl;
176  }
177  }
178 
179  // init base object
181  m_is_valid = false;
182  return(1);
183  }
184 
185 
186  // Register version of InnerDetector dictionary
187  if (register_dict_tag(dict_mgr, "InnerDetector")) {
188  m_is_valid = false;
189  return(1);
190  }
191 
192 
193  m_dict = dict_mgr.find_dictionary("InnerDetector");
194  if (!m_dict) {
195  if (m_msgSvc) {
196  log << MSG::ERROR << " TRT_ID::initialize_from_dict - cannot access InnerDetector dictionary "
197  << endmsg;
198  } else {
199  std::cout << " ERROR TRT_ID::initialize_from_dict - cannot access InnerDetector dictionary "
200  << std::endl;
201  }
202  m_is_valid = false;
203  return 1;
204  }
205 
206  // Initialize the field indices
207  if (initLevelsFromDict()) {
208  m_is_valid = false;
209  return(1);
210  }
211 
212 
213  //
214  // Set barrel field for testing is_barrel
215  //
216  int barrel_value;
218  // negative barrel
219  if (m_dict->get_label_value("barrel_endcap", "negative_barrel", barrel_value)) {
220  if (m_msgSvc) {
221  log << MSG::ERROR << "Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
222  << m_dict->m_name
223  << endmsg;
224  } else {
225  std::cout << " ERROR Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
226  << m_dict->m_name
227  << std::endl;
228  }
229  m_is_valid = false;
230  return(1);
231  }
232  m_barrel_field.add_value(barrel_value);
233  // negative barrel
234  if (m_dict->get_label_value("barrel_endcap", "positive_barrel", barrel_value)) {
235  if (m_msgSvc) {
236  log << MSG::ERROR << "Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
237  << m_dict->m_name
238  << endmsg;
239  } else {
240  std::cout << " ERROR Could not get value for label 'barrel' of field 'barrel_endcap' in dictionary "
241  << m_dict->m_name
242  << std::endl;
243  }
244  m_is_valid = false;
245  return(1);
246  }
247  m_barrel_field.add_value(barrel_value);
248  if (m_msgSvc) {
249  log << MSG::DEBUG << " TRT_ID::initialize_from_dict "
250  << "Set barrel field values: "
251  << (std::string) m_barrel_field
252  << endmsg;
253  } else {
254  std::cout << " DEBUG TRT_ID::initialize_from_dict "
255  << "Set barrel field values: "
256  << (std::string) m_barrel_field
257  << std::endl;
258  }
259 
260  //
261  // Build multirange for the valid set of identifiers
262  //
263 
264 
265  // Find value for the field InnerDetector
266  const IdDictDictionary* atlasDict = dict_mgr.find_dictionary("ATLAS");
267 
268  int inDetField = -1;
269  if (atlasDict->get_label_value("subdet", "InnerDetector", inDetField)) {
270  if (m_msgSvc) {
271  log << MSG::ERROR << "Could not get value for label 'InnerDetector' of field 'subdet' in dictionary "
272  << atlasDict->m_name
273  << endmsg;
274  } else {
275  std::cout << " ERROR Could not get value for label 'InnerDetector' of field 'subdet' in dictionary "
276  << atlasDict->m_name
277  << std::endl;
278  }
279  m_is_valid = false;
280  return(1);
281  }
282 
283  // Find value for the field TRT
284  int trtField = -1;
285  if (m_dict->get_label_value("part", "TRT", trtField)) {
286  if (m_msgSvc) {
287  log << MSG::ERROR << "Could not get value for label 'TRT' of field 'part' in dictionary "
288  << m_dict->m_name
289  << endmsg;
290  } else {
291  std::cout << " ERROR Could not get value for label 'TRT' of field 'part' in dictionary "
292  << m_dict->m_name
293  << std::endl;
294  }
295  m_is_valid = false;
296  return(1);
297  }
298  if (m_msgSvc) {
299  log << MSG::DEBUG << " TRT_ID::initialize_from_dict "
300  << "Found field values: InDet/TRT "
301  << inDetField << "/"
302  << trtField
303  << endmsg;
304  } else {
305  std::cout << " DEBUG TRT_ID::initialize_from_dict "
306  << "Found field values: InDet/TRT "
307  << inDetField << "/"
308  << trtField
309  << std::endl;
310  }
311 
312  // Set up id for region and range prefix
314  region_id.add(inDetField);
315  region_id.add(trtField);
316  Range prefix;
320 
321  init_hashes();
322 
323  if (m_msgSvc) {
324  log << MSG::DEBUG << " TRT_ID::initialize_from_dict "
325  << endmsg;
326  log << MSG::DEBUG << "Module range -> " << (std::string) m_full_module_range
327  << endmsg;
328  log << MSG::DEBUG << "Straw layer range -> " << (std::string) m_full_straw_layer_range
329  << endmsg;
330  log << MSG::DEBUG << "Straw range -> " << (std::string) m_full_straw_range
331  << endmsg;
332  } else {
333  std::cout << " DEBUG TRT_ID::initialize_from_dict "
334  << std::endl;
335  std::cout << " DEBUG Module range -> " << (std::string) m_full_module_range
336  << std::endl;
337  std::cout << " DEBUG Straw layer range -> " << (std::string) m_full_straw_layer_range
338  << std::endl;
339  std::cout << " DEBUG Straw range -> " << (std::string) m_full_straw_range
340  << std::endl;
341  }
342 
343  return 0;
344 }
345 
346 void
348  //
349  // create two vecs (module and straw layer) to retrieve the hashes
350  // for compact ids
351  //
352 
353  // module hash
354  MsgStream log(m_msgSvc, "TRT_ID");
355 
356  if (m_msgSvc) {
357  log << MSG::DEBUG << "Module range -> " << (std::string) m_full_module_range
358  << endmsg;
359  } else {
360  std::cout << " DEBUG Module range -> " << (std::string) m_full_module_range
361  << std::endl;
362  }
363 
364 
365 
368  unsigned int nids = 0;
369  std::set<Identifier> ids;
370  for (unsigned int i = 0; i < m_full_module_range.size(); ++i) {
371  const Range& range = m_full_module_range[i];
373  for (const auto & exp_id: rit) {
375  exp_id[m_PHI_MODULE_INDEX],
376  exp_id[m_LAYER_OR_WHEEL_INDEX]);
377  if (!(ids.insert(id)).second) {
378  if (m_msgSvc) {
379  log << MSG::ERROR << " TRT_ID::init_hashes "
380  << " Error: duplicated id for module id. nid " << nids
381  << " compact id " << show_to_string(id)
382  << " id " << std::string(exp_id)
383  << endmsg;
384  } else {
385  std::cout << " ERROR TRT_ID::init_hashes "
386  << " Error: duplicated id for module id. nid " << nids
387  << " compact id " << show_to_string(id)
388  << " id " << std::string(exp_id)
389  << std::endl;
390  }
391  }
392  nids++;
393  }
394  }
395  if (ids.size() != m_module_hash_max) {
396  if (m_msgSvc) {
397  log << MSG::ERROR << " TRT_ID::init_hashes "
398  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
399  << " hash max " << m_module_hash_max
400  << endmsg;
401  } else {
402  std::cout << " ERROR TRT_ID::init_hashes "
403  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
404  << " hash max " << m_module_hash_max
405  << std::endl;
406  }
407  } else {
408  if (m_msgSvc) {
409  log << MSG::DEBUG << " TRT_ID::init_hashes "
410  << " module hash max " << m_module_hash_max
411  << endmsg;
412  } else {
413  std::cout << " DEBUG TRT_ID::init_hashes "
414  << " module hash max " << m_module_hash_max
415  << std::endl;
416  }
417  }
418 
419  nids = 0;
420  std::set<Identifier>::const_iterator first = ids.begin();
421  std::set<Identifier>::const_iterator last = ids.end();
422  for (; first != last && nids < m_module_vec.size(); ++first) {
423  m_module_vec[nids] = (*first);
424  nids++;
425  }
426 
427  // straw_layer hash
430  nids = 0;
431  ids.clear();
432  for (unsigned int i = 0; i < m_full_straw_layer_range.size(); ++i) {
435  for (const auto & exp_id: rit) {
437  exp_id[m_PHI_MODULE_INDEX],
438  exp_id[m_LAYER_OR_WHEEL_INDEX],
439  exp_id[m_STRAW_LAYER_INDEX]);
440  if (!(ids.insert(id)).second) {
441  if (m_msgSvc) {
442  log << MSG::ERROR << " TRT_ID::init_hashes "
443  << " Error: duplicated id for straw layer id. nid " << nids
444  << " compact id " << show_to_string(id)
445  << " id " << std::string(exp_id)
446  << endmsg;
447  std::cout << " ERROR TRT_ID::init_hashes "
448  << " Error: duplicated id for straw layer id. nid " << nids
449  << " compact id " << show_to_string(id)
450  << " id " << std::string(exp_id)
451  << std::endl;
452  }
453  nids++;
454  }
455  }
456  }
457 
458  if (ids.size() != m_straw_layer_hash_max) {
459  if (m_msgSvc) {
460  log << MSG::ERROR << " TRT_ID::init_hashes "
461  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
462  << " hash max " << m_straw_layer_hash_max
463  << endmsg;
464  } else {
465  std::cout << " ERROR TRT_ID::init_hashes "
466  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
467  << " hash max " << m_straw_layer_hash_max
468  << std::endl;
469  }
470  } else {
471  if (m_msgSvc) {
472  log << MSG::DEBUG << " TRT_ID::init_hashes "
473  << " straw layer hash max " << m_straw_layer_hash_max
474  << endmsg;
475  } else {
476  std::cout << " DEBUG TRT_ID::init_hashes "
477  << " straw layer hash max " << m_straw_layer_hash_max
478  << std::endl;
479  }
480  }
481 
482  nids = 0;
483  first = ids.begin();
484  last = ids.end();
485  for (; first != last && nids < m_straw_layer_vec.size(); ++first) {
486  m_straw_layer_vec[nids] = (*first);
487  nids++;
488  }
489 
490 
491  // Init vector for binary lookup
493 
494 
495  // Setup for hash calculation for straw ids
496 
497 
498  // We use a HashCalc object to save the information needed to
499  // calculate the hash from the decoded values of a straw id.
500  //
501  // The number of HashCalc objects needed are 2x the number of
502  // ranges - one for each pos/neg. There are then two additional
503  // lookup tables, one for each of barrel and endcap, to access the
504  // index into the HashCalc table. Here we set up the HashCalc
505  // table and the additional tables for accessing the index.
506 
507  // Set up vector as lookup table for hash calculation.
508  unsigned int hcIndex = 0;
509  unsigned int nRanges = m_full_straw_range.size();
510  m_hash_calcs.resize(2 * nRanges); // allow for pos/neg
511 
512 // std::vector<bool> startHashFound(4,false);
513 // m_beStartHash.resize(4);
514 
515 
516  for (unsigned int i = 0; i < m_full_straw_range.size(); ++i) {
517  const Range* range = &m_full_straw_range[i];
518  ExpandedIdentifier exp_id = range->minimum();
520  exp_id[m_PHI_MODULE_INDEX],
521  exp_id[m_LAYER_OR_WHEEL_INDEX],
522  exp_id[m_STRAW_LAYER_INDEX],
523  exp_id[m_STRAW_INDEX]);
524  IdentifierHash min_neg = straw_hash_bin(min);
525 
526  // Calculate the offset in phi
527  Identifier next_phi = straw_id(exp_id[m_BARREL_EC_INDEX],
528  exp_id[m_PHI_MODULE_INDEX] + 1,
529  exp_id[m_LAYER_OR_WHEEL_INDEX],
530  exp_id[m_STRAW_LAYER_INDEX],
531  exp_id[m_STRAW_INDEX]);
532  IdentifierHash deltaPhi = straw_hash_bin(next_phi) - min_neg;
533 
534  // barrel or endcap
536 
537 // std::cout << " isBarrel: " << isBarrel << " " << exp_id[m_BARREL_EC_INDEX] << std::endl;
538 
539  // both pos and neg available?
540  bool two_sides = ((*range)[m_BARREL_EC_INDEX].get_indices() == 2);
541 
542  // fill lookup table with index to HashCalc
543  unsigned int lay_min = (*range)[m_LAYER_OR_WHEEL_INDEX].get_minimum();
544  unsigned int nlayers = (*range)[m_LAYER_OR_WHEEL_INDEX].get_indices();
545  unsigned int str_lay_min = (*range)[m_STRAW_LAYER_INDEX].get_minimum();
546  unsigned int nstr_layers = (*range)[m_STRAW_LAYER_INDEX].get_indices();
547  unsigned int start;
548  unsigned int end;
549 
550  if (isBarrel) {
551  // use layer and straw layer to distinguish which HashCalc
552  start = lay_min * 32 + str_lay_min;
553  end = start + nstr_layers;
555  for (unsigned int i = start; i < end; ++i) {
556  m_hash_calcs_barrel_indexes[i].first = hcIndex;
557  }
558 
559  } else {
560  // use layer alone to distinguish which HashCalc
561  start = lay_min;
562  end = start + nlayers;
564  for (unsigned int i = start; i < end; ++i) {
565  m_hash_calcs_endcap_indexes[i].first = hcIndex;
566  }
567 
568  }
569 
570 
571  // Set up HashCalc objet
572  HashCalc hc;
573  hc.m_hash = min_neg;
574 // hc.m_barrel_ec = exp_id[m_BARREL_EC_INDEX];
575  hc.m_deltaPhi = deltaPhi;
576  hc.m_layerMin = (*range)[m_LAYER_OR_WHEEL_INDEX].get_minimum();
577  hc.m_strLayerMin = (*range)[m_STRAW_LAYER_INDEX].get_minimum();
578 
579  hc.m_nStrawLayers = (*range)[m_STRAW_LAYER_INDEX].get_indices() *
580  (*range)[m_STRAW_INDEX].get_indices();
581  hc.m_nstraws = (*range)[m_STRAW_INDEX].get_indices();
582 
583 
584  m_hash_calcs[hcIndex] = hc;
585  hcIndex++;
586 
587  // Now repeat if there are both pos/neg
588 
589  if (two_sides) {
590  if (isBarrel) {
591  // use layer and straw layer to distinguish which HashCalc
592  start = lay_min * 32 + str_lay_min;
593  end = start + nstr_layers;
595  for (unsigned int i = start; i < end; ++i) {
596  m_hash_calcs_barrel_indexes[i].second = hcIndex;
597  }
598 
599  } else {
600  // use layer alone to distinguish which HashCalc
601  start = lay_min;
602  end = start + nlayers;
604  for (unsigned int i = start; i < end; ++i) {
605  m_hash_calcs_endcap_indexes[i].second = hcIndex;
606  }
607 
608  }
609 
610 
611 
612  // Flip sign for bec if 2 symmetric sides (ATLAS case, not TB)
614  exp_id[m_PHI_MODULE_INDEX],
615  exp_id[m_LAYER_OR_WHEEL_INDEX],
616  exp_id[m_STRAW_LAYER_INDEX],
617  exp_id[m_STRAW_INDEX]);
618  IdentifierHash min_pos = straw_hash_bin(min);
619  hc.m_hash = min_pos;
620  m_hash_calcs[hcIndex] = hc;
621  hcIndex++;
622  }
623  }
624 
625  // clear vector
627 }
628 
629 void
631  m_straw_vec.clear();
632 }
633 
634 void
636  // We init straw hashes separately to be able to reset the vector
637  // afterwards
638 
639  MsgStream log(m_msgSvc, "TRT_ID");
640 
641  // straw hash - we do not keep a vec for the straws - too large
644  unsigned int nids = 0;
645  std::set<Identifier> ids;
646 
647  for (unsigned int i = 0; i < m_full_straw_range.size(); ++i) {
648  const Range& range = m_full_straw_range[i];
650  for (const auto & exp_id:rit) {
652  exp_id[m_PHI_MODULE_INDEX],
653  exp_id[m_LAYER_OR_WHEEL_INDEX],
654  exp_id[m_STRAW_LAYER_INDEX],
655  exp_id[m_STRAW_INDEX]);
656  if (!(ids.insert(id)).second) {
657  if (m_msgSvc) {
658  log << MSG::ERROR << " TRT_ID::init_hashes "
659  << " Error: duplicated id for straw id. nid " << nids
660  << " compact id " << show_to_string(id)
661  << " id " << std::string(exp_id)
662  << endmsg;
663  } else {
664  std::cout << " ERROR TRT_ID::init_hashes "
665  << " Error: duplicated id for straw id. nid " << nids
666  << " compact id " << show_to_string(id)
667  << " id " << std::string(exp_id)
668  << std::endl;
669  }
670  }
671  nids++;
672  }
673  }
674  if (ids.size() != m_straw_hash_max) {
675  if (m_msgSvc) {
676  log << MSG::ERROR << " TRT_ID::init_hashes "
677  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
678  << " hash max " << m_straw_hash_max
679  << endmsg;
680  } else {
681  std::cout << " ERROR TRT_ID::init_hashes "
682  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
683  << " hash max " << m_straw_hash_max
684  << std::endl;
685  }
686  } else {
687  if (m_msgSvc) {
688  log << MSG::DEBUG << " TRT_ID::init_hashes "
689  << " straw hash max " << m_straw_hash_max
690  << endmsg;
691  } else {
692  std::cout << " DEBUG TRT_ID::init_hashes "
693  << " straw hash max " << m_straw_hash_max
694  << std::endl;
695  }
696  }
697 
698  nids = 0;
699  std::set<Identifier>::const_iterator first = ids.begin();
700  std::set<Identifier>::const_iterator last = ids.end();
701  for (; first != last && nids < m_straw_vec.size(); ++first) {
702  m_straw_vec[nids] = (*first);
703  nids++;
704  }
705 }
706 
707 int
709  MsgStream log(m_msgSvc, "TRT_ID");
710 
711  if (!m_dict) {
712  if (m_msgSvc) {
713  log << MSG::ERROR << " TRT_ID::initLevelsFromDict - dictionary NOT initialized "
714  << endmsg;
715  } else {
716  std::cout << " ERROR TRT_ID::initLevelsFromDict - dictionary NOT initialized "
717  << std::endl;
718  }
719  return(1);
720  }
721 
722  // Find out which identifier field corresponds to each level. Use
723  // names to find each field/leve.
724 
725  m_INDET_INDEX = 999;
726  m_TRT_INDEX = 999;
727  m_BARREL_EC_INDEX = 999;
728  m_PHI_MODULE_INDEX = 999;
730  m_STRAW_LAYER_INDEX = 999;
731  m_STRAW_INDEX = 999;
732 
733  // Save index to a TRT region for unpacking
735  id << indet_field_value() << trt_field_value();
737  if (m_msgSvc) {
738  log << MSG::WARNING << "TRT_ID::initLevelsFromDict - unable to initialize TRT_ID helper "
739  << endmsg;
740  log << MSG::WARNING << "TRT_ID::initLevelsFromDict - we assume that the TRT does NOT exist for this layout "
741  << endmsg;
742  } else {
743  std::cout << " WARNING TRT_ID::initLevelsFromDict - unable to initialize TRT_ID helper "
744  << std::endl;
745  std::cout << " WARNING TRT_ID::initLevelsFromDict - we assume that the TRT does NOT exist for this layout "
746  << std::endl;
747  }
748  return(1);
749  }
750 
751  // Find a TRT region
752  IdDictField* field = m_dict->find_field("subdet");
753  if (field) {
754  m_INDET_INDEX = field->m_index;
755  } else {
756  if (m_msgSvc) {
757  log << MSG::ERROR << "TRT_ID::initLevelsFromDict - unable to find 'subdet' field "
758  << endmsg;
759  } else {
760  std::cout << " ERROR TRT_ID::initLevelsFromDict - unable to find 'subdet' field "
761  << std::endl;
762  }
763  return(1);
764  }
765  field = m_dict->find_field("part");
766  if (field) {
767  m_TRT_INDEX = field->m_index;
768  } else {
769  if (m_msgSvc) {
770  log << MSG::ERROR << "TRT_ID::initLevelsFromDict - unable to find 'part' field "
771  << endmsg;
772  } else {
773  std::cout << " ERROR TRT_ID::initLevelsFromDict - unable to find 'part' field "
774  << std::endl;
775  }
776  return(1);
777  }
778  field = m_dict->find_field("barrel_endcap");
779  if (field) {
780  m_BARREL_EC_INDEX = field->m_index;
781  } else {
782  if (m_msgSvc) {
783  log << MSG::ERROR << "TRT_ID::initLevelsFromDict - unable to find 'barrel_endcap' field "
784  << endmsg;
785  } else {
786  std::cout << " ERROR TRT_ID::initLevelsFromDict - unable to find 'barrel_endcap' field "
787  << std::endl;
788  }
789 
790  return(1);
791  }
792  field = m_dict->find_field("phi_sector");
793  if (field) {
794  m_PHI_MODULE_INDEX = field->m_index;
795  } else {
796  if (m_msgSvc) {
797  log << MSG::ERROR << "TRT_ID::initLevelsFromDict - unable to find 'phi_sector' field "
798  << endmsg;
799  } else {
800  std::cout << " ERROR TRT_ID::initLevelsFromDict - unable to find 'phi_sector' field "
801  << std::endl;
802  }
803 
804  return(1);
805  }
806  field = m_dict->find_field("layer_or_wheel");
807  if (field) {
808  m_LAYER_OR_WHEEL_INDEX = field->m_index;
809  } else {
810  if (m_msgSvc) {
811  log << MSG::ERROR << "TRT_ID::initLevelsFromDict - unable to find 'layer' field "
812  << endmsg;
813  } else {
814  std::cout << " ERROR TRT_ID::initLevelsFromDict - unable to find 'layer' field "
815  << std::endl;
816  }
817 
818  return(1);
819  }
820  field = m_dict->find_field("straw_layer");
821  if (field) {
822  m_STRAW_LAYER_INDEX = field->m_index;
823  } else {
824  if (m_msgSvc) {
825  log << MSG::ERROR << "TRT_ID::initLevelsFromDict - unable to find 'straw_layer' field "
826  << endmsg;
827  } else {
828  std::cout << " ERROR TRT_ID::initLevelsFromDict - unable to find 'straw_layer' field "
829  << std::endl;
830  }
831 
832  return(1);
833  }
834  field = m_dict->find_field("straw");
835  if (field) {
836  m_STRAW_INDEX = field->m_index;
837  } else {
838  if (m_msgSvc) {
839  log << MSG::ERROR << "TRT_ID::initLevelsFromDict - unable to find 'straw' field "
840  << endmsg;
841  } else {
842  std::cout << " ERROR TRT_ID::initLevelsFromDict - unable to find 'straw' field "
843  << std::endl;
844  }
845 
846  return(1);
847  }
848 
849  // Set the field implementations: for bec, lay/disk, eta/phi mod
850 
851  const IdDictRegion& region = *m_dict->m_regions[m_trt_region_index];
852 
860 
861  if (m_msgSvc) {
862  log << MSG::DEBUG << "decode index and bit fields for each level: " << endmsg;
863  log << MSG::DEBUG << "indet " << m_indet_impl.show_to_string() << endmsg;
864  log << MSG::DEBUG << "trt " << m_trt_impl.show_to_string() << endmsg;
865  log << MSG::DEBUG << "bec " << m_bec_impl.show_to_string() << endmsg;
866  log << MSG::DEBUG << "phi_mod " << m_phi_mod_impl.show_to_string() << endmsg;
867  log << MSG::DEBUG << "lay_wheel " << m_lay_wheel_impl.show_to_string() << endmsg;
868  log << MSG::DEBUG << "str_lay " << m_str_lay_impl.show_to_string() << endmsg;
869  log << MSG::DEBUG << "straw " << m_straw_impl.show_to_string() << endmsg;
870  } else {
871  std::cout << " DEBUG decode index and bit fields for each level: " << std::endl;
872  std::cout << " DEBUG indet " << m_indet_impl.show_to_string() << std::endl;
873  std::cout << " DEBUG trt " << m_trt_impl.show_to_string() << std::endl;
874  std::cout << " DEBUG bec " << m_bec_impl.show_to_string() << std::endl;
875  std::cout << " DEBUG phi_mod " << m_phi_mod_impl.show_to_string() << std::endl;
876  std::cout << " DEBUG lay_wheel " << m_lay_wheel_impl.show_to_string() << std::endl;
877  std::cout << " DEBUG str_lay " << m_str_lay_impl.show_to_string() << std::endl;
878  std::cout << " DEBUG straw " << m_straw_impl.show_to_string() << std::endl;
879  }
880  return(0);
881 }
882 
883 int
885  IdentifierHash& hash_id) const {
887  return(0);
888 }
889 
890 // From hash get Identifier
891 int
893  Identifier& id,
894  const IdContext* context) const {
895  int result = 1;
896 
897  id.clear();
898 
899  size_t begin = (context) ? context->begin_index() : 0;
900  // cannot get hash if end is 0:
901  size_t end = (context) ? context->end_index() : 0;
902  if (0 == begin) {
903  // No hashes yet for ids with prefixes
904  if (m_LAYER_OR_WHEEL_INDEX == end) {
905  if (hash_id < (unsigned int) (m_module_vec.end() - m_module_vec.begin())) {
906  id = m_module_vec[hash_id];
907  result = 0;
908  }
909  } else if (m_STRAW_LAYER_INDEX == end) {
910  if (hash_id < (unsigned int) (m_straw_layer_vec.end() - m_straw_layer_vec.begin())) {
911  id = m_straw_layer_vec[hash_id];
912  result = 0;
913  }
914  } else if (m_STRAW_INDEX == end) {
915  // Do not know how to calculate straw id from hash yet!!
916  std::cout << "Do not know how to calculate straw id from hash yet!!" << std::endl;
917  }
918  }
919  return(result);
920 }
921 
922 void
924  ExpandedIdentifier& exp_id,
925  const IdContext* context) const {
926  exp_id.clear();
927  exp_id << indet_field_value()
928  << trt_field_value()
929  << barrel_ec(id)
930  << phi_module(id)
931  << layer_or_wheel(id);
932  if (!context || context->end_index() >= m_STRAW_LAYER_INDEX) {
933  exp_id << straw_layer(id);
934  }
935  if (!context || context->end_index() == m_STRAW_INDEX) {
936  exp_id << straw(id);
937  }
938 }
939 
940 int
942  IdentifierHash& hash_id,
943  const IdContext* context) const {
944  // Get the hash code from either a vec (for modules and straw
945  // layers) or calculate it (straws). For the former, we convert to
946  // compact and call get_hash again. For the latter, we calculate
947  // the hash from the Identifier.
948 
949  int result = 1;
950 
951  hash_id = 0;
952  size_t begin = (context) ? context->begin_index() : 0;
953  size_t end = (context) ? context->end_index() : 0;
954 
955  if (0 == begin) {
956  // No hashes yet for ids with prefixes
957  if (m_LAYER_OR_WHEEL_INDEX == end) {
958  hash_id = module_hash(id);
959  if (hash_id.is_valid()) result = 0;
960  } else if (m_STRAW_LAYER_INDEX == end) {
961  hash_id = straw_layer_hash(id);
962  if (hash_id.is_valid()) result = 0;
963  } else if (context && context->end_index() == m_STRAW_INDEX) {
964  // Must calculate for straw hash
965  ExpandedIdentifier new_id;
966  get_expanded_id(id, new_id);
967  hash_id = m_full_straw_range.cardinalityUpTo(new_id);
968  result = 0;
969  }
970  }
971  return(result);
972 }
973 
974 int
976  // get max from dictionary
977  ExpandedIdentifier expId;
978  IdContext module_context1 = module_context();
979 
980  get_expanded_id(id, expId, &module_context1);
981  int result = 0;
982  for (unsigned int i = 0; i < m_full_straw_layer_range.size(); ++i) {
984  if (range.match(expId)) {
986  if (not field.empty()) {
987  int max = field.get_maximum();
988  result = result > max ? result : max;
989  }
990  }
991  }
992  return(result);
993 }
994 
995 int
996 TRT_ID::straw_max(const Identifier& id) const {
997  // get max from dictionary
998  ExpandedIdentifier expId;
999  IdContext straw_layer_context1 = straw_layer_context();
1000 
1001  get_expanded_id(id, expId, &straw_layer_context1);
1002  for (unsigned int i = 0; i < m_full_straw_range.size(); ++i) {
1003  const Range& range = m_full_straw_range[i];
1004  if (range.match(expId)) {
1006  if (not field.empty()) {
1007  return(field.get_maximum());
1008  }
1009  }
1010  }
1011  return(-999); // default
1012 }
1013 
1014 void
1016  MsgStream log(m_msgSvc, "TRT_ID");
1017  int nids = 0;
1018  int nidsFailed = 0;
1019 
1021 
1022  std::cout << " vec size " << m_straw_vec.size() << " " << m_straw_hash_max << std::endl;
1023 
1024 
1025  // Check straw hashes
1026  //bool debug = false;
1027  for (unsigned int i = 0; i < m_straw_hash_max; ++i, ++nids) {
1028  Identifier id = m_straw_vec[i];
1030  IdentifierHash h2 = straw_hash(id);
1031  //IdentifierHash h2 = straw_hash(id, debug);
1032  if (h1 != h2) {
1033  std::cout << "test_trt_ids - bad match: id, bin hash, hash: "
1034  << nids << " "
1035  << show_to_string(id) << " "
1036  << h1 << " "
1037  << h2 << std::endl;
1038  nidsFailed++;
1039  //debug = true;
1040  }
1041  Identifier id1 = straw_id(h1);
1042  if (id != id1) {
1043  std::cout << "test_trt_ids - bad match: id, bin hash, hash: "
1044  << nids << " "
1045  << show_to_string(id) << " "
1046  << show_to_string(id1) << " "
1047  << h1 << " "
1048  << h2 << std::endl;
1049  nidsFailed++;
1050  }
1051  if (i % 10000 == 5) {
1052  std::cout << "test_trt_ids: id, bin hash, hash: "
1053  << nids << " "
1054  << show_to_string(id) << " "
1055  << h1 << " "
1056  << h2 << std::endl;
1057  }
1058  }
1059 
1060  std::cout << "Checked hash calculation for " << nids << " hashes and found "
1061  << nidsFailed << " failures to match between binary lookup and calculation "
1062  << std::endl;
1063 
1065 
1066  nids = 0;
1067  IdContext context = module_context();
1069  const_id_iterator last = m_module_vec.end();
1070  for (; first != last; ++first, ++nids) {
1071  Identifier id = (*first);
1072  ExpandedIdentifier exp_id;
1073  get_expanded_id(id, exp_id, &context);
1074  Identifier new_id = module_id(exp_id[m_BARREL_EC_INDEX],
1075  exp_id[m_PHI_MODULE_INDEX],
1076  exp_id[m_LAYER_OR_WHEEL_INDEX]);
1077  if (id != new_id) {
1078  if (m_msgSvc) {
1079  log << MSG::ERROR << "TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/expanded ids "
1080  << nids << " "
1081  << show_to_string(new_id) << " " << show_to_string(id) << " "
1082  << (std::string) exp_id << endmsg;
1083  } else {
1084  std::cout << " ERROR TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/expanded ids "
1085  << nids << " "
1086  << show_to_string(new_id) << " " << show_to_string(id) << " "
1087  << (std::string) exp_id << std::endl;
1088  }
1089  }
1090 
1091  IdentifierHash hashId;
1092  if (get_hash(id, hashId, &context)) {
1093  if (m_msgSvc) {
1094  log << MSG::ERROR << "Unable to set trt hash id for det elem "
1095  << show_to_string(id) << " " << nids
1096  << endmsg;
1097  } else {
1098  std::cout << " ERROR Unable to set trt hash id for det elem "
1099  << show_to_string(id) << " " << nids
1100  << std::endl;
1101  }
1102  }
1103  new_id = module_id(hashId);
1104 
1105  if (id != new_id) {
1106  if (m_msgSvc) {
1107  log << MSG::ERROR << "TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/hash ids "
1108  << nids << " "
1109  << show_to_string(new_id) << " "
1110  << show_to_string(id) << " " << MSG::hex
1111  << hashId << MSG::dec
1112  << endmsg;
1113  } else {
1114  std::cout << " ERROR TRT_ID::test_trt_ids: module new and old compacts not equal. New/old/hash ids "
1115  << nids << " "
1116  << show_to_string(new_id) << " "
1117  << show_to_string(id) << " " << std::hex
1118  << hashId << std::dec
1119  << std::endl;
1120  }
1121  }
1122  }
1123 
1124  nids = 0;
1125  context = straw_layer_context();
1126  first = m_straw_layer_vec.begin();
1127  last = m_straw_layer_vec.end();
1128  for (; first != last; ++first, ++nids) {
1129  Identifier id = (*first);
1130  ExpandedIdentifier exp_id;
1131  get_expanded_id(id, exp_id, &context);
1132  Identifier new_id = layer_id(exp_id[m_BARREL_EC_INDEX],
1133  exp_id[m_PHI_MODULE_INDEX],
1134  exp_id[m_LAYER_OR_WHEEL_INDEX],
1135  exp_id[m_STRAW_LAYER_INDEX]);
1136  if (id != new_id) {
1137  if (m_msgSvc) {
1138  log << MSG::ERROR << "TRT_ID::test_trt_ids: straw layer new and old compacts not equal. New/old/expanded ids "
1139  << show_to_string(new_id) << " " << show_to_string(id) << " "
1140  << (std::string) exp_id << endmsg;
1141  } else {
1142  std::cout << " ERROR TRT_ID::test_trt_ids: straw layer new and old compacts not equal. New/old/expanded ids "
1143  << show_to_string(new_id) << " " << show_to_string(id) << " "
1144  << (std::string) exp_id << std::endl;
1145  }
1146  }
1147 
1148  IdContext strcontext = straw_context();
1149 
1150  // test straw ids
1151  int nstraws = straw_max(id);
1152  for (int i = 0; i < nstraws; ++i) {
1153  id = straw_id(id, i);
1154  get_expanded_id(id, exp_id, &strcontext);
1155  new_id = straw_id(exp_id[m_BARREL_EC_INDEX],
1156  exp_id[m_PHI_MODULE_INDEX],
1157  exp_id[m_LAYER_OR_WHEEL_INDEX],
1158  exp_id[m_STRAW_LAYER_INDEX],
1159  exp_id[m_STRAW_INDEX]);
1160  if (id != new_id) {
1161  if (m_msgSvc) {
1162  log << MSG::ERROR << "TRT_ID::test_trt_ids: straw new and old compacts not equal. New/old/expanded ids "
1163  << show_to_string(new_id) << " " << show_to_string(id) << " "
1164  << (std::string) exp_id << endmsg;
1165  } else {
1166  std::cout << " ERROR TRT_ID::test_trt_ids: straw new and old compacts not equal. New/old/expanded ids "
1167  << show_to_string(new_id) << " " << show_to_string(id) << " "
1168  << (std::string) exp_id << std::endl;
1169  }
1170  }
1171  }
1172  }
1173 
1174  if (m_msgSvc) {
1175  log << MSG::INFO << "TRT_ID::test_trt_ids: Successful tested "
1176  << nids << " ids. "
1177  << endmsg;
1178  } else {
1179  std::cout << " INFO TRT_ID::test_trt_ids: Successful tested "
1180  << nids << " ids. "
1181  << std::endl;
1182  }
1183 }
IdDictDictionary::find_region
IdDictRegion * find_region(const std::string &region_name) const
Definition: IdDictMgr.cxx:368
TRT_ID::m_bec_impl
IdDictFieldImplementation m_bec_impl
Definition: TRT_ID.h:371
TRT_ID::test_trt_ids
void test_trt_ids(void)
Tests of packing.
Definition: TRT_ID.cxx:1015
TRT_ID::m_is_valid
bool m_is_valid
Definition: TRT_ID.h:323
AtlasDetectorID::indet_field_value
int indet_field_value() const
Provide efficient access to individual field values, for subclass idhelpers.
Definition: AtlasDetectorID.h:611
ConstRangeIterator
Definition: RangeIterator.h:46
TRT_ID::m_LAYER_OR_WHEEL_INDEX
size_type m_LAYER_OR_WHEEL_INDEX
Definition: TRT_ID.h:329
TRT_ID::m_full_straw_range
MultiRange m_full_straw_range
Definition: TRT_ID.h:333
TRT_ID::layer_id
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition: TRT_ID.h:500
IdDictDictionary::build_multirange
MultiRange build_multirange() const
Get MultiRange for full dictionary.
Definition: IdDictMgr.cxx:923
TRT_ID::m_trt_region_index
size_type m_trt_region_index
Definition: TRT_ID.h:324
TRT::Hit::straw
@ straw
Definition: HitInfo.h:82
AtlasDetectorID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
Definition: AtlasDetectorID.cxx:320
TRT_ID::m_hash_calcs
std::vector< HashCalc > m_hash_calcs
Definition: TRT_ID.h:365
TRT_ID::m_PHI_MODULE_INDEX
size_type m_PHI_MODULE_INDEX
Definition: TRT_ID.h:328
TRT_ID::module_id_checks
void module_id_checks(int barrel_ec, int phi_module, int layer_or_wheel) const
Definition: TRT_ID.cxx:71
get_generator_info.result
result
Definition: get_generator_info.py:21
TRT_ID::straw_max
int straw_max(const Identifier &id) const
Definition: TRT_ID.cxx:996
max
#define max(a, b)
Definition: cfImp.cxx:41
TRT_ID::m_full_straw_layer_range
MultiRange m_full_straw_layer_range
Definition: TRT_ID.h:334
TRT_ID::m_STRAW_LAYER_INDEX
size_type m_STRAW_LAYER_INDEX
Definition: TRT_ID.h:330
TRT_ID::reset_straw_hash_vector
void reset_straw_hash_vector(void)
Definition: TRT_ID.cxx:630
TRT_ID::initLevelsFromDict
int initLevelsFromDict(void)
Definition: TRT_ID.cxx:708
TRT_ID::m_phi_mod_impl
IdDictFieldImplementation m_phi_mod_impl
Definition: TRT_ID.h:372
TRT_ID::straw_hash
IdentifierHash straw_hash(Identifier straw_id) const
straw hash from id - optimized
Definition: TRT_ID.h:768
IdDictFieldImplementation::show_to_string
std::string show_to_string(void) const
Definition: IdDictFieldImplementation.cxx:44
TRT_ID::module_context
IdContext module_context(void) const
module id
Definition: TRT_ID.h:703
TRT_ID::m_straw_layer_vec
hash_vec m_straw_layer_vec
Definition: TRT_ID.h:341
TRT_ID::HashCalc::m_deltaPhi
size_type m_deltaPhi
Definition: TRT_ID.h:356
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
MultiRange::cardinalityUpTo
size_type cardinalityUpTo(const ExpandedIdentifier &id) const
Definition: MultiRange.cxx:88
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
TRT_ID::get_straw_layer_hash_calc
int get_straw_layer_hash_calc(const ExpandedIdentifier &id, IdentifierHash &hash_id) const
Special method for timing tests.
Definition: TRT_ID.cxx:884
TRT_ID::barrel_ec_id_checks
void barrel_ec_id_checks(int barrel_ec) const
Definition: TRT_ID.cxx:48
IdContext::end_index
size_type end_index() const
Definition: IdContext.h:46
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
TRT_ID::m_BARREL_EC_INDEX
size_type m_BARREL_EC_INDEX
Definition: TRT_ID.h:327
IdentifierField::clear
void clear()
Set methods.
Definition: IdentifierField.cxx:223
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
TRT_ID::m_trt_impl
IdDictFieldImplementation m_trt_impl
Definition: TRT_ID.h:370
AtlasDetectorID::m_msgSvc
IMessageSvc * m_msgSvc
pointer to the message service
Definition: AtlasDetectorID.h:368
TRT_ID::const_id_iterator
std::vector< Identifier >::const_iterator const_id_iterator
Definition: TRT_ID.h:89
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
AtlasDetectorID::trt_field_value
int trt_field_value() const
Definition: AtlasDetectorID.h:632
TRT_ID::m_TRT_INDEX
size_type m_TRT_INDEX
Definition: TRT_ID.h:326
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
TRT_ID::m_straw_hash_max
size_type m_straw_hash_max
Definition: TRT_ID.h:338
TRT_ID::m_str_lay_impl
IdDictFieldImplementation m_str_lay_impl
Definition: TRT_ID.h:374
TRT_ID::m_dict
const IdDictDictionary * m_dict
Definition: TRT_ID.h:332
IdDictDictionary::find_field
IdDictField * find_field(const std::string &name) const
Definition: IdDictMgr.cxx:311
CalibDbCompareRT.region_id
region_id
Definition: CalibDbCompareRT.py:68
IdDictRegion
Definition: IdDictDefs.h:433
TRT_ID::init_straw_hash_vector
void init_straw_hash_vector(void)
The init will use up ~2 MB of memory, so one should do init, use straw_id and then reset.
Definition: TRT_ID.cxx:635
TRT_ID::HashCalc::m_layerMin
size_type m_layerMin
Definition: TRT_ID.h:357
TRT_ID::module_hash
IdentifierHash module_hash(Identifier module_id) const
module hash from id - optimized
Definition: TRT_ID.h:732
TRT_ID::HashCalc::m_nStrawLayers
size_type m_nStrawLayers
Definition: TRT_ID.h:359
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TRT_ID::m_hash_calcs_barrel_indexes
std::vector< intPair > m_hash_calcs_barrel_indexes
Definition: TRT_ID.h:366
IdDictDefs.h
TRT_ID::m_STRAW_INDEX
size_type m_STRAW_INDEX
Definition: TRT_ID.h:331
TRT_ID::HashCalc::m_nstraws
size_type m_nstraws
Definition: TRT_ID.h:360
IdentifierField::match
bool match(element_type value) const
The basic match operation.
Definition: IdentifierField.cxx:70
IdDictMgr
Definition: IdDictDefs.h:32
IdContext::begin_index
size_type begin_index() const
Definition: IdContext.h:45
TRT_ID::get_id
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const override final
Create compact id from hash id (return == 0 for OK)
Definition: TRT_ID.cxx:892
TRT_ID::straw
int straw(const Identifier &id) const
Definition: TRT_ID.h:902
IdDictMgr::find_dictionary
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
Definition: IdDictMgr.cxx:163
TRT_ID::m_module_hash_max
size_type m_module_hash_max
Definition: TRT_ID.h:336
TRT_ID::straw_context
IdContext straw_context(void) const
straw id
Definition: TRT_ID.h:723
TRT_ID::get_hash
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const override final
Create hash id from compact id (return == 0 for OK)
Definition: TRT_ID.cxx:941
TRT_ID::m_INDET_INDEX
size_type m_INDET_INDEX
Definition: TRT_ID.h:325
lumiFormat.i
int i
Definition: lumiFormat.py:85
TRT_ID::straw_hash_bin
IdentifierHash straw_hash_bin(Identifier straw_id) const
Definition: TRT_ID.h:823
TRT_ID::m_straw_layer_hash_max
size_type m_straw_layer_hash_max
Definition: TRT_ID.h:337
TRT_ID::straw_layer_context
IdContext straw_layer_context(void) const
straw_layer id
Definition: TRT_ID.h:713
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TRT_ID::straw_id_checks
void straw_id_checks(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Definition: TRT_ID.cxx:97
IdDictDictionary::m_regions
std::vector< IdDictRegion * > m_regions
Definition: IdDictDefs.h:302
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
TRT_ID::m_indet_impl
IdDictFieldImplementation m_indet_impl
Definition: TRT_ID.h:369
TRT_ID::m_straw_vec
hash_vec m_straw_vec
Definition: TRT_ID.h:342
TRT_ID::HashCalc
Definition: TRT_ID.h:345
TRT_ID::get_expanded_id
void get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context=0) const
Definition: TRT_ID.cxx:923
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
TRT_ID::straw_layer
int straw_layer(const Identifier &id) const
Definition: TRT_ID.h:893
TRT_ID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override final
Set the IdDictionary.
Definition: TRT_ID.cxx:153
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
IdentifierHash::is_valid
bool is_valid() const
Check if id is in a valid state.
min
#define min(a, b)
Definition: cfImp.cxx:40
TRT_ID::m_module_vec
hash_vec m_module_vec
Definition: TRT_ID.h:340
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:266
TRT_ID::~TRT_ID
~TRT_ID(void)
IdDictDictionary::get_label_value
int get_label_value(const std::string &field, const std::string &label, int &value) const
Definition: IdDictMgr.cxx:340
TRT_ID::straw_layer_max
int straw_layer_max(const Identifier &id) const
Max values for each field (-999 == failure)
Definition: TRT_ID.cxx:975
TRT_ID::m_hash_calcs_endcap_indexes
std::vector< intPair > m_hash_calcs_endcap_indexes
Definition: TRT_ID.h:367
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
IdentifierHash.h
RangeIterator.h
TRT_ID::TRT_ID
TRT_ID(void)
Definition: TRT_ID.cxx:26
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
IdDictDictionary
Definition: IdDictDefs.h:97
TRT_ID::m_full_module_range
MultiRange m_full_module_range
Definition: TRT_ID.h:335
MultiRange::match
int match(const ExpandedIdentifier &id) const
Match an identifier.
Definition: MultiRange.cxx:57
TRT_ID::m_straw_impl
IdDictFieldImplementation m_straw_impl
Definition: TRT_ID.h:375
AtlasDetectorID::reinitialize
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
Definition: AtlasDetectorID.cxx:284
IdDictDictionary::m_name
std::string m_name
Definition: IdDictDefs.h:283
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:574
MultiRange::size
size_type size() const
Definition: MultiRange.cxx:70
DeMoScan.first
bool first
Definition: DeMoScan.py:536
DEBUG
#define DEBUG
Definition: page_access.h:11
TRT_ID::layer_id_checks
void layer_id_checks(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
Definition: TRT_ID.cxx:125
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
IdentifierField
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
Definition: IdentifierField.h:21
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
ExpandedIdentifier::clear
void clear()
Erase all fields.
TRT_ID::m_lay_wheel_impl
IdDictFieldImplementation m_lay_wheel_impl
Definition: TRT_ID.h:373
TRT_ID::HashCalc::m_hash
IdentifierHash m_hash
Definition: TRT_ID.h:355
TRT_ID::m_barrel_field
Range::field m_barrel_field
Definition: TRT_ID.h:339
IdDictField
Definition: IdDictDefs.h:316
MultiRange::cardinality
size_type cardinality() const
Computes a possible cardinality from all ranges.
Definition: MultiRange.cxx:82
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
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
IdDictRegion::m_implementation
std::vector< IdDictFieldImplementation > m_implementation
Definition: IdDictDefs.h:459
TRT_ID::init_hashes
void init_hashes(void)
Definition: TRT_ID.cxx:347
IdentifierField::add_value
void add_value(element_type value)
Definition: IdentifierField.cxx:249
TRT_ID::HashCalc::m_strLayerMin
size_type m_strLayerMin
Definition: TRT_ID.h:358
TRT_ID::straw_layer_hash
IdentifierHash straw_layer_hash(Identifier straw_layer_id) const
straw_layer hash from id - optimized
Definition: TRT_ID.h:750
TRT_ID::module_id
Identifier module_id(int barrel_ec, int phi_module, int layer_or_wheel) const
For an individual module phi sector.
Definition: TRT_ID.h:448
TRT_ID::straw_id
Identifier straw_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer, int straw) const
Three ways of getting id for a single straw:
Definition: TRT_ID.h:581
Identifier
Definition: IdentifierFieldParser.cxx:14