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