ATLAS Offline Software
LArOnlineID_Base.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GaudiKernel/MsgStream.h"
7 #include "IdDict/IdDictDefs.h"
11 #include <cmath>
12 #include <iostream>
13 #include <set>
14 #include <sstream>
15 #include <string>
16 
17 /* MAY-17-04:*/
18 /* AL added init_hashes for calib lines */
19 /* */
20 /* FEB-25-04: */
21 /* AL removed H6_channel_vec, H8_channel_vec and associated methods/iterators*/
22 /* replaced init_H8channelHashes by init_H8hashes */
23 /* replaced init_H6channelHashes by init_H6hashes */
24 /* removed init_H6febHashes and init_H8febHashes */
25 /* Choice of the init_hashes method NOW based on the "version" ID taken from */
26 /* the Dictionary */
27 /* FEB-16-04: */
28 /* AL added access to TestBeamH8 Channels via init_H8hashes */
29 /* added access to TestBeamH6 Channels via init_H6hashes*/
30 /* added access to TestBeamH8 febs via init_H8hashes */
31 /* added access to TestBeamH6 febs via init_H6hashes*/
32 /* */
33 /* FEB-12-04: */
34 /* FLG improved check_ids methods */
35 /* */
36 /* Set of instances developped in the following: */
37 /* LAronline_ID::destructor & constructor */
38 /* LArOnlineID::feedthroughContext() */
39 /* LArOnlineID::channelContext() */
40 /* LArOnlineID::initialize_from_dictionary(IdDictMgr&) */
41 /* LArOnlineID::get_expanded_id(HWIdentifier, ExpandedIdentifier, IdContext)*/
42 /* LArOnlineID::initLevelsFromDict() */
43 /* LArOnlineID::init_hashes() */
44 /* LArOnlineID::init_H8hashes() */
45 /* LArOnlineID::init_H6hashes() */
46 
48  m_this_is_slar(false),
49  m_laronlineRegion_index(999),
50  m_lar_index(999),
51  m_laronline_index(999),
52  m_bec_index(999),
53  m_side_index(999),
54  m_feedthrough_index(999),
55  m_slot_index(999),
56  m_channel_in_slot_index(999),
57  m_slar_index(999),
58  m_dict(nullptr),
59  m_feedthroughHashMax(0),
60  m_febHashMax(0),
61  m_channelHashMax(0),
62  m_calibModuleHashMax(0),
63  m_calibChannelHashMax(0)
64 {
65 }
66 
67 
69 = default;
70 
71 
72 //==================================================================
73 std::string LArOnlineID_Base::feedthrough_name( const HWIdentifier id )const{
74 //==================================================================
75  std::string result;
76  int ft = feedthrough(id);
77  if( barrel_ec(id)== 0 ){
78  // if BARREL
79  if( pos_neg(id) == 1 ){
80  // if EMBA
81  if( ft==31 ){result = "I01R";}
82  if( ft==0 ){result = "I01L";}
83  if( ft==1 ){result = "I02R";}
84  if( ft==2 ){result = "I02L";}
85  if( ft==3 ){result = "I03R";}
86  if( ft==4 ){result = "I03L";}
87  if( ft==5 ){result = "I04R";}
88  if( ft==6 ){result = "I04L";}
89  if( ft==7 ){result = "I05R";}
90  if( ft==8 ){result = "I05L";}
91  if( ft==9 ){result = "I06R";}
92  if( ft==10 ){result = "I06L";}
93  if( ft==11 ){result = "I07R";}
94  if( ft==12 ){result = "I07L";}
95  if( ft==13 ){result = "I08R";}
96  if( ft==14 ){result = "I08L";}
97  if( ft==15 ){result = "I09R";}
98  if( ft==16 ){result = "I09L";}
99  if( ft==17 ){result = "I10R";}
100  if( ft==18 ){result = "I10L";}
101  if( ft==19 ){result = "I11R";}
102  if( ft==20 ){result = "I11L";}
103  if( ft==21 ){result = "I12R";}
104  if( ft==22 ){result = "I12L";}
105  if( ft==23 ){result = "I13R";}
106  if( ft==24 ){result = "I13L";}
107  if( ft==25 ){result = "I14R";}
108  if( ft==26 ){result = "I14L";}
109  if( ft==27 ){result = "I15R";}
110  if( ft==28 ){result = "I15L";}
111  if( ft==29 ){result = "I16R";}
112  if( ft==30 ){result = "I16L";}
113  }
114  else{
115  // EMBC
116  if( ft==15 ){result = "H01R";}
117  if( ft==16 ){result = "H01L";}
118  if( ft==13 ){result = "H02R";}
119  if( ft==14 ){result = "H02L";}
120  if( ft==11 ){result = "H03R";}
121  if( ft==12 ){result = "H03L";}
122  if( ft==9 ){result = "H04R";}
123  if( ft==10){result = "H04L";}
124  if( ft==7 ){result = "H05R";}
125  if( ft==8 ){result = "H05L";}
126  if( ft==5 ){result = "H06R";}
127  if( ft==6 ){result = "H06L";}
128  if( ft==3 ){result = "H07R";}
129  if( ft==4 ){result = "H07L";}
130  if( ft==1 ){result = "H08R";}
131  if( ft==2 ){result = "H08L";}
132  if( ft==31){result = "H09R";}
133  if( ft==0 ){result = "H09L";}
134  if( ft==29 ){result = "H10R";}
135  if( ft==30 ){result = "H10L";}
136  if( ft==27 ){result = "H11R";}
137  if( ft==28 ){result = "H11L";}
138  if( ft==25 ){result = "H12R";}
139  if( ft==26 ){result = "H12L";}
140  if( ft==23 ){result = "H13R";}
141  if( ft==24 ){result = "H13L";}
142  if( ft==21 ){result = "H14R";}
143  if( ft==22 ){result = "H14L";}
144  if( ft==19 ){result = "H15R";}
145  if( ft==20 ){result = "H15L";}
146  if( ft==17 ){result = "H16R";}
147  if( ft==18 ){result = "H16L";}
148  }
149  }
150  if ( barrel_ec(id) == 1 ){
151  // ENDCAP
152  if( pos_neg(id) == 1 ){
153  // EMEC-A
154  if( ft==0 ){result = "A01R";}
155  if( ft==1 ){result = "A01L";}
156  if( ft==2 ){result = "A02R";}
157  if( ft==3 ){result = "A02L";}
158  if( ft==4 ){result = "A03R";}
159  if( ft==5 ){result = "A03L";}
160  if( ft==6 ){result = "A04R";}
161  if( ft==7 ){result = "A05R";}
162  if( ft==8 ){result = "A05L";}
163  if( ft==9 ){result = "A06R";}
164  if( ft==10){result = "A06L";}
165  if( ft==11){result = "A07R";}
166  if( ft==12){result = "A07L";}
167  if( ft==13){result = "A08R";}
168  if( ft==14){result = "A08L";}
169  if( ft==15){result = "A09R";}
170  if( ft==16){result = "A09L";}
171  if( ft==17){result = "A10R";}
172  if( ft==18){result = "A10L";}
173  if( ft==19){result = "A11R";}
174  if( ft==20){result = "A11L";}
175  if( ft==21){result = "A12R";}
176  if( ft==22){result = "A12L";}
177  if( ft==23){result = "A13R";}
178  if( ft==24){result = "A13L";}
179  if( ft==25){result = "A14R";} // ft25-27 are sFCal; A14R, A14L, A15L
180  if( ft==26){result = "A14L";} // will need to be replaced by actual
181  if( ft==27){result = "A15L";} // crate name once it exists
182  }
183  else{
184  // EMEC-C
185  if( ft==11 ){result = "C01R";}
186  if( ft==12 ){result = "C01L";}
187  if( ft==9 ){result = "C02R";}
188  if( ft==10 ){result = "C02L";}
189  if( ft==7 ){result = "C03R";}
190  if( ft==8 ){result = "C03L";}
191  if( ft==4 ){result = "C05R";}
192  if( ft==5 ){result = "C05L";}
193  if( ft==2 ){result = "C06R";}
194  if( ft==3 ){result = "C06L";}
195  if( ft==0 ){result = "C07R";}
196  if( ft==1 ){result = "C07L";}
197  if( ft==23 ){result = "C08R";}
198  if( ft==24 ){result = "C08L";}
199  if( ft==21 ){result = "C09R";}
200  if( ft==22 ){result = "C09L";}
201  if( ft==19 ){result = "C10R";}
202  if( ft==20 ){result = "C10L";}
203  if( ft==17 ){result = "C11R";}
204  if( ft==18 ){result = "C11L";}
205  if( ft==15 ){result = "C12R";}
206  if( ft==16 ){result = "C12L";}
207  if( ft==13 ){result = "C13R";}
208  if( ft==14 ){result = "C13L";}
209  if( ft==6 ){result = "C04L";}
210  if( ft==25 ){result = "C14R";} // ft25-27 are sFCal; C14R, C14L, C15L
211  if( ft==26 ){result = "C14L";} // will need to be replaced by actual
212  if( ft==27 ){result = "C15L";} // crate name once it exists
213  }
214  }
215  return result;
216 }
217 
218 //==================================================================
219 std::string LArOnlineID_Base::channel_name( const HWIdentifier id )const{
220 //==================================================================
221  std::ostringstream s1;
222  //std::string s2;
223  int Nchan = channel(id);
224  int Nslot = slot(id);
225  int Nft = feedthrough(id);
226  std::string det_barrel_endcap = "NODETE";
227  std::string det_side = "/X-SIDE";
228 
229  if( barrel_ec(id) == 0 ) det_barrel_endcap = "BARREL";
230  if( barrel_ec(id) == 1 ) det_barrel_endcap = "ENDCAP";
231  if( pos_neg(id) == 1 ) det_side = "/A-SIDE";
232  if( pos_neg(id) == 0 ) det_side = "/C-SIDE";
233 
234  s1 << det_barrel_endcap
235  << det_side
236  << "/FT-" << Nft
237  << "/SLOT-" << Nslot
238  << "/CHAN-" << Nchan;
239  return s1.str();
240  //return s2;
241 }
242 
243 
244 
245 /* =================================================================== */
247 /* =================================================================== */
248 {
250  return (IdContext(id, 0, m_side_index));
251 }
252 
253 
254 
255 /* =================================================================== */
257 /* =================================================================== */
258 {
260  return (IdContext(id, 0, m_feedthrough_index));
261 }
262 
263 
264 
265 
266 /* =================================================================== */
268 /* =================================================================== */
269 {
271  return (IdContext(id, 0, m_channel_in_slot_index));
272 }
273 
274 
275 
276 /* =================================================================== */
278 /* =================================================================== */
279 {
281  return (IdContext(id, 0, m_slot_index));
282 }
283 
284 
285 
286 /* =================================================================== */
288 /* =================================================================== */
289 {
290 
291  ExpandedIdentifier expId;
292  IdContext context = channelContext();
293  if(!get_expanded_id(channelId, expId, &context)) {
294  int result = -999;
295  for (unsigned int i = 0; i < m_full_laronline_range.size(); ++i) {
296  const Range& range = m_full_laronline_range[i];
297  if (range.match(expId)) {
298  const Range::field& channel_in_slot_field = range[m_channel_in_slot_index];
299  if (!channel_in_slot_field.empty()) {
300  int channel_in_slotmax = channel_in_slot_field.get_maximum();
301  if (result < channel_in_slotmax) result = channel_in_slotmax + 1;
302  }
303  }
304  }
305  return (result);
306  }
307  return (-999); // default
308 }
309 
310 
311 
312 
313 
314 /* =================================================================== */
316 /* =================================================================== */
317 {
318  MsgStream log(m_msgSvc, "LArOnlineID_Base" );
319  if (!m_quiet) {
320  std::string strg = "initialize_from_dictionary";
321  if(m_msgSvc) {
322  log << MSG::INFO << strg << endmsg;
323  }
324  else {
325  std::cout << strg << std::endl;
326  }
327  }
328 
329  // Check whether this helper should be reinitialized
330  if (!reinitialize(dict_mgr)) {
331  if(m_msgSvc)log << MSG::DEBUG << "Request to reinitialize not satisfied - tags have not changed" << endmsg;
332  return (0);
333  }
334  else {
335  log << MSG::DEBUG << "(Re)initialize" << endmsg;
336  }
337 
338  // init base object
339  if(AtlasDetectorID::initialize_from_dictionary(dict_mgr)) return (1);
340  m_dict = dict_mgr.find_dictionary ("LArCalorimeter");
341  if(!m_dict) {
342 
343  std::string strg = " initialize_from_dictionary - cannot access LArCalorimeter dictionary ";
344  if(m_msgSvc) {
345  log << MSG::ERROR << strg << endmsg;
346  }
347  else {
348  std::cout << "LArOnlineID_Base::" << strg << std::endl;
349  }
350  return 1;
351  }
352 
353  // Register version of the dictionary used
354  if (register_dict_tag(dict_mgr, "LArCalorimeter")) return(1);
355 
356  // initialize dictionary version
357  AtlasDetectorID::setDictVersion(dict_mgr, "LArCalorimeter");
358 
359  /* Initialize the field indices */
360 // if(initLevelsFromDict()) return (1);
361  std::string group_name("LArOnline");
362  if ( m_this_is_slar ) group_name+="_SuperCell";
363  if(initLevelsFromDict(group_name)) return (1);
364 
365 
366  /* Find value for the field LAr Calorimeter */
367  const IdDictDictionary* atlasDict = dict_mgr.find_dictionary ("ATLAS");
368  int larField = -1;
369  if (atlasDict->get_label_value("subdet", "LArCalorimeter", larField)) {
370  std::stringstream strm;
371  strm << atlasDict->m_name;
372  std::string strg= " Could not get value for label 'LArCalorimeter' of field 'subdet' in dictionary "+strm.str();
373  if(m_msgSvc) {
374  log << MSG::ERROR << strg << endmsg;
375  }
376  else {
377  std::cout << "LArOnlineID_Base:" << strg << std::endl;
378  }
379  return (1);
380  }
381 
382  /* Find value for the field LArOnline */
383  int larOnlineField = -4;
384  if (m_dict->get_label_value("part", "LArOnline", larOnlineField)) {
385  std::stringstream strm;
386  strm << m_dict->m_name;
387  std::string strg = "Could not get value for label 'LArOnline' of field 'part' in dictionary "+strm.str();
388  if(m_msgSvc) {
389  log << MSG::ERROR << strg << endmsg;
390  }
391  else {
392  std::cout << strg << std::endl;
393  }
394  return (1);
395  }
396 
397  /* Find value for the field calibLArOnline */
398  int larOnlineCalibField = -5;
399  if (m_dict->get_label_value("part", "LArOnlineCalib", larOnlineCalibField)) {
400  std::stringstream strm;
401  strm << m_dict->m_name;
402  std::string strg = "Could not get value for label 'LArOnlineCalib' of field 'part' in dictionary "+strm.str();
403  if(m_msgSvc) {
404  log << MSG::ERROR << strg << endmsg;
405  }
406  else {
407  std::cout << strg << std::endl;
408  }
409  return (1);
410  }
411 
412  /* Set up id for Region and range prefix */
414  region_id.add(larField);
415  region_id.add(larOnlineField);
416  Range prefix;
417  /* Calib Multirange */
418  ExpandedIdentifier region_id2;
419  region_id2.add(larField);
420  region_id2.add(larOnlineCalibField);
421  Range prefix2;
422 
423  /*Full range for all channels*/
427 
428  std::string strg0= " initialize_from_dictionary :";
429  std::string strg1= " feedthrough range -> " + (std::string)m_full_feedthrough_range;
430  std::string strg2= " feedthrough slot range -> " + (std::string)m_full_feb_range;
431  std::string strg3= " channel range -> " + (std::string)m_full_laronline_range;
432  if(m_msgSvc) {
433  log << MSG::DEBUG << strg0 << endmsg;
434  log << MSG::DEBUG << strg1 << endmsg;
435  log << MSG::DEBUG << strg2 << endmsg;
436  log << MSG::DEBUG << strg3 << endmsg;
437  }
438  else {
439  std::cout << strg0 << std::endl;
440  std::cout << strg1 << std::endl;
441  std::cout << strg2 << std::endl;
442  std::cout << strg3 << std::endl;
443  }
444 
445  /* calib */
446  /* Full range for calib channels */
448  m_full_calib_module_range = m_dict->build_multirange( region_id2 , group_name, prefix2, "slot");
449 
450  if (!m_quiet) {
451  std::string strg0= "=> initialize_from_dictionary : ";
452  std::string strg2= "=> Calib module range -> " + (std::string)m_full_calib_module_range;
453  std::string strg3= "=> Calib channel range -> " + (std::string)m_full_calib_laronline_range;
454  if(m_msgSvc) {
455  log << MSG::DEBUG << strg0 << endmsg;
456  log << MSG::DEBUG << strg2 << endmsg;
457  log << MSG::DEBUG << strg3 << endmsg;
458  }
459  else {
460  std::cout << strg0 << std::endl;
461  std::cout << strg2 << std::endl;
462  std::cout << strg3 << std::endl;
463  }
464  }
465 
466  /* Setup the hash tables */
467  std::string strg="[initialize_from_dictionary] version= " + dictionaryVersion();
468  if(m_msgSvc) {
469  log << MSG::DEBUG << strg << endmsg;
470  }
471  else {
472  std::cout << "LArOnlineID_Base: " << strg << std::endl;
473  }
474  if( dictionaryVersion() == "fullAtlas" ) {
475  if(init_hashes()) return (1);
476  }
477 
478  // Setup for hash calculation for channels (febs is further below)
479 
480  // Febs have a uniform number of channels
481  // The lookup table only needs to contain the
482  // hash offset for each feb
483 
484  // The implementation requires:
485 
486  // 1) a lookup table for each feb containing hash offset
487  // 2) a decoder to access the "index" corresponding to the
488  // bec/side/ft/slot fields. These fields use x bits, so the
489  // vector has a length of 2**x.
490 
491  /* Create decoder for fields bec to slot */
493  m_bec_impl.bits() +
494  m_side_impl.bits() +
496  m_slot_impl.bits();
498  m_bec_slot_impl.set_bits(bits, bits_offset);
499  int size = (1 << bits);
500 
501  // Set up vector as lookup table for hash calculation.
502  m_chan_hash_calcs.resize(size);
503 
504  for (unsigned int i = 0; i < m_febHashMax; ++i) {
505 
506  HWIdentifier febId = feb_Id(i) ;
507 
508  HashCalc hc;
509 
510  HWIdentifier min = channel_Id ( febId, 0);
511 
513  hc.m_hash = min_hash;
515 
516  if (m_bec_slot_impl.unpack(min) >= size) {
517  strg = "Min > "+std::to_string(size);
518  strg1= " "+ show_to_string(min);
520  if(m_msgSvc) {
521  log << MSG::DEBUG << strg << endmsg;
522  log << MSG::DEBUG << strg1 << endmsg;
523  log << MSG::DEBUG << strg2 << endmsg;
524  }
525  else {
526  std::cout << strg << std::endl;
527  std::cout << strg1 << std::endl;
528  std::cout << strg2 << std::endl;
529  }
530  }
531  }
532 
533  // Check channel hash calculation
534  for (unsigned int i = 0; i < m_channelHashMax; ++i) {
535  HWIdentifier id = channel_Id(i);
536  if (channel_Hash(id) != i) {
537  strg = " ***** Error channel ranges, id, hash, i = "+show_to_string(id);
538  strg1= " , "+std::to_string(channel_Hash(id));
539  strg2= " , "+std::to_string(i);
540  if(m_msgSvc) {
541  log << MSG::ERROR << strg << endmsg;
542  log << MSG::ERROR << strg1 << endmsg;
543  log << MSG::ERROR << strg2 << endmsg;
544  }
545  else {
546  std::cout << strg << std::endl;
547  std::cout << strg1 << std::endl;
548  std::cout << strg2 << std::endl;
549  }
550  }
551  }
552 
553 
554 
555  // Setup for hash calculation for febs
556 
557  // We calculate the feb hash by saving the hash of each
558  // feedthrough in a HashCalc object and then adding on the slot
559  // number for a particular feb
560 
561  // The implementation requires:
562 
563  // 1) a lookup table for each ft containing hash offset
564  // 2) a decoder to access the "index" corresponding to the
565  // bec/side/ft fields. These fields use x bits, so the
566  // vector has a length of 2**x.
567 
568  /* Create decoder for fields bec to ft */
569  bits = m_bec_impl.bits() +
570  m_side_impl.bits() +
572  bits_offset = m_bec_impl.bits_offset();
573  m_bec_ft_impl.set_bits(bits, bits_offset);
574  size = (1 << bits);
575 
576  // Set up vector as lookup table for hash calculation.
577  m_feb_hash_calcs.resize(size);
578 
579  // Get context for conversion to expanded ids
580  IdContext ftContext = feedthroughContext();
581  ExpandedIdentifier ftExpId;
582 
583  for (unsigned int i = 0; i < m_feedthroughHashMax; ++i) {
584 
586 
587  HashCalcFeb hc;
588 
589  // Set the hash id for each feedthrough, and then check if one
590  // needs to also save the slot values
592  hc.m_hash = min_hash;
593 
594  // For each feedthrough we must check to see if the slot
595  // values are enumerated or not. If they are enumerate we must
596  // save the values in order to calculate the fed hash
597  if (get_expanded_id(min, ftExpId, &ftContext)) {
598  if(m_msgSvc) {
599  log << MSG::WARNING << " ***** Warning cannot get ft expanded id for " << show_to_string(min) << endmsg;
600  } else {
601  std::cout << " ***** Warning cannot get ft expanded id for " << show_to_string(min) << std::endl;
602  }
603  }
604  unsigned int nrangesFound = 0;
605  for (unsigned int i = 0; i < m_full_feb_range.size(); ++i) {
606  if (m_full_feb_range[i].match(ftExpId)) {
607  nrangesFound += 1;
608  const Range::field& slotField = m_full_feb_range[i][m_slot_index];
609  if (slotField.isEnumerated()) {
610  // save values
611  hc.m_slot_values = slotField.get_values();
612  }
613  }
614  }
615 
616  // Similarly, if there is more than one range per feedthrough,
617  // this means that slot values are not a continuous range. In
618  // this case, as well, we save all possible slot values
619  if (nrangesFound > 1) {
620  for (unsigned int i = 0; i < m_full_feb_range.size(); ++i) {
621  if (m_full_feb_range[i].match(ftExpId)) {
622  const Range::field& slotField = m_full_feb_range[i][m_slot_index];
623  if (slotField.isBounded()) {
624  // save values
625  unsigned int nvalues = slotField.get_maximum() - slotField.get_minimum() + 1;
626  hc.m_slot_values.reserve(hc.m_slot_values.size() + nvalues);
627  for (unsigned int j = 0; j < nvalues; ++j) {
628  hc.m_slot_values.push_back(j + slotField.get_minimum());
629  }
630  }
631  else {
632 
633  if(m_msgSvc) {
634  log << MSG::WARNING << " ***** Warning feb range slot field is NOT both_bounded - id, slot mode: "
635  << show_to_string(min) << " enumerated" << endmsg;
636  } else {
637  std::cout << " ***** Error feb range slot field is NOT both_bounded - id, slot mode: "
638  << show_to_string(min) << " enumerated" << std::endl;
639  }
640  }
641  }
642  }
643  }
644 
645 
646  // Set hash calculator
648 
649 
650  if (m_bec_ft_impl.unpack(min) >= size) {
651  strg = "Min > " + std::to_string(size) + " " + show_to_string(min) +
652  " " + std::to_string(m_bec_ft_impl.unpack(min)) + " " +
653  std::to_string(min_hash);
654  if (m_msgSvc) {
655  log << MSG::DEBUG << strg << endmsg;
656  } else {
657  std::cout << strg << std::endl;
658  }
659  }
660  }
661 
662  // Check feb hash calculation
663  for (unsigned int i = 0; i < m_febHashMax; ++i) {
664  HWIdentifier id = feb_Id(i);
665  if (feb_Hash(id) != i) {
666  strg = " ***** Error feb ranges, id, hash, i = " +
667  show_to_string(id) + " , " + std::to_string(feb_Hash(id)) + " , "+std::to_string(i);
668  if(m_msgSvc) {
669  log << MSG::ERROR << strg << endmsg;
670  }
671  else {
672  std::cout << strg << std::endl;
673  }
674  }
675  }
676 
677  return 0;
678 }
679 
680 
681 
682 /* ================================================================*/
683 void LArOnlineID_Base::channel_Id_checks( int barrel_ec, int pos_neg, int feedthrough,
684  int slot, int channel ) const
685 /* ================================================================*/
686 {
687  // Check that id is within allowed range
688  // Fill expanded id
689  ExpandedIdentifier expId(lar_exp());
690  expId << s_lar_online_field_value << barrel_ec << pos_neg << feedthrough << slot << channel ;
691  if ( m_this_is_slar ) expId << 1;
692 
693  if (!m_full_laronline_range.match(expId)) {
694  std::string errorMessage = "LArOnlineID_Base::channel_Id_checks() result is not OK: ID, range = "
695  + std::string(expId) + " , " + (std::string)m_full_laronline_range;
696  LArOnlID_Exception except(errorMessage , 99);
697  throw except ;
698  }
699 }
700 
701 /* ================================================================*/
703  int channel ) const
704 /* ================================================================*/
705 {
706  // Check that id is within allowed range
707  // Fill expanded id
708  ExpandedIdentifier expId;
709  IdContext context = febContext();
710  if (get_expanded_id(febId, expId, &context)) {
711  std::string errorMessage = "LArOnlineID_Base::channel_Id_checks(febId) result is not OK: ID = "
712  + show_to_string(febId) ;
713  LArOnlID_Exception except(errorMessage , 99);
714  throw except ;
715  }
716 
717  expId << channel;
718  if ( m_this_is_slar ) expId << 1;
719  if (!m_full_laronline_range.match(expId)) {
720  std::string errorMessage = "LArOnlineID_Base::channel_Id_checks(febId) result is not OK: ID, range = "
721  + std::string(expId) + " , " + (std::string)m_full_laronline_range;
722  LArOnlID_Exception except(errorMessage , 99);
723  throw except ;
724  }
725 }
726 
727 /* ================================================================*/
729  int slot, int channel ) const
730 /* ================================================================*/
731 {
732  // Check that id is within allowed range
733  // Fill expanded id
734  ExpandedIdentifier expId;
735  IdContext context = feedthroughContext();
736  if (get_expanded_id(feedthroughId, expId, &context)) {
737  std::string errorMessage = "LArOnlineID_Base::channel_Id_checks(feedthroughId) result is not OK: ID = "
738  + show_to_string(feedthroughId) ;
739  LArOnlID_Exception except(errorMessage , 99);
740  throw except ;
741  }
742 
743  expId << slot << channel;
744  if ( m_this_is_slar ) expId << 1;
745  if (!m_full_laronline_range.match(expId)) {
746  std::string errorMessage = "LArOnlineID_Base::channel_Id_checks(feedthroughId) result is not OK: ID, range = "
747  + std::string(expId) + " , " + (std::string)m_full_laronline_range;
748  LArOnlID_Exception except(errorMessage , 99);
749  throw except ;
750  }
751 }
752 
753 /* ================================================================*/
754 void LArOnlineID_Base::feb_Id_checks( int barrel_ec, int pos_neg, int feedthrough, int slot ) const
755 /* ================================================================*/
756 {
757  // Check that id is within allowed range
758  // Fill expanded id
759  ExpandedIdentifier expId(lar_exp());
760  expId << s_lar_online_field_value << barrel_ec << pos_neg << feedthrough << slot ;
761 
762  if ( m_this_is_slar ) expId << 0 << 1;
763  if (!m_full_feedthrough_range.match(expId)) { std::string errorMessage = "LArOnlineID_Base::feb_Id_checks() result is not OK: ID, range = "
764  + std::string(expId) + " , " + (std::string)m_full_feb_range;
765  LArOnlID_Exception except(errorMessage , 99);
766  throw except ;
767  }
768 }
769 
770 /* ================================================================*/
771 void LArOnlineID_Base::feedthrough_Id_checks( int barrel_ec, int pos_neg, int feedthrough ) const
772 /* ==============================================================================*/
773 {
774  // Check that id is within allowed range
775  // Fill expanded id
776  ExpandedIdentifier expId(lar_exp());
777  expId << s_lar_online_field_value << barrel_ec << pos_neg << feedthrough << 0 << 0 << (int)m_this_is_slar;
778 
779 // if ( m_this_is_slar ) expId << 0 << 0 << 1;
780  if (!m_full_feedthrough_range.match(expId)) { std::string errorMessage = "LArOnlineID_Base::feedthrough_Id_checks() result is not OK: ID, range = "
781  + std::string(expId) + " , " + (std::string)m_full_feedthrough_range;
782  LArOnlID_Exception except(errorMessage , 99);
783  throw except ;
784  }
785 }
786 
787 
788 
789 /* =================================================================================*/
791  const IdContext* context) const
792 /*==================================================================================*/
793 {
794  // We assume that the context is >= feedthrough
795  exp_id.clear();
796  exp_id << lar_field_value()
797  << s_lar_online_field_value
798  << barrel_ec(id)
799  << pos_neg(id);
800  if(context && context->end_index() >= m_feedthrough_index) {
801  exp_id << feedthrough(id);
802  if(context && context->end_index() >= m_slot_index) {
803  exp_id << slot(id);
804  if(context->end_index() >= m_channel_in_slot_index) {
805  exp_id << channel(id);
806  if(context->end_index() >= m_slar_index) {
807  exp_id << is_slar(id);
808  }
809  }
810  }
811  }
812  return (0);
813 }
814 
815 
816 /* =================================================================================*/
818  const IdContext* context) const
819 /*==================================================================================*/
820 {
821  // We assume that the context is >= feedthrough
822  exp_id.clear();
823  exp_id << lar_field_value()
824  << s_lar_onlineCalib_field_value
825  << barrel_ec(id)
826  << pos_neg(id)
827  << feedthrough(id);
828  if(context && context->end_index() >= m_slot_index) {
829  exp_id << slot(id);
830  if(context->end_index() >= m_channel_in_slot_index) {
831  exp_id << channel(id);
832  if(context->end_index() >= m_slar_index) {
833  exp_id << is_slar(id);
834  }
835  }
836  }
837  return (0);
838 }
839 
840 
841 
842 /*======================================*/
844 /*======================================*/
845 {
846  MsgStream log(m_msgSvc, "LArOnlineID_Base" );
847 
848  if(!m_dict)
849  {
850  if(m_msgSvc) {
851  log << MSG::ERROR << "initLevelsFromDict - dictionary NOT initialized "
852  << endmsg;
853  }
854  else {
855  std::cout << "LArEM_ID::initLevelsFromDict - dictionary NOT initialized "
856  << std::endl ;
857  }
858  return (1);
859  }
860 
861  /* Find out which identifier field corresponds to each level.*/
862 
863  m_lar_index = 999 ;
864  m_laronline_index = 999 ;
865  m_bec_index = 999 ;
866  m_side_index = 999 ;
867  m_feedthrough_index = 999 ;
868  m_slot_index = 999 ;
870  m_slar_index = 999 ;
871  std::string strg;
872 
873  // Save index to a DictionaryRegion for unpacking
874  IdDictRegion* reg = m_dict->find_region("laronline-barrel");
875  if (reg)
876  {
878  }
879  else
880  {
881  strg = "initLevelsFromDict - unable to find laronline region ";
882  if(m_msgSvc)
883  {
884  log << MSG::ERROR << strg << endmsg;
885  }
886  else
887  {
888  std::cout << "LAronline_ID::" << strg << std::endl;
889  }
890  return (1);
891  }
892  /* Find LAr field */
893  IdDictField* field = m_dict->find_field("subdet") ;
894  if (field)
895  {
896  m_lar_index = field->m_index ;
897  }
898  else
899  {
900  strg= "initLevelsFromDict - unable to find 'subdet' field ";
901  if(m_msgSvc)
902  {
903  log << MSG::ERROR << strg << endmsg;
904  }
905  else
906  {
907  std::cout << "LArOnlineID_Base::" << strg << std::endl;
908  }
909  return (1);
910  }
911 
912  /* Find LArOnline field */
913  field = m_dict->find_field("part") ;
914  if (field)
915  {
916  m_laronline_index = field->m_index ;
917  }
918  else
919  {
920  strg= "initLevelsFromDict - unable to find 'part' field ";
921  if(m_msgSvc)
922  {
923  log << MSG::ERROR << strg << endmsg;
924  }
925  else
926  {
927  std::cout << "LArOnlineID_Base::" << strg << std::endl;
928  }
929  return (1);
930  }
931 
932  /* Find barrel-endcap field */
933  field = m_dict->find_field("barrel-ec") ;
934  if (field)
935  {
936  m_bec_index = field->m_index ;
937  }
938  else
939  {
940  strg= "initLevelsFromDict - unable to find 'barrel-endcap' field ";
941  if(m_msgSvc)
942  {
943  log << MSG::ERROR << strg << endmsg;
944  }
945  else
946  {
947  std::cout << "LArOnlineID_Base::" << strg << std::endl;
948  }
949  return (1);
950  }
951 
952  /* Find detector-side field */
953  field = m_dict->find_field("pos_neg") ;
954  if (field)
955  {
956  m_side_index = field->m_index ;
957  }
958  else
959  {
960  strg= "initLevelsFromDict - unable to find 'barrel-endcap' field ";
961  if(m_msgSvc)
962  {
963  log << MSG::ERROR << strg << endmsg;
964  }
965  else
966  {
967  std::cout << "LArOnlineID_Base::" << strg << std::endl;
968  }
969  return (1);
970  }
971 
972  /* Find feedthrough field */
973  std::string feedthrough_name;
974  if ( m_this_is_slar ){
975  feedthrough_name+="slar_feedthrough";
976  } else {
977  feedthrough_name+="feedthrough";
978  }
980  if (field) {
981  m_feedthrough_index = field->m_index ;
982  }
983  else
984  {
985  strg = "initLevelsFromDict - unable to find 'feedthrough' field ";
986  if(m_msgSvc)
987  {
988  log << MSG::ERROR << strg << endmsg;
989  }
990  else
991  {
992  std::cout << "LArOnlineID_Base::" << strg << std::endl;
993  }
994  return (1);
995  }
996 
997  /* Find slot field */
998  std::string slot_name;
999  if ( m_this_is_slar ){
1000  slot_name+="slar_slot";
1001  } else {
1002  slot_name+="slot";
1003  }
1004  field = m_dict->find_field(slot_name) ;
1005  if (field)
1006  {
1007  m_slot_index = field->m_index ;
1008  }
1009  else
1010  {
1011  strg = "initLevelsFromDict - unable to find 'slot' field ";
1012  if(m_msgSvc)
1013  {
1014  log << MSG::ERROR << strg << endmsg;
1015  }
1016  else
1017  {
1018  std::cout << "LArOnlineID_Base::" << strg << std::endl;
1019  }
1020  return (1);
1021  }
1022 
1023  /* Find channel_in_slot field */
1024  std::string channel_name;
1025  if ( m_this_is_slar ){
1026  channel_name+="sch_in_slot";
1027  } else {
1028  channel_name+="channel_in_slot";
1029  }
1031  if (field)
1032  {
1033  m_channel_in_slot_index = field->m_index ;
1034  }
1035  else
1036  {
1037  strg = "initLevelsFromDict - unable to find 'channel_in_slot' field ";
1038  if(m_msgSvc)
1039  {
1040  log << MSG::ERROR << strg << endmsg;
1041  }
1042  else
1043  {
1044  std::cout << "LArOnlineID_Base::" << strg << std::endl;
1045  }
1046  return (1);
1047  }
1048 
1049  /* Find slar field */
1050  if ( m_this_is_slar ) {
1051  field = m_dict->find_field("is-slar") ;
1052  if (field)
1053  {
1054  m_slar_index = field->m_index ;
1055  }
1056  else
1057  {
1058  strg = "initLevelsFromDict - unable to find 'slar' field ";
1059  if(m_msgSvc)
1060  {
1061  log << MSG::ERROR << strg << endmsg;
1062  }
1063  else
1064  {
1065  std::cout << "LArOnline_SuperCellID::" << strg << std::endl;
1066  }
1067  return (1);
1068  }
1069  } // end of m_this_is_slar
1070 
1071  /* Set the field implementations */
1072 
1074  if ( !group ) {
1075  log << MSG::ERROR << "initLevelsFromDict - cannot find "
1076  << group_name << endmsg;
1077  } else {
1078  m_laronlineRegion_index = group->regions()[0]->m_index;
1079  }
1080 
1082 
1090  if ( m_this_is_slar )
1092 
1093  if (!m_quiet) {
1094  if(m_msgSvc) {
1095  log << MSG::DEBUG << "decode index and bit fields for each level: " << endmsg;
1096  log << MSG::DEBUG << "lar " << m_lar_impl.show_to_string() << endmsg;
1097  log << MSG::DEBUG << "online " << m_laronline_impl.show_to_string() << endmsg;
1098  log << MSG::DEBUG << "bec " << m_bec_impl.show_to_string() << endmsg;
1099  log << MSG::DEBUG << "side " << m_side_impl.show_to_string() << endmsg;
1101  log << MSG::DEBUG << "slot " << m_slot_impl.show_to_string() << endmsg;
1102  log << MSG::DEBUG << "channel " << m_channel_in_slot_impl.show_to_string() << endmsg;
1103  if ( m_this_is_slar )
1104  log << MSG::DEBUG << "is-slar " << m_slar_impl.show_to_string() << endmsg;
1105  }
1106  else {
1107  std::cout << "decode index and bit fields for each level: " << std::endl;
1108  std::cout << "lar " << m_lar_impl.show_to_string() << std::endl;
1109  std::cout << "online " << m_laronline_impl.show_to_string() << std::endl;
1110  std::cout << "bec " << m_bec_impl.show_to_string() << std::endl;
1111  std::cout << "side " << m_side_impl.show_to_string() << std::endl;
1112  std::cout << "ft " << m_feedthrough_impl.show_to_string() << std::endl;
1113  std::cout << "solt " << m_slot_impl.show_to_string() << std::endl;
1114  std::cout << "channel " << m_channel_in_slot_impl.show_to_string() << std::endl;
1115  if ( m_this_is_slar )
1116  std::cout << "slar " << m_slar_impl.show_to_string() << std::endl;
1117  }
1118  }
1119 
1120  return(0) ;
1121 }
1122 
1123 
1124 
1125 /*======================================*/
1127 /*======================================*/
1128 {
1129  MsgStream log(m_msgSvc, "LArOnlineID_Base" );
1130  std::string strg1;
1131  std::string strg2;
1132  std::string strg3;
1133 
1134  /* channel hash */
1137  unsigned int nids = 0;
1138  std::set<HWIdentifier> ids;
1139  for (unsigned int i = 0; i < m_full_laronline_range.size(); ++i)
1140  {
1141  const Range& range = m_full_laronline_range[i];
1143  for (const auto & exp_id : rit)
1144  {
1145  HWIdentifier id = this->channel_Id (exp_id[m_bec_index],
1146  exp_id[m_side_index],
1147  exp_id[m_feedthrough_index],
1148  exp_id[m_slot_index],
1149  exp_id[m_channel_in_slot_index]);
1150  if(!(ids.insert(id)).second)
1151  {
1152  strg1 = " init_hashes: duplicated id for channel nb = "+std::to_string(nids);
1153  strg3 = " expanded Id= "+show_to_string(id);
1154  if(m_msgSvc)
1155  {
1156  log << MSG::ERROR << strg1 << endmsg;
1157  //log << MSG::ERROR << strg2 << endmsg;
1158  log << MSG::ERROR << strg3 << endmsg;
1159  }
1160  else
1161  {
1162  std::cout << "LArOnlineID_Base::Error" << strg1 << std::endl;
1163  //std::cout << strg2 << std::endl;
1164  std::cout << strg3 << std::endl;
1165  }
1166  }
1167  nids++;
1168  }
1169  }
1170  if(ids.size() != m_channelHashMax)
1171  {
1172  strg1 = " init_hashes ";
1173  strg2 = " set size NOT EQUAL to hash max. size "+std::to_string(ids.size());
1174  strg3 = " hash max "+std::to_string(m_channelHashMax);
1175  if(m_msgSvc)
1176  {
1177  log << MSG::ERROR << strg1 << endmsg;
1178  log << MSG::ERROR << strg2 << endmsg;
1179  log << MSG::ERROR << strg3 << endmsg;
1180  }
1181  else
1182  {
1183  std::cout << "LArOnlineID_Base::" << strg1 << std::endl;
1184  std::cout << "Error" << strg2 << std::endl;
1185  std::cout << strg3 << std::endl;
1186  }
1187  return (1);
1188  }
1189  nids=0;
1190  std::set<HWIdentifier>::const_iterator first = ids.begin();
1191  std::set<HWIdentifier>::const_iterator last = ids.end();
1192  for (;first != last && nids < m_channel_vec.size(); ++first)
1193  {
1194  m_channel_vec[nids] = (*first) ;
1195  nids++;
1196  }
1197 
1198  /* feedthrough hash */
1201  nids = 0;
1202  ids.clear();
1203  for (unsigned int i = 0; i < m_full_feedthrough_range.size(); ++i)
1204  {
1207  for (const auto & exp_id: rit) {
1208  HWIdentifier feedthroughId = feedthrough_Id( exp_id[m_bec_index],
1209  exp_id[m_side_index],
1210  exp_id[m_feedthrough_index] );
1211  if(!(ids.insert(feedthroughId)).second){
1212  strg1 = " init_hashes: duplicated id for feedthrough nb = "+std::to_string(nids);
1213  strg3 = " expanded Id= "+show_to_string(feedthroughId);
1214  if(m_msgSvc)
1215  {
1216  log << MSG::ERROR << strg1 << endmsg;
1217  //log << MSG::ERROR << strg2 << endmsg;
1218  log << MSG::ERROR << strg3 << endmsg;
1219  }
1220  else
1221  {
1222  std::cout << "LArOnlineID_Base:: Error" << strg1 << std::endl;
1223  //std::cout << strg2 << std::endl;
1224  std::cout << strg3 << std::endl;
1225  }
1226  }
1227  nids++;
1228  }
1229  }
1230  if(ids.size() != m_feedthroughHashMax)
1231  {
1232  strg1 = " init_hashes ";
1233  strg2 = " set size NOT EQUAL to feedthrough hash max. size "+std::to_string(ids.size());
1234  strg3 = " hash max= "+std::to_string(m_feedthroughHashMax);
1235  if(m_msgSvc)
1236  {
1237  log << MSG::ERROR << strg1 << endmsg;
1238  log << MSG::ERROR << strg2 << endmsg;
1239  log << MSG::ERROR << strg3 << endmsg;
1240  }
1241  else
1242  {
1243  std::cout << "LArOnlineID_Base::" << strg1 << std::endl;
1244  std::cout << " Error:" << strg2 << std::endl;
1245  std::cout << strg3 << std::endl;
1246  }
1247  return (1);
1248  }
1249  nids=0;
1250  first = ids.begin();
1251  last = ids.end();
1252  for (;first != last && nids < m_feedthrough_vec.size(); ++first)
1253  {
1254  m_feedthrough_vec[nids] = (*first) ;
1255  nids++;
1256  }
1257 
1258  /* FEB hash */
1259  /*==========*/
1261  m_feb_vec.resize(m_febHashMax);
1262  nids = 0;
1263  ids.clear();
1264  for (unsigned int i = 0; i < m_full_feb_range.size(); ++i)
1265  {
1266  const Range& range = m_full_feb_range[i];
1268  for (const auto & exp_id :rit)
1269  {
1270  HWIdentifier febId = feb_Id( exp_id[m_bec_index],
1271  exp_id[m_side_index],
1272  exp_id[m_feedthrough_index],
1273  exp_id[m_slot_index] );
1274  if(!(ids.insert(febId)).second)
1275  {
1276  strg1 = " init_hashes: duplicated id for FEB nb = "+std::to_string(nids);
1277  strg3 = " expanded Id= "+show_to_string(febId);
1278  if(m_msgSvc)
1279  {
1280  log << MSG::ERROR << strg1 << endmsg;
1281  //log << MSG::ERROR << strg2 << endmsg;
1282  log << MSG::ERROR << strg3 << endmsg;
1283  }
1284  else
1285  {
1286  std::cout << "LArOnlineID_Base::Error:" << strg1 << std::endl;
1287  //std::cout << strg2 << std::endl;
1288  std::cout << strg3 << std::endl;
1289  }
1290  }
1291  nids++;
1292  }
1293  }
1294  if(ids.size() != m_febHashMax)
1295  {
1296  strg1 = " init_hashes ";
1297  strg2 = " set size NOT EQUAL to FEB hash max. size "+std::to_string(ids.size());
1298  strg3 = " hash max "+std::to_string(m_febHashMax);
1299  if(m_msgSvc)
1300  {
1301  log << MSG::ERROR << strg1 << endmsg;
1302  log << MSG::ERROR << strg2 << endmsg;
1303  log << MSG::ERROR << strg3 << endmsg;
1304  }
1305  else
1306  {
1307  std::cout << "LArOnlineID_Base::" << strg1 << std::endl;
1308  std::cout << "Error:" << strg2 << std::endl;
1309  std::cout << strg3 << std::endl;
1310  }
1311  return (1);
1312  }
1313  nids=0;
1314  first = ids.begin();
1315  last = ids.end();
1316  for (;first != last && nids < m_feb_vec.size(); ++first)
1317  {
1318  m_feb_vec[nids] = (*first) ;
1319  nids++;
1320  }
1321 
1322 
1323  return (0);
1324 }
1325 
1326 
1327 
1328 
1330 
1331 
1332  const int larid=m_lar_impl.unpack(id);
1333  const int laronlineid=m_laronline_impl.unpack(id);
1334  if (larid!=lar_field_value()) return false;
1335 
1336  if (laronlineid!=s_lar_online_field_value && laronlineid!=s_lar_onlineCalib_field_value) return false;
1337 
1338  const int channel=m_channel_in_slot_impl.unpack(id);
1339  if (channel<0 || channel>128) return false;
1340 
1341  const int bec=m_bec_impl.unpack(id);
1342  const int ft=m_feedthrough_impl.unpack(id);
1343  const int slot=m_slot_impl.unpack(id);
1344  if (slot<1) return false;
1345  if (ft<0) return false;
1346  if (bec==0) { // Barrel case
1347  if (ft>31) return false;
1348  if (slot>14) return false;
1349  }
1350  else { //Endcap case
1351  if (ft>27) return false;
1352  if (ft==2 || ft==9 || ft==15 || ft==21){ //Special crate
1353  if (slot >15) return false;
1354  }
1355  else if (ft==6) { //FCAL
1356  if (slot>15) return false;
1357  }
1358  else if (ft>24 && ft<28) { //sFCAL
1359  if (slot>10) return false;
1360  }
1361  else if (ft==3 || ft==10 || ft==16 || ft==22) { //HEC
1362  if (slot==3 || slot==4 || slot>10) return false;
1363  }
1364  else //standard crate
1365  if (slot>13) return false;
1366  }//end endcap
1367  return true;
1368 }
1369 
1370 //=====================
1371 // Inline Definitions
1372 //=====================
1373 
1374 
1375 
1376 
1378 LArOnlineID_Base::feedthrough_Id (int barrel_ec, int pos_neg, int feedthrough,
1379  bool checks) const
1380 {
1381  HWIdentifier result(0);
1382 
1383  /*Pack fields independently */
1385  m_laronline_impl.pack (s_lar_online_field_value, result);
1389  if ( m_this_is_slar )
1390  m_slar_impl.pack (1 , result);
1391 
1392  /* Do checks */
1393  if(checks)
1394  {
1396  }
1397  return result;
1398 }
1400 LArOnlineID_Base::feedthrough_Id (int barrel_ec, int pos_neg, int feedthrough) const
1401 {
1403 }
1404 
1405 
1407 /*=============================================================================== */
1408 {
1409  return(m_feedthrough_vec[feedthroughHashId]);
1410 }
1411 
1413 /*=============================================================================== */
1414 {
1415  std::vector<HWIdentifier>::const_iterator it = std::lower_bound(m_feedthrough_vec.begin(),m_feedthrough_vec.end(),feedthroughId);
1416  if ( it != m_feedthrough_vec.end() ){
1417  return (it - m_feedthrough_vec.begin());
1418  }
1419  return (0);
1420 }
1421 
1423 /*============================================================================== */
1424 {
1425  HWIdentifier result(Id);
1426  m_slot_impl.reset(result);
1427  m_channel_in_slot_impl.reset(result);
1428  return(result);
1429 }
1430 
1432 /*====================================================================*/
1433 {
1434  return(m_feedthrough_vec.begin());
1435 }
1436 
1438 /*==================================================================*/
1439 {
1440  return(m_feedthrough_vec.end());
1441 }
1442 
1444 /*==================================================================*/
1445 {
1446  return {feedthrough_begin(), feedthrough_end()};
1447 }
1448 
1449 
1450 /* FEB id */
1451 /*========*/
1452 
1454 LArOnlineID_Base::feb_Id(int barrel_ec, int pos_neg,
1455  int feedthrough, int slot,
1456  bool checks ) const
1457 /*==================================================================== */
1458 {
1459  HWIdentifier result(0);
1460 
1461  /*Pack fields independently */
1462  m_lar_impl.pack (lar_field_value(), result);
1463  m_laronline_impl.pack (s_lar_online_field_value, result);
1464  m_bec_impl.pack (barrel_ec , result);
1465  m_side_impl.pack (pos_neg , result);
1466  m_feedthrough_impl.pack(feedthrough , result);
1467  m_slot_impl.pack (slot , result);
1468  if ( m_this_is_slar )
1469  m_slar_impl.pack (1 , result);
1470 
1471  /* Do checks */
1472  if(checks) {
1473  feb_Id_checks ( barrel_ec, pos_neg, feedthrough, slot );
1474  }
1475  return result;
1476 }
1477 
1479 LArOnlineID_Base::feb_Id(int barrel_ec, int pos_neg,
1480  int feedthrough, int slot) const
1481 {
1483 }
1484 
1485 HWIdentifier LArOnlineID_Base::feb_Id(const HWIdentifier feedthroughId , int slot) const
1486 /*==================================================================================== */
1487 {
1488  HWIdentifier result(feedthroughId);
1489  /* Pack fields independently */
1490  m_slot_impl.reset (result);
1491  m_slot_impl.pack (slot , result);
1492  if ( m_this_is_slar )
1493  m_slar_impl.pack (1 , result);
1494 
1495  return(result);
1496 }
1497 
1499 /*======================================================================= */
1500 {
1502  m_channel_in_slot_impl.reset(result);
1503  return(result);
1504 }
1505 
1507 /*================================================================== */
1508 {
1509  return(m_feb_vec[febHashId]);
1510 }
1511 
1513 /*=============================================================================== */
1514 {
1515  // Get the hash caculator for the febs
1516  const HashCalcFeb& hc = m_feb_hash_calcs[m_bec_ft_impl.unpack(febId)];
1517  // Two cases:
1518  // 1) slot values are enumerated and we must look for a matching
1519  // value to obtain the index
1520  // 2) slot values are a continuous range, then the slot index is
1521  // sufficient for the hash calculation
1522  if (!hc.m_slot_values.empty()) {
1523  // find matching value
1524  int slotValue = slot(febId);
1525  for (int i = 0; (unsigned int)i < hc.m_slot_values.size(); ++i) {
1526  if (slotValue == hc.m_slot_values[i]) return (hc.m_hash + i);
1527  }
1528  MsgStream log(m_msgSvc, "LArOnlineID_Base" );
1529  if(m_msgSvc) {
1530  log << MSG::WARNING << "LArOnlineID_Base::feb_Hash - ***** WARNING: could not match slot value for has calculation " << endmsg;
1531  } else {
1532  std::cout << "LArOnlineID_Base::feb_Hash - ***** WARNING: could not match slot value for has calculation " << std::endl;
1533  }
1534  }
1535  size_type slotIndex = m_slot_impl.unpackToIndex(febId);
1536  return (hc.m_hash + slotIndex);
1537 }
1538 
1540 LArOnlineID_Base::channel_Id( int barrel_ec, int pos_neg, int feedthrough,
1541  int slot, int channel,
1542  bool checks) const
1543 /*============================================================================== */
1544 {
1545  HWIdentifier result(0);
1546  /* Pack fields independently */
1547  m_lar_impl.pack (lar_field_value() , result);
1548  m_laronline_impl.pack (s_lar_online_field_value , result);
1549  m_bec_impl.pack (barrel_ec , result);
1550  m_side_impl.pack (pos_neg , result);
1551  m_feedthrough_impl.pack (feedthrough , result);
1552  m_slot_impl.pack (slot , result);
1553  m_channel_in_slot_impl.pack(channel , result);
1554  if ( m_this_is_slar )
1555  m_slar_impl.pack (1 , result);
1556 
1557  /* Do checks */
1558  if(checks) {
1559  channel_Id_checks( barrel_ec, pos_neg, feedthrough, slot, channel );
1560  }
1561  return result;
1562 }
1563 
1565 LArOnlineID_Base::channel_Id( int barrel_ec, int pos_neg, int feedthrough,
1566  int slot, int channel) const
1567 {
1569  do_checks());
1570 }
1571 
1573 /*===================================================================*/
1574 {
1575  return(m_channel_vec[channelHashId]);
1576 }
1577 
1578 
1580 LArOnlineID_Base::channel_Id(const HWIdentifier feedthroughId,int slot,int channel,
1581  bool checks) const
1582 /*==================================================================================================== */
1583 {
1584  HWIdentifier result(feedthroughId);
1585  /* Pack fields independently */
1586  m_slot_impl.reset (result);
1587  m_channel_in_slot_impl.reset(result);
1588  m_slot_impl.pack (slot , result);
1589  m_channel_in_slot_impl.pack (channel, result);
1590  if ( m_this_is_slar )
1591  m_slar_impl.pack (1 , result);
1592 
1593  /* Do checks */
1594  if(checks) {
1595  channel_Id_checks( feedthroughId, slot, channel );
1596  }
1597  return result;
1598 }
1599 
1601 LArOnlineID_Base::channel_Id(const HWIdentifier feedthroughId,int slot,int channel) const
1602 {
1603  return channel_Id (feedthroughId, slot, channel, do_checks());
1604 }
1605 
1608  bool checks) const
1609 /*======================================================================================= */
1610 {
1611  HWIdentifier result(febId);
1612  /* Pack fields independently */
1613  m_channel_in_slot_impl.reset(result);
1614  m_channel_in_slot_impl.pack (channel, result);
1615  if ( m_this_is_slar )
1616  m_slar_impl.pack (1, result);
1617 
1618  /* Do checks */
1619  if(checks) {
1620  channel_Id_checks( febId, channel );
1621  }
1622  return result;
1623 }
1624 
1627 {
1628  return channel_Id (febId, channel, do_checks());
1629 }
1630 
1631 //----------------------------------------------------------------------------
1633 {
1635  return (hc.m_hash + channel(channelId));
1636 }
1637 
1638 /* BOOLEAN */
1639 
1640 /*
1641  *=============================================================
1642  *=============================================================
1643  * Recommended methods
1644  *=============================================================
1645  *=============================================================
1646  */
1647 
1649 /*========================================================*/
1650 {
1651  return (barrel_ec(id)==0);
1652 }
1654 /*========================================================*/
1655 {
1656  return ( barrel_ec(id)==1 && feedthrough(id) == 6 );
1657 }
1658 
1659 
1660 
1662 /*=================================================================*/
1663 {
1664  int bec= barrel_ec(id);
1665  int sl = slot(id);
1666  return (
1667  bec == 0 && sl == 1
1668  );
1669 }
1670 
1672 /*=================================================================*/
1673 {/* redefinition (bug fix) */
1674  return (isEMECOW(id) && slot(id)==1);
1675 }
1676 
1678 /*=================================================================*/
1679 {/* redefinition with isEMBPS and isEMECPS */
1680  return ( isEMBPS(id) || isEMECPS(id));
1681 }
1682 
1683 
1685 /*========================================================*/
1686 {
1687  int ft = feedthrough(id);
1688  int sl = slot(id);
1689  int ch = channel(id);
1690  return (
1691  (
1692  isEMBchannel(id) &&
1693  ( (-1 < ft && ft < 32) &&
1694  ( sl == 14 ) &&
1695  ( 63 < ch && ch < 128 )
1696  )
1697  )
1698  ||
1699  (
1700  isEMECchannel(id) && sl == 1 &&
1701  (ft == 2 || ft == 9 || ft == 15 || ft == 21 ) &&
1702  (63 < ch && ch < 128)
1703  )
1704  );
1705 }
1706 
1707 
1708 /*
1709  *=============================================================
1710  *=============================================================
1711  * Obsolete methods
1712  *=============================================================
1713  *=============================================================
1714  */
1715 
1717 /*========================================================*/
1718 {/* redefined to isEMBchannel() */
1719  return (isEMBchannel(id));
1720 }
1721 
1723 /*========================================================*/
1724 {
1725  return (barrel_ec(id)==1);
1726 }
1727 
1729 /*========================================================*/
1730 {/* redefinition (was redundant with isFCALchannel) */
1731  return isFCALchannel(id);
1732 }
1734 /*========================================================*/
1735 {/* redefinition */
1736  return isEMECchannel(id);
1737 }
1738 
1739 
1740 /*
1741  *=============================================================
1742  *=============================================================
1743  * Specific UseCases
1744  *=============================================================
1745  *=============================================================
1746  */
1747 
1749 /*======================================================================*/
1750 {
1751  int ft = feedthrough(id);
1752  return ( barrel_ec(id)==1 &&
1753  (ft==0 ||
1754  ft==1 ||
1755  ft==4 ||
1756  ft==5 ||
1757  ft==7 ||
1758  ft==8 ||
1759  ft==11 ||
1760  ft==12 ||
1761  ft==13 ||
1762  ft==14 ||
1763  ft==17 ||
1764  ft==18 ||
1765  ft==19 ||
1766  ft==20 ||
1767  ft==23 ||
1768  ft==24)
1769  );
1770 }
1772 /*======================================================================*/
1773 {
1774  int ft = feedthrough(id);
1775  return ( barrel_ec(id)==1 &&
1776  (ft==2 ||
1777  ft==9 ||
1778  ft==15 ||
1779  ft==21 )
1780  );
1781 }
1782 
1784 /*========================================================*/
1785 {
1786  int bec= barrel_ec(id);
1787  int ft = feedthrough(id);
1788  int sl = slot(id);
1789  return ( (bec==0 && sl==15)
1790  ||
1791  ( bec==1 && sl==15 &&
1792  (ft==0 ||
1793  ft==1 ||
1794  ft==4 ||
1795  ft==5 ||
1796  ft==7 ||
1797  ft==8 ||
1798  ft==11 ||
1799  ft==12 ||
1800  ft==13 ||
1801  ft==14 ||
1802  ft==17 ||
1803  ft==18 ||
1804  ft==19 ||
1805  ft==20 ||
1806  ft==23 ||
1807  ft==24 )
1808  )
1809  ||
1810  ( barrel_ec(id)==1 &&
1811  (sl==3 || sl==4 || sl==12) &&
1812  (ft==3 ||
1813  ft==10 ||
1814  ft==16 ||
1815  ft==22 )
1816  )
1817  ||
1818  ( barrel_ec(id)==1 && sl==16 )
1819  ||
1820  ( barrel_ec(id)==1 && ft==27 && sl==11 )
1821  );
1822 }
1823 
1824 
1825 /*
1826  *================================================================
1827  *================================================================
1828  * The following methods should NOT be used for new applications:
1829  *================================================================
1830  *================================================================
1831  */
1832 
1834 /*========================================================*/
1835 {
1836  /* Must be used with CARE !
1837  * This method returns true for all slots/channel in HEC crates,
1838  * thus including the EMEC slot/channels that are present
1839  * in slot 1 and slot 2 of HEC crates !
1840  * To access specifically EMEC in HEC slot/channel, you then
1841  * have to use isEMECinHECchannel()
1842  */
1843  int ft = feedthrough(id);
1844  return (
1845  //(slot(id)!=1 && slot(id)!= 2) &&
1846  barrel_ec(id)==1 &&
1847  (ft==3 ||
1848  ft==10 ||
1849  ft==16 ||
1850  ft==22 )
1851  );
1852 }
1853 
1855 /*========================================================*/
1856 {
1857  /* Must be used with CARE !
1858  * This method returns true for all slots/channel in HEC crates,
1859  * thus including the EMEC slot/channels that are present
1860  * in slot 1 and slot 2 of HEC crates !
1861  * To access specifically EMEC in HEC slot/channel, you then
1862  * have to use isEMECinHECchannel()
1863  */
1864  int ft = feedthrough(febId);
1865  return ( barrel_ec(febId)==1 &&
1866  (ft==3 ||
1867  ft==10 ||
1868  ft==16 ||
1869  ft==22 )
1870  );
1871 }
1872 
1874 /*=================================================================*/
1875 {/* re-definition with isEMECIW */
1876  return isEMECIW(id);
1877 }
1878 
1879 
1880 
1881 
1882 
1883 
1884 
1885 
1886 
1888  /*=======================================================================*/
1889 {
1890  return m_feedthroughHashMax;
1891 }
1893 /*=======================================================================*/
1894 {
1895  return m_febHashMax;
1896 }
1898 /*====================================================================*/
1899 {
1900  return m_channelHashMax;
1901 }
1902 
1903 
1904 
1905 
1907 /*====================================================================*/
1908 {
1909  return(m_feb_vec.begin());
1910 }
1912 /*==================================================================*/
1913 {
1914  return(m_feb_vec.end());
1915 }
1917 /*==================================================================*/
1918 {
1919  return {feb_begin(), feb_end()};
1920 }
1921 
1923 /*======================================================================*/
1924 {
1925  return(m_channel_vec.begin());
1926 }
1928 /*======================================================================*/
1929 {
1930  return(m_channel_vec.end());
1931 }
1933 /*======================================================================*/
1934 {
1935  return {channel_begin(), channel_end()};
1936 }
1937 
1939 /*=========================================================*/
1940 {
1941  return (m_bec_impl.unpack(id));
1942 }
1943 
1945 /*===========================================================*/
1946 {
1947  return (m_feedthrough_impl.unpack(id));
1948 }
1949 
1951 /*===========================================================*/
1952 {
1953  return (m_side_impl.unpack(id));
1954 }
1955 
1956 
1958 /*=====================================================*/
1959 {
1960  return (m_slot_impl.unpack(id));
1961 }
1962 
1964 /*=====================================================*/
1965 {
1966  return (m_channel_in_slot_impl.unpack(id));
1967 }
1968 
1970 /*=====================================================*/
1971 {
1972  return (m_slar_impl.unpack(id));
1973 }
1974 
1975 
1976 /*========================================*/
1978 /*========================================*/
1979 {
1980  MsgStream log(m_msgSvc, "LArOnlineID_Base" );
1981  unsigned int nids=0;
1982  std::set<HWIdentifier> ids;
1983  for (unsigned int i = 0; i < m_full_calib_laronline_range.size(); ++i) {
1986  for (const auto & exp_id : rit) {
1987  HWIdentifier id = this->calib_channel_Id(exp_id[m_bec_index],
1988  exp_id[m_side_index],
1989  exp_id[m_feedthrough_index],
1990  exp_id[m_slot_index],
1991  exp_id[m_channel_in_slot_index]);
1992  if(!(ids.insert(id)).second) {
1993  if(m_msgSvc) {
1994  log << MSG::WARNING << " LArOnlineID_Base::init_calib_Hashes "
1995  << " Error: duplicated id for channel id. nids= " << nids
1996  << " compact Id " << std::string(exp_id) << " " << show_to_string(id) << endmsg;
1997  } else {
1998  std::cout << " LArOnlineID_Base::init_calib_Hashes "
1999  << " Error: duplicated id for channel id. nids= " << nids
2000  << " compact Id " ;
2001  exp_id.show();
2002  std::cout << " " << show_to_string(id) << std::endl;
2003  }
2004  }
2005  nids++;
2006  }
2007  }
2008  unsigned int nidtb=0;
2009  std::set<HWIdentifier>::const_iterator first = ids.begin();
2010  std::set<HWIdentifier>::const_iterator last = ids.end();
2011  for (;first != last && nidtb < nids; ++first) {
2012  m_calib_channel_vec.push_back(*first);
2013  nidtb++;
2014  }
2016 
2017  /* FEB hash */
2018  /*==========*/
2019  nids = 0;
2020  ids.clear();
2021  for (unsigned int i = 0; i < m_full_calib_module_range.size(); ++i) {
2024  for (const auto & exp_id : rit) {
2025  HWIdentifier febId = calib_module_Id( exp_id[m_bec_index],
2026  exp_id[m_side_index],
2027  exp_id[m_feedthrough_index],
2028  exp_id[m_slot_index] );
2029  if(!(ids.insert(febId)).second){
2030  if(m_msgSvc) {
2031  log << MSG::WARNING << " LArOnlineID_Base::init_calibhashes "
2032  << " Warning: duplicated id for feb id. nids= " << nids
2033  << " compact Id " << std::string(exp_id) << " " << show_to_string(febId) << endmsg;
2034  } else {
2035  std::cout << " LArOnlineID_Base::init_calibhashes "
2036  << " Error: duplicated id for feb id. nids= " << nids
2037  << " compact Id " ;
2038  exp_id.show();
2039  std::cout << " " << show_to_string(febId) << std::endl;
2040  std::cout << std::endl;
2041 
2042  }
2043  }
2044  nids++;
2045  }
2046  }
2047  nidtb=0;
2048  first = ids.begin();
2049  last = ids.end();
2050  for (;first != last && nidtb < nids; ++first)
2051  {
2052  m_calib_module_vec.push_back(*first);
2053  nidtb++;
2054  }
2056  return (0);
2057 }
2058 
2059 
2060 
2061 
2062 
2063 
2064 
LArOnlineID_Base::m_side_index
size_type m_side_index
Definition: LArOnlineID_Base.h:482
IdDictDictionary::find_region
IdDictRegion * find_region(const std::string &region_name) const
Definition: IdDictDictionary.cxx:101
LArOnlineID_Base::feedthroughHashMax
size_type feedthroughHashMax(void) const
Define feedthrough hash tables max size.
Definition: LArOnlineID_Base.cxx:1887
ConstRangeIterator
Definition: RangeIterator.h:46
LArOnlineID_Base::febContext
IdContext febContext(void) const
Define context for feb.
Definition: LArOnlineID_Base.cxx:277
IdDictDictionary::build_multirange
MultiRange build_multirange() const
Get MultiRange for full dictionary.
Definition: IdDictDictionary.cxx:299
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
LArOnlineID_Base::channel_Hash
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
Definition: LArOnlineID_Base.cxx:1632
PlotCalibFromCool.ft
ft
Definition: PlotCalibFromCool.py:329
AtlasDetectorID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
Definition: AtlasDetectorID.cxx:320
get_generator_info.result
result
Definition: get_generator_info.py:21
LArOnlineID_Base::cryostatEndContext
IdContext cryostatEndContext(void) const
Define context for cryostat (obsolete)
Definition: LArOnlineID_Base.cxx:246
LArOnlineID_Base::feedthrough_range
id_range feedthrough_range() const
Definition: LArOnlineID_Base.cxx:1443
IdDictGroup
Definition: IdDictGroup.h:19
LArOnlineID_Base::febHashMax
size_type febHashMax(void) const
define feb hash tables max size
Definition: LArOnlineID_Base.cxx:1892
LArOnlineID_Base::m_slar_impl
IdDictFieldImplementation m_slar_impl
Definition: LArOnlineID_Base.h:519
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:24
LArOnlineID_Base::HashCalcFeb::m_hash
IdentifierHash m_hash
Definition: LArOnlineID_Base.h:534
LArOnlineID_Base::feedthrough_name
std::string feedthrough_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:73
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
LArOnlineID_Base::size_type
Identifier::size_type size_type
Definition: LArOnlineID_Base.h:108
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
IdDictFieldImplementation::show_to_string
std::string show_to_string(void) const
Definition: IdDictFieldImplementation.cxx:38
LArOnlineID_Base::HashCalcFeb::m_slot_values
std::vector< int > m_slot_values
Definition: LArOnlineID_Base.h:535
LArOnlineID_Base::m_feedthrough_impl
IdDictFieldImplementation m_feedthrough_impl
Definition: LArOnlineID_Base.h:514
LArOnlineID_Base::init_calib_hashes
int init_calib_hashes(void)
Definition: LArOnlineID_Base.cxx:1977
IdentifierField::get_minimum
element_type get_minimum() const
Query the values.
Definition: IdentifierField.h:59
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
LArOnlineID_Base.h
LArOnlineID_Base::isHecOnlineFebId
bool isHecOnlineFebId(const HWIdentifier febId) const
Definition: LArOnlineID_Base.cxx:1854
LArOnlineID_Base::feb_Id_checks
void feb_Id_checks(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Definition: LArOnlineID_Base.cxx:754
LArOnlID_Exception.h
LArOnlineID_Base::m_channel_vec
std::vector< HWIdentifier > m_channel_vec
Definition: LArOnlineID_Base.h:499
ExpandedIdentifier::add
void add(element_type value)
Append a value into a new field.
skel.it
it
Definition: skel.GENtoEVGEN.py:396
LArOnlineID_Base::slot
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
Definition: LArOnlineID_Base.cxx:1957
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
IdDictFieldImplementation::pack
void pack(int value, Identifier &id) const
Definition: IdDictFieldImplementation.h:173
LArOnlineID_Base::m_slot_impl
IdDictFieldImplementation m_slot_impl
Definition: LArOnlineID_Base.h:515
LArOnlineID_Base::HashCalc
Define the Hash identifier for channels and febs.
Definition: LArOnlineID_Base.h:525
LArOnlineID_Base::m_laronline_impl
IdDictFieldImplementation m_laronline_impl
Definition: LArOnlineID_Base.h:511
AtlasDetectorID::m_msgSvc
IMessageSvc * m_msgSvc
pointer to the message service
Definition: AtlasDetectorID.h:368
IdentifierField::get_values
const element_vector & get_values() const
Definition: IdentifierField.h:71
IdentifierField::get_maximum
element_type get_maximum() const
Definition: IdentifierField.h:68
LArOnlineID_Base::feb_begin
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
Definition: LArOnlineID_Base.cxx:1906
LArOnlineID_Base::feedthrough_begin
id_iterator feedthrough_begin() const
Return an iterator pointing to Feedthrough identifiers collection.
Definition: LArOnlineID_Base.cxx:1431
LArOnlineID_Base::feedthroughContext
IdContext feedthroughContext(void) const
Define context for feedthroughs.
Definition: LArOnlineID_Base.cxx:256
LArOnlineID_Base::isFcalOnline
bool isFcalOnline(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1728
LArOnlineID_Base::calib_module_Id
HWIdentifier calib_module_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Build calibration module identifier from fields.
Definition: LArOnlineID_Base.h:573
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
LArOnlineID_Base::m_laronline_index
size_type m_laronline_index
Definition: LArOnlineID_Base.h:480
LArOnlineID_Base::m_dict
const IdDictDictionary * m_dict
Definition: LArOnlineID_Base.h:488
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
AtlasDetectorID::lar_field_value
int lar_field_value() const
Definition: AtlasDetectorID.h:614
LArOnlineID_Base::m_side_impl
IdDictFieldImplementation m_side_impl
Definition: LArOnlineID_Base.h:513
HWIdentifier
Definition: HWIdentifier.h:13
LArOnlineID_Base::barrel_ec
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
Definition: LArOnlineID_Base.cxx:1938
IdDictFieldImplementation::unpack
int unpack(Identifier id) const
Identifier manipulation methods.
Definition: IdDictFieldImplementation.h:147
LArOnlineID_Base::channel_end
id_iterator channel_end() const
Definition: LArOnlineID_Base.cxx:1927
LArOnlineID_Base::id_iterator
std::vector< HWIdentifier >::const_iterator id_iterator
Type for iterators over identifiers.
Definition: LArOnlineID_Base.h:111
IdDictDictionary::find_field
IdDictField * find_field(const std::string &name) const
Definition: IdDictDictionary.cxx:45
CalibDbCompareRT.region_id
region_id
Definition: CalibDbCompareRT.py:68
IdDictRegion
Definition: IdDictRegion.h:20
LArOnlineID_Base::m_feedthroughHashMax
size_type m_feedthroughHashMax
Definition: LArOnlineID_Base.h:493
AtlasDetectorID::dictionaryVersion
virtual std::string dictionaryVersion(void) const override
Definition: AtlasDetectorID.cxx:347
LArOnlineID_Base::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
initialization from the identifier dictionary
Definition: LArOnlineID_Base.cxx:315
LArOnlineID_Base::m_calib_channel_vec
std::vector< HWIdentifier > m_calib_channel_vec
Definition: LArOnlineID_Base.h:507
LArOnlineID_Base::m_bec_slot_impl
IdDictFieldImplementation m_bec_slot_impl
Definition: LArOnlineID_Base.h:518
LArOnlineID_Base::m_calibModuleHashMax
size_type m_calibModuleHashMax
Definition: LArOnlineID_Base.h:504
IdDictDefs.h
AtlasDetectorID::size_type
Identifier::size_type size_type
Definition: AtlasDetectorID.h:384
LArOnlineID_Base::m_feb_hash_calcs
std::vector< HashCalcFeb > m_feb_hash_calcs
Definition: LArOnlineID_Base.h:537
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
LArOnlineID_Base::isFCALchannel
bool isFCALchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1653
LArOnlineID_Base::is_slar
int is_slar(const HWIdentifier id) const
Return whether the channel is in slar or not is_ slar = [0,1] in all FEB.
Definition: LArOnlineID_Base.cxx:1969
LArOnlineID_Base::m_channel_in_slot_impl
IdDictFieldImplementation m_channel_in_slot_impl
Definition: LArOnlineID_Base.h:516
IdDictMgr
Definition: IdDictMgr.h:14
LArOnlineID_Base::id_range
boost::iterator_range< id_iterator > id_range
Type for range over identifiers.
Definition: LArOnlineID_Base.h:113
LArOnlineID_Base::m_full_feedthrough_range
MultiRange m_full_feedthrough_range
Definition: LArOnlineID_Base.h:490
IdDictDictionary::find_group
IdDictGroup * find_group(const std::string &group_name) const
Definition: IdDictDictionary.cxx:115
LArOnlineID_Base::channel
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
Definition: LArOnlineID_Base.cxx:1963
IdDictMgr::find_dictionary
IdDictDictionary * find_dictionary(const std::string &name) const
Access dictionary by name.
Definition: IdDictMgr.cxx:115
IdDictRegion::m_index
size_t m_index
Definition: IdDictRegion.h:43
LArOnlineID_Base::feb_range
id_range feb_range() const
Definition: LArOnlineID_Base.cxx:1916
LArOnlineID_Base::m_febHashMax
size_type m_febHashMax
Definition: LArOnlineID_Base.h:494
LArOnlineID_Base::feedthrough_Hash
IdentifierHash feedthrough_Hash(HWIdentifier feedthroughId) const
Create hash id from feedthrough identifiers.
Definition: LArOnlineID_Base.cxx:1412
LArOnlineID_Base::channel_range
id_range channel_range() const
Definition: LArOnlineID_Base.cxx:1932
IdentifierField::empty
bool empty() const
Definition: IdentifierField.h:114
LArOnlineID_Base::m_slar_index
size_type m_slar_index
Definition: LArOnlineID_Base.h:486
lumiFormat.i
int i
Definition: lumiFormat.py:85
IdDictFieldImplementation::set_bits
void set_bits(size_type bits, size_type bits_offset)
Definition: IdDictFieldImplementation.h:278
LArOnlineID_Base::channelInSlotMax
int channelInSlotMax(const HWIdentifier Id) const
Return the Maximum channel number of a given feb slot.
Definition: LArOnlineID_Base.cxx:287
LArOnlineID_Base::m_calibChannelHashMax
size_type m_calibChannelHashMax
Definition: LArOnlineID_Base.h:505
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LArOnlID_Exception
Exception class for LAr online Identifiers.
Definition: LArOnlID_Exception.h:16
LArOnlineID_Base::isEMECPS
bool isEMECPS(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1671
LArOnlineID_Base::get_expanded_id
int get_expanded_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded HWIdentifier from HWIdentifier (return == 0 for OK)
Definition: LArOnlineID_Base.cxx:790
IdDictFieldImplementation::bits_offset
size_type bits_offset() const
Definition: IdDictFieldImplementation.h:208
IdDictDictionary::m_regions
std::vector< IdDictRegion * > m_regions
Definition: IdDictDictionary.h:235
LArOnlineID_Base::channel_Id
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
Definition: LArOnlineID_Base.cxx:1565
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
LArOnlineID_Base::pos_neg
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
Definition: LArOnlineID_Base.cxx:1950
LArOnlineID_Base::isEmEndcapStandardOnline
bool isEmEndcapStandardOnline(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1748
mc.group_name
group_name
Definition: mc.PhPy8EG_A14NNPDF23_NNLOPS_example.py:33
LArOnlineID_Base::initLevelsFromDict
int initLevelsFromDict(const std::string &group_name)
Definition: LArOnlineID_Base.cxx:843
LArOnlineID_Base::m_channelHashMax
size_type m_channelHashMax
Definition: LArOnlineID_Base.h:495
LArOnlineID_Base::m_full_calib_laronline_range
MultiRange m_full_calib_laronline_range
Definition: LArOnlineID_Base.h:502
LArOnlineID_Base::isEndcapOnline
bool isEndcapOnline(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1722
CaloCondBlobAlgs_fillNoiseFromASCII.channelId
channelId
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:122
LArOnlineID_Base::isValidId
bool isValidId(const HWIdentifier id) const
Returns false if the identifier is not a LAr-online id or any of the sub-fields is out of range.
Definition: LArOnlineID_Base.cxx:1329
AtlasDetectorID::m_quiet
bool m_quiet
If true, suppress DEBUG/INFO messages.
Definition: AtlasDetectorID.h:371
LArOnlineID_Base::m_lar_index
size_type m_lar_index
Definition: LArOnlineID_Base.h:479
LArOnlineID_Base::isHecOnline
bool isHecOnline(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1833
IdentifierField::isEnumerated
bool isEnumerated() const
Definition: IdentifierField.h:117
LArOnlineID_Base::init_hashes
int init_hashes(void)
Definition: LArOnlineID_Base.cxx:1126
LArOnlineID_Base::feb_Id
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
Definition: LArOnlineID_Base.cxx:1479
LArOnlineID_Base::m_feedthrough_index
size_type m_feedthrough_index
Definition: LArOnlineID_Base.h:483
LArOnlineID_Base::m_bec_index
size_type m_bec_index
Definition: LArOnlineID_Base.h:481
LArOnlineID_Base::channel_Hash_binary_search
IdentifierHash channel_Hash_binary_search(HWIdentifier channelId) const
Definition: LArOnlineID_Base.h:560
AtlasDetectorID::register_dict_tag
int register_dict_tag(const IdDictMgr &dict_mgr, const std::string &dict_name)
Register the file and tag names for a particular IdDict dictionary.
Definition: AtlasDetectorID.cxx:266
LArOnlineID_Base::feb_end
id_iterator feb_end() const
Definition: LArOnlineID_Base.cxx:1911
IdDictDictionary::get_label_value
int get_label_value(const std::string &field, const std::string &label, int &value) const
Definition: IdDictDictionary.cxx:73
LArOnlineID_Base::m_feedthrough_vec
std::vector< HWIdentifier > m_feedthrough_vec
Definition: LArOnlineID_Base.h:497
LArOnlineID_Base::m_lar_impl
IdDictFieldImplementation m_lar_impl
Field Implementation.
Definition: LArOnlineID_Base.h:510
LArOnlineID_Base::feb_Hash_binary_search
IdentifierHash feb_Hash_binary_search(HWIdentifier channelId) const
Definition: LArOnlineID_Base.h:549
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
python.subdetectors.mmg.ids
ids
Definition: mmg.py:8
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
IdentifierHash.h
LArOnlineID_Base::HashCalc::m_hash
IdentifierHash m_hash
Definition: LArOnlineID_Base.h:528
LArOnlineID_Base::channelHashMax
size_type channelHashMax(void) const
Define channel hash tables max size.
Definition: LArOnlineID_Base.cxx:1897
RangeIterator.h
LArOnlineID_Base::isCalibration
bool isCalibration(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1783
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:29
LArOnlineID_Base::isEmEndcapSpecialOnline
bool isEmEndcapSpecialOnline(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1771
LArOnlineID_Base::isEMBchannel
bool isEMBchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1648
LArOnlineID_Base::m_chan_hash_calcs
std::vector< HashCalc > m_chan_hash_calcs
Definition: LArOnlineID_Base.h:538
IdDictDictionary
Definition: IdDictDictionary.h:30
LArOnlineID_Base::m_bec_impl
IdDictFieldImplementation m_bec_impl
Definition: LArOnlineID_Base.h:512
IdentifierField::isBounded
bool isBounded() const
Definition: IdentifierField.h:116
LArOnlineID_Base::channel_Id_checks
void channel_Id_checks(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
Definition: LArOnlineID_Base.cxx:683
LArOnlineID_Base::get_expanded_calib_id
int get_expanded_calib_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
Definition: LArOnlineID_Base.cxx:817
LArOnlineID_Base::feedthrough
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
Definition: LArOnlineID_Base.cxx:1944
LArOnlineID_Base::feedthrough_Id_checks
void feedthrough_Id_checks(int barrel_ec, int pos_neg, int feedthrough) const
Definition: LArOnlineID_Base.cxx:771
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
LArOnlineID_Base::m_full_feb_range
MultiRange m_full_feb_range
Definition: LArOnlineID_Base.h:491
CaloLCW_tf.group
group
Definition: CaloLCW_tf.py:28
IdDictDictionary::m_name
std::string m_name
Definition: IdDictDictionary.h:216
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
LArOnlineID_Base::m_feb_vec
std::vector< HWIdentifier > m_feb_vec
Definition: LArOnlineID_Base.h:498
LArOnlineID_Base::channelContext
IdContext channelContext(void) const
Define context for channel.
Definition: LArOnlineID_Base.cxx:267
LArOnlineID_Base::feedthrough_end
id_iterator feedthrough_end() const
Definition: LArOnlineID_Base.cxx:1437
LArOnlineID_Base::~LArOnlineID_Base
~LArOnlineID_Base(void)
Default destructor.
LArOnlineID_Base::m_full_laronline_range
MultiRange m_full_laronline_range
Definition: LArOnlineID_Base.h:489
MultiRange::size
size_type size() const
Definition: MultiRange.cxx:70
DeMoScan.first
bool first
Definition: DeMoScan.py:536
LArOnlineID_Base::isEMBPS
bool isEMBPS(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1661
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
IdentifierField
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
Definition: IdentifierField.h:21
LArOnlineID_Base::isPS
bool isPS(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1677
LArOnlineID_Base::m_full_calib_module_range
MultiRange m_full_calib_module_range
Definition: LArOnlineID_Base.h:503
LArOnlineID_Base::LArOnlineID_Base
LArOnlineID_Base(void)
Default constructor.
Definition: LArOnlineID_Base.cxx:47
LArOnlineID_Base::m_slot_index
size_type m_slot_index
Definition: LArOnlineID_Base.h:484
LArOnlineID_Base::isEmEndcapOnline
bool isEmEndcapOnline(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1733
LArOnlineID_Base::isNotWarmCableConnected
bool isNotWarmCableConnected(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1684
IdDictField
Definition: IdDictField.h:15
MultiRange::cardinality
size_type cardinality() const
Computes a possible cardinality from all ranges.
Definition: MultiRange.cxx:82
LArOnlineID_Base::m_channel_in_slot_index
size_type m_channel_in_slot_index
Definition: LArOnlineID_Base.h:485
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
LArOnlineID_Base::channel_name
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
Definition: LArOnlineID_Base.cxx:219
LArOnlineID_Base::m_calib_module_vec
std::vector< HWIdentifier > m_calib_module_vec
Definition: LArOnlineID_Base.h:506
LArOnlineID_Base::HashCalcFeb
Definition: LArOnlineID_Base.h:531
AtlasDetectorID::do_checks
virtual bool do_checks(void) const override
Checks are performed by default in debug compilation and NOT in optimized compilation.
Definition: AtlasDetectorID.cxx:728
LArOnlineID_Base::m_laronlineRegion_index
size_type m_laronlineRegion_index
Definition: LArOnlineID_Base.h:478
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
LArOnlineID_Base::calib_channel_Id
HWIdentifier calib_channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create calibration channel identifiers from fields
Definition: LArOnlineID_Base.h:622
IdDictRegion::m_implementation
std::vector< IdDictFieldImplementation > m_implementation
Definition: IdDictRegion.h:42
LArOnlineID_Base::isEMECinHECchannel
bool isEMECinHECchannel(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1873
LArOnlineID_Base::m_bec_ft_impl
IdDictFieldImplementation m_bec_ft_impl
Definition: LArOnlineID_Base.h:517
LArOnlineID_Base::channel_begin
id_iterator channel_begin() const
Returns an iterator pointing to a channel identifier collection.
Definition: LArOnlineID_Base.cxx:1922
LArOnlineID_Base::feb_Hash
IdentifierHash feb_Hash(HWIdentifier febId) const
Create feb hash identifiers from feb identifiers.
Definition: LArOnlineID_Base.cxx:1512
LArOnlineID_Base::isEmBarrelOnline
bool isEmBarrelOnline(const HWIdentifier id) const
Definition: LArOnlineID_Base.cxx:1716
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356
LArOnlineID_Base::feedthrough_Id
HWIdentifier feedthrough_Id(int barrel_ec, int pos_neg, int feedthrough) const
Create a feedthrough identifier from fields.
Definition: LArOnlineID_Base.cxx:1400
LArOnlineID_Base::m_this_is_slar
bool m_this_is_slar
Definition: LArOnlineID_Base.h:443
IdDictFieldImplementation::size_type
Identifier::size_type size_type
Definition: IdDictFieldImplementation.h:62
IdDictFieldImplementation::bits
size_type bits() const
Definition: IdDictFieldImplementation.h:202