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