LDMX Software
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ldmx::EcalTriggerID Class Reference

Extension of DetectorID providing access to ECal trigger cell information. More...

#include <EcalTriggerID.h>

Public Member Functions

 EcalTriggerID ()
 Empty ECAL id (but not null!)
 
 EcalTriggerID (RawValue rawid)
 Create from raw number.
 
 EcalTriggerID (const DetectorID id)
 Create from a DetectorID, but check.
 
 EcalTriggerID (unsigned int layer, unsigned int module, unsigned int cell)
 Create from pieces.
 
int module () const
 Get the value of the module field from the ID.
 
int getModuleID () const
 Get the value of the module field from the ID.
 
int layer () const
 Get the value of the layer field from the ID.
 
int getLayerID () const
 Get the value of the layer field from the ID.
 
int triggercell () const
 Get the value of the trigger cell field from the ID.
 
int getTriggerCellID () const
 Get the value of the trigger cell field from the ID.
 
std::pair< unsigned int, unsigned int > getCellUV () const
 Get the cell u,v index assuming a CMS-standard 432-cell sensor.
 
- Public Member Functions inherited from ldmx::EcalAbstractID
 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 cell_type () 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 Member Functions

static void createInterpreters ()
 

Static Public Attributes

static const RawValue LAYER_MASK {0x3F}
 
static const RawValue LAYER_SHIFT {12}
 
static const RawValue MODULE_MASK {0x1F}
 
static const RawValue MODULE_SHIFT {7}
 
static const RawValue CELL_MASK
 
static const RawValue CELL_SHIFT {0}
 
- Static Public Attributes inherited from ldmx::EcalAbstractID
static const RawValue CELL_TYPE_MASK
 
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}
 

Additional Inherited Members

- Public Types inherited from ldmx::EcalAbstractID
enum  EcalCellType { PrecisionGlobal = 0 , PrecisionLocal = 1 , TriggerCell = 2 , Special = 7 }
 
- Public Types inherited from ldmx::DetectorID
typedef uint32_t RawValue
 
- Protected Attributes inherited from ldmx::DetectorID
RawValue id_
 The raw, packed value of the ID.
 

Detailed Description

Extension of DetectorID providing access to ECal trigger cell information.

Definition at line 20 of file EcalTriggerID.h.

Constructor & Destructor Documentation

◆ EcalTriggerID() [1/4]

ldmx::EcalTriggerID::EcalTriggerID ( )
inline

Empty ECAL id (but not null!)

Definition at line 33 of file EcalTriggerID.h.

33: EcalAbstractID() {}
EcalAbstractID()
Empty ECAL id (but not null!)

◆ EcalTriggerID() [2/4]

ldmx::EcalTriggerID::EcalTriggerID ( RawValue  rawid)
inline

Create from raw number.

Definition at line 38 of file EcalTriggerID.h.

38 : EcalAbstractID(rawid) {
39 if (!null() && cell_type() != TriggerCell) {
40 EXCEPTION_RAISE(
41 "DetectorIDMismatch",
42 "Attempted to create EcalTriggerID from mismatched Ecal cell_type " +
43 std::to_string(cell_type()));
44 }
45 }
bool null() const
Definition DetectorID.h:60
int cell_type() const
Get the value of the cell field from the ID.

References ldmx::EcalAbstractID::cell_type(), and ldmx::DetectorID::null().

◆ EcalTriggerID() [3/4]

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

Create from a DetectorID, but check.

Definition at line 50 of file EcalTriggerID.h.

50 : EcalAbstractID(id) {
51 if (!null() && cell_type() != TriggerCell) {
52 EXCEPTION_RAISE(
53 "DetectorIDMismatch",
54 "Attempted to create EcalTriggerID from mismatched Ecal cell_type " +
55 std::to_string(cell_type()));
56 }
57 }

References ldmx::EcalAbstractID::cell_type(), and ldmx::DetectorID::null().

◆ EcalTriggerID() [4/4]

ldmx::EcalTriggerID::EcalTriggerID ( unsigned int  layer,
unsigned int  module,
unsigned int  cell 
)
inline

Create from pieces.

Definition at line 62 of file EcalTriggerID.h.

63 : EcalAbstractID(TriggerCell, 0) {
64 id_ |= (layer & LAYER_MASK) << LAYER_SHIFT;
65 id_ |= (module & MODULE_MASK) << MODULE_SHIFT;
66 id_ |= (cell & CELL_MASK) << CELL_SHIFT;
67 }
RawValue id_
The raw, packed value of the ID.
Definition DetectorID.h:84
int layer() const
Get the value of the layer field from the ID.

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

Member Function Documentation

◆ createInterpreters()

void ldmx::EcalTriggerID::createInterpreters ( )
static

Definition at line 13 of file EcalTriggerID.cxx.

13 {
15 fields.push_back(new IDField("subdetector", 0, SUBDETECTORID_SHIFT, 31));
16 fields.push_back(
17 new IDField("layer", 1, LAYER_SHIFT,
18 LAYER_SHIFT + IDField::countOnes(LAYER_MASK) - 1));
19 fields.push_back(
20 new IDField("module", 2, MODULE_SHIFT,
21 MODULE_SHIFT + IDField::countOnes(MODULE_MASK) - 1));
22 fields.push_back(new IDField("cell", 3, CELL_SHIFT,
23 CELL_SHIFT + IDField::countOnes(CELL_MASK) - 1));
24
26 SD_ECAL,
27 EcalAbstractID::CELL_TYPE_MASK << EcalAbstractID::CELL_TYPE_SHIFT,
28 EcalAbstractID::TriggerCell << EcalAbstractID::CELL_TYPE_SHIFT, fields);
29}
static void registerInterpreter(SubdetectorIDType idtype, const IDField::IDFieldList &fieldList)
Register a new field interpreter for a given subdetector id.
static unsigned countOnes(unsigned mask)
Utility for counting number of 1 in a mask.
Definition IDField.cxx:33
std::vector< IDField * > IDFieldList
List of fields.
Definition IDField.h:25

◆ getCellUV()

std::pair< unsigned int, unsigned int > ldmx::EcalTriggerID::getCellUV ( ) const

Get the cell u,v index assuming a CMS-standard 432-cell sensor.

Returns
Pair providing a U/V index

◆ getLayerID()

int ldmx::EcalTriggerID::getLayerID ( ) const
inline

Get the value of the layer field from the ID.

Returns
The value of the layer field.

Definition at line 91 of file EcalTriggerID.h.

91{ return (id_ >> LAYER_SHIFT) & LAYER_MASK; }

References ldmx::DetectorID::id_.

◆ getModuleID()

int ldmx::EcalTriggerID::getModuleID ( ) const
inline

Get the value of the module field from the ID.

Returns
The value of the module field.

Definition at line 79 of file EcalTriggerID.h.

79{ return (id_ >> MODULE_SHIFT) & MODULE_MASK; }

References ldmx::DetectorID::id_.

◆ getTriggerCellID()

int ldmx::EcalTriggerID::getTriggerCellID ( ) const
inline

Get the value of the trigger cell field from the ID.

Returns
The value of the cell field.

Definition at line 103 of file EcalTriggerID.h.

103{ return (id_ >> CELL_SHIFT) & CELL_MASK; }

References ldmx::DetectorID::id_.

Referenced by trigger::TrigEcalClusterProducer::produce().

◆ layer()

int ldmx::EcalTriggerID::layer ( ) const
inline

Get the value of the layer field from the ID.

Returns
The value of the layer field.

Definition at line 85 of file EcalTriggerID.h.

85{ return (id_ >> LAYER_SHIFT) & LAYER_MASK; }

References ldmx::DetectorID::id_.

Referenced by trigger::DumpFileWriter::analyze(), ecal::EcalTriggerGeometry::centerInTriggerCell(), ecal::EcalTriggerGeometry::contentsOfTriggerCell(), EcalTriggerID(), trigger::EcalTPSelector::produce(), trigger::TrigEcalClusterProducer::produce(), and trigger::TrigEcalEnergySum::produce().

◆ module()

int ldmx::EcalTriggerID::module ( ) const
inline

Get the value of the module field from the ID.

Returns
The value of the module field.

Definition at line 73 of file EcalTriggerID.h.

73{ return (id_ >> MODULE_SHIFT) & MODULE_MASK; }

References ldmx::DetectorID::id_.

Referenced by ecal::EcalTriggerGeometry::centerInTriggerCell(), ecal::EcalTriggerGeometry::contentsOfTriggerCell(), and trigger::TrigEcalClusterProducer::produce().

◆ triggercell()

int ldmx::EcalTriggerID::triggercell ( ) const
inline

Get the value of the trigger cell field from the ID.

Returns
The value of the cell field.

Definition at line 97 of file EcalTriggerID.h.

97{ return (id_ >> CELL_SHIFT) & CELL_MASK; }

References ldmx::DetectorID::id_.

Referenced by ecal::EcalTriggerGeometry::centerInTriggerCell(), and ecal::EcalTriggerGeometry::contentsOfTriggerCell().

Member Data Documentation

◆ CELL_MASK

const RawValue ldmx::EcalTriggerID::CELL_MASK
static
Initial value:
{
0x7F}

Definition at line 26 of file EcalTriggerID.h.

26 {
27 0x7F}; // space for 128 trigger cells/module (!)

◆ CELL_SHIFT

const RawValue ldmx::EcalTriggerID::CELL_SHIFT {0}
static

Definition at line 28 of file EcalTriggerID.h.

28{0};

◆ LAYER_MASK

const RawValue ldmx::EcalTriggerID::LAYER_MASK {0x3F}
static

Definition at line 22 of file EcalTriggerID.h.

22{0x3F}; // space for up to 64 layers

◆ LAYER_SHIFT

const RawValue ldmx::EcalTriggerID::LAYER_SHIFT {12}
static

Definition at line 23 of file EcalTriggerID.h.

23{12};

◆ MODULE_MASK

const RawValue ldmx::EcalTriggerID::MODULE_MASK {0x1F}
static

Definition at line 24 of file EcalTriggerID.h.

24{0x1F}; // space for up to 32 modules/layer

◆ MODULE_SHIFT

const RawValue ldmx::EcalTriggerID::MODULE_SHIFT {7}
static

Definition at line 25 of file EcalTriggerID.h.

25{7};

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