ATLAS Offline Software
LArElectrodeID.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef LARIDENTIFIER_LARELECTRODEID_H
6 #define LARIDENTIFIER_LARELECTRODEID_H
7 
12 #include "Identifier/MultiRange.h"
13 #include "AthenaKernel/CLASS_DEF.h"
14 #include <vector>
15 
16 
96  public:
97 
98 
100 
101 
105  LArElectrodeID();
109  virtual ~LArElectrodeID();
110 
114  HWIdentifier ElectrodeId( int det, int side, int mod, int phi, int eta, int gap, int elec ) const;
118  HWIdentifier ElectrodeId( IdentifierHash electrode_hash )const;
122  IdentifierHash electrodeHash( HWIdentifier electrode_id ) const;
123 
127  std::vector<HWIdentifier>::const_iterator electrode_begin() const;
128  std::vector<HWIdentifier>::const_iterator electrode_end() const;
129 
133  size_type electrodeHashMax () const;
134 
138  virtual int initialize_from_dictionary (const IdDictMgr& dict_mgr);
139 
144  int detector ( const HWIdentifier id) const;
149  int zside ( const HWIdentifier id) const;
154  int module ( const HWIdentifier id) const;
159  int hv_phi (const HWIdentifier id) const;
164  int hv_eta (const HWIdentifier id) const;
169  int gap ( const HWIdentifier id) const;
174  int electrode( const HWIdentifier id) const;
175 
176 
180  bool isEMB(const HWIdentifier id) const;
184  bool isEMBPS(const HWIdentifier id) const;
188  bool isEMEC(const HWIdentifier id) const;
192  bool isEMECinWHEEL(const HWIdentifier id) const;
196  bool isEMECoutWHEEL(const HWIdentifier id) const;
200  bool isEMECPS(const HWIdentifier id) const;
204  bool isHEC(const HWIdentifier id) const;
208  bool isFCAL( const HWIdentifier id) const;
212  bool isFCAL1(const HWIdentifier id) const;
216  bool isFCAL2(const HWIdentifier id) const;
220  bool isFCAL3(const HWIdentifier id) const;
224  bool isEMBPUR(const HWIdentifier id) const;
228  bool isECPUR(const HWIdentifier id) const;
229 
233  IdContext electrodeContext() const;
234 
235 
236  private:
237 
238 
239  enum {NOT_VALID_HASH = 256000};
240 
242 
243  /* Check methods */
244  void electrodeId_checks(int det, int side, int mod, int phi, int eta, int hvgap, int elec )const;
245 
246  /* create expanded HWIdentifier from HWIdentifier (return == 0 for OK) */
247  int get_expanded_id (const HWIdentifier& id, ExpandedIdentifier& exp_id,
248  const IdContext* context) const;
249 
250  /* init() hashes */
251  int initLevelsFromDict();
252  int init_hashes();
253 
254  /* Member Data index */
266 
271  std::vector<HWIdentifier> m_electrode_vec;
272 
283 
284 };
285 static const int s_larconfig_value = 1 ;
286 
287 //using the macro below we can assign an identifier (and a version)
288 //This is required and checked at compile time when you try to record/retrieve
289 CLASS_DEF( LArElectrodeID , 80757351 , 1 )
290 
291 
292 
293 
294 //=====================
295 // Inline Definitions
296 //=====================
297 
298 
299 /* Identifier Definition Inline */
300 inline HWIdentifier LArElectrodeID::ElectrodeId (int det, int zside, int mod, int phi,
301  int eta, int gap, int elec ) const
302 /*============================================================================== */
303 {
304  HWIdentifier result(0);
305  /*Pack fields independently */
306  m_atlas_impl.pack (lar_field_value(), result);
307  m_configuration_impl.pack(s_larconfig_value, result);
308  m_detector_impl.pack (det , result);
309  m_zside_impl.pack (zside , result);
310  m_module_impl.pack (mod , result);
311  m_hvphi_impl.pack (phi , result);
312  m_hveta_impl.pack (eta , result);
313  m_hvgap_impl.pack (gap , result);
314  m_electrode_impl.pack (elec , result);
315  return result;
316 }
317 
319 /*===================================================================*/
320 {
321  return(m_electrode_vec[electrodeHashId]);
322 }
323 
324 
326 /*=============================================================================== */
327 {
328  std::vector<HWIdentifier>::const_iterator it = std::lower_bound(m_electrode_vec.begin(),m_electrode_vec.end(),hvId);
329  if ( it != m_electrode_vec.end() ){
330  return (it - m_electrode_vec.begin());
331  }
332  return (0);
333 }
334 
336 /*====================================================================*/
337 {
338  return m_electrodeHashMax;
339 }
340 
341 
342 inline std::vector<HWIdentifier>::const_iterator LArElectrodeID::electrode_begin() const
343 /*====================================================================*/
344 {
345  return(m_electrode_vec.begin());
346 }
347 
348 inline std::vector<HWIdentifier>::const_iterator LArElectrodeID::electrode_end() const
349 /*==================================================================*/
350 {
351  return(m_electrode_vec.end());
352 }
353 
354 
355 inline int LArElectrodeID::detector(const HWIdentifier id)const
356 /*===========================================================*/
357 {
358  return (m_detector_impl.unpack(id));
359 }
360 
361 inline int LArElectrodeID::zside(const HWIdentifier id)const
362 /*===========================================================*/
363 {
364  return (m_zside_impl.unpack(id));
365 }
366 
367 
368 inline int LArElectrodeID::module(const HWIdentifier id)const
369 /*===========================================================*/
370 {
371  return (m_module_impl.unpack(id));
372 }
373 
374 inline int LArElectrodeID::hv_phi(const HWIdentifier id)const
375 /*===========================================================*/
376 {
377  return (m_hvphi_impl.unpack(id));
378 }
379 
380 inline int LArElectrodeID::hv_eta(const HWIdentifier id)const
381 /*===========================================================*/
382 {
383  return (m_hveta_impl.unpack(id));
384 }
385 
386 inline int LArElectrodeID::gap(const HWIdentifier id)const
387 /*===========================================================*/
388 {
389  return (m_hvgap_impl.unpack(id));
390 }
391 
392 inline int LArElectrodeID::electrode(const HWIdentifier id)const
393 /*===========================================================*/
394 {
395  return (m_electrode_impl.unpack(id));
396 }
397 
398 
399 // ==========================
400 // HEC
401 // ==========================
402 //
403 inline bool LArElectrodeID::isHEC( const HWIdentifier id ) const
404 /*================================================================*/
405 {
406  int det = detector(id);
407  return(
408  det == 4
409  );
410 }
411 
412 
413 // ==========================
414 // FCAL
415 // ==========================
416 //
417 inline bool LArElectrodeID::isFCAL( const HWIdentifier id ) const
418 /*================================================================*/
419 {
420  int det = detector(id);
421  //int hveta= hv_eta(id);
422  return(
423  det == 5
424  );
425 }
426 // ==========================
427 // FCAL-S1
428 // ==========================
429 //
430 inline bool LArElectrodeID::isFCAL1( const HWIdentifier id ) const
431 /*================================================================*/
432 {
433  int det = detector(id);
434  int hveta = hv_eta(id);
435  return(
436  det == 5 && hveta == 1
437  );
438 }
439 
440 // ==========================
441 // FCAL-S2
442 // ==========================
443 //
444 inline bool LArElectrodeID::isFCAL2( const HWIdentifier id ) const
445 /*================================================================*/
446 {
447  int det = detector(id);
448  int hveta = hv_eta(id);
449  return(
450  det == 5 && hveta == 2
451  );
452 }
453 // ==========================
454 // FCAL-S3
455 // ==========================
456 //
457 inline bool LArElectrodeID::isFCAL3( const HWIdentifier id ) const
458 /*================================================================*/
459 {
460  int det = detector(id);
461  int hveta = hv_eta(id);
462  return(
463  det == 5 && hveta == 3
464  );
465 }
466 
467 // ==========================
468 // EMBPUR
469 // ==========================
470 //
471 inline bool LArElectrodeID::isEMBPUR( const HWIdentifier id ) const
472 /*================================================================*/
473 {
474  int det = detector(id);
475  return(
476  det == 6
477  );
478 }
479 
480 // ==========================
481 // ECPUR
482 // ==========================
483 //
484 inline bool LArElectrodeID::isECPUR( const HWIdentifier id ) const
485 /*================================================================*/
486 {
487  int det = detector(id);
488  return(
489  det == 7
490  );
491 }
492 
493 
494 // ==========================
495 // EMEC
496 // ==========================
497 //
498 inline bool LArElectrodeID::isEMEC( const HWIdentifier id ) const
499 /*================================================================*/
500 {
501  int det = detector(id);
502  return(
503  det == 2
504  );
505 }
506 inline bool LArElectrodeID::isEMECinWHEEL( const HWIdentifier id ) const
507 /*================================================================*/
508 {
509  int det = detector(id);
510  int eta = hv_eta(id);
511  return(
512  det == 2 && eta >= 7
513  );
514 }
515 inline bool LArElectrodeID::isEMECoutWHEEL( const HWIdentifier id ) const
516 /*================================================================*/
517 {
518  int det = detector(id);
519  int eta = hv_eta(id);
520  return(
521  det == 2 && eta < 7
522  );
523 }
524 
525 // ==========================
526 // EMECPS
527 // ==========================
528 //
529 inline bool LArElectrodeID::isEMECPS( const HWIdentifier id ) const
530 /*================================================================*/
531 {
532  int det = detector(id);
533  return(
534  det == 3
535  );
536 }
537 
538 // ==========================
539 // EMB
540 // ==========================
541 //
542 inline bool LArElectrodeID::isEMB( const HWIdentifier id ) const
543 /*================================================================*/
544 {
545  int det = detector(id);
546  return(
547  det == 0
548  );
549 }
550 
551 
552 // ==========================
553 // EMBPS
554 // ==========================
555 //
556 inline bool LArElectrodeID::isEMBPS( const HWIdentifier id ) const
557 /*================================================================*/
558 {
559  int det = detector(id);
560  return(
561  det == 1
562  );
563 }
564 
565 
566 
567 
568 
569 #endif //LARELECTRODEID_H
LArElectrodeID::~LArElectrodeID
virtual ~LArElectrodeID()
Default destructor.
LArElectrodeID::isEMECPS
bool isEMECPS(const HWIdentifier id) const
Return yes if electrode is in EMEC PreSampler.
Definition: LArElectrodeID.h:529
LArElectrodeID::electrodeId_checks
void electrodeId_checks(int det, int side, int mod, int phi, int eta, int hvgap, int elec) const
get_generator_info.result
result
Definition: get_generator_info.py:21
LArElectrodeID::m_hveta_impl
IdDictFieldImplementation m_hveta_impl
Definition: LArElectrodeID.h:280
LArElectrodeID::electrode_begin
std::vector< HWIdentifier >::const_iterator electrode_begin() const
Return an iterator pointing to a collection of electrode identifiers.
Definition: LArElectrodeID.h:342
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
LArElectrodeID::m_hvphi_impl
IdDictFieldImplementation m_hvphi_impl
Definition: LArElectrodeID.h:279
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
LArElectrodeID
Helper for the Liquid Argon Calorimeter cell at the electrode level.
Definition: LArElectrodeID.h:95
TRTCalib_cfilter.detector
detector
Definition: TRTCalib_cfilter.py:241
LArElectrodeID::ElectrodeId
HWIdentifier ElectrodeId(int det, int side, int mod, int phi, int eta, int gap, int elec) const
Create an Electrode identifier from fields.
Definition: LArElectrodeID.h:300
skel.it
it
Definition: skel.GENtoEVGEN.py:407
LArElectrodeID::m_hveta_index
size_type m_hveta_index
Definition: LArElectrodeID.h:263
LArElectrodeID::initLevelsFromDict
int initLevelsFromDict()
Definition: LArElectrodeID.cxx:199
LArElectrodeID::m_atlas_impl
IdDictFieldImplementation m_atlas_impl
Field Implementation.
Definition: LArElectrodeID.h:274
ExpandedIdentifier
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:102
LArElectrodeID::electrodeHash
IdentifierHash electrodeHash(HWIdentifier electrode_id) const
Create an electrode hash identifier from an electrode identifier.
Definition: LArElectrodeID.h:325
LArElectrodeID::isEMBPUR
bool isEMBPUR(const HWIdentifier id) const
Return yes if electrode is in EMB PUR.
Definition: LArElectrodeID.h:471
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
LArElectrodeID::isFCAL1
bool isFCAL1(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 1.
Definition: LArElectrodeID.h:430
LArElectrodeID::m_configuration_impl
IdDictFieldImplementation m_configuration_impl
Definition: LArElectrodeID.h:275
HWIdentifier
Definition: HWIdentifier.h:13
LArElectrodeID::electrode_hash_binary_search
IdentifierHash electrode_hash_binary_search(HWIdentifier elecId) const
CaloSwCorrections.gap
def gap(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:212
LArElectrodeID::m_electrodeHashMax
size_type m_electrodeHashMax
Definition: LArElectrodeID.h:270
LArElectrodeID::isFCAL2
bool isFCAL2(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 2.
Definition: LArElectrodeID.h:444
LArElectrodeID::isFCAL3
bool isFCAL3(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 3.
Definition: LArElectrodeID.h:457
LArElectrodeID::m_hvgap_impl
IdDictFieldImplementation m_hvgap_impl
Definition: LArElectrodeID.h:281
LArElectrodeID::isEMECinWHEEL
bool isEMECinWHEEL(const HWIdentifier id) const
Return yes if electrode is in EMEC inner wheel.
Definition: LArElectrodeID.h:506
LArElectrodeID::m_zside_index
size_type m_zside_index
Definition: LArElectrodeID.h:260
TRT::Hit::side
@ side
Definition: HitInfo.h:83
LArElectrodeID::m_full_electrode_range
MultiRange m_full_electrode_range
Definition: LArElectrodeID.h:269
LArElectrodeID::m_larElectrodeRegion_index
size_type m_larElectrodeRegion_index
Definition: LArElectrodeID.h:255
LArElectrodeID::electrodeContext
IdContext electrodeContext() const
Define feedthrough Context.
Definition: LArElectrodeID.cxx:44
AtlasDetectorID::size_type
Identifier::size_type size_type
Definition: AtlasDetectorID.h:385
LArElectrodeID::electrode
int electrode(const HWIdentifier id) const
Return an integer corresponding to the electrode number of an hardware electrode identifier.
Definition: LArElectrodeID.h:392
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
IdDictMgr
Definition: IdDictMgr.h:14
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
LArElectrodeID::zside
int zside(const HWIdentifier id) const
Return an integer corresponding to the side of an hardware electrode identifier.
Definition: LArElectrodeID.h:361
LArElectrodeID::isHEC
bool isHEC(const HWIdentifier id) const
Return yes if electrode is in HEC.
Definition: LArElectrodeID.h:403
LArElectrodeID::isEMECoutWHEEL
bool isEMECoutWHEEL(const HWIdentifier id) const
Return yes if electrode is in EMEC outer wheel.
Definition: LArElectrodeID.h:515
LArElectrodeID::module
int module(const HWIdentifier id) const
Return an integer corresponding to the module of an hardware electrode identifier.
Definition: LArElectrodeID.h:368
LArElectrodeID::m_larelectrode_index
size_type m_larelectrode_index
Definition: LArElectrodeID.h:256
LArElectrodeID::detector
int detector(const HWIdentifier id) const
Return an integer corresponding to the detector of an hardware electrode identifier.
Definition: LArElectrodeID.h:355
LArElectrodeID::m_atlas_index
size_type m_atlas_index
Definition: LArElectrodeID.h:257
LArElectrodeID::m_hvphi_index
size_type m_hvphi_index
Definition: LArElectrodeID.h:262
LArElectrodeID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: LArElectrodeID.h:239
LArElectrodeID::m_configuration_index
size_type m_configuration_index
Definition: LArElectrodeID.h:258
LArElectrodeID::gap
int gap(const HWIdentifier id) const
Return an integer corresponding to the cell gap of an hardware electrode identifier.
Definition: LArElectrodeID.h:386
MultiRange
A MultiRange combines several Ranges.
Definition: MultiRange.h:17
HWIdentifier.h
LArElectrodeID::m_detector_impl
IdDictFieldImplementation m_detector_impl
Definition: LArElectrodeID.h:276
IdentifierHash.h
LArElectrodeID::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
Initialization from the identifier dictionary.
Definition: LArElectrodeID.cxx:52
LArElectrodeID::m_dict
const IdDictDictionary * m_dict
Definition: LArElectrodeID.h:267
LArElectrodeID::m_detector_index
size_type m_detector_index
Definition: LArElectrodeID.h:259
LArElectrodeID::hv_eta
int hv_eta(const HWIdentifier id) const
Return an integer corresponding to the high volatge eta sector of an hardware electrode identifier.
Definition: LArElectrodeID.h:380
LArElectrodeID::init_hashes
int init_hashes()
Definition: LArElectrodeID.cxx:398
LArElectrodeID::get_expanded_id
int get_expanded_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
Definition: LArElectrodeID.cxx:174
MultiRange.h
IdDictDictionary
Definition: IdDictDictionary.h:30
LArElectrodeID::LArElectrodeID
LArElectrodeID()
Default constructor.
Definition: LArElectrodeID.cxx:22
IdDictFieldImplementation.h
LArElectrodeID::m_electrode_vec
std::vector< HWIdentifier > m_electrode_vec
Definition: LArElectrodeID.h:271
LArElectrodeID::isFCAL
bool isFCAL(const HWIdentifier id) const
Return yes if electrode is in FCAL.
Definition: LArElectrodeID.h:417
LArElectrodeID::isEMEC
bool isEMEC(const HWIdentifier id) const
Return yes if electrode is in EMEC.
Definition: LArElectrodeID.h:498
LArElectrodeID::m_electrode_impl
IdDictFieldImplementation m_electrode_impl
Definition: LArElectrodeID.h:282
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:67
LArElectrodeID::electrodeHashMax
size_type electrodeHashMax() const
Define hash tables max size.
Definition: LArElectrodeID.h:335
LArElectrodeID::electrode_end
std::vector< HWIdentifier >::const_iterator electrode_end() const
Definition: LArElectrodeID.h:348
LArElectrodeID::hv_phi
int hv_phi(const HWIdentifier id) const
Return an integer corresponding to the high voltage phi sector of an hardware electrode identifier.
Definition: LArElectrodeID.h:374
LArElectrodeID::isEMBPS
bool isEMBPS(const HWIdentifier id) const
Return yes if electrode is in EMBPS.
Definition: LArElectrodeID.h:556
LArElectrodeID::m_electrode_index
size_type m_electrode_index
Definition: LArElectrodeID.h:265
Identifier::size_type
unsigned long long size_type
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:29
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition: IdDictFieldImplementation.h:58
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
LArElectrodeID::isECPUR
bool isECPUR(const HWIdentifier id) const
Return yes if electrode is in EC PUR.
Definition: LArElectrodeID.h:484
LArElectrodeID::m_zside_impl
IdDictFieldImplementation m_zside_impl
Definition: LArElectrodeID.h:277
LArElectrodeID::m_module_impl
IdDictFieldImplementation m_module_impl
Definition: LArElectrodeID.h:278
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
LArElectrodeID::m_full_larelectrode_range
MultiRange m_full_larelectrode_range
Definition: LArElectrodeID.h:268
CLASS_DEF.h
macros to associate a CLID to a type
LArElectrodeID::size_type
Identifier::size_type size_type
Definition: LArElectrodeID.h:99
LArElectrodeID::m_module_index
size_type m_module_index
Definition: LArElectrodeID.h:261
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:52
LArElectrodeID::m_hvgap_index
size_type m_hvgap_index
Definition: LArElectrodeID.h:264
LArElectrodeID::isEMB
bool isEMB(const HWIdentifier id) const
Return boolean yes if electrode is in EMB.
Definition: LArElectrodeID.h:542