ATLAS Offline Software
LArMiniFCAL_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"
14 
15 #include "GaudiKernel/MsgStream.h"
16 
17 #include <cmath>
18 #include <fstream>
19 #include <iostream>
20 #include <set>
21 #include <sstream>
22 #include <stdexcept>
23 #include <string>
24 
25 #include "CxxUtils/StrFormat.h"
26 
28 
29 
31  :
32  CaloIDHelper ("LArMiniFCAL_ID", "lar_mini_fcal"),
33  m_is_initialized(false),
34  m_fcal_region_index(0),
35  m_LAR_INDEX(999),
36  m_MiniFCAL_INDEX(999),
37  m_POSNEG_INDEX(999),
38  m_MODULE_INDEX(999),
39  m_DEPTH_INDEX(999),
40  m_ETA_INDEX(999),
41  m_PHI_INDEX(999),
42  m_two_sym_sides(1)
43 {}
44 
46 
47 int LArMiniFCAL_ID::eta_min(const Identifier modId) const
48 {
49  ExpandedIdentifier expId;
50  IdContext module_cntxt = module_context();
51  if(!get_expanded_id(modId, expId, &module_cntxt)) {
52  int result = -999;
53  for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
55  if (range.match(expId)) {
56  const Range::field& eta_field = range[m_ETA_INDEX];
57  if (not eta_field.empty()) {
58  int etamin = eta_field.get_minimum();
59  if (-999 == result) {
60  result = etamin;
61  }
62  else {
63  if (etamin < result) result = etamin;
64  }
65  }
66  }
67  }
68  return (result);
69  }
70  return (-999);
71 }
72 
73 int LArMiniFCAL_ID::eta_max(const Identifier modId) const
74 {
75  ExpandedIdentifier expId;
76  IdContext module_cntxt = module_context();
77  if(!get_expanded_id(modId, expId, &module_cntxt)) {
78  int result = -999;
79  for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
81  if (range.match(expId)) {
82  const Range::field& eta_field = range[m_ETA_INDEX];
83  if (not eta_field.empty()) {
84  int etamax = eta_field.get_maximum();
85  if (result < etamax) result = etamax;
86  }
87  }
88  }
89  return (result);
90  }
91  return (-999); // default
92 }
93 
95 {
96  ExpandedIdentifier expId;
97  IdContext module_cntxt = module_context();
98  if(!get_expanded_id(modId, expId, &module_cntxt)) {
99  int result = -999;
100  for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
101  const Range& range = m_full_channel_range[i];
102  if (range.match(expId)) {
103  const Range::field& phi_field = range[m_PHI_INDEX];
104  if (not phi_field.empty()) {
105  int phimin = phi_field.get_minimum();
106  if (-999 == result) {
107  result = phimin;
108  }
109  else {
110  if (phimin < result) result = phimin;
111  }
112  }
113  }
114  }
115  return (result);
116  }
117  return (-999); // default
118 }
119 
120 int LArMiniFCAL_ID::phi_max(const Identifier modId) const
121 {
122  ExpandedIdentifier expId;
123  IdContext module_cntxt = module_context();
124  if(!get_expanded_id(modId, expId, &module_cntxt)) {
125  int result = -999;
126  for (unsigned int i = 0; i < m_full_channel_range.size(); ++i) {
127  const Range& range = m_full_channel_range[i];
128  if (range.match(expId)) {
129  const Range::field& phi_field = range[m_PHI_INDEX];
130  if (not phi_field.empty()) {
131  int phimax = phi_field.get_maximum();
132  if (result < phimax) result = phimax;
133  }
134  }
135  }
136  return (result);
137  }
138  return (-999); // default
139 }
140 
141 int LArMiniFCAL_ID::get_neighbours(const IdentifierHash id, const LArNeighbours::neighbourOption& option, std::vector<IdentifierHash>& neighbourList) const
142 {
143  int result = 1;
144 
145  neighbourList.clear();
146 
147  if(!m_do_neighbours) {
148  if(m_msgSvc) {
149  MsgStream log(m_msgSvc, "LArMiniFCAL_ID" );
150  log << MSG::WARNING << "neighbours not initialized !!! returning empty list" << endmsg;
151  }
152  else {
153  std::cout << " neighbours not initialized !!! returning empty list " << std::endl;
154  }
155  return result;
156  }
157 
158  if(id>=channels().hash_max()) {
159  if(m_msgSvc) {
160  MsgStream log(m_msgSvc, "LArMiniFCAL_ID" );
161  log << MSG::WARNING << "neighbours requested for non-existing channel -- id/max " << id << "/"
162  << channel_hash_max() << endmsg;
163  }
164  else {
165  std::cout << " neighbours requested for non-existing channel -- id/max " << id << "/"
166  << channel_hash_max() << std::endl;
167  }
168  return result;
169  }
170 
171  if( dictionaryVersion() == "fullAtlas" ) {
172 
173  if ( (option & LArNeighbours::all2D) == LArNeighbours::all2D ){
174  if ( !m_neighbors_2d_vec[(unsigned int)id].empty() ) {
175  neighbourList.insert(neighbourList.end(),
176  m_neighbors_2d_vec[(unsigned int)id].begin(),
177  m_neighbors_2d_vec[(unsigned int)id].end());
178  }
179  }
180 
181  if ( (option & LArNeighbours::prevInSamp) ){
182  if ( !m_neighbors_3d_prev_vec[(unsigned int)id].empty() ) {
183  neighbourList.insert(neighbourList.end(),
184  m_neighbors_3d_prev_vec[(unsigned int)id].begin(),
185  m_neighbors_3d_prev_vec[(unsigned int)id].end());
186  }
187  }
188 
189  if ( (option & LArNeighbours::nextInSamp) ){
190  if ( !m_neighbors_3d_next_vec[(unsigned int)id].empty() ) {
191  neighbourList.insert(neighbourList.end(),
192  m_neighbors_3d_next_vec[(unsigned int)id].begin(),
193  m_neighbors_3d_next_vec[(unsigned int)id].end());
194  }
195  }
196 
197  } else {
198  if(m_msgSvc) {
199  MsgStream log(m_msgSvc, "LArMiniFCAL_ID" );
200  log << MSG::WARNING << " NO MiniFCAL neighbours (yet) in the context of " << dictionaryVersion() << endmsg;
201  }
202  else {
203  std::cout << " NO MiniFCAL neighbours (yet) in the context of " << dictionaryVersion() << std::endl;
204  }
205  }
206  return result;
207 }
208 
209 IdContext
211 {
212  return region_context();
213 }
214 
216 /*=================================================================*/
217 {
218  MsgStream log(m_msgSvc, "LArMiniFCAL_ID" );
219 
220  std::string strg = "initialize_from_dictionary";
221  log << MSG::DEBUG << strg << endmsg;
222 
223  // Check whether this helper should be reinitialized
224  if (!reinitialize(dict_mgr)) {
225  log << MSG::DEBUG << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
226  return (0);
227  }
228  else {
229  if(m_msgSvc)log << MSG::DEBUG << "(Re)initialize" << endmsg;
230  }
231 
232  // init base object
234  "LArCalorimeter"))
235  return (1);
236 
237  // initialize dictionary version
238  AtlasDetectorID::setDictVersion(dict_mgr, "LArCalorimeter");
239 
240  // Check whether dictionary has miniFCAL
241  if (!dict()->find_group("lar_mini_fcal")) {
242  strg = " initialize_from_dict - LArCalorimeter dictionary does NOT contain miniFCAL description. Unable to initialize LArMiniFCAL_ID.";
243  log << MSG::INFO << strg << endmsg;
244  return 0; // return OK
245  }
246 
247 
248  // Initialize the field indices
249  if(initLevelsFromDict()) {
250  strg = " initialize_from_dict - cannot initialize MiniFCAL part of LArCalorimeter dictionary ";
251  if(m_msgSvc) {
252  log << MSG::WARNING << strg << endmsg;
253  }
254  else {
255  std::cout << strg << std::endl;
256  }
257  return (1);
258  }
259  else {
260 
261  // Find value for the field LAr Calorimeter
262  const IdDictDictionary* atlasDict = dict_mgr.find_dictionary ("ATLAS");
263  int larField = -1;
264  if (atlasDict->get_label_value("subdet", "LArCalorimeter", larField)) {
265  std::stringstream strm ;
266  strm << atlasDict->name();
267  strg = "Could not get value for label 'LArCalorimeter' of field 'subdet' in dictionary "
268  + strm.str();
269  if(m_msgSvc) {
270  log << MSG::ERROR << strg << endmsg;
271  }
272  else {
273  std::cout << strg << std::endl;
274  }
275  return (1);
276  }
277 
278 
279  // Find value for the field LArMiniFCAL - here the "part" has to be LArFCAL
280  int larFcalField = -1;
281  if (dict()->get_label_value("part", "LArFCAL", larFcalField)) {
282  std::stringstream strm ;
283  strm << atlasDict->name();
284  strg = "Could not get value for label 'LArMiniFCAL' of field 'part' in dictionary "
285  + strm.str();
286  if(m_msgSvc) {
287  log << MSG::ERROR << strg << endmsg;
288  }
289  else {
290  std::cout << strg << std::endl;
291  }
292  return (1);
293  }
294 
295  // Set up id for region and range prefix
296 
297  // RDS: need to find the range for MiniFCAL module 0, which includes
298  // both pos/neg endcaps
300  region_id.add(larField);
301  region_id.add(larFcalField);
302  Range prefix;
303  std::string str = "lar_mini_fcal";
307 
308  if (!m_quiet) {
309  std::string strg0 = "initialize_from_dict : " ;
310  std::string strg1 = " channel range -> " + (std::string)m_full_channel_range;
311  std::string strg2 = " module range -> " + (std::string)m_full_module_range;
312  std::string strg2a= " depth range -> " + (std::string)m_full_depth_range;
313  if(m_msgSvc) {
314  log << MSG::DEBUG << strg0 << endmsg;
315  log << MSG::DEBUG << strg1 << endmsg;
316  log << MSG::DEBUG << strg2 << endmsg;
317  log << MSG::DEBUG << strg2a<< endmsg;
318  }
319  else {
320  std::cout << strg0 << std::endl;
321  std::cout << strg1 << std::endl;
322  std::cout << strg2 << std::endl;
323  std::cout << strg2a<< std::endl;
324  }
325  }
326 
327  // Setup the hash tables
328  if(init_hashes()) return (1);
329 
330  // initilize m_two_sym_sides
331  m_two_sym_sides = ( dictionaryVersion() == "fullAtlas" );
332 
333  // collect the regions to later access deta/dphi etc.
334  if (fill_vec_of_dict_regions()) return 1;
335 
336  m_vecOfPhiMin.resize(regions().hash_max());
337  for (unsigned int i = 1; i < regions().hash_max(); ++i) {
338  Identifier modId = module_id(i);
339  m_vecOfPhiMin[i] = phi_min_init(modId);
340  }
341 
342  // Setup hash tables for finding neighbors
343  if(m_do_neighbours) {
344  if(init_neighbors(dict_mgr)) return (1);
345  }
346 
347  }
348 
349  m_is_initialized = true;
350  return 0;
351 
352 }
353 
354 void LArMiniFCAL_ID::module_id_checks ( int pos_neg, int /*module*/ ) const
355 {
356 
357  // Check that id is within allowed range
358  // Fill expanded id
360  //expId << pos_neg << module;
361  expId << pos_neg << 0;
362 
363  if (!m_full_module_range.match(expId)) {
364  std::string errorMessage = "LArMiniFCAL_ID::module_id() result is not OK: ID, range = "
365  + std::string(expId) + " , " + (std::string)m_full_module_range;
366  throw LArID_Exception(errorMessage , 6);
367  }
368 }
369 
370 void LArMiniFCAL_ID::channel_id_checks ( int pos_neg, int /*module*/, int depth, int eta, int phi) const
371 {
372 
373  // Check that id is within allowed range
374  // Fill expanded id
376  //expId << pos_neg << module << depth << eta << phi ;
377  expId << pos_neg << 0 << depth << eta << phi ;
378 
379  if (!m_full_channel_range.match(expId)) {
380  std::string errorMessage = "LArMiniFCAL_ID::channel_id() result is not OK: ID, range = "
381  + std::string(expId) + " , " + (std::string)m_full_channel_range;
382  throw LArID_Exception(errorMessage , 10);
383  }
384 }
385 
387  int eta, int phi) const
388 {
389  // Check that id is within allowed range
390  // Fill expanded id
391  ExpandedIdentifier expId;
392 
393  IdContext context = module_context();
394  if (get_expanded_id(moduleId, expId, &context)) {
395  std::string errorMessage = "LArMiniFCAL_ID::channel_id(modId) result is not OK: ID = "
396  + show_to_string(moduleId) ;
397  throw LArID_Exception(errorMessage , 10);
398  }
399 
400  expId << depth << eta << phi ;
401 
402  if (!m_full_channel_range.match(expId)) {
403  std::string errorMessage = "LArMiniFCAL_ID::channel_id(modId) result is not OK: ID, range = "
404  + std::string(expId) + " , " + (std::string)m_full_channel_range;
405  throw LArID_Exception(errorMessage , 10);
406  }
407 }
408 
409 int LArMiniFCAL_ID::get_expanded_id (const Identifier& id, ExpandedIdentifier& exp_id, const IdContext* context) const
410 {
411  // We assume that the context is >= region
412  exp_id.clear();
413  exp_id << lar_field_value()
415  << pos_neg(id)
416  << module(id);
417  if (context && context->end_index() >= m_DEPTH_INDEX) {
418  exp_id << depth(id);
419  if (context->end_index() >= m_ETA_INDEX) {
420  exp_id << eta(id);
421  if (context->end_index() >= m_PHI_INDEX) {
422  exp_id << phi(id);
423  }
424  }
425  }
426  return 0;
427 }
428 
430 {
431  MsgStream log(m_msgSvc, "LArMiniFCAL_ID" );
432 
433  if(!dict()) {
434  std::string strg = "initLevelsFromDict - dictionary NOT initialized ";
435  if(m_msgSvc) {
436  log << MSG::ERROR << strg << endmsg;
437  }
438  else {
439  std::cout << strg << std::endl;
440  }
441  return (1);
442  }
443 
444  // Find out which identifier field corresponds to each level.
445 
446  m_fcal_region_index = 999 ;
447  m_LAR_INDEX = 999 ;
448  m_MiniFCAL_INDEX = 999 ;
449  m_POSNEG_INDEX = 999 ;
450  m_MODULE_INDEX = 999 ;
451  m_DEPTH_INDEX = 999 ;
452  m_ETA_INDEX = 999 ;
453  m_PHI_INDEX = 999 ;
454 
455  IdDictField* field = dict()->find_field("subdet") ;
456  if (field) {
457  m_LAR_INDEX = field->index();
458  }
459  else {
460  std::string strg = "initLevelsFromDict - unable to find 'subdet' field ";
461  if(m_msgSvc) {
462  log << MSG::ERROR << strg << endmsg;
463  }
464  else {
465  std::cout << strg << std::endl;
466  }
467  return (1);
468  }
469 
470  field = dict()->find_field("part") ;
471  if (field) {
472  m_MiniFCAL_INDEX = field->index();
473  }
474  else {
475  std::string strg = "initLevelsFromDict - unable to find 'part' field ";
476  if(m_msgSvc) {
477  log << MSG::ERROR << strg << endmsg;
478  }
479  else {
480  std::cout << strg << std::endl;
481  }
482  return (1);
483  }
484 
485  field = dict()->find_field("barrel-endcap") ;
486  if (field) {
487  m_POSNEG_INDEX = field->index();
488  }
489  else {
490  std::string strg = "initLevelsFromDict - unable to find 'barrel-endcap' field ";
491  if(m_msgSvc) {
492  log << MSG::ERROR << strg << endmsg;
493  }
494  else {
495  std::cout << strg << std::endl;
496  }
497  return (1);
498  }
499 
500  field = dict()->find_field("module") ;
501  if (field) {
502  m_MODULE_INDEX = field->index();
503  }
504  else {
505  std::string strg = "initLevelsFromDict - unable to find 'module' field ";
506  if(m_msgSvc) {
507  log << MSG::ERROR << strg << endmsg;
508  }
509  else {
510  std::cout << strg << std::endl;
511  }
512  return (1);
513  }
514 
515 
516  field = dict()->find_field("depth-mfcal") ;
517  if (field) {
518  m_DEPTH_INDEX = field->index();
519  }
520  else {
521  std::string strg = "initLevelsFromDict - unable to find 'depth' field ";
522  if(m_msgSvc) {
523  log << MSG::WARNING << strg << endmsg;
524  }
525  else {
526  std::cout << strg << std::endl;
527  }
528  return (1);
529  }
530 
531 
532  field = dict()->find_field("eta-mfcal") ;
533  if (field) {
534  m_ETA_INDEX = field->index();
535  }
536  else {
537  std::string strg = "initLevelsFromDict - unable to find 'eta' field ";
538  if(m_msgSvc) {
539  log << MSG::ERROR << strg << endmsg;
540  }
541  else {
542  std::cout << strg << std::endl;
543  }
544  return (1);
545  }
546 
547  field = dict()->find_field("phi-mfcal") ;
548  if (field) {
549  m_PHI_INDEX = field->index();
550  }
551  else {
552  std::string strg = "initLevelsFromDict - unable to find 'phi' field ";
553  if(m_msgSvc) {
554  log << MSG::ERROR << strg << endmsg;
555  }
556  else {
557  std::cout << strg << std::endl;
558  }
559  return (1);
560  }
561 
562  /*
563  std::cout << "LArMiniFCAL_ID::initLevelsFromDict - found levels " << std::endl ;
564  std::cout << "part " << m_MiniFCAL_INDEX << std::endl ;
565  std::cout << "pos-neg " << m_POSNEG_INDEX << std::endl ;
566  std::cout << "module " << m_MODULE_INDEX << std::endl ;
567  std::cout << "eta " << m_ETA_INDEX << std::endl ;
568  std::cout << "phi " << m_PHI_INDEX << std::endl ;
569  */
570 
571  // Save index to a MiniFCAL region for unpacking
572 
573  // Fill expanded identifier with id for module 0 of the MiniFCAL,
574  // i.e. add on module == 0 to the id below
575 
577  if (dict()->find_region(id,m_fcal_region_index)){
578  std::stringstream strm ;
579  strm << m_fcal_region_index ;
580  std::string strg = "initLevelsFromDict - unable to find fcal region index: id, reg "
581  + (std::string)id + strm.str();
582  if(m_msgSvc) {
583  log << MSG::ERROR << strg << endmsg;
584  }
585  else {
586  std::cout << strg << std::endl;
587  }
588  return (1);
589  }
590 
591  // Set the field implementations
592 
593 
594  const IdDictRegion& region = *dict()->find_region ("", "lar_mini_fcal");
595 
603 
604  if (!m_quiet) {
605  if(m_msgSvc) {
606  log << MSG::DEBUG << "decode index and bit fields for each level: " << endmsg;
607  log << MSG::DEBUG << "lar " << m_lar_impl.show_to_string() << endmsg;
608  log << MSG::DEBUG << "fcal " << m_fcal_impl.show_to_string() << endmsg;
609  log << MSG::DEBUG << "pn " << m_pn_impl.show_to_string() << endmsg;
610  log << MSG::DEBUG << "mod " << m_module_impl.show_to_string() << endmsg;
611  log << MSG::DEBUG << "depth " << m_depth_impl.show_to_string() << endmsg;
612  log << MSG::DEBUG << "eta " << m_eta_impl.show_to_string() << endmsg;
613  log << MSG::DEBUG << "phi " << m_phi_impl.show_to_string() << endmsg;
614  }
615  else {
616  std::cout << "decode index and bit fields for each level: " << std::endl;
617  std::cout << "lar " << m_lar_impl.show_to_string() << std::endl;
618  std::cout << "fcal " << m_fcal_impl.show_to_string() << std::endl;
619  std::cout << "pn " << m_pn_impl.show_to_string() << std::endl;
620  std::cout << "mod " << m_module_impl.show_to_string() << std::endl;
621  std::cout << "depth " << m_depth_impl.show_to_string() << std::endl;
622  std::cout << "eta " << m_eta_impl.show_to_string() << std::endl;
623  std::cout << "phi " << m_phi_impl.show_to_string() << std::endl;
624  }
625  }
626 
627 
628  return(0) ;
629 }
630 
632 {
633  if (channels().init (*this, "channels",
636  m_PHI_INDEX))
637  return 1;
638  if (regions().init (*this, "regions",
642  return 1;
643 
644  return (0);
645 }
646 
647 
648 int LArMiniFCAL_ID::init_neighbors_from_file(const std::string& filename, std::vector<std::set<IdentifierHash> > & vec)
649 {
650  MsgStream log(m_msgSvc, "LArMiniFCAL_ID" );
651 
652  if(m_msgSvc) {
653  log << MSG::DEBUG << "init_neighbors_from_file" << endmsg;
654  }
655  else {
656  std::cout << "LArMiniFCAL_ID::init_neighbors_from_file " << std::endl;
657  }
658  // Find the full path to filename:
659  std::string file = PathResolver::find_file (filename, "DATAPATH");
660  log << MSG::INFO << "Reading file " << file << endmsg;
661 
662  std::ifstream fin;
663  if (!file.empty()) {
664  fin.open(file.c_str());
665  }
666  else {
667  if(m_msgSvc) {
668  log << MSG::ERROR << "Could not find input file " << filename << endmsg;
669  }
670  else {
671  std::cout << "LArMiniFCAL_ID::Could not find input file " << filename << std::endl;
672  }
673  return 1;
674  }
675  if (fin.bad()) {
676  if(m_msgSvc) {
677  log << MSG::ERROR << "Could not open file " << file << endmsg;
678  }
679  else {
680  std::cout << "LArMiniFCAL_ID::Could not open file " << file << std::endl;
681  }
682  return 1;
683  }
684 
685  //
686  // Parse the input file
687  //
688 
689  vec.resize(channels().hash_max());
690 
691  char aLine[1024];
692  std::string sLine;
693  bool isComment = true;
694  char AorC,dot;
695  int isamp,idepth, iphi,ieta;
696 
697  while( isComment ) {
698  sLine.resize( 0 );
699  do {
700  fin.getline(aLine,sizeof(aLine)-1);
701  sLine = std::string(aLine);
702  } while (sLine.empty() && !fin.eof());
703  isComment = ( sLine.find('#') != std::string::npos );
704  }
705  do {
706  while ( sLine.empty() && !fin.eof()) {
707  fin.getline(aLine,sizeof(aLine)-1);
708  sLine = std::string(aLine);
709  }
710  std::istringstream es( sLine.c_str() );
711 
712  if ( es >> AorC >> isamp >> dot >> idepth >> dot >> iphi >> dot >> ieta ) {
713  Identifier thisCell = channel_id((AorC=='A'?2:-2),isamp,idepth,ieta,iphi);
714  IdentifierHash ic = channel_hash(thisCell);
715  while ( es >> AorC >> isamp >> dot >> idepth >> dot >> iphi >> dot >> ieta ) {
716  if (!ic.is_valid()) continue;
717  Identifier nextCell = channel_id((AorC=='A'?2:-2),isamp,idepth,ieta,iphi);
718  IdentifierHash inext = channel_hash(nextCell);
719  vec[ic].insert(vec[ic].end(),inext);
720  }
721  sLine.resize(0);
722  }
723  }while (!fin.eof()) ;
724  fin.close();
725 
726  return 0;
727 }
728 
730 {
731  MsgStream log(m_msgSvc, "LArMiniFCAL_ID" );
732 
733  if(m_msgSvc) {
734  log << MSG::DEBUG << "init_neighbors" << endmsg;
735  }
736  else {
737  std::cout << "LArMiniFCAL_ID::init_neighbors " << std::endl;
738  }
739 
740  int status;
741  std::string f2d,f3dnext,f3dprev;
742 
743  f2d = dict_mgr.find_metadata("FCAL2DNEIGHBORS");
744  f3dnext = dict_mgr.find_metadata("FCAL3DNEIGHBORSNEXT");
745  f3dprev = dict_mgr.find_metadata("FCAL3DNEIGHBORSPREV");
746  if (f2d.empty() || f3dnext.empty() || f3dprev.empty()) {
747  if(m_msgSvc) {
748  log << MSG::ERROR << "init_neighbours: cannot find neighbours files: "
749  << " f2d: " << f2d << " f3dnext: " << f3dnext << " f3dprev: " << f3dprev
750  << endmsg;
751  }
752  else {
753  std::cout << "LArMiniFCAL_ID::init_neighbours cannot find neighbours files: "
754  << " f2d: " << f2d << " f3dnext: " << f3dnext << " f3dprev: " << f3dprev
755  << std::endl;
756  }
757  throw std::runtime_error("LArMiniFCAL_ID::init_neighbours: Cannot find the FCAL Neighbour file names");
758  }
759 
760  status = init_neighbors_2d(f2d);
761  if ( status == 0 )
762  status = init_neighbors_3d_next(f3dnext);
763  if ( status == 0 )
764  status = init_neighbors_3d_prev(f3dprev);
765 
766  if ( status == 0 )
767  return (0);
768  else
769  return (1);
770 }
771 
772 
773 
LArMiniFCAL_ID::m_is_initialized
bool m_is_initialized
Definition: LArMiniFCAL_ID.h:240
IdDictDictionary::find_region
IdDictRegion * find_region(const std::string &region_name) const
Definition: IdDictDictionary.cxx:101
LArMiniFCAL_ID::eta_max
int eta_max(const Identifier regId) const
max value of eta index (-999 == failure)
Definition: LArMiniFCAL_ID.cxx:73
IdDictMgr.h
LArNeighbours::neighbourOption
neighbourOption
Definition: LArNeighbours.h:12
IdDictDictionary::build_multirange
MultiRange build_multirange() const
Get MultiRange for full dictionary.
Definition: IdDictDictionary.cxx:290
LArMiniFCAL_ID::m_full_module_range
MultiRange m_full_module_range
Definition: LArMiniFCAL_ID.h:251
egammaParameters::depth
@ depth
pointing depth of the shower as calculated in egammaqgcld
Definition: egammaParamDefs.h:276
LArMiniFCAL_ID::m_full_channel_range
MultiRange m_full_channel_range
Definition: LArMiniFCAL_ID.h:250
get_generator_info.result
result
Definition: get_generator_info.py:21
LArMiniFCAL_ID::m_ETA_INDEX
size_type m_ETA_INDEX
Definition: LArMiniFCAL_ID.h:247
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
LArMiniFCAL_ID::init_neighbors
int init_neighbors(const IdDictMgr &dict_mgr)
Definition: LArMiniFCAL_ID.cxx:729
IdDictFieldImplementation::show_to_string
std::string show_to_string(void) const
Definition: IdDictFieldImplementation.cxx:32
CaloIDHelper::channel_hash_max
size_type channel_hash_max() const
One more than the largest channel (cell) hash code.
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
LArMiniFCAL_ID::m_PHI_INDEX
size_type m_PHI_INDEX
Definition: LArMiniFCAL_ID.h:248
CaloIDHelper::fill_vec_of_dict_regions
int fill_vec_of_dict_regions(const std::string &group_name="")
Initialize the list of detector regions.
Definition: CaloIDHelper.cxx:261
IdentifierField::get_minimum
element_type get_minimum() const
Query the values.
Definition: IdentifierField.h:121
LArMiniFCAL_ID::module
int module(const Identifier id) const
module [0]
Definition: LArMiniFCAL_ID.h:489
IdDictDictionary.h
IdContext::end_index
size_type end_index() const
Definition: IdContext.h:46
LArMiniFCAL_ID::m_module_impl
IdDictFieldImplementation m_module_impl
Definition: LArMiniFCAL_ID.h:263
LArID_Exception.h
CaloIDHelper::region_context
IdContext region_context() const
Return the context for regions.
LArMiniFCAL_ID::LArMiniFCAL_ID
LArMiniFCAL_ID()
Definition: LArMiniFCAL_ID.cxx:30
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
LArMiniFCAL_ID::depth
int depth(const Identifier id) const
depth [0,3]
Definition: LArMiniFCAL_ID.h:495
AtlasDetectorID::m_msgSvc
IMessageSvc * m_msgSvc
pointer to the message service
Definition: AtlasDetectorID.h:369
LArMiniFCAL_ID::m_MODULE_INDEX
size_type m_MODULE_INDEX
Definition: LArMiniFCAL_ID.h:245
IdDictMgr::find_metadata
const std::string & find_metadata(const std::string &name) const
Access to meta data, name/value pairs.
Definition: IdDictMgr.cxx:91
CaloIDHelper::region_id
Identifier region_id(IdentifierHash hashId) const
Return the region Identifier for a given hash code (no checking).
IdentifierField::get_maximum
element_type get_maximum() const
Definition: IdentifierField.h:130
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
IdDictDictionary::name
const std::string & name() const
Dictionary name.
Definition: IdDictDictionary.h:332
AtlasDetectorID::lar_field_value
int lar_field_value() const
Definition: AtlasDetectorID.h:609
LArMiniFCAL_ID::m_lar_impl
IdDictFieldImplementation m_lar_impl
Definition: LArMiniFCAL_ID.h:260
LArMiniFCAL_ID::get_expanded_id
virtual int get_expanded_id(const Identifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded Identifier from Identifier (return == 0 for OK)
Definition: LArMiniFCAL_ID.cxx:409
LArMiniFCAL_ID::m_depth_impl
IdDictFieldImplementation m_depth_impl
Definition: LArMiniFCAL_ID.h:264
IdDictDictionary::find_field
IdDictField * find_field(const std::string &name) const
Definition: IdDictDictionary.cxx:47
IdDictRegion
Definition: IdDictRegion.h:20
CaloIDHelper::regions
const HashGroup & regions() const
Return the HashGroup for regions.
AtlasDetectorID::dictionaryVersion
virtual std::string dictionaryVersion(void) const override
Definition: AtlasDetectorID.cxx:281
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
AtlasDetectorID::m_do_neighbours
bool m_do_neighbours
Flag for subclasses to know whether or not to perform neighbour initialization.
Definition: AtlasDetectorID.h:366
LArNeighbours::nextInSamp
@ nextInSamp
Definition: LArNeighbours.h:20
IdDictRegion::implementation
const IdDictFieldImplementation & implementation(size_t i) const
Definition: IdDictRegion.cxx:34
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
LArMiniFCAL_ID::phi_min_init
int phi_min_init(const Identifier regId) const
Definition: LArMiniFCAL_ID.cxx:94
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
LArMiniFCAL_ID::phi
int phi(const Identifier id) const
phi [0,15]
Definition: LArMiniFCAL_ID.h:509
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
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArMiniFCAL_ID::m_pn_impl
IdDictFieldImplementation m_pn_impl
Definition: LArMiniFCAL_ID.h:262
CaloIDHelper::dict
const IdDictDictionary * dict() const
Return the dictionary for this subdetector.
CaloIDHelper
Base class to factor out code common among Calo ID helpers.
Definition: CaloIDHelper.h:34
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArMiniFCAL_ID::init_hashes
int init_hashes()
Definition: LArMiniFCAL_ID.cxx:631
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:194
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
file
TFile * file
Definition: tile_monitor.h:29
LArMiniFCAL_ID::m_LAR_INDEX
size_type m_LAR_INDEX
Definition: LArMiniFCAL_ID.h:242
LArMiniFCAL_ID::m_POSNEG_INDEX
size_type m_POSNEG_INDEX
Definition: LArMiniFCAL_ID.h:244
LArMiniFCAL_ID::m_neighbors_3d_next_vec
std::vector< std::set< IdentifierHash > > m_neighbors_3d_next_vec
Definition: LArMiniFCAL_ID.h:201
LArNeighbours::prevInSamp
@ prevInSamp
Definition: LArNeighbours.h:19
AtlasDetectorID::m_quiet
bool m_quiet
If true, suppress DEBUG/INFO messages.
Definition: AtlasDetectorID.h:372
dot.dot
def dot(G, fn, nodesToHighlight=[])
Definition: dot.py:5
LArMiniFCAL_ID::~LArMiniFCAL_ID
~LArMiniFCAL_ID()
LArMiniFCAL_ID::module_id
Identifier module_id(const ExpandedIdentifier &exp_id) const
module identifier for a channel from ExpandedIdentifier
Definition: LArMiniFCAL_ID.h:290
LArMiniFCAL_ID::module_context
IdContext module_context() const
context for modules – method kept for backward compatibility.
Definition: LArMiniFCAL_ID.cxx:210
LArMiniFCAL_ID::init_neighbors_from_file
int init_neighbors_from_file(const std::string &filename, std::vector< std::set< IdentifierHash > > &vec)
Definition: LArMiniFCAL_ID.cxx:648
CaloIDHelper::initialize_base_from_dictionary
int initialize_base_from_dictionary(const IdDictMgr &dict_mgr, const std::string &dict_name)
Do basic initialization of the helper.
Definition: CaloIDHelper.cxx:234
grepfile.ic
int ic
Definition: grepfile.py:33
LArMiniFCAL_ID::module_id_checks
void module_id_checks(int pos_neg, int module) const
Definition: LArMiniFCAL_ID.cxx:354
IdDictDictionary::get_label_value
int get_label_value(const std::string &field, const std::string &label, int &value) const
Definition: IdDictDictionary.cxx:75
PathResolver.h
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
IdentifierHash.h
LArMiniFCAL_ID::m_MiniFCAL_INDEX
size_type m_MiniFCAL_INDEX
Definition: LArMiniFCAL_ID.h:243
LArMiniFCAL_ID::initLevelsFromDict
int initLevelsFromDict()
Definition: LArMiniFCAL_ID.cxx:429
AtlasDetectorID::setDictVersion
virtual void setDictVersion(const IdDictMgr &dict_mgr, const std::string &name) override
Definition: AtlasDetectorID.cxx:499
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
python.PyKernel.init
def init(v_theApp, v_rootStream=None)
Definition: PyKernel.py:45
IdDictDictionary
Definition: IdDictDictionary.h:30
CaloIDHelper::channels
const HashGroup & channels() const
Return the HashGroup for channels (cells).
LArMiniFCAL_ID::init_neighbors_3d_next
int init_neighbors_3d_next(const std::string &filename)
Definition: LArMiniFCAL_ID.h:226
MultiRange::match
int match(const ExpandedIdentifier &id) const
Match an identifier.
Definition: MultiRange.cxx:57
LArMiniFCAL_ID::get_neighbours
int get_neighbours(const IdentifierHash id, const LArNeighbours::neighbourOption &option, std::vector< IdentifierHash > &neighbourList) const
access to hashes for neighbours return == 0 for neighbours found option = all2D,...
Definition: LArMiniFCAL_ID.cxx:141
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
LArMiniFCAL_ID::pos_neg
int pos_neg(const Identifier id) const
pos_neg : +/- 2 (A/C side)
Definition: LArMiniFCAL_ID.h:483
LArMiniFCAL_ID::m_eta_impl
IdDictFieldImplementation m_eta_impl
Definition: LArMiniFCAL_ID.h:265
IdDictField.h
CaloIDHelper::channel_hash
IdentifierHash channel_hash(Identifier channelId) const
Convert a connected channel (cell) Identifier to a hash code.
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
LArMiniFCAL_ID::m_neighbors_3d_prev_vec
std::vector< std::set< IdentifierHash > > m_neighbors_3d_prev_vec
Definition: LArMiniFCAL_ID.h:202
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
LArMiniFCAL_ID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
initialization from the identifier dictionary
Definition: LArMiniFCAL_ID.cxx:215
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition: PathResolver.cxx:221
LArMiniFCAL_ID::m_fcal_region_index
size_type m_fcal_region_index
Definition: LArMiniFCAL_ID.h:241
LArMiniFCAL_ID.h
LArMiniFCAL_ID::m_phi_impl
IdDictFieldImplementation m_phi_impl
Definition: LArMiniFCAL_ID.h:266
MultiRange::size
size_type size() const
Definition: MultiRange.cxx:70
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LArMiniFCAL_ID::m_two_sym_sides
bool m_two_sym_sides
Definition: LArMiniFCAL_ID.h:254
IdentifierField
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
Definition: IdentifierField.h:83
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:23
ExpandedIdentifier::clear
void clear()
Erase all fields.
LArMiniFCAL_ID::m_vecOfPhiMin
std::vector< short int > m_vecOfPhiMin
Definition: LArMiniFCAL_ID.h:257
compute_lumi.fin
fin
Definition: compute_lumi.py:19
LArMiniFCAL_ID::channel_id
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
Definition: LArMiniFCAL_ID.h:298
LArMiniFCAL_ID::m_full_depth_range
MultiRange m_full_depth_range
Definition: LArMiniFCAL_ID.h:252
LArMiniFCAL_ID::phi_max
int phi_max(const Identifier regId) const
max value of phi index (-999 == failure)
Definition: LArMiniFCAL_ID.cxx:120
dot
Definition: dot.py:1
str
Definition: BTagTrackIpAccessor.cxx:11
merge.status
status
Definition: merge.py:16
LArMiniFCAL_ID::m_neighbors_2d_vec
std::vector< std::set< IdentifierHash > > m_neighbors_2d_vec
Definition: LArMiniFCAL_ID.h:200
LArMiniFCAL_ID::m_DEPTH_INDEX
size_type m_DEPTH_INDEX
Definition: LArMiniFCAL_ID.h:246
AtlasDetectorID::lar_fcal_exp
ExpandedIdentifier lar_fcal_exp(void) const
Definition: AtlasDetectorID.h:571
IdDictRegion.h
LArMiniFCAL_ID::init_neighbors_3d_prev
int init_neighbors_3d_prev(const std::string &filename)
Definition: LArMiniFCAL_ID.h:231
IdDictField
Definition: IdDictField.h:15
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
LArMiniFCAL_ID::m_fcal_impl
IdDictFieldImplementation m_fcal_impl
Definition: LArMiniFCAL_ID.h:261
LArMiniFCAL_ID::init_neighbors_2d
int init_neighbors_2d(const std::string &filename)
Definition: LArMiniFCAL_ID.h:221
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137
LArMiniFCAL_ID::eta_min
int eta_min(const Identifier regId) const
min value of eta index (-999 == failure)
Definition: LArMiniFCAL_ID.cxx:47
LArMiniFCAL_ID::channel_id_checks
void channel_id_checks(int pos_neg, int module, int depth, int eta, int phi) const
Definition: LArMiniFCAL_ID.cxx:370
LArMiniFCAL_ID::eta
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
Definition: LArMiniFCAL_ID.h:502
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
AtlasDetectorID::lar_fcal_field_value
int lar_fcal_field_value() const
Definition: AtlasDetectorID.h:645
LArID_Exception
Exception class for LAr Identifiers.
Definition: LArID_Exception.h:20
LArNeighbours::all2D
@ all2D
Definition: LArNeighbours.h:18
CaloIDHelper::HashGroup::hash_max
size_type hash_max() const
Return one more than the largest hash code.
Identifier
Definition: IdentifierFieldParser.cxx:14