CMS 3D CMS Logo

GEMGeometryBuilderFromCondDB.cc
Go to the documentation of this file.
1 
8 
12 
13 #include <algorithm>
14 
15 using namespace geant_units::operators;
16 
18 
20 
22  const std::vector<DetId>& detids(rgeo.detIds());
23  std::unordered_map<uint32_t, GEMSuperChamber*> superChambers;
24  std::unordered_map<uint32_t, GEMChamber*> chambers;
25  std::unordered_map<uint32_t, GEMEtaPartition*> partitions;
26 
27  for (unsigned int id = 0; id < detids.size(); ++id) {
28  GEMDetId gemid(detids[id]);
29  LogDebug("GEMGeometryBuilder") << "GEMGeometryBuilder adding " << gemid;
30  if (gemid.roll() == 0) {
31  if (gemid.layer() == 0) {
32  GEMSuperChamber* gsc = buildSuperChamber(rgeo, id, gemid);
33  superChambers.emplace(gemid.rawId(), gsc);
34  } else {
35  GEMChamber* gch = buildChamber(rgeo, id, gemid);
36  chambers.emplace(gemid.rawId(), gch);
37  }
38  } else {
39  GEMEtaPartition* gep = buildEtaPartition(rgeo, id, gemid);
40  partitions.emplace(gemid.rawId(), gep);
41  }
42  }
43 
45  // TEMP - for backward compatability with old geometry
46  // no superchambers or chambers in old geometry, using etpartitions
47  if (superChambers.empty()) {
48  for (unsigned int id = 0; id < detids.size(); ++id) {
49  GEMDetId gemid(detids[id]);
50  if (gemid.roll() == 1) {
51  GEMChamber* gch = buildChamber(rgeo, id, gemid.chamberId());
52  chambers.emplace(gemid.chamberId().rawId(), gch);
53  if (gemid.layer() == 1) {
54  GEMSuperChamber* gsc = buildSuperChamber(rgeo, id, gemid.superChamberId());
55  superChambers.emplace(gemid.superChamberId().rawId(), gsc);
56  }
57  }
58  }
59  }
61 
62  // construct the regions, stations and rings.
63  for (int re = -1; re <= 1; re = re + 2) {
64  GEMRegion* region = new GEMRegion(re);
65 
66  for (int st = 0; st <= GEMDetId::maxStationId; ++st) {
67  GEMStation* station = new GEMStation(re, st);
68  std::string sign(re == -1 ? "-" : "");
69  std::string name("GE" + sign + std::to_string(st) + "/1");
70  station->setName(name);
71 
72  for (int ri = 1; ri <= 1; ++ri) {
73  GEMRing* ring = new GEMRing(re, st, ri);
74 
75  for (auto sch : superChambers) {
76  auto superChamber = sch.second;
77  const GEMDetId scId(superChamber->id());
78  if (scId.region() != re || scId.station() != st || scId.ring() != ri)
79  continue;
80  int ch = scId.chamber();
81 
82  for (int ly = 1; ly <= GEMDetId::maxLayerId; ++ly) {
83  const GEMDetId chId(re, ri, st, ly, ch, 0);
84  auto chamberIt = chambers.find(chId.rawId());
85  if (chamberIt == chambers.end())
86  continue;
87  auto chamber = chamberIt->second;
88 
89  for (int roll = 1; roll <= GEMDetId::maxRollId; ++roll) {
90  const GEMDetId rollId(re, ri, st, ly, ch, roll);
91  auto gepIt = partitions.find(rollId.rawId());
92  if (gepIt == partitions.end())
93  continue;
94  auto gep = gepIt->second;
95 
96  chamber->add(gep);
97  theGeometry.add(gep);
98  }
99 
100  superChamber->add(chamber);
101  theGeometry.add(chamber);
102  }
103 
104  LogDebug("GEMGeometryBuilder") << "Adding super chamber " << scId << " to ring:";
105  ring->add(superChamber);
106  theGeometry.add(superChamber);
107  } // end superChambers
108 
109  if (ring->nSuperChambers()) {
110  LogDebug("GEMGeometryBuilder") << "Adding ring " << ri << " to station "
111  << "re " << re << " st " << st;
112  station->add(ring);
113  theGeometry.add(ring);
114  } else {
115  delete ring;
116  }
117  } // end ring
118 
119  if (station->nRings()) {
120  LogDebug("GEMGeometryBuilder") << "Adding station " << st << " to region " << re;
121  region->add(station);
122  theGeometry.add(station);
123  } else {
124  delete station;
125  }
126  } // end station
127 
128  LogDebug("GEMGeometryBuilder") << "Adding region " << re << " to the geometry";
129  theGeometry.add(region);
130  }
131 }
132 
134  unsigned int gid,
135  GEMDetId detId) const {
136  LogDebug("GEMGeometryBuilderFromCondDB") << "buildSuperChamber " << detId;
137 
138  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
139 
140  GEMSuperChamber* superChamber = new GEMSuperChamber(detId, surf);
141  return superChamber;
142 }
143 
145  unsigned int gid,
146  GEMDetId detId) const {
147  LogDebug("GEMGeometryBuilderFromCondDB") << "buildChamber " << detId;
148 
149  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
150 
151  GEMChamber* chamber = new GEMChamber(detId, surf);
152  return chamber;
153 }
154 
156  unsigned int gid,
157  GEMDetId detId) const {
158  std::vector<std::string>::const_iterator strStart = rgeo.strStart(gid);
159  std::string name = *(strStart);
160  LogDebug("GEMGeometryBuilderFromCondDB") << "buildEtaPartition " << name << " " << detId;
161 
162  std::vector<double>::const_iterator shapeStart = rgeo.shapeStart(gid);
163  float be = convertMmToCm(*(shapeStart + 0));
164  float te = convertMmToCm(*(shapeStart + 1));
165  float ap = convertMmToCm(*(shapeStart + 2));
166  float ti = convertMmToCm(*(shapeStart + 3));
167  float nstrip = *(shapeStart + 4);
168  float npad = *(shapeStart + 5);
169  //float dphi = *(shapeStart + 6);
170 
171  std::vector<float> pars;
172  pars.emplace_back(be);
173  pars.emplace_back(te);
174  pars.emplace_back(ap);
175  pars.emplace_back(nstrip);
176  pars.emplace_back(npad);
177  //pars.emplace_back(dphi);
178  pars.emplace_back(0.17715); //temporary input for PR
179 
180  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
182 
183  LogDebug("GEMGeometryBuilderFromCondDB") << "size " << be << " " << te << " " << ap << " " << ti;
184  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
185  return etaPartition;
186 }
187 
189  unsigned int gid,
190  GEMDetId detId) const {
191  std::vector<double>::const_iterator shapeStart = rgeo.shapeStart(gid);
192  float be = convertMmToCm(*(shapeStart + 0));
193  float te = convertMmToCm(*(shapeStart + 1));
194  float ap = convertMmToCm(*(shapeStart + 2));
195  float ti = convertMmToCm(*(shapeStart + 3));
196  Bounds* bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
197 
198  std::vector<double>::const_iterator tranStart = rgeo.tranStart(gid);
199  Surface::PositionType posResult(
200  convertMmToCm(*(tranStart)), convertMmToCm(*(tranStart + 1)), convertMmToCm(*(tranStart + 2)));
201 
202  std::vector<double>::const_iterator rotStart = rgeo.rotStart(gid);
203  Surface::RotationType rotResult(*(rotStart + 0),
204  *(rotStart + 1),
205  *(rotStart + 2),
206  *(rotStart + 3),
207  *(rotStart + 4),
208  *(rotStart + 5),
209  *(rotStart + 6),
210  *(rotStart + 7),
211  *(rotStart + 8));
212 
213  //Change of axes for the forward
214  Basic3DVector<float> newX(1., 0., 0.);
215  Basic3DVector<float> newY(0., 0., -1.);
216  Basic3DVector<float> newZ(0., 1., 0.);
217 
218  rotResult.rotateAxes(newX, newY, newZ);
219 
220  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
221 }
TkRotation< float >
GEMGeometry::add
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
MessageLogger.h
GEMSuperChamber
Definition: GEMSuperChamber.h:19
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:187
relativeConstraints.station
station
Definition: relativeConstraints.py:67
GEMEtaPartition
Definition: GEMEtaPartition.h:12
Basic3DVector.h
Bounds
Definition: Bounds.h:18
GEMDetId::superChamberId
constexpr GEMDetId superChamberId() const
Definition: GEMDetId.h:199
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
GEMDetId::maxStationId
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
AlignmentPI::partitions
partitions
Definition: AlignmentPayloadInspectorHelper.h:48
geant_units::operators
Definition: GeantUnits.h:18
GEMDetId::maxRollId
static constexpr int32_t maxRollId
Definition: GEMDetId.h:34
RecoIdealGeometry::rotStart
std::vector< double >::const_iterator rotStart(size_t ind) const
Definition: RecoIdealGeometry.h:91
GEMGeometryBuilderFromCondDB::buildEtaPartition
GEMEtaPartition * buildEtaPartition(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
Definition: GEMGeometryBuilderFromCondDB.cc:155
TrapezoidalPlaneBounds.h
GEMStation
Definition: GEMStation.h:19
GEMGeometryBuilderFromCondDB::buildChamber
GEMChamber * buildChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
Definition: GEMGeometryBuilderFromCondDB.cc:144
Point3DBase< float, GlobalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMRing
Definition: GEMRing.h:18
GEMGeometryBuilderFromCondDB::boundPlane
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
Definition: GEMGeometryBuilderFromCondDB.cc:188
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:180
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
GEMEtaPartitionSpecs.h
GeantUnits.h
GEMDetId::roll
constexpr int roll() const
Definition: GEMDetId.h:191
GEMGeometryBuilderFromCondDB::GEMGeometryBuilderFromCondDB
GEMGeometryBuilderFromCondDB()
Definition: GEMGeometryBuilderFromCondDB.cc:17
GEMDetId
Definition: GEMDetId.h:18
GEMGeometryBuilderFromCondDB::buildSuperChamber
GEMSuperChamber * buildSuperChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
Definition: GEMGeometryBuilderFromCondDB.cc:133
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88272
RecoIdealGeometry::detIds
const std::vector< DetId > & detIds() const
Definition: RecoIdealGeometry.h:85
chambers
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
TrapezoidalPlaneBounds
Definition: TrapezoidalPlaneBounds.h:15
RecoIdealGeometry::tranStart
std::vector< double >::const_iterator tranStart(size_t ind) const
Definition: RecoIdealGeometry.h:87
GEMChamber
Definition: GEMChamber.h:19
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
BoundPlane
Plane BoundPlane
Definition: Plane.h:94
RecoIdealGeometry::strStart
std::vector< std::string >::const_iterator strStart(size_t ind) const
Definition: RecoIdealGeometry.h:101
TkRotation::rotateAxes
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
Definition: extTkRotation.h:218
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
GEMDetId::maxLayerId
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
GEMDetId::chamberId
constexpr GEMDetId chamberId() const
Definition: GEMDetId.h:196
RecoIdealGeometry::shapeStart
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: RecoIdealGeometry.h:95
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
GeomDetEnumerators::GEM
Definition: GeomDetEnumerators.h:21
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
GEMGeometryBuilderFromCondDB::build
void build(GEMGeometry &theGeometry, const RecoIdealGeometry &rgeo)
Definition: GEMGeometryBuilderFromCondDB.cc:21
GEMGeometryBuilderFromCondDB.h
gen::npad
int npad
Definition: Cascade2Hadronizer.cc:75
GEMGeometryBuilderFromCondDB::~GEMGeometryBuilderFromCondDB
~GEMGeometryBuilderFromCondDB()
Definition: GEMGeometryBuilderFromCondDB.cc:19
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
GEMGeometry
Definition: GEMGeometry.h:24
cms::cuda::be
int be
Definition: HistoContainer.h:126
GEMRegion
Definition: GEMRegion.h:19
GEMEtaPartitionSpecs
Definition: GEMEtaPartitionSpecs.h:18
Basic3DVector< float >
RecoIdealGeometry
Definition: RecoIdealGeometry.h:28