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 ( )

Implementation of the GEM Geometry Builder from GEM record stored in CondDB

Author
M. Maggi - INFN Bari

Definition at line 16 of file GEMGeometryBuilderFromCondDB.cc.

16 {}

◆ ~GEMGeometryBuilderFromCondDB()

GEMGeometryBuilderFromCondDB::~GEMGeometryBuilderFromCondDB ( )

Definition at line 18 of file GEMGeometryBuilderFromCondDB.cc.

18 {}

Member Function Documentation

◆ boundPlane()

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

Definition at line 184 of file GEMGeometryBuilderFromCondDB.cc.

186  {
187  std::vector<double>::const_iterator shapeStart = rgeo.shapeStart(gid);
188  float be = *(shapeStart + 0) / cm;
189  float te = *(shapeStart + 1) / cm;
190  float ap = *(shapeStart + 2) / cm;
191  float ti = *(shapeStart + 3) / cm;
192  Bounds* bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
193 
194  std::vector<double>::const_iterator tranStart = rgeo.tranStart(gid);
195  Surface::PositionType posResult(*(tranStart) / cm, *(tranStart + 1) / cm, *(tranStart + 2) / cm);
196 
197  std::vector<double>::const_iterator rotStart = rgeo.rotStart(gid);
198  Surface::RotationType rotResult(*(rotStart + 0),
199  *(rotStart + 1),
200  *(rotStart + 2),
201  *(rotStart + 3),
202  *(rotStart + 4),
203  *(rotStart + 5),
204  *(rotStart + 6),
205  *(rotStart + 7),
206  *(rotStart + 8));
207 
208  //Change of axes for the forward
209  Basic3DVector<float> newX(1., 0., 0.);
210  Basic3DVector<float> newY(0., 0., -1.);
211  Basic3DVector<float> newZ(0., 1., 0.);
212 
213  rotResult.rotateAxes(newX, newY, newZ);
214 
215  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
216 }

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

Referenced by buildChamber(), buildEtaPartition(), and buildSuperChamber().

◆ build()

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

Definition at line 20 of file GEMGeometryBuilderFromCondDB.cc.

20  {
21  const std::vector<DetId>& detids(rgeo.detIds());
22  std::unordered_map<uint32_t, GEMSuperChamber*> superChambers;
23  std::unordered_map<uint32_t, GEMChamber*> chambers;
24  std::unordered_map<uint32_t, GEMEtaPartition*> partitions;
25 
26  for (unsigned int id = 0; id < detids.size(); ++id) {
27  GEMDetId gemid(detids[id]);
28  LogDebug("GEMGeometryBuilderFromDDD") << "GEMGeometryBuilderFromDDD adding " << gemid << std::endl;
29  if (gemid.roll() == 0) {
30  if (gemid.layer() == 0) {
31  GEMSuperChamber* gsc = buildSuperChamber(rgeo, id, gemid);
32  superChambers.emplace(gemid.rawId(), gsc);
33  } else {
34  GEMChamber* gch = buildChamber(rgeo, id, gemid);
35  chambers.emplace(gemid.rawId(), gch);
36  }
37  } else {
38  GEMEtaPartition* gep = buildEtaPartition(rgeo, id, gemid);
39  partitions.emplace(gemid.rawId(), gep);
40  }
41  }
42 
44  // TEMP - for backward compatability with old geometry
45  // no superchambers or chambers in old geometry, using etpartitions
46  if (superChambers.empty()) {
47  for (unsigned int id = 0; id < detids.size(); ++id) {
48  GEMDetId gemid(detids[id]);
49  if (gemid.roll() == 1) {
50  GEMChamber* gch = buildChamber(rgeo, id, gemid.chamberId());
51  chambers.emplace(gemid.chamberId().rawId(), gch);
52  if (gemid.layer() == 1) {
53  GEMSuperChamber* gsc = buildSuperChamber(rgeo, id, gemid.superChamberId());
54  superChambers.emplace(gemid.superChamberId().rawId(), gsc);
55  }
56  }
57  }
58  }
60 
61  // construct the regions, stations and rings.
62  for (int re = -1; re <= 1; re = re + 2) {
63  GEMRegion* region = new GEMRegion(re);
64 
65  for (int st = 0; st <= GEMDetId::maxStationId; ++st) {
66  GEMStation* station = new GEMStation(re, st);
67  std::string sign(re == -1 ? "-" : "");
68  std::string name("GE" + sign + std::to_string(st) + "/1");
69  station->setName(name);
70 
71  for (int ri = 1; ri <= 1; ++ri) {
72  GEMRing* ring = new GEMRing(re, st, ri);
73 
74  for (auto sch : superChambers) {
75  auto superChamber = sch.second;
76  const GEMDetId scId(superChamber->id());
77  if (scId.region() != re || scId.station() != st || scId.ring() != ri)
78  continue;
79  int ch = scId.chamber();
80 
81  for (int ly = 1; ly <= GEMDetId::maxLayerId; ++ly) {
82  const GEMDetId chId(re, ri, st, ly, ch, 0);
83  auto chamberIt = chambers.find(chId.rawId());
84  if (chamberIt == chambers.end())
85  continue;
86  auto chamber = chamberIt->second;
87 
88  for (int roll = 1; roll <= GEMDetId::maxRollId; ++roll) {
89  const GEMDetId rollId(re, ri, st, ly, ch, roll);
90  auto gepIt = partitions.find(rollId.rawId());
91  if (gepIt == partitions.end())
92  continue;
93  auto gep = gepIt->second;
94 
95  chamber->add(gep);
96  theGeometry.add(gep);
97  }
98 
99  superChamber->add(chamber);
100  theGeometry.add(chamber);
101  }
102 
103  LogDebug("GEMGeometryBuilderFromDDD") << "Adding super chamber " << scId << " to ring: " << std::endl;
104  ring->add(superChamber);
105  theGeometry.add(superChamber);
106  } // end superChambers
107 
108  if (ring->nSuperChambers()) {
109  LogDebug("GEMGeometryBuilderFromDDD") << "Adding ring " << ri << " to station "
110  << "re " << re << " st " << st << std::endl;
111  station->add(ring);
112  theGeometry.add(ring);
113  } else {
114  delete ring;
115  }
116  } // end ring
117 
118  if (station->nRings()) {
119  LogDebug("GEMGeometryBuilderFromDDD") << "Adding station " << st << " to region " << re << std::endl;
120  region->add(station);
121  theGeometry.add(station);
122  } else {
123  delete station;
124  }
125  } // end station
126 
127  LogDebug("GEMGeometryBuilderFromDDD") << "Adding region " << re << " to the geometry " << std::endl;
128  theGeometry.add(region);
129  }
130 }

References GEMGeometry::add(), buildChamber(), buildEtaPartition(), buildSuperChamber(), 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_2018_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 143 of file GEMGeometryBuilderFromCondDB.cc.

145  {
146  LogDebug("GEMGeometryBuilderFromCondDB") << "buildChamber " << detId << std::endl;
147 
148  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
149 
150  GEMChamber* chamber = new GEMChamber(detId, surf);
151  return chamber;
152 }

References boundPlane(), relativeConstraints::chamber, and LogDebug.

Referenced by build().

◆ buildEtaPartition()

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

Definition at line 154 of file GEMGeometryBuilderFromCondDB.cc.

156  {
157  std::vector<std::string>::const_iterator strStart = rgeo.strStart(gid);
158  std::string name = *(strStart);
159  LogDebug("GEMGeometryBuilderFromCondDB") << "buildEtaPartition " << name << " " << detId << std::endl;
160 
161  std::vector<double>::const_iterator shapeStart = rgeo.shapeStart(gid);
162  float be = *(shapeStart + 0) / cm;
163  float te = *(shapeStart + 1) / cm;
164  float ap = *(shapeStart + 2) / cm;
165  float ti = *(shapeStart + 3) / cm;
166  float nstrip = *(shapeStart + 4);
167  float npad = *(shapeStart + 5);
168 
169  std::vector<float> pars;
170  pars.emplace_back(be);
171  pars.emplace_back(te);
172  pars.emplace_back(ap);
173  pars.emplace_back(nstrip);
174  pars.emplace_back(npad);
175 
176  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
178 
179  LogDebug("GEMGeometryBuilderFromCondDB") << "size " << be << " " << te << " " << ap << " " << ti << std::endl;
180  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
181  return etaPartition;
182 }

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

Referenced by build().

◆ buildSuperChamber()

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

Definition at line 132 of file GEMGeometryBuilderFromCondDB.cc.

134  {
135  LogDebug("GEMGeometryBuilderFromCondDB") << "buildSuperChamber " << detId << std::endl;
136 
137  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
138 
139  GEMSuperChamber* superChamber = new GEMSuperChamber(detId, surf);
140  return superChamber;
141 }

References boundPlane(), and LogDebug.

Referenced by build().

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:26
AlignmentPI::partitions
partitions
Definition: AlignmentPayloadInspectorHelper.h:48
GEMDetId::maxRollId
static constexpr int32_t maxRollId
Definition: GEMDetId.h:33
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:154
GEMStation
Definition: GEMStation.h:19
GEMGeometryBuilderFromCondDB::buildChamber
GEMChamber * buildChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
Definition: GEMGeometryBuilderFromCondDB.cc:143
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:184
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:177
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
GEMDetId
Definition: GEMDetId.h:17
GEMGeometryBuilderFromCondDB::buildSuperChamber
GEMSuperChamber * buildSuperChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
Definition: GEMGeometryBuilderFromCondDB.cc:132
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:31
GEMDetId::maxLayerId
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:31
RecoIdealGeometry::shapeStart
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: RecoIdealGeometry.h:95
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
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:73
cms::cuda::be
int be
Definition: HistoContainer.h:126
GEMRegion
Definition: GEMRegion.h:19
GEMEtaPartitionSpecs
Definition: GEMEtaPartitionSpecs.h:18
Basic3DVector< float >