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 (const std::shared_ptr< 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 26 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.

17 { }
GEMGeometryBuilderFromCondDB::~GEMGeometryBuilderFromCondDB ( )

Definition at line 19 of file GEMGeometryBuilderFromCondDB.cc.

20 { }

Member Function Documentation

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

Definition at line 188 of file GEMGeometryBuilderFromCondDB.cc.

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

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

189 {
190  std::vector<double>::const_iterator shapeStart = rgeo.shapeStart( gid );
191  float be = *(shapeStart+0)/cm;
192  float te = *(shapeStart+1)/cm;
193  float ap = *(shapeStart+2)/cm;
194  float ti = *(shapeStart+3)/cm;
195  Bounds* bounds = new TrapezoidalPlaneBounds( be, te, ap, ti );
196 
197  std::vector<double>::const_iterator tranStart = rgeo.tranStart( gid );
198  Surface::PositionType posResult(*(tranStart)/cm, *(tranStart+1)/cm, *(tranStart+2)/cm );
199 
200  std::vector<double>::const_iterator rotStart = rgeo.rotStart( gid );
201  Surface::RotationType rotResult(*(rotStart+0), *(rotStart+1), *(rotStart+2),
202  *(rotStart+3), *(rotStart+4), *(rotStart+5),
203  *(rotStart+6), *(rotStart+7), *(rotStart+8));
204 
205  //Change of axes for the forward
206  Basic3DVector<float> newX(1.,0.,0.);
207  Basic3DVector<float> newY(0.,0.,1.);
208  Basic3DVector<float> newZ(0.,1.,0.);
209  // Odd chambers are inverted in gem.xml
210  bool isOdd = detId.chamber()%2;
211  // all me0 chambers are inverted
212  if (detId.station() == 0) isOdd = true;
213  if (isOdd) newY *= -1;
214 
215  rotResult.rotateAxes(newX, newY, newZ);
216 
217  return RCPBoundPlane( new BoundPlane( posResult, rotResult, bounds));
218 }
Plane BoundPlane
Definition: Plane.h:95
std::vector< double >::const_iterator rotStart(size_t ind) const
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
int station() const
Station id : the station is the pair of chambers at same disk.
Definition: GEMDetId.h:64
std::vector< double >::const_iterator tranStart(size_t ind) const
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: Bounds.h:22
void GEMGeometryBuilderFromCondDB::build ( const std::shared_ptr< GEMGeometry > &  theGeometry,
const RecoIdealGeometry rgeo 
)

Definition at line 23 of file GEMGeometryBuilderFromCondDB.cc.

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

Referenced by GEMGeometryESModule::produce().

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

Definition at line 148 of file GEMGeometryBuilderFromCondDB.cc.

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

Referenced by build().

149 {
150  LogDebug("GEMGeometryBuilderFromCondDB") << "buildChamber "<< detId <<std::endl;
151 
152  RCPBoundPlane surf(boundPlane(rgeo, gid, detId ));
153 
154  GEMChamber* chamber = new GEMChamber(detId, surf);
155  return chamber;
156 }
#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 158 of file GEMGeometryBuilderFromCondDB.cc.

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

Referenced by build().

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

References boundPlane(), and LogDebug.

Referenced by build().

139 {
140  LogDebug("GEMGeometryBuilderFromCondDB") << "buildSuperChamber "<< detId <<std::endl;
141 
142  RCPBoundPlane surf(boundPlane(rgeo, gid, detId ));
143 
144  GEMSuperChamber* superChamber = new GEMSuperChamber(detId, surf);
145  return superChamber;
146 }
#define LogDebug(id)
ReferenceCountingPointer< BoundPlane > RCPBoundPlane
RCPBoundPlane boundPlane(const RecoIdealGeometry &rgeo, unsigned int gid, GEMDetId detId) const