test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:131
static const int minRingId
Definition: GEMDetId.h:93
static const int minChamberId
Definition: GEMDetId.h:99
static const int GEM
Definition: MuonSubdetId.h:15
int roll() const
Definition: GEMDetId.h:80
static const int maxRollId
Definition: GEMDetId.h:106
static const int minRegionId
Definition: GEMDetId.h:90
GEMDetId()
Definition: GEMDetId.cc:8
static const unsigned int StationMask_
Definition: GEMDetId.h:119
static const int RegionStartBit_
Definition: GEMDetId.h:110
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
static const int maxChamberId
Definition: GEMDetId.h:100
static const int maxLayerId
Definition: GEMDetId.h:103
static const int StationStartBit_
Definition: GEMDetId.h:118
static const unsigned int RollMask_
Definition: GEMDetId.h:132
void init(int region, int ring, int station, int layer, int chamber, int roll)
Definition: GEMDetId.cc:36
static const int ChamberStartBit_
Definition: GEMDetId.h:123
static const int LayerStartBit_
Definition: GEMDetId.h:127
static const int maxStationId
Definition: GEMDetId.h:97
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
static const unsigned int RingMask_
Definition: GEMDetId.h:115
Definition: DetId.h:18
static const int minStationId
Definition: GEMDetId.h:96
uint32_t id_
Definition: DetId.h:55
static const unsigned int ChamberMask_
Definition: GEMDetId.h:124
static const int RegionMask_
Definition: GEMDetId.h:111
static const int maxRingId
Definition: GEMDetId.h:94
static const int minLayerId
Definition: GEMDetId.h:102
static const int maxRegionId
Definition: GEMDetId.h:91
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
static const unsigned int LayerMask_
Definition: GEMDetId.h:128
static const int RingStartBit_
Definition: GEMDetId.h:114