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