LDMX Software
|
Class provides an "introspection" capability for the 32-bit packed IDs used for uniquely identifying hits and detector components. More...
#include <DetectorIDInterpreter.h>
Classes | |
struct | IDSignature |
struct | SubdetectorIDFields |
Public Types | |
typedef unsigned | FieldValue |
Definition of the field value type. | |
typedef std::vector< FieldValue > | FieldValueList |
A list of field values. | |
Public Member Functions | |
DetectorIDInterpreter (DetectorID detid) | |
DetectorID | getId () const |
Get the raw value of the detector ID. | |
void | setRawValue (DetectorID rawValue) |
Set the raw value of the detector ID. | |
FieldValue | getFieldValue (int i) const |
Decode and return a field's value from the raw ID. | |
void | setFieldValue (int i, FieldValue value) |
Set a field value by index in the field value list. | |
void | setFieldValue (const std::string &fieldName, FieldValue fieldValue) |
Set a field value by its name. | |
int | getFieldCount () const |
Get the list of field information. | |
const IDField::IDFieldList & | getFieldList () const |
Get the list of field information. | |
const IDField * | getField (const std::string &fieldName) const |
Get the information for a field by name. | |
FieldValue | getFieldValue (const std::string &fieldName) const |
Decode and return a field's value by name (e.g. | |
Static Public Member Functions | |
static void | registerInterpreter (SubdetectorIDType idtype, const IDField::IDFieldList &fieldList) |
Register a new field interpreter for a given subdetector id. | |
static void | registerInterpreter (SubdetectorIDType idtype, unsigned int mask, unsigned int equality, const IDField::IDFieldList &fieldList) |
Register a new field interpreter for a more-complex case where additional bits are needed to determine format. | |
Private Member Functions | |
void | init () |
Reinitialize the ID in case the field list changed. | |
void | unpack () |
Unpack the current raw value into a list. | |
void | pack () |
Pack the current list of field values into a raw value. | |
Static Private Member Functions | |
static void | loadStandardInterpreters () |
Load the standard field interpreters if not yet loaded. | |
Private Attributes | |
DetectorID | id_ |
The raw, packed value of the ID. | |
FieldValueList | fieldValues_ |
The unpacked list of field values. | |
const SubdetectorIDFields * | p_fieldInfo_ |
Pointer to the appropriate field info for this class. | |
Static Private Attributes | |
static std::map< IDSignature, const SubdetectorIDFields * > | g_rosettaStone |
Class provides an "introspection" capability for the 32-bit packed IDs used for uniquely identifying hits and detector components.
Definition at line 25 of file DetectorIDInterpreter.h.
Definition of the field value type.
Definition at line 35 of file DetectorIDInterpreter.h.
std::vector<FieldValue> ldmx::DetectorIDInterpreter::FieldValueList |
A list of field values.
Definition at line 40 of file DetectorIDInterpreter.h.
ldmx::DetectorIDInterpreter::DetectorIDInterpreter | ( | ) |
Definition at line 17 of file DetectorIDInterpreter.cxx.
ldmx::DetectorIDInterpreter::DetectorIDInterpreter | ( | DetectorID | detid | ) |
Definition at line 21 of file DetectorIDInterpreter.cxx.
ldmx::DetectorIDInterpreter::~DetectorIDInterpreter | ( | ) |
Definition at line 16 of file DetectorIDInterpreter.cxx.
const IDField * ldmx::DetectorIDInterpreter::getField | ( | const std::string & | fieldName | ) | const |
Get the information for a field by name.
Definition at line 72 of file DetectorIDInterpreter.cxx.
|
inline |
Get the list of field information.
Definition at line 78 of file DetectorIDInterpreter.h.
References p_fieldInfo_.
|
inline |
Get the list of field information.
Definition at line 84 of file DetectorIDInterpreter.h.
References p_fieldInfo_.
DetectorIDInterpreter::FieldValue ldmx::DetectorIDInterpreter::getFieldValue | ( | const std::string & | fieldName | ) | const |
Decode and return a field's value by name (e.g.
"layer").
Definition at line 79 of file DetectorIDInterpreter.cxx.
DetectorIDInterpreter::FieldValue ldmx::DetectorIDInterpreter::getFieldValue | ( | int | i | ) | const |
Decode and return a field's value from the raw ID.
i | The index of the field value. |
Definition at line 52 of file DetectorIDInterpreter.cxx.
References ldmx::IDField::getBitMask(), and ldmx::IDField::getStartBit().
Referenced by TEST_CASE().
|
inline |
Get the raw value of the detector ID.
Definition at line 46 of file DetectorIDInterpreter.h.
References id_.
Referenced by TEST_CASE().
|
private |
Reinitialize the ID in case the field list changed.
This is called automatically by setFieldList. Function should be called by a subclass if a new field list is set outside that method or if new fields are added to the existing list.
Definition at line 85 of file DetectorIDInterpreter.cxx.
|
staticprivate |
Load the standard field interpreters if not yet loaded.
Definition at line 147 of file DetectorIDInterpreter.cxx.
|
private |
Pack the current list of field values into a raw value.
Definition at line 42 of file DetectorIDInterpreter.cxx.
|
static |
Register a new field interpreter for a given subdetector id.
Definition at line 110 of file DetectorIDInterpreter.cxx.
|
static |
Register a new field interpreter for a more-complex case where additional bits are needed to determine format.
Definition at line 126 of file DetectorIDInterpreter.cxx.
void ldmx::DetectorIDInterpreter::setFieldValue | ( | const std::string & | fieldName, |
FieldValue | fieldValue ) |
Set a field value by its name.
fieldName | The name of the field. |
fieldValue | The new value of the field. |
Definition at line 64 of file DetectorIDInterpreter.cxx.
void ldmx::DetectorIDInterpreter::setFieldValue | ( | int | i, |
FieldValue | value ) |
Set a field value by index in the field value list.
i | The index of the field value. |
value | The new field value. |
Definition at line 59 of file DetectorIDInterpreter.cxx.
Referenced by TEST_CASE().
void ldmx::DetectorIDInterpreter::setRawValue | ( | DetectorID | rawValue | ) |
Set the raw value of the detector ID.
rawValue | The raw value of the ID. |
Definition at line 27 of file DetectorIDInterpreter.cxx.
|
private |
Unpack the current raw value into a list.
Definition at line 33 of file DetectorIDInterpreter.cxx.
|
private |
The unpacked list of field values.
Definition at line 149 of file DetectorIDInterpreter.h.
|
staticprivate |
Definition at line 164 of file DetectorIDInterpreter.h.
|
private |
The raw, packed value of the ID.
Definition at line 144 of file DetectorIDInterpreter.h.
Referenced by getId().
|
private |
Pointer to the appropriate field info for this class.
Definition at line 169 of file DetectorIDInterpreter.h.
Referenced by getFieldCount(), and getFieldList().