CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions
GEMGeometryBuilderFromCondDB Class Reference

#include <GEMGeometryBuilderFromCondDB.h>

Public Member Functions

void build (GEMGeometry &theGeometry, const RecoIdealGeometry &rgeo)
 
 GEMGeometryBuilderFromCondDB ()
 
 ~GEMGeometryBuilderFromCondDB ()
 

Private Types

typedef ReferenceCountingPointer< BoundPlaneRCPBoundPlane
 

Private Member Functions

RCPBoundPlane boundPlane (const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
 
GEMChamberbuildChamber (const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
 
GEMEtaPartitionbuildEtaPartition (const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
 
GEMSuperChamberbuildSuperChamber (const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
 

Detailed Description

Build the GEMGeometry from the RecoIdealGeometry description stored in Condition DB

Author
M. Maggi - INFN Bari

Definition at line 14 of file GEMGeometryBuilderFromCondDB.h.

Member Typedef Documentation

◆ RCPBoundPlane

Definition at line 23 of file GEMGeometryBuilderFromCondDB.h.

Constructor & Destructor Documentation

◆ GEMGeometryBuilderFromCondDB()

GEMGeometryBuilderFromCondDB::GEMGeometryBuilderFromCondDB ( )

Definition at line 17 of file GEMGeometryBuilderFromCondDB.cc.

17 {}

◆ ~GEMGeometryBuilderFromCondDB()

GEMGeometryBuilderFromCondDB::~GEMGeometryBuilderFromCondDB ( )

Definition at line 19 of file GEMGeometryBuilderFromCondDB.cc.

19 {}

Member Function Documentation

◆ boundPlane()

GEMGeometryBuilderFromCondDB::RCPBoundPlane GEMGeometryBuilderFromCondDB::boundPlane ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 188 of file GEMGeometryBuilderFromCondDB.cc.

190  {
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 }

References cms::cuda::be, geant_units::operators::convertMmToCm(), TkRotation< T >::rotateAxes(), RecoIdealGeometry::rotStart(), RecoIdealGeometry::shapeStart(), and RecoIdealGeometry::tranStart().

◆ build()

void GEMGeometryBuilderFromCondDB::build ( GEMGeometry theGeometry,
const RecoIdealGeometry rgeo 
)

Definition at line 21 of file GEMGeometryBuilderFromCondDB.cc.

21  {
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 }

References GEMGeometry::add(), relativeConstraints::chamber, GEMDetId::chamber(), GEMDetId::chamberId(), chambers, RecoIdealGeometry::detIds(), triggerObjects_cff::id, GEMDetId::layer(), LogDebug, GEMDetId::maxLayerId, GEMDetId::maxRollId, GEMDetId::maxStationId, Skims_PA_cff::name, DetId::rawId(), HLT_FULL_cff::region, relativeConstraints::ring, GEMDetId::roll(), Validation_hcalonly_cfi::sign, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, and GEMDetId::superChamberId().

Referenced by GEMGeometryESModule::produce().

◆ buildChamber()

GEMChamber * GEMGeometryBuilderFromCondDB::buildChamber ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 144 of file GEMGeometryBuilderFromCondDB.cc.

146  {
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 }

References relativeConstraints::chamber, and LogDebug.

◆ buildEtaPartition()

GEMEtaPartition * GEMGeometryBuilderFromCondDB::buildEtaPartition ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 155 of file GEMGeometryBuilderFromCondDB.cc.

157  {
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 }

References cms::cuda::be, geant_units::operators::convertMmToCm(), GeomDetEnumerators::GEM, LogDebug, Skims_PA_cff::name, gen::npad, RecoIdealGeometry::shapeStart(), AlCaHLTBitMon_QueryRunRegistry::string, and RecoIdealGeometry::strStart().

◆ buildSuperChamber()

GEMSuperChamber * GEMGeometryBuilderFromCondDB::buildSuperChamber ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 133 of file GEMGeometryBuilderFromCondDB.cc.

135  {
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 }

References LogDebug.

TkRotation< float >
GEMGeometry::add
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
GEMSuperChamber
Definition: GEMSuperChamber.h:19
relativeConstraints.station
station
Definition: relativeConstraints.py:67
GEMEtaPartition
Definition: GEMEtaPartition.h:12
Bounds
Definition: Bounds.h:18
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
GEMDetId::maxStationId
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
AlignmentPI::partitions
partitions
Definition: AlignmentPayloadInspectorHelper.h:48
GEMDetId::maxRollId
static constexpr int32_t maxRollId
Definition: GEMDetId.h:36
GEMGeometryBuilderFromCondDB::RCPBoundPlane
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
Definition: GEMGeometryBuilderFromCondDB.h:23
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
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:183
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
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:88271
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
BoundPlane
Plane BoundPlane
Definition: Plane.h:94
RecoIdealGeometry::strStart
std::vector< std::string >::const_iterator strStart(size_t ind) const
Definition: RecoIdealGeometry.h:101
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
GEMDetId::maxLayerId
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
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
gen::npad
int npad
Definition: Cascade2Hadronizer.cc:75
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
cms::cuda::be
int be
Definition: HistoContainer.h:126
GEMRegion
Definition: GEMRegion.h:19
GEMEtaPartitionSpecs
Definition: GEMEtaPartitionSpecs.h:18
Basic3DVector< float >