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