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