CMS 3D CMS Logo

GEMDetId.cc
Go to the documentation of this file.
1 
7 
9 
10 
11 GEMDetId::GEMDetId(uint32_t id):DetId(id){
13  throw cms::Exception("InvalidDetId") << "GEMDetId ctor:"
14  << " det: " << det()
15  << " subdet: " << subdetId()
16  << " is not a valid GEM id";
17  }
18 }
19 
22  throw cms::Exception("InvalidDetId") << "GEMDetId ctor:"
23  << " det: " << det()
24  << " subdet: " << subdetId()
25  << " is not a valid GEM id";
26  }
27 }
28 
29 GEMDetId::GEMDetId(int region, int ring, int station, int layer,int chamber, int roll):
31 {
32  this->init(region,ring,station,layer,chamber,roll);
33 }
34 
35 void
37  int layer,int chamber,int roll)
38 {
39  if ( region < minRegionId || region > maxRegionId ||
40  ring < minRingId || ring > maxRingId ||
41  station < minStationId || station > maxStationId ||
42  layer < minLayerId || layer > maxLayerId ||
43  chamber < minChamberId || chamber > maxChamberId ||
44  roll < minRollId || roll > maxRollId) {
45  throw cms::Exception("InvalidDetId") << "GEMDetId ctor:"
46  << " Invalid parameters: "
47  << " region "<<region
48  << " ring "<<ring
49  << " station "<<station
50  << " layer "<<layer
51  << " chamber "<<chamber
52  << " roll "<<roll
53  << std::endl;
54  }
55  int regionInBits=region-minRegionId;
56  int ringInBits = ring-minRingId;
57  int stationInBits=station-minStationId;
58  int layerInBits=layer-minLayerId;
59  int chamberInBits=chamber-(minChamberId+1);
60  int rollInBits=roll;
61 
62  id_ |= ( regionInBits & RegionMask_) << RegionStartBit_ |
63  ( ringInBits & RingMask_) << RingStartBit_ |
64  ( stationInBits & StationMask_) << StationStartBit_ |
65  ( layerInBits & LayerMask_) << LayerStartBit_ |
66  ( chamberInBits & ChamberMask_) << ChamberStartBit_ |
67  ( rollInBits & RollMask_) << RollStartBit_ ;
68 
69 }
70 
71 
72 
73 std::ostream& operator<<( std::ostream& os, const GEMDetId& id ){
74 
75 
76  os << " Re "<<id.region()
77  << " Ri "<<id.ring()
78  << " St "<<id.station()
79  << " La "<<id.layer()
80  << " Ch "<<id.chamber()
81  << " Ro "<<id.roll()
82  <<" ";
83 
84  return os;
85 }
86 
87 
static const int RollStartBit_
Definition: GEMDetId.h:136
static const int minRingId
Definition: GEMDetId.h:97
static const int minChamberId
Definition: GEMDetId.h:103
static const int GEM
Definition: MuonSubdetId.h:15
int roll() const
Definition: GEMDetId.h:80
static const int maxRollId
Definition: GEMDetId.h:111
int ring() const
Definition: GEMDetId.h:59
static const int minRegionId
Definition: GEMDetId.h:94
GEMDetId()
Definition: GEMDetId.cc:8
static const unsigned int StationMask_
Definition: GEMDetId.h:124
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
static const int RegionStartBit_
Definition: GEMDetId.h:115
static const int maxChamberId
Definition: GEMDetId.h:104
static const int maxLayerId
Definition: GEMDetId.h:108
static const int StationStartBit_
Definition: GEMDetId.h:123
static const unsigned int RollMask_
Definition: GEMDetId.h:137
Definition: Muon.py:1
void init(int region, int ring, int station, int layer, int chamber, int roll)
Definition: GEMDetId.cc:36
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
Definition: GEMDetId.h:69
int station() const
Station id : the station is the pair of chambers at same disk.
Definition: GEMDetId.h:64
static const int ChamberStartBit_
Definition: GEMDetId.h:128
static const int LayerStartBit_
Definition: GEMDetId.h:132
static const int maxStationId
Definition: GEMDetId.h:101
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: GEMDetId.h:53
static const unsigned int RingMask_
Definition: GEMDetId.h:120
Definition: DetId.h:18
static const int minStationId
Definition: GEMDetId.h:100
uint32_t id_
Definition: DetId.h:56
static const unsigned int ChamberMask_
Definition: GEMDetId.h:129
static const int RegionMask_
Definition: GEMDetId.h:116
std::ostream & operator<<(std::ostream &os, const GEMDetId &id)
Definition: GEMDetId.cc:73
static const int maxRingId
Definition: GEMDetId.h:98
static const int minLayerId
Definition: GEMDetId.h:107
static const int maxRegionId
Definition: GEMDetId.h:95
Detector det() const
get the detector field from this detid
Definition: DetId.h:36
static const unsigned int LayerMask_
Definition: GEMDetId.h:133
static const int RingStartBit_
Definition: GEMDetId.h:119