ATLAS Offline Software
CaloLVL1_ID.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 "CxxUtils/StrFormat.h"
8 #include "GaudiKernel/MsgStream.h"
9 #include "IdDict/IdDictDefs.h"
12 #include <algorithm>
13 #include <cassert>
14 #include <cmath>
15 #include <cstdio>
16 #include <iostream>
17 #include <set>
18 #include <string>
19 
20 
22 
23 
25  AtlasDetectorID("CaloLVL1_ID", "Reg_Lvl1")
26  , m_lvl1_region_index(0)
27  , m_CALO_INDEX(999)
28  , m_DETZSIDE_INDEX(999)
29  , m_SAMPLING_INDEX(999)
30  , m_REGION_INDEX(999)
31  , m_ETA_INDEX(999)
32  , m_PHI_INDEX(999)
33  , m_LAYER_INDEX(999)
34  , m_dict(nullptr)
35  , m_tower_hash_max(0)
36  , m_layer_hash_max(0)
37  , m_region_hash_max(0)
38 
39 {
40 
41 }
42 
44 
45 
46 
47 IdContext
49 {
51  return {id, 0, m_REGION_INDEX};
52 }
53 
54 IdContext
56 {
58  return {id, 0, m_PHI_INDEX};
59 }
60 
61 IdContext
63 {
65  return {id, 0, m_LAYER_INDEX};
66 }
67 
68 
69 
70 int CaloLVL1_ID::get_id (const IdentifierHash& hash_id, Identifier& id, const IdContext* context) const
71 {
72  MsgStream log(m_msgSvc, "CaloLVL1_ID" );
73  std::stringstream strm;
74  std::string strg;
75  int result = 1;
76  id.clear();
77 
78  size_t begin = (context) ? context->begin_index(): 0;
79  // cannot get hash if end is 0:
80  size_t end = (context) ? context->end_index() : 0;
81 
82  if (0 == begin) {
83  if (m_REGION_INDEX == end) {
84  if (hash_id < (unsigned int)(m_region_vec.end() - m_region_vec.begin()))
85  {
86  id = m_region_vec[hash_id];
87  result = 0;
88  }
89  else
90  {
91  strm << hash_id;
92  strg = " hash_id out of range "+strm.str();
93  if(m_msgSvc)
94  {
95  log << MSG::ERROR << strg << endmsg;
96  }
97  else
98  {
99  std::cout << strg << std::endl;
100  }
101  }
102  }
103  else if (m_PHI_INDEX == end) {
104  if (hash_id < (unsigned int)(m_tower_vec.end() - m_tower_vec.begin())) {
105  id = m_tower_vec[hash_id];
106  result = 0;
107  }
108  else
109  {
110  strm << hash_id;
111  strg = " hash_id out of range "+strm.str();
112  if(m_msgSvc)
113  {
114  log << MSG::ERROR << strg << endmsg;
115  }
116  else
117  {
118  std::cout << strg << std::endl;
119  }
120  }
121  }
122  else if(m_LAYER_INDEX == end) {
123  if (hash_id < (unsigned int)(m_layer_vec.end() - m_layer_vec.begin())) {
124  id = m_layer_vec[hash_id];
125  result = 0;
126  }
127  else
128  {
129  strm << hash_id;
130  strg = " hash_id out of range "+strm.str();
131  if(m_msgSvc)
132  {
133  log << MSG::ERROR << strg << endmsg;
134  }
135  else
136  {
137  std::cout << strg << std::endl;
138  }
139  }
140  }
141  }
142  return(result);
143 }
144 
145 int CaloLVL1_ID::get_hash (const Identifier& id, IdentifierHash& hash_id, const IdContext* context) const
146 {
147  hash_id = 0;
148  int result = 1;
149 
150  size_t begin = (context) ? context->begin_index(): 0;
151  size_t end = (context) ? context->end_index() : 0;
152 
153  if (0 == begin) {
154  if (m_REGION_INDEX == end) {
155  Identifier redId = region_id (id);
156  std::vector<Identifier>::const_iterator it = std::lower_bound(m_region_vec.begin(),m_region_vec.end(),redId);
157  if ( it != m_region_vec.end() ){
158  hash_id = it - m_region_vec.begin();
159  result = 0;
160  }
161  }
162  else if (m_PHI_INDEX == end) {
163 
164  Identifier redId = tower_id (id);
165 
166  std::vector<Identifier>::const_iterator it = std::lower_bound(m_tower_vec.begin(),m_tower_vec.end(),redId);
167  if ( it != m_tower_vec.end() ){
168  hash_id = it - m_tower_vec.begin();
169  result = 0;
170  }
171  }
172  else if (m_LAYER_INDEX == end) {
173 
174  std::vector<Identifier>::const_iterator it = std::lower_bound(m_layer_vec.begin(),m_layer_vec.end(),id);
175  if ( it != m_layer_vec.end() ){
176  hash_id = it - m_layer_vec.begin();
177  result = 0;
178  }
179  }
180 
181  else {
182  std::string errorMessage =
183  "Error in CaloLVL1_ID::get_hash, invalid context ";
184  throw CaloID_Exception(errorMessage , 10);
185  }
186  }
187 
188  return (result);
189 }
190 
191 
192 
193 
195 {
196  MsgStream log(m_msgSvc, "CaloLVL1_ID" );
197  std::string strg = "initialize_from_dictionary";
198  if(m_msgSvc) {
199  log << MSG::INFO << strg << endmsg;
200  }
201  else {
202  std::cout << strg << std::endl;
203  }
204 
205  // Check whether this helper should be reinitialized
206  if (!reinitialize(dict_mgr)) {
207  if(m_msgSvc)log << MSG::DEBUG << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
208  return (0);
209  }
210  else {
211  if(m_msgSvc)log << MSG::DEBUG << "(Re)initialize" << endmsg;
212  }
213 
214  std::stringstream strm;
215  std::stringstream strm1;
216  std::stringstream strm2;
217  std::string strg1;
218  std::string strg2;
219 
220  // init base object
221  if(AtlasDetectorID::initialize_from_dictionary(dict_mgr)) return (1);
222 
223  // Register version of the Calorimeter dictionary
224  if (register_dict_tag(dict_mgr, "Calorimeter")) return(1);
225 
226  m_dict = dict_mgr.find_dictionary ("Calorimeter");
227  if(!m_dict)
228  {
229  strg= " initialize_from_dict - cannot access LVL1Calorimeter dictionary ";
230  if(m_msgSvc) {
231  log << MSG::ERROR << strg << endmsg;
232  }
233  else
234  {
235  std::cout << strg << std::endl;
236  }
237  return(1);
238  }
239 
240  // Initialize the field indices
241  if(initLevelsFromDict()) return (1);
242 
243 
244  // Find values for the calo and LVL1 (neg) fields
245  int caloValue = -1;
246  if (m_dict->get_label_value("subdet", "Calorimeter", caloValue))
247  {
248  strm << m_dict->name();
249  strg= "Could not get value for label 'Calorimeter' of field 'subdet' in dictionary "+strm.str();
250  if(m_msgSvc)
251  {
252  log << MSG::ERROR << strg << endmsg;
253  }
254  else
255  {
256  std::cout << strg << std::endl;
257  }
258  return (1);
259  }
260 
261  int lvl1CaloValue = -1;
262  // negative half
263  // if (m_dict->get_label_value("DetZside", "negative_lvl1_side", lvl1CaloValue))
264  // positive half FLG 12 Jul 07: negative side -> problem for test beam
265  if (m_dict->get_label_value("DetZside", "positive_lvl1_side", lvl1CaloValue))
266  {
267  strm << m_dict->name();
268  // strg = " Could not get value for label 'negative_lvl1_side' of field 'DetZside in dictionary"+strm.str();
269  strg = " Could not get value for label 'positive_lvl1_side' of field 'DetZside in dictionary"+strm.str();
270  if(m_msgSvc)
271  {
272  log << MSG::ERROR << strg << endmsg;
273  }
274  else
275  {
276  std::cout << strg << std::endl;
277  }
278  return (1);
279  }
280 
281  // Set up id for region and range prefix
282  // NOTE: negative value is good enough to get multirange since the
283  // regions are symmetric in +/-eta
284  // FLG Jul 07: EXCEPT FOR CTB !!!!!!!!!!
285 
286  ExpandedIdentifier reg_id;
287  reg_id.add(caloValue);
288  reg_id.add(lvl1CaloValue);
289  Range prefix;
290  m_full_region_range = m_dict->build_multirange(reg_id, group(), prefix, "region");
291  m_full_tower_range = m_dict->build_multirange(reg_id, group(), prefix, "phi");
293 
294  // Setup the hash tables
295  if(init_hashes()) return (1);
296 
297  // Setup hash tables for finding neighbors
298  if(init_neighbors()) return (1);
299 
300  strm1 << (std::string)m_full_tower_range;
301  strm2 << (std::string)m_full_layer_range;
302  strg = " CaloLVL1_ID::initialize_from_dict : ";
303  strg1 = " tower range -> "+strm1.str();
304  strg2 = " layer range -> "+strm2.str();
305  if(m_msgSvc)
306  {
307  log << MSG::DEBUG << strg << endmsg;
308  log << MSG::DEBUG << strg1 << endmsg;
309  log << MSG::DEBUG << strg2 << endmsg;
310  }
311  else
312  {
313  std::cout << strg << std::endl;
314  std::cout << strg1 << std::endl;
315  std::cout << strg2 << std::endl;
316  }
317 
318  //std::cout << " CaloLVL1_ID::initialize_from_dict : "
319  // << std::endl;
320  //std::cout << " tower range -> " << (std::string)m_full_tower_range
321  // << std::endl;
322  //std::cout << " layer range -> " << (std::string)m_full_layer_range
323  // << std::endl;
324 
325 
326  // Setup for hash calculation
327 
328  // Regions have uniform eta/phi granularity
329  // The lookup table only needs to contain the
330  // hash offset for each region, the first eta index
331  // and the number of phi cells.
332 
333  // The implementation requires:
334 
335  // 1) a lookup table for each region containing hash offset,
336  // etamin and nphi
337  // 2) a decoder to access the "index" corresponding to the
338  // pnz/samp/reg fields. These fields use 6 bits, so the
339  // vector has a length of 64 for 16 regions.
340 
341 
342  // Create decoder for fields pnz to region
344  m_lvl1_impl.bits() +
348  m_pnz_reg_impl.set_bits(bits, bits_offset);
349  int size = (1 << bits);
350 
351 // std::cout << "pnz_reg "
352 // << m_pnz_reg_impl.show_to_string() << std::endl;
353 // std::cout << "size " << size << std::endl;
354 
355 
356  // std::cout << "pnz_reg " << m_pnz_reg_impl.decode_index() << " "
357  // << (std::string)m_pnz_reg_impl.ored_field() << " "
358  // << std::hex << m_pnz_reg_impl.mask() << " "
359  // << m_pnz_reg_impl.zeroing_mask() << " "
360  // << std::dec << m_pnz_reg_impl.shift()
361  // << " " << m_pnz_reg_impl.bits() << " " <<m_pnz_reg_impl.bits_offset()
362  // << std::endl;
363 
364 
365  // Set up vector as lookup table for hash calculation.
366  m_hash_calcs.resize(size);
367 
368  for (unsigned int i = 0; i < m_region_hash_max; ++i) {
369 
370  Identifier regId = region_id(i) ;
371 
372  HashCalc hc;
373 
374  int etamin = eta_min(regId);
375  Identifier min = tower_id ( regId, etamin, 0);
377  hc.m_hash = min_hash;
378  hc.m_etamin = etamin;
379  hc.m_nphi = phi_max(min)+1 ;
381 
382  if (m_pnz_reg_impl.unpack(min) >= size)
383  {
384  strm << size;
385  strm1 << show_to_string(min);
386  strm2 << m_pnz_reg_impl.unpack(min);
387  strg = "Min > "+strm.str();
388  strg1= " "+strm1.str();
389  strg2= " "+strm2.str();
390  if(m_msgSvc)
391  {
392  log << MSG::DEBUG << strg << endmsg;
393  log << MSG::DEBUG << strg1 << endmsg;
394  log << MSG::DEBUG << strg2 << endmsg;
395  }
396  else
397  {
398  std::cout << strg << std::endl;
399  std::cout << strg1 << std::endl;
400  std::cout << strg2 << std::endl;
401  }
402  //std::cout << "min > " << size << " "
403  // << i << " "
404  // << show_to_string(min) << " "
405  // << m_pnz_reg_impl.unpack(min) << " "
406  // << std::endl;
407  }
408  }
409 
410  // Check hash calculation
411  for (unsigned int i = 0; i < m_tower_hash_max; ++i) {
412  Identifier id = tower_id(i);
413  if (tower_hash(id) != i)
414  {
415  strm << show_to_string(id);
416  strm1 << tower_hash(id);
417  strm2 << i;
418  strg = " ***** Error tower ranges, id, hash, i = "+strm.str();
419  strg1= " , "+strm1.str();
420  strg2= " , "+strm2.str();
421  if(m_msgSvc)
422  {
423  log << MSG::ERROR << strg << endmsg;
424  log << MSG::ERROR << strg1 << endmsg;
425  log << MSG::ERROR << strg2 << endmsg;
426  }
427  else
428  {
429  std::cout << strg << std::endl;
430  std::cout << strg1 << std::endl;
431  std::cout << strg2 << std::endl;
432  }
433 
434  //std::cout << "tower ranges, id, hash, i = "
435  // << show_to_string(id) << ", "
436  // << tower_hash(id) << ", "
437  // << i
438  // << std::endl;
439  }
440  }
441 
442  return 0;
443 
444 }
445 
446 
447 
448 
449 int CaloLVL1_ID::eta_min(const Identifier regId) const
450 {
451  ExpandedIdentifier expId;
452  IdContext region_cntxt = region_context();
453  if(!get_expanded_id(regId, expId, &region_cntxt)) {
454  int result = -999;
455  for (unsigned int i = 0; i < m_full_tower_range.size(); ++i) {
456  const Range& range = m_full_tower_range[i];
457  if (range.match(expId)) {
458  const Range::field& eta_field = range[m_ETA_INDEX];
459  if (not eta_field.empty()) {
460  int etamin = eta_field.get_minimum();
461  if (-999 == result) {
462  result = etamin;
463  }
464  else {
465  if (etamin < result) result = etamin;
466  }
467  }
468  }
469  }
470  return (result);
471  }
472  return (-999);
473 }
474 
475 int CaloLVL1_ID::eta_max(const Identifier regId) const
476 {
477  ExpandedIdentifier expId;
478  IdContext region_cntxt = region_context();
479  if(!get_expanded_id(regId, expId, &region_cntxt)) {
480  int result = -999;
481  for (unsigned int i = 0; i < m_full_tower_range.size(); ++i) {
482  const Range& range = m_full_tower_range[i];
483  if (range.match(expId)) {
484  const Range::field& eta_field = range[m_ETA_INDEX];
485  if (not eta_field.empty()) {
486  int etamax = eta_field.get_maximum();
487  if (result < etamax) result = etamax;
488  }
489  }
490  }
491  return (result);
492  }
493  return (-999); // default
494 }
495 
496 int CaloLVL1_ID::phi_max(const Identifier regId) const
497 {
498  ExpandedIdentifier expId;
499  IdContext region_cntxt = region_context();
500  if(!get_expanded_id(regId, expId, &region_cntxt)) {
501  int result = -999;
502  for (unsigned int i = 0; i < m_full_tower_range.size(); ++i) {
503  const Range& range = m_full_tower_range[i];
504  if (range.match(expId)) {
505  const Range::field& phi_field = range[m_PHI_INDEX];
506  if (not phi_field.empty()) {
507  int phimax = phi_field.get_maximum();
508  if (result < phimax) result = phimax;
509  }
510  }
511  }
512  return (result);
513  }
514  return (-999); // default
515 }
516 
517 int CaloLVL1_ID::layer_max(const Identifier regId) const
518 {
519  ExpandedIdentifier expId;
520  IdContext region_cntxt = region_context();
521  if(!get_expanded_id(regId, expId, &region_cntxt)) {
522  int result = -999;
523  for (unsigned int i = 0; i < m_full_layer_range.size(); ++i) {
524  const Range& range = m_full_layer_range[i];
525  if (range.match(expId)) {
526  const Range::field& lay_field = range[m_LAYER_INDEX];
527  if (not lay_field.empty()) {
528  int laymax = lay_field.get_maximum();
529  if (result < laymax) result = laymax;
530  }
531  }
532  }
533  return (result);
534  }
535  return (-999); // default
536 }
537 
538 int
540 {
541  unsigned short index = id;
542  if (index < m_prev_phi_vec.size()) {
543  if (m_prev_phi_vec[index] == NOT_VALID_HASH) return (1);
544  prev = m_prev_phi_vec[index];
545  return (0);
546  }
547  return (1);
548 }
549 
550 int
552 {
553  unsigned short index = id;
554  if (index < m_next_phi_vec.size()) {
555  if (m_next_phi_vec[index] == NOT_VALID_HASH) return (1);
557  return (0);
558  }
559  return (1);
560 }
561 
562 int
564 {
565  unsigned short index = id;
566  if (index < m_prev_eta_vec.size()) {
567  if (m_prev_eta_vec[index] == NOT_VALID_HASH) return (1);
568  prev = m_prev_eta_vec[index];
569  return (0);
570  }
571  return (1);
572 }
573 
574 int
576 {
577  unsigned short index = id;
578  if (index < m_next_eta_vec.size()) {
579  if (m_next_eta_vec[index] == NOT_VALID_HASH) return (1);
581  return (0);
582  }
583  return (1);
584 }
585 
586 
587  int CaloLVL1_ID::get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const
588 {
589  // We assume that the context is >= region
590  exp_id.clear();
591  exp_id << calo_field_value()
592  << pos_neg_z(id)
593  << sampling(id)
594  << region(id);
595  if(context && context->end_index() >= m_ETA_INDEX) {
596  exp_id << eta(id);
597  if(context->end_index() >= m_PHI_INDEX) {
598  exp_id << phi(id);
599  if(context->end_index() >= m_LAYER_INDEX) {
600  exp_id << layer(id);
601  }
602  }
603  }
604  return (0);
605 }
606 
607 void CaloLVL1_ID::tower_id_checks ( int pos_neg_z, int sampling, int region,
608  int eta, int phi ) const
609 {
610  // Fill expanded id
612  id << pos_neg_z << sampling << region << eta << phi;
613 
614  if (!m_full_tower_range.match(id)) {
615  std::string errorMessage = "CaloLVL1_ID::tower_id() result is not OK: ID, range = "
616  + std::string(id) + " , " + (std::string)m_full_tower_range;
617  throw CaloID_Exception(errorMessage , 2);
618  }
619 }
620 
621 
623  int eta, int phi ) const
624 {
625  // Fill expanded id
627 
628  IdContext context = region_context();
629  if (get_expanded_id(regionId, id, &context)) {
630  std::string errorMessage = "CaloLVL1_ID::tower_id(regionId) result is not OK: ID= "
631  + show_to_string(regionId) ;
632  throw CaloID_Exception(errorMessage , 2);
633  }
634 
635  id << eta << phi;
636 
637  if (!m_full_tower_range.match(id)) {
638  std::string errorMessage = "CaloLVL1_ID::tower_id(regionId,field values) result is not OK: ID, range = "
639  + std::string(id) + " , " + (std::string)m_full_tower_range;
640  throw CaloID_Exception(errorMessage , 2);
641  }
642 }
643 
644 void CaloLVL1_ID::region_id_checks (int pos_neg_z, int sampling, int region)const
645 {
646  // Fill expanded id
648  id << pos_neg_z << sampling << region ;
649 
650  if (!m_full_region_range.match(id)) {
651  std::string errorMessage = "CaloLVL1_ID::region_id() result is not OK: ID, range = "
652  + std::string(id) + " , " + (std::string)m_full_region_range;
653  throw CaloID_Exception(errorMessage , 2);
654  }
655 }
656 
657 void CaloLVL1_ID::layer_id_checks ( int pos_neg_z, int sampling, int region,
658  int eta, int phi, int layer ) const
659 {
660  // Fill expanded id
662  id << pos_neg_z << sampling << region << eta << phi << layer;
663 
664  if (!m_full_layer_range.match(id)) {
665  std::string errorMessage = "CaloLVL1_ID::layer_id(field values) result is not OK: ID, range = "
666  + std::string(id) + " , " + (std::string)m_full_layer_range;
667  throw CaloID_Exception(errorMessage , 2);
668  }
669 }
670 
672  int layer ) const
673 {
674  // Fill expanded id
676 
677  IdContext context = layer_context();
678  if (get_expanded_id(towerId, id, &context)) {
679  std::string errorMessage = "CaloLVL1_ID::layer_id(towerId, layer) result is not OK: ID= "
680  + show_to_string(towerId) ;
681  throw CaloID_Exception(errorMessage , 2);
682  }
683 
684  id << layer;
685 
686  if (!m_full_layer_range.match(id)) {
687  std::string errorMessage = "CaloLVL1_ID::layer_id(towerId) result is not OK: ID, range = "
688  + (std::string)id + " , " + (std::string)m_full_layer_range;
689  throw CaloID_Exception(errorMessage , 2);
690  }
691 }
692 
693 
695 {
696  MsgStream log(m_msgSvc, "CaloLVL1_ID" );
697  std::stringstream strm;
698  std::stringstream strm1;
699  std::stringstream strm2;
700  std::stringstream strm3;
701  std::stringstream strm4;
702  std::stringstream strm5;
703  std::stringstream strm6;
704  std::stringstream strm7;
705  std::string strg;
706  std::string strg1;
707  std::string strg2;
708  std::string strg3;
709  std::string strg4;
710  std::string strg5;
711  std::string strg6;
712  std::string strg7;
713  if(!m_dict)
714  {
715  strg= "initLevelsFromDict - dictionary NOT initialized ";
716  if(m_msgSvc) {
717  log << MSG::ERROR << strg << endmsg;
718  }
719  else
720  {
721  std::cout << strg << std::endl;
722  }
723  return (1);
724  }
725 
726  // Find out which identifier field corresponds to each level.
727 
728  m_CALO_INDEX = 999 ;
729  m_DETZSIDE_INDEX = 999 ;
730  m_SAMPLING_INDEX = 999 ;
731  m_REGION_INDEX = 999 ;
732  m_ETA_INDEX = 999 ;
733  m_PHI_INDEX = 999 ;
734  m_LAYER_INDEX = 999 ;
735 
736  // Save index to a LVL1 region for unpacking - search with region name
737  IdDictRegion* reg = m_dict->find_region("Lvl1_0");
738  if (reg)
739  {
740  m_lvl1_region_index = reg->index();
741  }
742  else
743  {
744  strg = "initLevelsFromDict - unable to find lvl1 region ";
745  if(m_msgSvc) {
746  log << MSG::ERROR << strg << endmsg;
747  }
748  else
749  {
750  std::cout << strg << std::endl;
751  }
752  return (1);
753  }
754 
755  // Fing a LVL1 region
756  IdDictField* field = m_dict->find_field("subdet") ;
757  if (field) {
758  m_CALO_INDEX = field->index();
759  }
760  else
761  {
762  strg= "initLevelsFromDict - unable to find 'subdet' field ";
763  if(m_msgSvc)
764  {
765  log << MSG::ERROR << strg << endmsg;
766  }
767  else
768  {
769  std::cout << strg << std::endl;
770  }
771  return (1);
772  }
773 
774  field = m_dict->find_field("DetZside") ;
775  if (field) {
776  m_DETZSIDE_INDEX = field->index();
777  }
778  else
779  {
780  strg= "initLevelsFromDict - unable to find 'DetZside' field ";
781  if(m_msgSvc)
782  {
783  log << MSG::ERROR << strg << endmsg;
784  }
785  else
786  {
787  std::cout << strg << std::endl;
788  }
789  return (1);
790  }
791 
792  field = m_dict->find_field("LVL1sampling") ;
793  if (field) {
794  m_SAMPLING_INDEX = field->index();
795  }
796  else
797  {
798  strg= "initLevelsFromDict - unable to find 'LVL1sampling' field ";
799  if(m_msgSvc) {
800  log << MSG::ERROR << strg << endmsg;
801  }
802  else
803  {
804  std::cout << strg << std::endl;
805  }
806  return (1);
807  }
808 
809  field = m_dict->find_field("region") ;
810  if (field) {
811  m_REGION_INDEX = field->index();
812  }
813  else
814  {
815 
816  strg="initLevelsFromDict - unable to find 'region' field ";
817  if(m_msgSvc)
818  {
819  log << MSG::ERROR << strg << endmsg;
820  }
821  else
822  {
823  std::cout << strg << std::endl;
824  }
825  return (1);
826  }
827 
828  /* std::cout << "m_region= " << m_REGION_INDEX << std::endl; */
829 
830  field = m_dict->find_field("eta") ;
831  if (field) {
832  m_ETA_INDEX = field->index();
833  }
834  else
835  {
836  strg= "initLevelsFromDict - unable to find 'eta' field ";
837  if(m_msgSvc)
838  {
839  log << MSG::ERROR << strg << endmsg;
840  }
841  else
842  {
843  std::cout << strg << std::endl;
844  }
845  return (1);
846  }
847 
848  field = m_dict->find_field("phi") ;
849  if (field) {
850  m_PHI_INDEX = field->index();
851  }
852  else
853  {
854 
855  strg= "initLevelsFromDict - unable to find 'phi' field ";
856  if(m_msgSvc)
857  {
858  log << MSG::ERROR << strg << endmsg;
859  }
860  else
861  {
862  std::cout << strg << std::endl;
863  }
864  return (1);
865  }
866 
867  field = m_dict->find_field("layer") ;
868  if (field) {
869  m_LAYER_INDEX = field->index();
870  }
871  else
872  {
873  strg= "initLevelsFromDict - unable to find 'layer' field ";
874  if(m_msgSvc) {
875  log << MSG::ERROR << strg << endmsg;
876  }
877  else
878  {
879  std::cout << strg << std::endl;
880  }
881  return (1);
882  }
883 
884  // Set the field implementations
885 
887 
888  m_calo_impl = region.implementation(m_CALO_INDEX);
889  m_lvl1_impl = region.implementation(m_DETZSIDE_INDEX);
890  m_sampling_impl = region.implementation(m_SAMPLING_INDEX);
891  m_region_impl = region.implementation(m_REGION_INDEX);
892  m_eta_impl = region.implementation(m_ETA_INDEX);
893  m_phi_impl = region.implementation(m_PHI_INDEX);
894  m_layer_impl = region.implementation(m_LAYER_INDEX);
895 
896  if (!m_quiet) {
897  strm1 << m_calo_impl.show_to_string();
898  strm2 << m_lvl1_impl.show_to_string();
899  strm3 << m_sampling_impl.show_to_string();
900  strm4 << m_region_impl.show_to_string();
901  strm5 << m_eta_impl.show_to_string();
902  strm6 << m_phi_impl.show_to_string();
903  strm7 << m_layer_impl.show_to_string();
904  strg = "decode index and bit fields for each level: ";
905  strg1= "calo "+strm1.str();
906  strg2= "detzside "+strm2.str();
907  strg3= "samp "+strm3.str();
908  strg4= "reg "+strm4.str();
909  strg5= "eta "+strm5.str();
910  strg6= "phi "+strm6.str();
911  strg7= "layer "+strm7.str();
912  if(m_msgSvc)
913  {
914  log << MSG::DEBUG << strg << endmsg;
915  log << MSG::DEBUG << strg1 << endmsg;
916  log << MSG::DEBUG << strg2 << endmsg;
917  log << MSG::DEBUG << strg3 << endmsg;
918  log << MSG::DEBUG << strg4 << endmsg;
919  log << MSG::DEBUG << strg5 << endmsg;
920  log << MSG::DEBUG << strg6 << endmsg;
921  log << MSG::DEBUG << strg7 << endmsg;
922  }
923  else
924  {
925  std::cout << strg << std::endl;
926  std::cout << strg1 << std::endl;
927  std::cout << strg2 << std::endl;
928  std::cout << strg3 << std::endl;
929  std::cout << strg4 << std::endl;
930  std::cout << strg5 << std::endl;
931  std::cout << strg6 << std::endl;
932  std::cout << strg7 << std::endl;
933  }
934  }
935 
936  return(0) ;
937 }
938 
939 
941 {
942  MsgStream log(m_msgSvc, "CaloLVL1_ID" );
943  std::stringstream strm;
944  std::stringstream strm1;
945  std::stringstream strm2;
946  std::string strg;
947  std::string strg1;
948  std::string strg2;
949  // tower hash
952  unsigned int nids = 0;
953  std::set<Identifier> ids;
954  for (unsigned int i = 0; i < m_full_tower_range.size(); ++i) {
955  const Range& range = m_full_tower_range[i];
957  auto first = rit.begin();
958  auto last = rit.end();
959  for (; first != last; ++first) {
960  const ExpandedIdentifier& exp_id = (*first);
961  Identifier tow_id = tower_id ( exp_id[m_DETZSIDE_INDEX],
962  exp_id[m_SAMPLING_INDEX],
963  exp_id[m_REGION_INDEX] ,
964  exp_id[m_ETA_INDEX] ,
965  exp_id[m_PHI_INDEX] ) ;
966  if(!(ids.insert(tow_id)).second)
967  {
968  if(m_msgSvc)
969  {
970  log << MSG::ERROR << " init_hashes "
971  << " duplicated id for TT id. nids= " << nids
972  << " compact Id " << endmsg;
973  }
974  else
975  {
976  std::cout << " CaloLVL1_ID::init_hashes "
977  << " Error: duplicated id for TT id. nids= " << nids
978  << " compact Id " ;
979  (*first).show();
980  std::cout << " " << show_to_string(tow_id) << std::endl;
981  }
982  }
983  nids++;
984  }
985  }
986  if(ids.size() != m_tower_hash_max)
987  {
988  if( m_msgSvc)
989  {
990  log << MSG::ERROR << " init_hashes "
991  << " set size NOT EQUAL to hash max. size " << ids.size()
992  << " hash max " << m_tower_hash_max
993  << endmsg;
994  }
995  else
996  {
997  std::cout << " CaloLVL1_ID::init_hashes "
998  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
999  << " hash max " << m_tower_hash_max
1000  << std::endl;
1001  }
1002  return (1);
1003  }
1004 
1005  nids=0;
1006  std::set<Identifier>::const_iterator first = ids.begin();
1007  std::set<Identifier>::const_iterator last = ids.end();
1008  for (;first != last && nids < m_tower_vec.size(); ++first) {
1009  m_tower_vec[nids] = (*first) ;
1010  nids++;
1011  }
1012 
1013  // layer hash
1015  m_layer_vec.resize(m_layer_hash_max);
1016  nids = 0;
1017  ids.clear();
1018  for (unsigned int i = 0; i < m_full_layer_range.size(); ++i)
1019  {
1020  const Range& range = m_full_layer_range[i];
1022  auto first = rit.begin();
1023  auto last = rit.end();
1024  for (; first != last; ++first)
1025  {
1026  const ExpandedIdentifier& exp_id = (*first);
1027  Identifier lay_id = layer_id ( exp_id[m_DETZSIDE_INDEX],
1028  exp_id[m_SAMPLING_INDEX],
1029  exp_id[m_REGION_INDEX] ,
1030  exp_id[m_ETA_INDEX] ,
1031  exp_id[m_PHI_INDEX] ,
1032  exp_id[m_LAYER_INDEX] );
1033  if(!(ids.insert(lay_id)).second)
1034  {
1035  if(m_msgSvc)
1036  {
1037  log << MSG::ERROR << " init_hashes "
1038  << " duplicated id for extended TT id. nids= " << nids
1039  << " compact Id " << show_to_string(lay_id) << endmsg;
1040  }
1041  else
1042  {
1043  std::cout << " CaloLVL1_ID::init_hashes "
1044  << " Error: duplicated id for extended TT id. nids= " << nids
1045  << " compact Id " ;
1046  (*first).show();
1047  std::cout << show_to_string(lay_id) << std::endl;
1048  }
1049  }
1050  nids++;
1051  }
1052  }
1053  if(ids.size() != m_layer_hash_max)
1054  {
1055  if( m_msgSvc)
1056  {
1057  log << MSG::ERROR << " init_hashes "
1058  << " set size NOT EQUAL to hash max. size " << ids.size()
1059  << " hash max " << m_layer_hash_max
1060  << endmsg;
1061  }
1062  else
1063  {
1064  std::cout << " CaloLVL1_ID::init_hashes "
1065  << " Error: set size NOT EQUAL to hash max. size " << ids.size()
1066  << " hash max " << m_layer_hash_max
1067  << std::endl;
1068  }
1069  return (1);
1070  }
1071 
1072  nids=0;
1073  first = ids.begin();
1074  last = ids.end();
1075  for (;first != last && nids < m_layer_vec.size(); ++first) {
1076  m_layer_vec[nids] = (*first) ;
1077  nids++;
1078  }
1079 
1080 
1081  // region hash
1084  nids = 0;
1085  ids.clear();
1086  for (unsigned int i = 0; i < m_full_region_range.size(); ++i) {
1087  const Range& range = m_full_region_range[i];
1089  auto first = rit.begin();
1090  auto last = rit.end();
1091  for (; first != last; ++first) {
1092  const ExpandedIdentifier& exp_id = (*first);
1093  Identifier reg_id = region_id ( exp_id[m_DETZSIDE_INDEX],
1094  exp_id[m_SAMPLING_INDEX],
1095  exp_id[m_REGION_INDEX] );
1096  if(!(ids.insert(reg_id)).second)
1097  {
1098  if(m_msgSvc)
1099  {
1100  log << MSG::ERROR << " LArEM_ID::init_hashes "
1101  << " duplicated id for region id. nids= " << nids
1102  << " compact Id " << endmsg;
1103  }
1104  else
1105  {
1106  std::cout << " LArEM_ID::init_hashes "
1107  << " Error: duplicated id for region id. nids= " << nids
1108  << " compact Id " ;
1109  (*first).show();
1110  std::cout << " " << show_to_string(reg_id) << std::endl;
1111  std::cout << std::endl;
1112  }
1113  }
1114  nids++;
1115  }
1116  }
1117  if(ids.size() != m_region_hash_max)
1118  {
1119  if(m_msgSvc)
1120  {
1121  log << MSG::ERROR << " LArEM_ID::init_hashes "
1122  << " set size NOT EQUAL to region hash max. size " << ids.size()
1123  << " region hash max " << m_region_hash_max
1124  << endmsg;
1125  }
1126  else
1127  {
1128  std::cout << " LArEM_ID::init_hashes "
1129  << " Error: set size NOT EQUAL to region hash max. size " << ids.size()
1130  << " region hash max " << m_region_hash_max
1131  << std::endl;
1132  }
1133  return (1);
1134  }
1135  nids=0;
1136  first = ids.begin();
1137  last = ids.end();
1138  for (;first != last && nids < m_region_vec.size(); ++first) {
1139  m_region_vec[nids] = (*first) ;
1140  nids++;
1141  }
1142 
1143  return (0);
1144 }
1145 
1146 
1147 
1149 {
1150  MsgStream log(m_msgSvc, "CaloLVL1_ID" );
1151  // std::cout << " CaloLVL1_ID::init_neighbors " << std::endl;
1152  // std::cout << " m_tower_hash_max, NOT_VALID_HASH = " << m_tower_hash_max << " " << NOT_VALID_HASH << std::endl;
1153 
1158  for (unsigned int i = 0; i < m_full_tower_range.size(); ++i) {
1159  const Range& range = m_full_tower_range[i];
1161  const Range::field& eta_field = range[m_ETA_INDEX];
1162  const Range::field& phi_field = range[m_PHI_INDEX];
1163  auto first = rit.begin();
1164  auto last = rit.end();
1165  for (; first != last; ++first) {
1166  const ExpandedIdentifier& exp_id = (*first);
1167  ExpandedIdentifier::element_type previous_eta;
1169  ExpandedIdentifier::element_type previous_phi;
1171  bool peta = eta_field.get_previous(exp_id[m_ETA_INDEX], previous_eta);
1172  bool neta = eta_field.get_next (exp_id[m_ETA_INDEX], next_eta);
1173  bool pphi = phi_field.get_previous(exp_id[m_PHI_INDEX], previous_phi);
1174  bool nphi = phi_field.get_next (exp_id[m_PHI_INDEX], next_phi);
1175 
1176  IdContext tcontext = tower_context();
1177 
1178  // Get and save region id to speed things up
1179  Identifier reg_id = region_id ( exp_id[m_DETZSIDE_INDEX],
1180  exp_id[m_SAMPLING_INDEX],
1181  exp_id[m_REGION_INDEX] );
1182 
1183  // First get primary hash id
1184  IdentifierHash hash_id;
1185  Identifier id = tower_id (reg_id,
1186  exp_id[m_ETA_INDEX],
1187  exp_id[m_PHI_INDEX]);
1188  if (get_hash(id, hash_id,&tcontext))
1189  {
1190  if( m_msgSvc )
1191  {
1192  log << MSG::ERROR << " init_neighbors - unable to get hash, compact = " << endmsg;
1193  }
1194  else
1195  {
1196  std::cout << " CaloLVL1_ID::init_neighbors - unable to get hash, compact = ";
1197  exp_id.show();
1198  std::cout << std::endl;
1199  }
1200  return (1);
1201  }
1202 
1203  // index for the subsequent arrays
1204  unsigned short index = hash_id;
1205  assert (hash_id < m_prev_phi_vec.size());
1206  assert (hash_id < m_next_phi_vec.size());
1207  assert (hash_id < m_prev_eta_vec.size());
1208  assert (hash_id < m_next_eta_vec.size());
1209 
1210  if (pphi) {
1211  // Get previous phi hash id
1212  id = tower_id (reg_id,
1213  exp_id[m_ETA_INDEX],
1214  previous_phi);
1215  // forward to compact -> hash
1216  if (get_hash(id, hash_id,&tcontext))
1217  {
1218  if( m_msgSvc )
1219  {
1220  log << MSG::ERROR << " init_neighbors - unable to get previous phi hash, exp/compact " << endmsg;
1221  }
1222  else
1223  {
1224  std::cout << " CaloLVL1_ID::init_neighbors - unable to get previous phi hash, exp/compact ";
1225  exp_id.show();
1226  std::cout << " "
1227  << std::endl;
1228  }
1229  return (1);
1230  }
1231  m_prev_phi_vec[index] = hash_id;
1232  }
1233 
1234  if (nphi) {
1235  // Get next phi hash id
1236  id = tower_id (reg_id,
1237  exp_id[m_ETA_INDEX],
1238  next_phi);
1239  // forward to compact -> hash
1240  if (get_hash(id, hash_id,&tcontext))
1241  {
1242  if(m_msgSvc)
1243  {
1244  log << MSG::ERROR << " init_neighbors - unable to get next phi hash, exp/compact "<<endmsg;
1245  }
1246  else
1247  {
1248  std::cout << " CaloLVL1_ID::init_neighbors - unable to get next phi hash, exp/compact ";
1249  exp_id.show();
1250  std::cout << " "
1251  << std::endl;
1252  }
1253  return (1);
1254  }
1255  m_next_phi_vec[index] = hash_id;
1256  }
1257  if (peta) {
1258  // Get previous eta hash id
1259  id = tower_id (reg_id,
1260  previous_eta,
1261  exp_id[m_PHI_INDEX]);
1262  // forward to compact -> hash
1263  if (get_hash(id, hash_id,&tcontext))
1264  {
1265  if( m_msgSvc )
1266  {
1267  log << MSG::ERROR << " init_neighbors - unable to get previous eta hash, exp/compact "<< endmsg;
1268  }
1269  else
1270  {
1271  std::cout << " CaloLVL1_ID::init_neighbors - unable to get previous eta hash, exp/compact ";
1272  exp_id.show();
1273  std::cout << " "
1274  << std::endl;
1275  }
1276  return (1);
1277  }
1278  m_prev_eta_vec[index] = hash_id;
1279  }
1280 
1281  if (neta) {
1282  // Get next eta hash id
1283  id = tower_id (reg_id,
1284  next_eta,
1285  exp_id[m_PHI_INDEX]);
1286  // forward to compact -> hash
1287  if (get_hash(id, hash_id,&tcontext))
1288  {
1289  if( m_msgSvc )
1290  {
1291  log << MSG::ERROR << " init_neighbors - unable to get next eta hash, exp/compact ";
1292  }
1293  else
1294  {
1295  std::cout << " CaloLVL1_ID::init_neighbors - unable to get next eta hash, exp/compact ";
1296  exp_id.show();
1297  std::cout << " "
1298  << std::endl;
1299  }
1300  return (1);
1301  }
1302  m_next_eta_vec[index] = hash_id;
1303  } // end neta cond
1304  } // end loop on identifiers
1305  } // end loop on ranges
1306  return (0);
1307 }
1308 
1309 
IdDictDictionary::find_region
IdDictRegion * find_region(const std::string &region_name) const
Definition: IdDictDictionary.cxx:92
CaloLVL1_ID::get_next_in_eta
int get_next_in_eta(const IdentifierHash &id, IdentifierHash &next) const
access to hashes for neighbours in eta – towers only (no extended) return == 0 for neighbours found
Definition: CaloLVL1_ID.cxx:575
ConstRangeIterator
Definition: RangeIterator.h:46
CaloLVL1_ID::m_next_phi_vec
std::vector< unsigned short > m_next_phi_vec
Definition: CaloLVL1_ID.h:367
CaloLVL1_ID::HashCalc::m_nphi
size_type m_nphi
Definition: CaloLVL1_ID.h:385
IdDictDictionary::build_multirange
MultiRange build_multirange() const
Get MultiRange for full dictionary.
Definition: IdDictDictionary.cxx:291
CaloLVL1_ID::layer_max
int layer_max(const Identifier regId) const
max value of phi index (-999 == failure)
Definition: CaloLVL1_ID.cxx:517
AtlasDetectorID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
Definition: AtlasDetectorID.cxx:250
get_generator_info.result
result
Definition: get_generator_info.py:21
CaloLVL1_ID::m_PHI_INDEX
size_type m_PHI_INDEX
Definition: CaloLVL1_ID.h:352
CaloLVL1_ID::get_expanded_id
int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
Definition: CaloLVL1_ID.cxx:587
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
CaloLVL1_ID::layer_context
IdContext layer_context() const
access to IdContext's which define which levels of fields are contained in the id
Definition: CaloLVL1_ID.cxx:62
CaloLVL1_ID::layer_id_checks
void layer_id_checks(int pos_neg_z, int sampling, int region, int eta, int phi, int layer) const
Definition: CaloLVL1_ID.cxx:657
CaloID_Exception
Exception class for Calo Identifiers.
Definition: CaloID_Exception.h:20
CaloLVL1_ID::m_prev_eta_vec
std::vector< unsigned short > m_prev_eta_vec
Definition: CaloLVL1_ID.h:368
CaloLVL1_ID::m_REGION_INDEX
size_type m_REGION_INDEX
Definition: CaloLVL1_ID.h:350
IdDictFieldImplementation::show_to_string
std::string show_to_string(void) const
Definition: IdDictFieldImplementation.cxx:38
CaloLVL1_ID::m_sampling_impl
IdDictFieldImplementation m_sampling_impl
Definition: CaloLVL1_ID.h:393
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
index
Definition: index.py:1
IdDictDictionary::region
const IdDictRegion & region(size_t i) const
Region at index i.
Definition: IdDictDictionary.h:341
IdentifierField::get_minimum
element_type get_minimum() const
Query the values.
Definition: IdentifierField.h:121
CaloLVL1_ID::phi_max
int phi_max(const Identifier regId) const
min value of phi index (-999 == failure)
Definition: CaloLVL1_ID.cxx:496
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
CaloLVL1_ID::m_phi_impl
IdDictFieldImplementation m_phi_impl
Definition: CaloLVL1_ID.h:396
IdContext::end_index
size_type end_index() const
Definition: IdContext.h:46
AtlasDetectorID::calo_field_value
int calo_field_value() const
Definition: AtlasDetectorID.h:618
CaloLVL1_ID::m_region_impl
IdDictFieldImplementation m_region_impl
Definition: CaloLVL1_ID.h:394
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
ExpandedIdentifier::add
void add(element_type value)
Append a value into a new field.
CaloLVL1_ID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
initialization from the identifier dictionary
Definition: CaloLVL1_ID.cxx:194
skel.it
it
Definition: skel.GENtoEVGEN.py:407
CaloLVL1_ID::m_region_vec
std::vector< Identifier > m_region_vec
Definition: CaloLVL1_ID.h:365
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
CaloLVL1_ID::region
int region(const Identifier id) const
return region according to :
Definition: CaloLVL1_ID.h:647
ExpandedIdentifier::show
void show() const
Send to std::cout.
Definition: DetectorDescription/Identifier/src/ExpandedIdentifier.cxx:60
CaloLVL1_ID::m_dict
const IdDictDictionary * m_dict
Definition: CaloLVL1_ID.h:355
AtlasDetectorID::m_msgSvc
IMessageSvc * m_msgSvc
pointer to the message service
Definition: AtlasDetectorID.h:369
IdentifierField::get_maximum
element_type get_maximum() const
Definition: IdentifierField.h:130
CaloLVL1_ID::m_layer_impl
IdDictFieldImplementation m_layer_impl
Definition: CaloLVL1_ID.h:397
CaloLVL1_ID::region_id
Identifier region_id(int pos_neg_z, int sampling, int region) const
build a region (of towers) identifier
Definition: CaloLVL1_ID.h:502
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
IdDictDictionary::name
const std::string & name() const
Dictionary name.
Definition: IdDictDictionary.h:323
IdDictFieldImplementation::unpack
int unpack(Identifier id) const
Identifier manipulation methods.
Definition: IdDictFieldImplementation.h:147
CaloLVL1_ID::layer
int layer(const Identifier id) const
return layer according to :
Definition: CaloLVL1_ID.h:665
IdDictDictionary::find_field
IdDictField * find_field(const std::string &name) const
Definition: IdDictDictionary.cxx:36
IdDictRegion
Definition: IdDictRegion.h:20
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
IdDictDefs.h
CaloLVL1_ID::get_prev_in_eta
int get_prev_in_eta(const IdentifierHash &id, IdentifierHash &prev) const
access to hashes for neighbours in eta – towers only (no extended) return == 0 for neighbours found
Definition: CaloLVL1_ID.cxx:563
CaloLVL1_ID::m_full_layer_range
MultiRange m_full_layer_range
Definition: CaloLVL1_ID.h:359
CaloLVL1_ID::layer_id
Identifier layer_id(int pos_neg_z, int sampling, int region, int eta, int phi, int layer) const
build a layer identifier
Definition: CaloLVL1_ID.h:530
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CaloLVL1_ID::phi
int phi(const Identifier id) const
return phi according to :
Definition: CaloLVL1_ID.h:659
CaloLVL1_ID::eta_max
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
Definition: CaloLVL1_ID.cxx:475
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
IdDictMgr
Definition: IdDictMgr.h:14
CaloLVL1_ID::m_next_eta_vec
std::vector< unsigned short > m_next_eta_vec
Definition: CaloLVL1_ID.h:369
IdContext::begin_index
size_type begin_index() const
Definition: IdContext.h:45
CaloLVL1_ID::m_eta_impl
IdDictFieldImplementation m_eta_impl
Definition: CaloLVL1_ID.h:395
StrFormat.h
Provide helper functions to create formatted strings.
IdDictMgr::find_dictionary
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
Definition: IdDictMgr.cxx:115
CaloLVL1_ID::~CaloLVL1_ID
virtual ~CaloLVL1_ID()
CaloLVL1_ID::m_LAYER_INDEX
size_type m_LAYER_INDEX
Definition: CaloLVL1_ID.h:353
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
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
CaloLVL1_ID::init_neighbors
int init_neighbors()
Definition: CaloLVL1_ID.cxx:1148
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloLVL1_ID::m_hash_calcs
std::vector< HashCalc > m_hash_calcs
Definition: CaloLVL1_ID.h:387
CaloLVL1_ID::HashCalc
small class holding the starting hash value, the min eta and the number of phi bins of each region
Definition: CaloLVL1_ID.h:377
IdDictFieldImplementation::set_bits
void set_bits(size_type bits, size_type bits_offset)
Definition: IdDictFieldImplementation.h:278
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
CaloLVL1_ID::m_prev_phi_vec
std::vector< unsigned short > m_prev_phi_vec
Definition: CaloLVL1_ID.h:366
CaloLVL1_ID::m_tower_vec
std::vector< Identifier > m_tower_vec
Definition: CaloLVL1_ID.h:363
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CaloLVL1_ID::eta_min
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
Definition: CaloLVL1_ID.cxx:449
CaloLVL1_ID::get_next_in_phi
int get_next_in_phi(const IdentifierHash &id, IdentifierHash &next) const
access to hashes for neighbours in phi – towers only (no extended) return == 0 for neighbours found
Definition: CaloLVL1_ID.cxx:551
IdDictFieldImplementation::bits_offset
size_type bits_offset() const
Definition: IdDictFieldImplementation.h:208
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
CaloLVL1_ID::init_hashes
int init_hashes()
Definition: CaloLVL1_ID.cxx:940
CaloLVL1_ID::HashCalc::m_etamin
size_type m_etamin
Definition: CaloLVL1_ID.h:384
CaloLVL1_ID::get_hash
virtual int get_hash(const Identifier &id, IdentifierHash &hash_id, const IdContext *context=0) const
create hash id from compact id (return == 0 for OK)
Definition: CaloLVL1_ID.cxx:145
IdentifierField::get_next
bool get_next(element_type current, element_type &next) const
Definition: IdentifierField.cxx:149
AtlasDetectorID::group
const std::string & group() const
Group name for this helper.
Definition: AtlasDetectorID.cxx:27
ConstRangeIterator::begin
ConstRangeIterator begin() const
Definition: RangeIterator.cxx:18
CaloLVL1_ID::m_DETZSIDE_INDEX
size_type m_DETZSIDE_INDEX
Definition: CaloLVL1_ID.h:348
AtlasDetectorID::m_quiet
bool m_quiet
If true, suppress DEBUG/INFO messages.
Definition: AtlasDetectorID.h:372
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:196
CaloLVL1_ID::initLevelsFromDict
int initLevelsFromDict()
Definition: CaloLVL1_ID.cxx:694
IdDictDictionary::get_label_value
int get_label_value(const std::string &field, const std::string &label, int &value) const
Definition: IdDictDictionary.cxx:64
CaloLVL1_ID::m_lvl1_impl
IdDictFieldImplementation m_lvl1_impl
Definition: CaloLVL1_ID.h:392
CaloLVL1_ID::m_SAMPLING_INDEX
size_type m_SAMPLING_INDEX
Definition: CaloLVL1_ID.h:349
CaloLVL1_ID::get_id
virtual int get_id(const IdentifierHash &hash_id, Identifier &id, const IdContext *context=0) const
create compact id from hash id (return == 0 for OK)
Definition: CaloLVL1_ID.cxx:70
CxxUtils::strformat
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
Definition: StrFormat.cxx:49
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:239
CaloLVL1_ID::m_region_hash_max
size_type m_region_hash_max
Definition: CaloLVL1_ID.h:362
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
IdentifierHash.h
CaloLVL1_ID::m_pnz_reg_impl
IdDictFieldImplementation m_pnz_reg_impl
Definition: CaloLVL1_ID.h:399
CaloLVL1_ID::get_prev_in_phi
int get_prev_in_phi(const IdentifierHash &id, IdentifierHash &prev) const
access to hashes for neighbours in phi – towers only (no extended) return == 0 for neighbours found
Definition: CaloLVL1_ID.cxx:539
RangeIterator.h
CaloLVL1_ID::tower_hash_binary_search
IdentifierHash tower_hash_binary_search(Identifier towerId) const
create hash id from tower id – method NOT optimised, please use tower_hash() above
Definition: CaloLVL1_ID.h:735
CaloLVL1_ID::eta
int eta(const Identifier id) const
return eta according to :
Definition: CaloLVL1_ID.h:653
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
AtlasDetectorID::calo_exp
ExpandedIdentifier calo_exp(void) const
Definition: AtlasDetectorID.h:508
CaloLVL1_ID::m_ETA_INDEX
size_type m_ETA_INDEX
Definition: CaloLVL1_ID.h:351
CaloLVL1_ID::m_lvl1_region_index
size_type m_lvl1_region_index
Definition: CaloLVL1_ID.h:346
CaloLVL1_ID::m_full_region_range
MultiRange m_full_region_range
Definition: CaloLVL1_ID.h:357
CaloLVL1_ID::region_id_checks
void region_id_checks(int pos_neg_z, int sampling, int region) const
Definition: CaloLVL1_ID.cxx:644
CaloLVL1_ID::pos_neg_z
int pos_neg_z(const Identifier id) const
return pos_neg_z according to :
Definition: CaloLVL1_ID.h:635
CaloLVL1_ID::tower_context
IdContext tower_context() const
access to IdContext's which define which levels of fields are contained in the id
Definition: CaloLVL1_ID.cxx:55
MultiRange::match
int match(const ExpandedIdentifier &id) const
Match an identifier.
Definition: MultiRange.cxx:57
CaloLVL1_ID::m_layer_vec
std::vector< Identifier > m_layer_vec
Definition: CaloLVL1_ID.h:364
DeMoScan.index
string index
Definition: DeMoScan.py:362
AtlasDetectorID::reinitialize
bool reinitialize(const IdDictMgr &dict_mgr)
Test whether an idhelper should be reinitialized based on the change of tags.
Definition: AtlasDetectorID.cxx:216
CaloLVL1_ID::tower_id_checks
void tower_id_checks(int pos_neg_z, int sampling, int region, int eta, int phi) const
Definition: CaloLVL1_ID.cxx:607
CaloLVL1_ID.h
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:360
CaloLVL1_ID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: CaloLVL1_ID.h:320
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
MultiRange::size
size_type size() const
Definition: MultiRange.cxx:70
DeMoScan.first
bool first
Definition: DeMoScan.py:534
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
IdentifierField
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
Definition: IdentifierField.h:83
CaloLVL1_ID::sampling
int sampling(const Identifier id) const
return sampling according to :
Definition: CaloLVL1_ID.h:641
CaloLVL1_ID::m_calo_impl
IdDictFieldImplementation m_calo_impl
Definition: CaloLVL1_ID.h:391
CaloLVL1_ID::HashCalc::m_hash
IdentifierHash m_hash
Definition: CaloLVL1_ID.h:383
ExpandedIdentifier::clear
void clear()
Erase all fields.
IdentifierField::get_previous
bool get_previous(element_type current, element_type &previous) const
Returns false if previous/next is at end of range, or not possible.
Definition: IdentifierField.cxx:106
CaloLVL1_ID::m_CALO_INDEX
size_type m_CALO_INDEX
Definition: CaloLVL1_ID.h:347
IdDictRegion::index
size_t index() const
Definition: IdDictRegion.h:119
CaloLVL1_ID::tower_hash
IdentifierHash tower_hash(Identifier towerId) const
create hash id from tower id
Definition: CaloLVL1_ID.h:728
ConstRangeIterator::end
ConstRangeIterator end() const
Definition: RangeIterator.cxx:32
IdDictField
Definition: IdDictField.h:15
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
CaloLVL1_ID::m_layer_hash_max
size_type m_layer_hash_max
Definition: CaloLVL1_ID.h:361
CaloLVL1_ID::m_full_tower_range
MultiRange m_full_tower_range
Definition: CaloLVL1_ID.h:358
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137
ExpandedIdentifier::element_type
int element_type
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:106
CaloLVL1_ID::tower_id
Identifier tower_id(int pos_neg_z, int sampling, int region, int eta, int phi) const
build a tower identifier
Definition: CaloLVL1_ID.h:429
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
CaloLVL1_ID::region_context
IdContext region_context() const
access to IdContext's which define which levels of fields are contained in the id
Definition: CaloLVL1_ID.cxx:48
CaloLVL1_ID::m_tower_hash_max
size_type m_tower_hash_max
Definition: CaloLVL1_ID.h:360
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:52
CaloLVL1_ID::CaloLVL1_ID
CaloLVL1_ID()
Definition: CaloLVL1_ID.cxx:24
IdDictFieldImplementation::size_type
Identifier::size_type size_type
Definition: IdDictFieldImplementation.h:62
IdDictFieldImplementation::bits
size_type bits() const
Definition: IdDictFieldImplementation.h:202
Identifier
Definition: IdentifierFieldParser.cxx:14