LDMX Software
IDField.h
1#ifndef DETDESCR_IDFIELD_H
2#define DETDESCR_IDFIELD_H
3
4// STL
5#include <map>
6#include <string>
7#include <vector>
8
9namespace ldmx {
10
15class IDField {
16 public:
20 typedef std::map<std::string, IDField*> IDFieldMap;
21
25 typedef std::vector<IDField*> IDFieldList;
26
34 IDField(std::string name, unsigned index, unsigned startBit, unsigned endBit);
35
40 const std::string& getFieldName();
41
46 unsigned getIndex();
47
52 unsigned getStartBit();
53
58 unsigned getEndBit();
59
64 unsigned getBitMask();
65
71 static unsigned createBitMask(unsigned startBit, unsigned endBit);
72
78 static unsigned countOnes(unsigned mask);
79
80 private:
84 std::string fieldName_;
85
89 unsigned index_;
90
94 unsigned startBit_;
95
99 unsigned endBit_;
100
104 unsigned bitMask_;
105};
106} // namespace ldmx
107
108#endif
Provides information about a field within a DetectorID.
Definition IDField.h:15
unsigned endBit_
The end bit of the field.
Definition IDField.h:99
unsigned getStartBit()
Get the start bit of the field.
Definition IDField.cxx:19
static unsigned countOnes(unsigned mask)
Utility for counting number of 1 in a mask.
Definition IDField.cxx:33
unsigned startBit_
The start bit of the field.
Definition IDField.h:94
std::map< std::string, IDField * > IDFieldMap
Map of name to field.
Definition IDField.h:20
unsigned getIndex()
Get the index of the field.
Definition IDField.cxx:17
std::vector< IDField * > IDFieldList
List of fields.
Definition IDField.h:25
static unsigned createBitMask(unsigned startBit, unsigned endBit)
Utility for creating a bit mask from a start to end bit.
Definition IDField.cxx:25
unsigned bitMask_
The bit mask of the field.
Definition IDField.h:104
std::string fieldName_
The name of the field.
Definition IDField.h:84
unsigned index_
The index of the field.
Definition IDField.h:89
unsigned getBitMask()
Get a bit mask for this field.
Definition IDField.cxx:23
const std::string & getFieldName()
Get the name of the field.
Definition IDField.cxx:15
unsigned getEndBit()
Get the end bit of the field.
Definition IDField.cxx:21