LDMX Software
ldmx::EcalAbstractID Class Reference

Parent of precision and trigger EcalIDs. More...

#include <EcalAbstractID.h>

Public Types

enum  EcalCellType { PrecisionGlobal = 0 , PrecisionLocal = 1 , TriggerCell = 2 , Special = 7 }
 
- Public Types inherited from ldmx::DetectorID
typedef uint32_t RawValue
 

Public Member Functions

 EcalAbstractID ()
 Empty ECAL id (but not null!)
 
 EcalAbstractID (RawValue rawid)
 Create from raw number.
 
 EcalAbstractID (const DetectorID id)
 Create from a DetectorID, but check.
 
 EcalAbstractID (unsigned int cell_type, unsigned int payload)
 Create from pieces.
 
int cellType () const
 Get the value of the cell field from the ID.
 
int payload () const
 Get the value of the payload field from the ID.
 
- Public Member Functions inherited from ldmx::DetectorID
 DetectorID ()
 Class constructor for a null DetectorID.
 
 DetectorID (RawValue rawid)
 Class constructor from a raw 32-bit integer.
 
 DetectorID (SubdetectorIDType sdtype, RawValue raw_subpayload)
 Class constructor from a subdetector id and a subdetector-specific section (masked to.
 
bool null () const
 
SubdetectorIDType subdet () const
 
RawValue raw () const
 
void setRawValue (RawValue rawValue)
 Set the raw value of the detector ID.
 
bool operator< (const DetectorID &id) const
 
bool operator== (const DetectorID &id) const
 
bool operator!= (const DetectorID &id) const
 

Static Public Attributes

static const RawValue CELL_TYPE_MASK {0x7}
 
static const RawValue CELL_TYPE_SHIFT {23}
 
static const RawValue ECAL_PAYLOAD_MASK {0x007FFFFF}
 
- Static Public Attributes inherited from ldmx::DetectorID
static const RawValue SUBDETECTORID_MASK {0x3F}
 
static const RawValue SUBDETECTORID_SHIFT {26}
 
static const RawValue SUBDETECTOR_PAYLOAD_MASK {0x3FFFFFF}
 

Friends

std::ostream & operator<< (std::ostream &s, const ldmx::EcalAbstractID &id)
 

Additional Inherited Members

- Protected Attributes inherited from ldmx::DetectorID
RawValue id_
 The raw, packed value of the ID.
 

Detailed Description

Parent of precision and trigger EcalIDs.

Definition at line 19 of file EcalAbstractID.h.

Member Enumeration Documentation

◆ EcalCellType

enum ldmx::EcalAbstractID::EcalCellType

Definition at line 21 of file EcalAbstractID.h.

21 {
22 PrecisionGlobal = 0, // full-granularity cells, transformed to a uniform
23 // grid not alternating by layer
24 PrecisionLocal = 1, // full-granularity cells, labelled by their local
25 // coordinatate system as from DAQ
26 TriggerCell = 2, // trigger cells
27 Special = 7 // common-mode, calibration cells, etc
28 };

Constructor & Destructor Documentation

◆ EcalAbstractID() [1/4]

ldmx::EcalAbstractID::EcalAbstractID ( )
inline

Empty ECAL id (but not null!)

Definition at line 38 of file EcalAbstractID.h.

38: DetectorID(SD_ECAL, 0) {}
DetectorID()
Class constructor for a null DetectorID.
Definition DetectorID.h:44

◆ EcalAbstractID() [2/4]

ldmx::EcalAbstractID::EcalAbstractID ( RawValue rawid)
inline

Create from raw number.

Definition at line 43 of file EcalAbstractID.h.

43 : DetectorID(rawid) {
44 SUBDETECTORID_TEST("EcalAbstractID", SD_ECAL);
45 }

◆ EcalAbstractID() [3/4]

ldmx::EcalAbstractID::EcalAbstractID ( const DetectorID id)
inline

Create from a DetectorID, but check.

Definition at line 50 of file EcalAbstractID.h.

50 : DetectorID(id) {
51 SUBDETECTORID_TEST("EcalAbstractID", SD_ECAL);
52 }

◆ EcalAbstractID() [4/4]

ldmx::EcalAbstractID::EcalAbstractID ( unsigned int cell_type,
unsigned int payload )
inline

Create from pieces.

Definition at line 57 of file EcalAbstractID.h.

58 : DetectorID(SD_ECAL, 0) {
59 id_ |= (cell_type & CELL_TYPE_MASK) << CELL_TYPE_SHIFT;
60 id_ |= (payload & ECAL_PAYLOAD_MASK);
61 }
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:84
int payload() const
Get the value of the payload field from the ID.

References ldmx::DetectorID::id_, and payload().

Member Function Documentation

◆ cellType()

int ldmx::EcalAbstractID::cellType ( ) const
inline

Get the value of the cell field from the ID.

Returns
The value of the cell field.

Definition at line 67 of file EcalAbstractID.h.

67{ return (id_ >> CELL_TYPE_SHIFT) & CELL_TYPE_MASK; }

References ldmx::DetectorID::id_.

Referenced by ldmx::EcalID::EcalID(), ldmx::EcalID::EcalID(), ldmx::EcalTriggerID::EcalTriggerID(), and ldmx::EcalTriggerID::EcalTriggerID().

◆ payload()

int ldmx::EcalAbstractID::payload ( ) const
inline

Get the value of the payload field from the ID.

Returns
The value of the payload field.

Definition at line 73 of file EcalAbstractID.h.

73{ return id_ & ECAL_PAYLOAD_MASK; }

References ldmx::DetectorID::id_.

Referenced by EcalAbstractID().

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const ldmx::EcalAbstractID & id )
friend

Definition at line 10 of file EcalAbstractID.cxx.

10 {
11 switch (id.cellType()) {
12 case (ldmx::EcalAbstractID::PrecisionGlobal):
13 return s << ldmx::EcalID(id);
14 case (ldmx::EcalAbstractID::TriggerCell):
15 return s << ldmx::EcalTriggerID(id);
16 default:
17 return s << "EcalAbstractID(" << id.cellType() << ":0x"
18 << std::setfill('0') << std::setw(6) << std::right << std::hex
19 << id.payload();
20 }
21}
int cellType() const
Get the value of the cell field from the ID.
Extension of DetectorID providing access to ECal layers and cell numbers in a hex grid.
Definition EcalID.h:20
Extension of DetectorID providing access to ECal trigger cell information.

Member Data Documentation

◆ CELL_TYPE_MASK

const RawValue ldmx::EcalAbstractID::CELL_TYPE_MASK {0x7}
static

Definition at line 31 of file EcalAbstractID.h.

31{0x7};

◆ CELL_TYPE_SHIFT

const RawValue ldmx::EcalAbstractID::CELL_TYPE_SHIFT {23}
static

Definition at line 32 of file EcalAbstractID.h.

32{23};

◆ ECAL_PAYLOAD_MASK

const RawValue ldmx::EcalAbstractID::ECAL_PAYLOAD_MASK {0x007FFFFF}
static

Definition at line 33 of file EcalAbstractID.h.

33{0x007FFFFF};

The documentation for this class was generated from the following file: