CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< BoundPlane
RCPBoundPlane
 

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

Definition at line 17 of file GEMGeometryBuilderFromCondDB.cc.

17 {}
GEMGeometryBuilderFromCondDB::~GEMGeometryBuilderFromCondDB ( )

Definition at line 19 of file GEMGeometryBuilderFromCondDB.cc.

19 {}

Member Function Documentation

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

Definition at line 187 of file GEMGeometryBuilderFromCondDB.cc.

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

189  {
190  std::vector<double>::const_iterator shapeStart = rgeo.shapeStart(gid);
191  float be = convertMmToCm(*(shapeStart + 0));
192  float te = convertMmToCm(*(shapeStart + 1));
193  float ap = convertMmToCm(*(shapeStart + 2));
194  float ti = convertMmToCm(*(shapeStart + 3));
195  Bounds* bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
196 
197  std::vector<double>::const_iterator tranStart = rgeo.tranStart(gid);
198  Surface::PositionType posResult(
199  convertMmToCm(*(tranStart)), convertMmToCm(*(tranStart + 1)), convertMmToCm(*(tranStart + 2)));
200 
201  std::vector<double>::const_iterator rotStart = rgeo.rotStart(gid);
202  Surface::RotationType rotResult(*(rotStart + 0),
203  *(rotStart + 1),
204  *(rotStart + 2),
205  *(rotStart + 3),
206  *(rotStart + 4),
207  *(rotStart + 5),
208  *(rotStart + 6),
209  *(rotStart + 7),
210  *(rotStart + 8));
211 
212  //Change of axes for the forward
213  Basic3DVector<float> newX(1., 0., 0.);
214  Basic3DVector<float> newY(0., 0., -1.);
215  Basic3DVector<float> newZ(0., 1., 0.);
216 
217  rotResult.rotateAxes(newX, newY, newZ);
218 
219  return RCPBoundPlane(new BoundPlane(posResult, rotResult, bounds));
220 }
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
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
Definition: Bounds.h:18
void GEMGeometryBuilderFromCondDB::build ( GEMGeometry theGeometry,
const RecoIdealGeometry rgeo 
)

Definition at line 21 of file GEMGeometryBuilderFromCondDB.cc.

References GEMRing::add(), GEMStation::add(), GEMRegion::add(), GEMGeometry::add(), GEMDetId::chamber(), GEMDetId::chamberId(), chambers, RecoIdealGeometry::detIds(), gpuClustering::id, GEMDetId::layer(), LogDebug, GEMDetId::maxLayerId, GEMDetId::maxRollId, GEMDetId::maxStationId, mergeVDriftHistosByStation::name, GEMStation::nRings(), GEMRing::nSuperChambers(), DetId::rawId(), HLT_FULL_cff::region, relativeConstraints::ring, GEMDetId::roll(), GEMStation::setName(), jetcorrextractor::sign(), relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, and GEMDetId::superChamberId().

Referenced by GEMGeometryESModule::produce().

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 }
uint16_t *__restrict__ id
int nSuperChambers() const
Return numbers of chambers.
Definition: GEMRing.cc:44
double sign(double x)
GEMSuperChamber * buildSuperChamber(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const
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
static constexpr int32_t maxStationId
Definition: GEMDetId.h:27
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
constexpr int chamber() const
Definition: GEMDetId.h:183
static constexpr int32_t maxLayerId
Definition: GEMDetId.h:32
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
static constexpr int32_t maxRollId
Definition: GEMDetId.h:36
void add(const GEMRegion *region)
Add a GEMRegion to the Geometry.
Definition: GEMGeometry.cc:81
#define LogDebug(id)
GEMChamber * GEMGeometryBuilderFromCondDB::buildChamber ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 144 of file GEMGeometryBuilderFromCondDB.cc.

References LogDebug.

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

Definition at line 155 of file GEMGeometryBuilderFromCondDB.cc.

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

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 < rgeo.shapeEnd(gid)) ? *(shapeStart + 6) : 0.17715;
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 
179  RCPBoundPlane surf(boundPlane(rgeo, gid, detId));
181 
182  LogDebug("GEMGeometryBuilderFromCondDB") << "size " << be << " " << te << " " << ap << " " << ti;
183  GEMEtaPartition* etaPartition = new GEMEtaPartition(detId, surf, e_p_specs);
184  return etaPartition;
185 }
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 shapeEnd(size_t ind) const
std::vector< double >::const_iterator shapeStart(size_t ind) const
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
#define LogDebug(id)
GEMSuperChamber * GEMGeometryBuilderFromCondDB::buildSuperChamber ( const RecoIdealGeometry rgeo,
unsigned int  gid,
GEMDetId  detId 
) const
private

Definition at line 133 of file GEMGeometryBuilderFromCondDB.cc.

References LogDebug.

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