CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GEMGeometry.cc
Go to the documentation of this file.
1 
8 
10 
12 
14 
16 
18 
20 
22 
23 const GeomDet* GEMGeometry::idToDetUnit(DetId id) const { return dynamic_cast<const GeomDet*>(idToDet(id)); }
24 
26  mapIdToDet::const_iterator i = theMap.find(GEMDetId(id).rawId());
27  return (i != theMap.end()) ? i->second : nullptr;
28 }
29 
30 const std::vector<const GEMRegion*>& GEMGeometry::regions() const { return allRegions; }
31 
32 const std::vector<const GEMStation*>& GEMGeometry::stations() const { return allStations; }
33 
34 const std::vector<const GEMRing*>& GEMGeometry::rings() const { return allRings; }
35 
36 const std::vector<const GEMSuperChamber*>& GEMGeometry::superChambers() const { return allSuperChambers; }
37 
38 const std::vector<const GEMChamber*>& GEMGeometry::chambers() const { return allChambers; }
39 
40 const std::vector<const GEMEtaPartition*>& GEMGeometry::etaPartitions() const { return allEtaPartitions; }
41 
42 const GEMRegion* GEMGeometry::region(int re) const {
43  for (auto region : allRegions) {
44  if (re != region->region())
45  continue;
46  return region;
47  }
48  return nullptr;
49 }
50 
51 const GEMStation* GEMGeometry::station(int re, int st) const {
52  for (auto station : allStations) {
53  if (re != station->region() || st != station->station())
54  continue;
55  return station;
56  }
57  return nullptr;
58 }
59 
60 const GEMRing* GEMGeometry::ring(int re, int st, int ri) const {
61  for (auto ring : allRings) {
62  if (re != ring->region() || st != ring->station() || ri != ring->ring())
63  continue;
64  return ring;
65  }
66  return nullptr;
67 }
68 
70  return dynamic_cast<const GEMSuperChamber*>(idToDet(id.superChamberId()));
71 }
72 
74  return dynamic_cast<const GEMChamber*>(idToDet(id.chamberId()));
75 }
76 
78  return dynamic_cast<const GEMEtaPartition*>(idToDetUnit(id));
79 }
80 
81 void GEMGeometry::add(const GEMRegion* region) { allRegions.emplace_back(region); }
82 
83 void GEMGeometry::add(const GEMStation* station) { allStations.emplace_back(station); }
84 
85 void GEMGeometry::add(const GEMRing* ring) { allRings.emplace_back(ring); }
86 
87 void GEMGeometry::add(const GEMSuperChamber* superChamber) {
88  allSuperChambers.emplace_back(superChamber);
89  theDets.emplace_back(superChamber);
90  theDetIds.emplace_back(superChamber->geographicalId());
91  theMap.insert(std::make_pair((superChamber->geographicalId()).rawId(), superChamber));
92 }
93 
94 void GEMGeometry::add(const GEMEtaPartition* etaPartition) {
95  theDets.emplace_back(etaPartition);
96  allEtaPartitions.emplace_back(etaPartition);
97  theEtaPartitions.emplace_back(etaPartition);
98  theEtaPartitionIds.emplace_back(etaPartition->geographicalId());
99  theDetIds.emplace_back(etaPartition->geographicalId());
100  theEtaPartitionTypes.emplace_back(&etaPartition->type());
101  theMap.insert(std::make_pair((etaPartition->geographicalId()).rawId(), etaPartition));
102 }
103 
104 void GEMGeometry::add(const GEMChamber* chamber) {
105  allChambers.emplace_back(chamber);
106  theDets.emplace_back(chamber);
107  theDetIds.emplace_back(chamber->geographicalId());
108  theMap.insert(std::make_pair((chamber->geographicalId()).rawId(), chamber));
109 }
110 
111 bool GEMGeometry::hasME0() const { return station(1, 0) != nullptr and station(-1, 0) != nullptr; }
112 
113 bool GEMGeometry::hasGE11() const { return station(1, 1) != nullptr and station(-1, 1) != nullptr; }
114 
115 bool GEMGeometry::hasGE21() const { return station(1, 2) != nullptr and station(-1, 2) != nullptr; }
int region() const
Return the region number.
Definition: GEMRing.cc:46
~GEMGeometry() override
Destructor.
Definition: GEMGeometry.cc:11
int station() const
Return the station number.
Definition: GEMRing.cc:48
std::vector< const GEMRegion * > allRegions
Definition: GEMGeometry.h:131
std::vector< const GEMEtaPartition * > allEtaPartitions
Definition: GEMGeometry.h:126
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: GEMGeometry.cc:23
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
Definition: GEMGeometry.cc:15
DetContainer theEtaPartitions
Definition: GEMGeometry.h:117
bool hasME0() const
Definition: GEMGeometry.cc:111
DetIdContainer theEtaPartitionIds
Definition: GEMGeometry.h:120
int region() const
Get the region.
Definition: GEMStation.cc:70
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:25
std::vector< const GEMSuperChamber * > allSuperChambers
Definition: GEMGeometry.h:128
const DetTypeContainer & detTypes() const override
Return a vector of all det types.
Definition: GEMGeometry.cc:13
int station() const
Get the station.
Definition: GEMStation.cc:72
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: GEMGeometry.cc:17
const DetIdContainer & detUnitIds() const override
Returm a vector of all GeomDetUnit DetIds.
Definition: GEMGeometry.cc:19
const GEMRing * ring(int region, int station, int ring) const
Return a GEMRing.
Definition: GEMGeometry.cc:60
const GEMRegion * region(int region) const
Definition: GEMGeometry.cc:42
GEMGeometry()
Default constructor.
Definition: GEMGeometry.cc:9
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:77
DetIdContainer theDetIds
Definition: GEMGeometry.h:121
std::vector< const GEMRing * > allRings
Definition: GEMGeometry.h:129
int ring() const
Return the ring number.
Definition: GEMRing.cc:50
int region() const
Return the region.
Definition: GEMRegion.cc:64
std::vector< const GeomDet * > DetContainer
mapIdToDet theMap
Definition: GEMGeometry.h:124
std::vector< const GEMStation * > allStations
Definition: GEMGeometry.h:130
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
Definition: GEMGeometry.cc:30
bool hasGE11() const
Definition: GEMGeometry.cc:113
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return a vector of all GEM eta partitions.
Definition: GEMGeometry.cc:40
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
const GeomDetType & type() const override
const GEMSuperChamber * superChamber(GEMDetId id) const
Definition: GEMGeometry.cc:69
const GEMStation * station(int region, int station) const
Definition: GEMGeometry.cc:51
const std::vector< const GEMSuperChamber * > & superChambers() const
Return a vector of all GEM super chambers.
Definition: GEMGeometry.cc:36
Definition: DetId.h:17
DetContainer theDets
Definition: GEMGeometry.h:118
const std::vector< const GEMRing * > & rings() const
Return a vector of all GEM rings.
Definition: GEMGeometry.cc:34
const GEMChamber * chamber(GEMDetId id) const
Definition: GEMGeometry.cc:73
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: GEMGeometry.cc:21
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:38
std::vector< DetId > DetIdContainer
const std::vector< const GEMStation * > & stations() const
Return a vector of all GEM stations.
Definition: GEMGeometry.cc:32
std::vector< const GeomDetType * > DetTypeContainer
DetTypeContainer theEtaPartitionTypes
Definition: GEMGeometry.h:119
std::vector< const GEMChamber * > allChambers
Definition: GEMGeometry.h:127
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
bool hasGE21() const
Definition: GEMGeometry.cc:115