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

Definition at line 23 of file GEMGeometryBuilderFromCondDB.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file GEMGeometryBuilderFromCondDB.cc.

18 {}

Member Function Documentation

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

Definition at line 184 of file GEMGeometryBuilderFromCondDB.cc.

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

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

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 }
Plane BoundPlane
Definition: Plane.h:94
std::vector< double >::const_iterator rotStart(size_t ind) const
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
std::vector< double >::const_iterator tranStart(size_t ind) const
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: Bounds.h:20
void GEMGeometryBuilderFromCondDB::build ( GEMGeometry theGeometry,
const RecoIdealGeometry rgeo 
)

Definition at line 20 of file GEMGeometryBuilderFromCondDB.cc.

References GEMRing::add(), GEMStation::add(), GEMRegion::add(), 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, GEMStation::nRings(), GEMRing::nSuperChambers(), DetId::rawId(), HLT_2018_cff::region, relativeConstraints::ring, GEMDetId::roll(), GEMStation::setName(), Validation_hcalonly_cfi::sign, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, and GEMDetId::superChamberId().

Referenced by GEMGeometryESModule::produce().

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 }
#define LogDebug(id)
static int32_t maxRollId
Definition: GEMDetId.h:33
int nSuperChambers() const
Return numbers of chambers.
Definition: GEMRing.cc:44
GEMSuperChamber * buildSuperChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
static int32_t maxStationId
Definition: GEMDetId.h:26
int chamber() const
Definition: GEMDetId.h:177
void add(GEMRing *ring)
Add ring to the station which takes ownership.
Definition: GEMStation.cc:22
void add(GEMSuperChamber *ch)
Add super chamber to the ring which takes ownership.
Definition: GEMRing.cc:14
GEMEtaPartition * buildEtaPartition(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
void setName(std::string name)
Set the station name.
Definition: GEMStation.cc:66
GEMChamber * buildChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
const std::vector< DetId > & detIds() const
static int32_t maxLayerId
Definition: GEMDetId.h:31
int nRings() const
Return numbers of rings for this station.
Definition: GEMStation.cc:64
void add(GEMStation *st)
Add station to the region which takes ownership.
Definition: GEMRegion.cc:20
static char chambers[264][20]
Definition: ReadPGInfo.cc:243
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
GEMChamber * GEMGeometryBuilderFromCondDB::buildChamber ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 143 of file GEMGeometryBuilderFromCondDB.cc.

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

Referenced by build().

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 }
#define LogDebug(id)
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
GEMEtaPartition * GEMGeometryBuilderFromCondDB::buildEtaPartition ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 154 of file GEMGeometryBuilderFromCondDB.cc.

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

Referenced by build().

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 }
#define LogDebug(id)
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
std::vector< std::string >::const_iterator strStart(size_t ind) const
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
std::vector< double >::const_iterator shapeStart(size_t ind) const
GEMSuperChamber * GEMGeometryBuilderFromCondDB::buildSuperChamber ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 132 of file GEMGeometryBuilderFromCondDB.cc.

References boundPlane(), and LogDebug.

Referenced by build().

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 }
#define LogDebug(id)
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const