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