ATLAS Offline Software
Loading...
Searching...
No Matches
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
14#include <vector>
15
16
96 public:
97
98
99 using size_type = Identifier::size_type;
100
101
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
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
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};
285static 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
289CLASS_DEF( LArElectrodeID , 80757351 , 1 )
290
291
292
293
294//=====================
295// Inline Definitions
296//=====================
297
298
299/* Identifier Definition Inline */
300inline HWIdentifier LArElectrodeID::ElectrodeId (int det, int zside, int mod, int phi,
301 int eta, int gap, int elec ) const
302/*============================================================================== */
303{
305 /*Pack fields independently */
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
342inline std::vector<HWIdentifier>::const_iterator LArElectrodeID::electrode_begin() const
343/*====================================================================*/
344{
345 return(m_electrode_vec.begin());
346}
347
348inline std::vector<HWIdentifier>::const_iterator LArElectrodeID::electrode_end() const
349/*==================================================================*/
350{
351 return(m_electrode_vec.end());
352}
353
354
355inline int LArElectrodeID::detector(const HWIdentifier id)const
356/*===========================================================*/
357{
358 return (m_detector_impl.unpack(id));
359}
360
361inline int LArElectrodeID::zside(const HWIdentifier id)const
362/*===========================================================*/
363{
364 return (m_zside_impl.unpack(id));
365}
366
367
368inline int LArElectrodeID::module(const HWIdentifier id)const
369/*===========================================================*/
370{
371 return (m_module_impl.unpack(id));
372}
373
374inline int LArElectrodeID::hv_phi(const HWIdentifier id)const
375/*===========================================================*/
376{
377 return (m_hvphi_impl.unpack(id));
378}
379
380inline int LArElectrodeID::hv_eta(const HWIdentifier id)const
381/*===========================================================*/
382{
383 return (m_hveta_impl.unpack(id));
384}
385
386inline int LArElectrodeID::gap(const HWIdentifier id)const
387/*===========================================================*/
388{
389 return (m_hvgap_impl.unpack(id));
390}
391
393/*===========================================================*/
394{
395 return (m_electrode_impl.unpack(id));
396}
397
398
399// ==========================
400// HEC
401// ==========================
402//
403inline 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//
417inline 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//
430inline 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//
444inline 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//
457inline 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//
471inline 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//
484inline 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//
498inline bool LArElectrodeID::isEMEC( const HWIdentifier id ) const
499/*================================================================*/
500{
501 int det = detector(id);
502 return(
503 det == 2
504 );
505}
506inline 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}
515inline 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//
529inline 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//
542inline 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//
556inline 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
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
static const int s_larconfig_value
int lar_field_value() const
AtlasDetectorID(const std::string &name, const std::string &group)
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
This is a "hash" representation of an Identifier.
Helper for the Liquid Argon Calorimeter cell at the electrode level.
IdentifierHash electrodeHash(HWIdentifier electrode_id) const
Create an electrode hash identifier from an electrode identifier.
IdDictFieldImplementation m_atlas_impl
Field Implementation.
size_type m_detector_index
bool isFCAL3(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 3.
bool isFCAL(const HWIdentifier id) const
Return yes if electrode is in FCAL.
IdDictFieldImplementation m_hveta_impl
bool isEMBPUR(const HWIdentifier id) const
Return yes if electrode is in EMB PUR.
IdDictFieldImplementation m_hvphi_impl
IdDictFieldImplementation m_detector_impl
Identifier::size_type size_type
std::vector< HWIdentifier >::const_iterator electrode_begin() const
Return an iterator pointing to a collection of electrode identifiers.
bool isEMECoutWHEEL(const HWIdentifier id) const
Return yes if electrode is in EMEC outer wheel.
size_type m_electrode_index
IdDictFieldImplementation m_configuration_impl
IdDictFieldImplementation m_hvgap_impl
size_type m_larelectrode_index
size_type m_hvphi_index
MultiRange m_full_larelectrode_range
IdContext electrodeContext() const
Define feedthrough Context.
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
Initialization from the identifier dictionary.
bool isEMEC(const HWIdentifier id) const
Return yes if electrode is in EMEC.
size_type m_atlas_index
virtual ~LArElectrodeID()
Default destructor.
void electrodeId_checks(int det, int side, int mod, int phi, int eta, int hvgap, int elec) const
IdDictFieldImplementation m_electrode_impl
size_type m_configuration_index
bool isFCAL1(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 1.
IdDictFieldImplementation m_zside_impl
size_type m_larElectrodeRegion_index
HWIdentifier ElectrodeId(int det, int side, int mod, int phi, int eta, int gap, int elec) const
Create an Electrode identifier from fields.
int hv_eta(const HWIdentifier id) const
Return an integer corresponding to the high volatge eta sector of an hardware electrode identifier.
LArElectrodeID()
Default constructor.
int zside(const HWIdentifier id) const
Return an integer corresponding to the side of an hardware electrode identifier.
IdentifierHash electrode_hash_binary_search(HWIdentifier elecId) const
size_type m_hveta_index
std::vector< HWIdentifier > m_electrode_vec
bool isEMECinWHEEL(const HWIdentifier id) const
Return yes if electrode is in EMEC inner wheel.
int get_expanded_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
int gap(const HWIdentifier id) const
Return an integer corresponding to the cell gap of an hardware electrode identifier.
size_type electrodeHashMax() const
Define hash tables max size.
std::vector< HWIdentifier >::const_iterator electrode_end() const
bool isEMECPS(const HWIdentifier id) const
Return yes if electrode is in EMEC PreSampler.
bool isEMBPS(const HWIdentifier id) const
Return yes if electrode is in EMBPS.
size_type m_module_index
size_type m_electrodeHashMax
bool isECPUR(const HWIdentifier id) const
Return yes if electrode is in EC PUR.
bool isEMB(const HWIdentifier id) const
Return boolean yes if electrode is in EMB.
const IdDictDictionary * m_dict
bool isFCAL2(const HWIdentifier id) const
Return yes if electrode is in FCAL wheel 2.
int electrode(const HWIdentifier id) const
Return an integer corresponding to the electrode number of an hardware electrode identifier.
size_type m_hvgap_index
int detector(const HWIdentifier id) const
Return an integer corresponding to the detector of an hardware electrode identifier.
IdDictFieldImplementation m_module_impl
bool isHEC(const HWIdentifier id) const
Return yes if electrode is in HEC.
MultiRange m_full_electrode_range
size_type m_zside_index
int hv_phi(const HWIdentifier id) const
Return an integer corresponding to the high voltage phi sector of an hardware electrode identifier.
A MultiRange combines several Ranges.
Definition MultiRange.h:17