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