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