1 #ifndef DataFormats_MuonDetId_GEMDetId_h 2 #define DataFormats_MuonDetId_GEMDetId_h 76 <<
"GEMDetId ctor: det: " <<
det() <<
" subdet: " <<
subdetId() <<
" is not a valid GEM id\n";
85 <<
"GEMDetId ctor: det: " <<
det() <<
" subdet: " <<
subdetId() <<
" is not a valid GEM id\n";
92 if (region < minRegionId || region > maxRegionId || ring < minRingId || ring > maxRingId ||
93 station < minStationId0 || station > maxStationId || layer < minLayerId || layer > maxLayerId0 ||
94 chamber < minChamberId || chamber > maxChamberId || roll < minRollId || roll > maxRollId)
96 <<
"GEMDetId ctor: Invalid parameters: region " << region <<
" ring " << ring <<
" station " << station
97 <<
" layer " << layer <<
" chamber " << chamber <<
" roll " << roll << std::endl;
103 int chamberInBits = chamber - (minChamberId + 1);
104 int rollInBits =
roll;
106 id_ |= ((regionInBits &
RegionMask) << RegionStartBit | (ringInBits & RingMask) << RingStartBit |
107 (stationInBits &
StationMask) << StationStartBit | (layerInBits & LayerMask) << LayerStartBit |
117 <<
"GEMDetId ctor: Cannot assign GEMDetID from " << std::hex << gen.
rawId() <<
std::dec;
130 uint32_t rawid = gen.
rawId();
133 int reg(0), ri(0), stn(-1), lay(0), chamb(0), rol(0);
134 unpackId(rawid, reg, ri, stn, lay, chamb, rol);
135 return (((
id_ & kMuonIdMask) == (rawid & kMuonIdMask)) && (reg ==
region()) && (ri ==
ring()) &&
139 uint32_t rawid = gen.
rawId();
142 int reg(0), ri(0), stn(-1), lay(0), chamb(0), rol(0);
143 unpackId(rawid, reg, ri, stn, lay, chamb, rol);
144 return (((
id_ & kMuonIdMask) != (rawid & kMuonIdMask)) || (reg !=
region()) || (ri !=
ring()) ||
165 constexpr int region()
const {
return (static_cast<int>((
id_ >> RegionStartBit) & RegionMask) + minRegionId); }
170 constexpr int ring()
const {
return (static_cast<int>((
id_ >> RingStartBit) & RingMask) + minRingId); }
173 constexpr int station()
const {
return (static_cast<int>((
id_ >> StationStartBit) & StationMask) + minStationId0); }
178 return (static_cast<int>((
id_ >> ChamberStartBit) & ChamberMask) + (minChamberId + 1));
184 constexpr int layer()
const {
return (static_cast<int>((
id_ >> LayerStartBit) & LayerMask) + minLayerId); }
189 return (static_cast<int>((
id_ >> RollStartBit) & RollMask));
203 return ((
station() == 0) ? maxLayerId0 : ((
station() > maxStationId) ? 0 : maxLayerId));
209 uint32_t rawid(inpid);
210 if ((rawid & kGEMIdFormat) == 0) {
217 int chamberInBits =
chamber - (minChamberId + 1);
218 int rollInBits =
roll;
221 ((regionInBits &
RegionMask) << RegionStartBit) | ((ringInBits &
RingMask) << RingStartBit) |
222 ((stationInBits &
StationMask) << StationStartBit) | ((layerInBits &
LayerMask) << LayerStartBit) |
223 ((chamberInBits &
ChamberMask) << ChamberStartBit) | ((rollInBits &
RollMask) << RollStartBit) |
239 chamber = (
static_cast<int>((rawid >>
ChamberStartBit) & ChamberMask) + (minChamberId + 1));
240 if ((rawid & kGEMIdFormat) == 0) {
243 roll = (
static_cast<int>((rawid >>
RollStartBitP) & RollMask));
247 roll = (
static_cast<int>((rawid >>
RollStartBit) & RollMask));
255 roll = (
static_cast<int>((rawid >>
RollStartBitM) & RollMask));
static uint32_t RollStartBitM
std::ostream & operator<<(std::ostream &os, const GEMDetId &id)
static uint32_t StationNumBits
bool operator==(const GEMDetId &gen) const
static uint32_t LayerStartBitM
constexpr bool null() const
is this a null id ?
static uint32_t RollStartBit
static int32_t maxLayerId0
static uint32_t ChamberStartBitM
static uint32_t LayerStartBit
constexpr uint32_t rawId() const
get the raw id
static int32_t maxStationId
static int32_t minRegionId
static uint32_t StationStartBit
static const int kSubdetOffset
static uint32_t RollNumBits
static uint32_t chamberIdMask
GEMDetId superChamberId() const
bool operator!=(const GEMDetId &gen) const
static uint32_t LayerNumBitsP
static uint32_t StationMask
static uint32_t RegionNumBits
static int32_t minStationId0
GEMDetId chamberId() const
bool operator<(const GEMDetId &r) const
static uint32_t FormatMask
static uint32_t LayerNumBits
static const int kSubdetMask
static uint32_t RingStartBit
static uint32_t RegionStartBit
GEMDetId(int region, int ring, int station, int layer, int chamber, int roll)
Construct from fully qualified identifier.
static uint32_t RegionMask
static uint32_t kGEMIdFormat
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static int32_t maxChamberId
GEMDetId & operator=(const DetId &gen)
std::bitset< maskSIZE > RollMask
static uint32_t FormatNumBits
static uint32_t kMuonIdMask
static int32_t maxLayerId
static uint32_t ChamberNumBits
static uint32_t LayerMaskP
static const int kDetMask
static uint32_t LayerMask
static int32_t maxRegionId
static const int kDetOffset
static uint32_t superChamberIdMask
static int32_t minStationId
static uint32_t ChamberStartBit
void v12FromV11(const uint32_t &rawid)
static void unpackId(const uint32_t &rawid, int ®ion, int &ring, int &station, int &layer, int &chamber, int &roll)
static int32_t minLayerId
static uint32_t ChamberMask
static uint32_t RollStartBitP
static uint32_t RingNumBits
static int32_t minChamberId
static uint32_t FormatStartBit
static uint32_t v12Form(const uint32_t &inpid)
constexpr Detector det() const
get the detector field from this detid