ATLAS Offline Software
Loading...
Searching...
No Matches
LArOnlineID_Base.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 LARONLINEID_BASE_H
6#define LARONLINEID_BASE_H
7
14#include <vector>
15#include <ranges>
16
17
18
19
97{
98 public:
99
100 using size_type = Identifier::size_type;
101
103 using id_iterator = std::vector<HWIdentifier>::const_iterator;
105 using id_range = std::ranges::subrange<id_iterator>;
106
110 LArOnlineID_Base(const std::string& name,
111 const std::string& group,
112 bool is_slar);
117
123 bool checks) const;
124
128 HWIdentifier feedthrough_Id(IdentifierHash feedthroughHash) const;
129
133 IdentifierHash feedthrough_Hash(HWIdentifier feedthroughId) const;
134
141
142
143
148 int pos_neg,
149 int feedthrough,
150 int slot) const;
152 int pos_neg,
153 int feedthrough,
154 int slot,
155 bool checks) const;
159 HWIdentifier feb_Id(IdentifierHash febHash) const;
160
165
169 id_iterator feb_begin() const;
170 id_iterator feb_end () const;
171 id_range feb_range() const;
172
173
174
179 int pos_neg,
180 int feedthrough,
181 int slot,
182 int channel) const;
184 int pos_neg,
185 int feedthrough,
186 int slot,
187 int channel,
188 bool checks) const;
192 HWIdentifier channel_Id(IdentifierHash channelHash) const;
193
198
203 id_iterator channel_end () const;
204 id_range channel_range() const;
205
206
214 HWIdentifier feb_Id(const HWIdentifier channelId) const ;
218 HWIdentifier feb_Id(const HWIdentifier feedthroughId, int slot) const ;
222 HWIdentifier channel_Id(const HWIdentifier feedthroughId, int slot, int channel) const;
223 HWIdentifier channel_Id(const HWIdentifier feedthroughId, int slot, int channel,
224 bool checks) const;
228 HWIdentifier channel_Id(const HWIdentifier febId, int channel) const;
230 bool checks) const;
231
232
240 size_type febHashMax () const;
244 size_type channelHashMax () const;
245
250 int pos_neg,
251 int feedthrough,
252 int slot ) const;
256 HWIdentifier calib_module_Id(IdentifierHash calibModuleHash) const;
260 IdentifierHash calib_module_Hash(HWIdentifier calibModuleId) const;
261
268
269
274 int pos_neg,
275 int feedthrough,
276 int slot,
277 int channel ) const;
281 HWIdentifier calib_channel_Id(IdentifierHash calibChannelHash) const;
288
289
293 HWIdentifier calib_module_Id(const HWIdentifier ChannelId) const ;
297 HWIdentifier calib_module_Id(const HWIdentifier FeedthroughId, int slot) const ;
301 HWIdentifier calib_channel_Id(const HWIdentifier FeedthroughId, int slot, int channel ) const ;
305 HWIdentifier calib_channel_Id(const HWIdentifier febId, int ChannelId) const ;
306
308
313
318
319
323 /* recommended methods */
324 bool isEMBchannel (const HWIdentifier id) const;
325 virtual bool isEMECchannel (const HWIdentifier id) const = 0; // differs for Main and DT
326 virtual bool isHECchannel (const HWIdentifier id) const = 0; // differs for Main and DT
327 bool isFCALchannel (const HWIdentifier id) const;
328 virtual bool isEMECIW (const HWIdentifier id) const = 0; // differs for Main and DT
329 virtual bool isEMECOW (const HWIdentifier id) const = 0; // differs for Main and DT
330 bool isEMBPS (const HWIdentifier id) const;
331 bool isEMECPS (const HWIdentifier id) const;
332 bool isPS (const HWIdentifier id) const;
333 bool isNotWarmCableConnected (const HWIdentifier id) const;
334 bool isCalibration (const HWIdentifier id) const;
335
336 /* To be used with care */
337 bool isHecOnline (const HWIdentifier id) const;
338 bool isHecOnlineFebId (const HWIdentifier febId) const;
339 bool isEMECinHECchannel (const HWIdentifier id) const;
340
341 /* obsolete */
342 bool isEmBarrelOnline (const HWIdentifier id) const;
343 bool isEmEndcapOnline (const HWIdentifier id) const;
344 bool isEndcapOnline (const HWIdentifier id) const;
345 bool isFcalOnline (const HWIdentifier id) const;
346 bool isEmEndcapStandardOnline (const HWIdentifier id) const;
347 bool isEmEndcapSpecialOnline (const HWIdentifier id) const;
348
352 int channelInSlotMax (const HWIdentifier Id) const;
353
357 std::string feedthrough_name(const HWIdentifier id ) const;
358
362 std::string channel_name(const HWIdentifier id ) const;
363
368 int barrel_ec(const HWIdentifier id)const;
369
374 int pos_neg(const HWIdentifier id)const;
375
383 int feedthrough(const HWIdentifier id)const;
384
390 int slot(const HWIdentifier id)const;
391
396 int channel(const HWIdentifier id)const;
397
402 int is_slar(const HWIdentifier id)const;
403
404
408 bool isValidId(const HWIdentifier id) const;
409
413 virtual int initialize_from_dictionary (const IdDictMgr& dict_mgr);
414
415
427 IdContext febContext() const;
432
433protected:
434/*==== */
435
436 enum {NOT_VALID_HASH = 256000};
438
440
442
443 // Check methods
445 int pos_neg,
446 int feedthrough,
447 int slot,
448 int channel ) const;
449
450 void channel_Id_checks(const HWIdentifier feedthroughId,
451 int slot,
452 int channel ) const;
453
454 void channel_Id_checks(const HWIdentifier febId,
455 int channel ) const;
456
457 void feb_Id_checks(int barrel_ec, int pos_neg, int feedthrough, int slot ) const;
458
459 void feedthrough_Id_checks(int barrel_ec, int pos_neg, int feedthrough ) const;
460
462 int get_expanded_id (const HWIdentifier& id,
463 ExpandedIdentifier& exp_id,
464 const IdContext* context) const;
465 int get_expanded_calib_id (const HWIdentifier& id,
466 ExpandedIdentifier& exp_id,
467 const IdContext* context) const;
468 int initLevelsFromDict(const std::string& group_name) ;
469 int init_hashes();
470 int init_calib_hashes();
471
475 size_type m_bec_index; // [0 Barrel, 1 Endcap]
476 size_type m_side_index; // [-1 negative-side, 1 positive-side]
477 size_type m_feedthrough_index; // [0,31] or [0,24]
481
490
491 std::vector<HWIdentifier> m_feedthrough_vec;
492 std::vector<HWIdentifier> m_feb_vec;
493 std::vector<HWIdentifier> m_channel_vec;
494
495 /* Calib */
500 std::vector<HWIdentifier> m_calib_module_vec;
501 std::vector<HWIdentifier> m_calib_channel_vec;
502
514
519 {
520 public:
521 HashCalc() : m_hash(0) {}
523 };
525 {
526 public:
529 std::vector<int> m_slot_values; // need to save slot values for enumerated slot field
530 };
531 std::vector<HashCalcFeb> m_feb_hash_calcs;
532 std::vector<HashCalc> m_chan_hash_calcs;
533
534};
535
536static const int s_lar_online_field_value = 4 ;
537static const int s_lar_onlineCalib_field_value = 5 ;
538
539//=====================
540// Inline Definitions
541//=====================
542
544/*=============================================================================== */
545{
546 std::vector<HWIdentifier>::const_iterator it = std::lower_bound(m_feb_vec.begin(),m_feb_vec.end(),febId);
547 if ( it != m_feb_vec.end() ){
548 return (it - m_feb_vec.begin());
549 }
550 return (0);
551}
552
553
555/*=========================================================================*/
556{
557 std::vector<HWIdentifier>::const_iterator it = std::lower_bound(m_channel_vec.begin(),m_channel_vec.end(),channelId);
558 if ( it != m_channel_vec.end() ){
559 return (it - m_channel_vec.begin());
560 }
561 return(0) ;
562}
563
564/* CALIB inline Identifiers */
565/*==========================*/
566
568 int feedthrough, int slot ) const
569/*=============================================================== */
570{
572 /*Pack fields independently */
574 m_laronline_impl.pack (5 , result);
575 m_bec_impl.pack (barrel_ec , result);
576 m_side_impl.pack (pos_neg , result);
578 m_slot_impl.pack (slot , result);
579 return result;
580}
581
583/*==================================================================================== */
584{
585 HWIdentifier result(feedthroughId);
586 /* Pack fields independently */
587 m_slot_impl.reset (result);
588 m_slot_impl.pack (slot , result);
589 return(result);
590}
591
593/*======================================================================= */
594{
595 HWIdentifier result(calibChannelId);
597 return(result);
598}
599
601/*=========================================================================== */
602{
603 return(m_calib_module_vec[calibModuleHashId]);
604}
605
607/*=============================================================================== */
608{
609 std::vector<HWIdentifier>::const_iterator it = std::lower_bound(m_calib_module_vec.begin(),m_calib_module_vec.end(),calibModuleId);
610 if ( it != m_calib_module_vec.end() ){
611 return (it - m_calib_module_vec.begin());
612 }
613 return (0);
614}
615
617 int slot, int channel ) const
618/*============================================================================== */
619{
621 /* Pack fields independently */
623 m_laronline_impl.pack (5 , result);
624 m_bec_impl.pack (barrel_ec , result);
625 m_side_impl.pack (pos_neg , result);
627 m_slot_impl.pack (slot , result);
629
630 return result;
631}
632
634/*==================================================================================================== */
635{
636 HWIdentifier result(feedthroughId);
637 /* Pack fields independently */
638 m_slot_impl.reset (result);
640 m_slot_impl.pack (slot , result);
642
643 return result;
644}
645
647/*======================================================================================= */
648{
649 HWIdentifier result(febId);
650 /* Pack fields independently */
653
654 return result;
655}
657/*===================================================================*/
658{
659 return(m_calib_channel_vec[channelHashId]);
660}
661
663/*=========================================================================*/
664{
665 std::vector<HWIdentifier>::const_iterator it = std::lower_bound(m_calib_channel_vec.begin(),m_calib_channel_vec.end(),channelId);
666 if ( it != m_calib_channel_vec.end() ){
667 return (it - m_calib_channel_vec.begin());
668 }
669 return(0) ;
670}
671
672/* Calib */
674/*=======================================================================*/
675{
677}
679/*====================================================================*/
680{
682}
683
684
685
686
687
688/* Calib */
690/*====================================================================*/
691{
692 return(m_calib_module_vec.begin());
693}
695/*==================================================================*/
696{
697 return(m_calib_module_vec.end());
698}
700/*==================================================================*/
701{
703}
704
706/*======================================================================*/
707{
708 return(m_calib_channel_vec.begin());
709}
711/*======================================================================*/
712{
713 return(m_calib_channel_vec.end());
714}
716/*======================================================================*/
717{
719}
720
721
722
723//using the macro below we can assign an identifier (and a version)
724//This is required and checked at compile time when you try to record/retrieve
725CLASS_DEF( LArOnlineID_Base , 28598761 , 1 )
726
727
728#endif // LARONLINE_ID_BASE_H
729
730
731
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_lar_online_field_value
static const int s_lar_onlineCalib_field_value
int lar_field_value() const
const std::string & group() const
Group name for this helper.
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 identifiers.
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.
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
bool isNotWarmCableConnected(const HWIdentifier id) const
MultiRange m_full_laronline_range
std::string feedthrough_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
std::ranges::subrange< id_iterator > id_range
Type for range over identifiers.
HWIdentifier feedthrough_Id(int barrel_ec, int pos_neg, int feedthrough) const
Create a feedthrough identifier from fields.
virtual bool isEMECchannel(const HWIdentifier id) const =0
std::vector< HWIdentifier > m_channel_vec
bool isHecOnline(const HWIdentifier id) const
bool isFcalOnline(const HWIdentifier id) const
size_type m_calibModuleHashMax
id_iterator feedthrough_begin() const
Return an iterator pointing to Feedthrough identifiers collection.
bool isPS(const HWIdentifier id) const
int get_expanded_calib_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
bool isEndcapOnline(const HWIdentifier id) const
bool isEMBchannel(const HWIdentifier id) const
IdentifierHash calib_channel_Hash(HWIdentifier channelId) const
IdContext cryostatEndContext() const
Define context for cryostat (obsolete)
std::vector< HWIdentifier >::const_iterator id_iterator
Type for iterators over identifiers.
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...
HWIdentifier calib_channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create calibration channel identifiers from fields
virtual bool isEMECIW(const HWIdentifier id) const =0
const IdDictDictionary * m_dict
size_type m_channel_in_slot_index
id_iterator calib_module_end() const
IdDictFieldImplementation m_channel_in_slot_impl
size_type m_feedthrough_index
bool isEmBarrelOnline(const HWIdentifier id) const
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
id_range channel_range() const
void feb_Id_checks(int barrel_ec, int pos_neg, int feedthrough, int slot) const
id_iterator calib_channel_begin() const
Return an iterator pointing to a collection of calibration channel identifiers.
size_type calibChannelHashMax() const
Define calibration channel hash tables max size.
MultiRange m_full_calib_laronline_range
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
HWIdentifier channel_Id(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
create channel identifier from fields
std::vector< HWIdentifier > m_calib_channel_vec
MultiRange m_full_channel_range
IdContext channelContext() const
Define context for channel.
int get_expanded_id(const HWIdentifier &id, ExpandedIdentifier &exp_id, const IdContext *context) const
create expanded HWIdentifier from HWIdentifier (return == 0 for OK)
IdContext febContext() const
Define context for feb.
id_iterator channel_end() const
virtual bool isEMECOW(const HWIdentifier id) const =0
IdentifierHash channel_Hash_binary_search(HWIdentifier channelId) const
HWIdentifier calib_module_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Build calibration module identifier from fields.
IdentifierHash feb_Hash_binary_search(HWIdentifier channelId) const
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
id_range feb_range() const
int is_slar(const HWIdentifier id) const
Return whether the channel is in slar or not is_ slar = [0,1] in all FEB.
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
size_type m_laronline_index
std::vector< HWIdentifier > m_calib_module_vec
id_iterator channel_begin() const
Returns an iterator pointing to a channel identifier collection.
MultiRange m_full_feb_range
IdDictFieldImplementation m_bec_ft_impl
size_type febHashMax() const
define feb hash tables max size
bool isEmEndcapStandardOnline(const HWIdentifier id) const
size_type channelHashMax() const
Define channel hash tables max size.
LArOnlineID_Base(const std::string &name, const std::string &group, bool is_slar)
Default constructor.
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...
size_type calibModuleHashMax() const
Define calibration module hash tables max size.
bool isEmEndcapSpecialOnline(const HWIdentifier id) const
IdDictFieldImplementation m_feedthrough_impl
std::string channel_name(const HWIdentifier id) const
Return a string corresponding to a feedthrough name given an identifier.
IdentifierHash feb_Hash(HWIdentifier febId) const
Create feb hash identifiers from feb identifiers.
IdContext feedthroughContext() const
Define context for feedthroughs.
IdDictFieldImplementation m_slot_impl
void channel_Id_checks(int barrel_ec, int pos_neg, int feedthrough, int slot, int channel) const
IdDictFieldImplementation m_laronline_impl
IdentifierHash calib_module_Hash(HWIdentifier calibModuleId) const
create calibration module_hash identifier from module Identifier
id_range calib_module_range() const
IdentifierHash feedthrough_Hash(HWIdentifier feedthroughId) const
Create hash id from feedthrough identifiers.
size_type m_feedthroughHashMax
virtual ~LArOnlineID_Base()
Default destructor.
IdDictFieldImplementation m_side_impl
id_iterator feb_end() const
size_type m_laronlineRegion_index
std::vector< HWIdentifier > m_feb_vec
std::vector< HashCalcFeb > m_feb_hash_calcs
int initLevelsFromDict(const std::string &group_name)
bool isEMECPS(const HWIdentifier id) const
Identifier::size_type size_type
IdDictFieldImplementation m_bec_impl
std::vector< HWIdentifier > m_feedthrough_vec
bool isCalibration(const HWIdentifier id) const
bool isHecOnlineFebId(const HWIdentifier febId) const
bool isFCALchannel(const HWIdentifier id) const
IdDictFieldImplementation m_bec_slot_impl
id_iterator feedthrough_end() const
virtual bool isHECchannel(const HWIdentifier id) const =0
id_iterator calib_channel_end() const
bool isEMECinHECchannel(const HWIdentifier id) const
IdDictFieldImplementation m_lar_impl
Field Implementation.
size_type feedthroughHashMax() const
Define feedthrough hash tables max size.
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr)
initialization from the identifier dictionary
bool isEMBPS(const HWIdentifier id) const
MultiRange m_full_calib_module_range
id_range feedthrough_range() const
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
size_type m_calibChannelHashMax
int channelInSlotMax(const HWIdentifier Id) const
Return the Maximum channel number of a given feb slot.
bool isEmEndcapOnline(const HWIdentifier id) const
IdDictFieldImplementation m_slar_impl
id_iterator calib_module_begin() const
Return an iterator pointing to a calibFeb identifier 's collection.
MultiRange m_full_feedthrough_range
id_range calib_channel_range() const
std::vector< HashCalc > m_chan_hash_calcs
void feedthrough_Id_checks(int barrel_ec, int pos_neg, int feedthrough) const
A MultiRange combines several Ranges.
Definition MultiRange.h:17