CMS 3D CMS Logo

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

#include <GEMGeometryBuilderFromCondDB.h>

Public Member Functions

void build (const std::shared_ptr< GEMGeometry > &theGeometry, const RecoIdealGeometry &rgeo)
 
 GEMGeometryBuilderFromCondDB ()
 
 ~GEMGeometryBuilderFromCondDB ()
 

Private Attributes

std::map< GEMDetId, std::list< GEMEtaPartition * > > m_chids
 

Detailed Description

Build the GEMGeometry from the RecoIdealGeometry description stored in Condition DB

Author
M. Maggi - INFN Bari

Definition at line 19 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 29 of file GEMGeometryBuilderFromCondDB.cc.

30 { }
GEMGeometryBuilderFromCondDB::~GEMGeometryBuilderFromCondDB ( )

Definition at line 32 of file GEMGeometryBuilderFromCondDB.cc.

33 { }

Member Function Documentation

void GEMGeometryBuilderFromCondDB::build ( const std::shared_ptr< GEMGeometry > &  theGeometry,
const RecoIdealGeometry rgeo 
)

Definition at line 36 of file GEMGeometryBuilderFromCondDB.cc.

References GEMRing::add(), GEMStation::add(), GEMRegion::add(), GEMChamber::add(), GEMSuperChamber::add(), GEMDetId::chamber(), RecoIdealGeometry::detIds(), GeomDetEnumerators::GEM, triggerObjects_cff::id, GEMSuperChamber::id(), GEMDetId::layer(), LogDebug, m_chids, GEMDetId::maxStationId, dataset::name, gen::npad, DetId::rawId(), GEMDetId::region(), GEMDetId::ring(), relativeConstraints::ring, makeMuonMisalignmentScenario::rot, TkRotation< T >::rotateAxes(), RecoIdealGeometry::rotStart(), GEMStation::setName(), RecoIdealGeometry::shapeStart(), Validation_hcalonly_cfi::sign, GEMDetId::station(), relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, RecoIdealGeometry::strStart(), and RecoIdealGeometry::tranStart().

Referenced by GEMGeometryESModule::produce().

38 {
39  const std::vector<DetId>& detids( rgeo.detIds());
40  std::vector<GEMSuperChamber*> superChambers;
41 
43  std::vector<double>::const_iterator tranStart;
44  std::vector<double>::const_iterator shapeStart;
45  std::vector<double>::const_iterator rotStart;
46  std::vector<std::string>::const_iterator strStart;
47 
48  for( unsigned int id = 0; id < detids.size(); ++id )
49  {
50  GEMDetId gemid( detids[id] );
51  GEMDetId chid( gemid.region(), gemid.ring(), gemid.station(),
52  gemid.layer(), gemid.chamber(), 0 );
53 
54  tranStart = rgeo.tranStart( id );
55  shapeStart = rgeo.shapeStart( id );
56  rotStart = rgeo.rotStart( id );
57  strStart = rgeo.strStart( id );
58  name = *( strStart );
59 
60  Surface::PositionType pos(*(tranStart)/cm, *(tranStart+1)/cm, *(tranStart+2)/cm );
61  // CLHEP way
62  Surface::RotationType rot(*(rotStart+0), *(rotStart+1), *(rotStart+2),
63  *(rotStart+3), *(rotStart+4), *(rotStart+5),
64  *(rotStart+6), *(rotStart+7), *(rotStart+8));
65 
66  float be = *(shapeStart+0)/cm;
67  float te = *(shapeStart+1)/cm;
68  float ap = *(shapeStart+2)/cm;
69  float ti = *(shapeStart+3)/cm;
70  float nstrip = *(shapeStart+4);
71  float npad = *(shapeStart+5);
72  // TrapezoidalPlaneBounds*
73  Bounds* bounds = new TrapezoidalPlaneBounds( be, te, ap, ti );
74 
75  std::vector<float> pars;
76  pars.emplace_back(be); //b/2;
77  pars.emplace_back(te); //B/2;
78  pars.emplace_back(ap); //h/2;
79  pars.emplace_back(nstrip);
80  pars.emplace_back(npad);
81 
83 
84  //Change of axes for the forward
85  Basic3DVector<float> newX( 1., 0., 0. );
86  Basic3DVector<float> newY( 0., 0., 1. );
87  // if (tran[2] > 0. )
88  newY *= -1;
89  Basic3DVector<float> newZ( 0., 1., 0. );
90  rot.rotateAxes( newX, newY, newZ );
91 
92  BoundPlane* bp = new BoundPlane( pos, rot, bounds );
94  GEMEtaPartition* gep = new GEMEtaPartition( gemid, surf, epSpecs );
95  LogDebug("GEMGeometryBuilder") << "GEM Eta Partition created with id = " << gemid
96  << " and added to the GEMGeometry" << std::endl;
97  theGeometry->add(gep);
98 
99  std::list<GEMEtaPartition *> gepList;
100  if( m_chids.find( chid ) != m_chids.end()) {
101  gepList = m_chids[chid];
102  }
103  gepList.emplace_back(gep);
104  m_chids[chid] = gepList;
105  }
106 
107  // Create the GEMChambers and store them on the Geometry
108 
109  for( const auto& ich : m_chids ) {
110  GEMDetId chid = ich.first;
111  std::list<GEMEtaPartition * > gepList = ich.second;
112 
113  // compute the overall boundplane. At the moment we use just the last
114  // surface
115  BoundPlane* bp = nullptr;
116  for( const auto& gep : gepList ) {
117  const BoundPlane& bps = ( *gep ).surface();
118  bp = const_cast<BoundPlane *>( &bps );
119  }
120 
122  // Create the superchamber
123  if( chid.layer() == 1 ) {
124  GEMDetId schid( chid.region(), chid.ring(), chid.station(), 0, chid.chamber(), 0 );
125  GEMSuperChamber* sch = new GEMSuperChamber( schid, surf );
126  LogDebug("GEMGeometryBuilder") << "GEM SuperChamber created with id = " << schid
127  << " and added to the GEMGeometry" << std::endl;
128  superChambers.emplace_back( sch );
129  }
130 
131  // Create the chamber
132  GEMChamber* ch = new GEMChamber( chid, surf );
133  LogDebug("GEMGeometryBuilder") << "GEM Chamber created with id = " << chid
134  << " = " << chid.rawId() << " and added to the GEMGeometry" << std::endl;
135  LogDebug("GEMGeometryBuilder") << "GEM Chamber has following eta partitions associated: " << std::endl;
136 
137  // Add the etaps to rhe chamber
138  for( const auto& gep : gepList ) {
139  ch->add(gep);
140  LogDebug("GEMGeometryBuilder") << " --> GEM Eta Partition " << GEMDetId(( *gep ).id()) << std::endl;
141  }
142  // Add the chamber to the geometry
143  theGeometry->add( ch );
144  }
145 
146  // The super chamber is composed of 2 chambers.
147  // It's detId is layer 0, chambers are layer 1 and 2
148 
149  // construct the regions, stations and rings.
150  for( int re = -1; re <= 1; re = re+2 ) {
151  GEMRegion* region = new GEMRegion( re );
152  for( int st = 1; st <= GEMDetId::maxStationId; ++st ) {
153  GEMStation* station = new GEMStation(re, st);
154  std::string sign( re==-1 ? "-" : "");
155  std::string name("GE" + sign + std::to_string(st) + "/1");
156  station->setName(name);
157  for( int ri = 1; ri <= 1; ++ri ) {
158  GEMRing* ring = new GEMRing( re, st, ri );
159  for( unsigned sch = 0; sch < superChambers.size(); ++sch ) {
160  GEMSuperChamber* superChamber = superChambers[sch];
161  const GEMDetId detId( superChamber->id());
162  if (detId.region() != re || detId.station() != st || detId.ring() != ri) continue;
163 
164  superChamber->add( theGeometry->chamber( GEMDetId( detId.region(), detId.ring(), detId.station(), 1, detId.chamber(), 0 )));
165  superChamber->add( theGeometry->chamber( GEMDetId( detId.region(), detId.ring(), detId.station(), 2, detId.chamber(), 0 )));
166  ring->add( superChamber );
167  theGeometry->add( superChamber );
168  LogDebug("GEMGeometryBuilderFromDDD") << "Adding super chamber " << detId << " to ring: "
169  << "re " << re << " st " << st << " ri " << ri << std::endl;
170  }
171  LogDebug("GEMGeometryBuilderFromDDD") << "Adding ring " << ri << " to station " << "re " << re << " st " << st << std::endl;
172  station->add( ring );
173  theGeometry->add( ring );
174  }
175  LogDebug("GEMGeometryBuilderFromDDD") << "Adding station " << st << " to region " << re << std::endl;
176  region->add( station );
177  theGeometry->add( station );
178  }
179  LogDebug("GEMGeometryBuilderFromDDD") << "Adding region " << re << " to the geometry " << std::endl;
180  theGeometry->add( region );
181  }
182 }
#define LogDebug(id)
Plane BoundPlane
Definition: Plane.h:95
std::vector< double >::const_iterator rotStart(size_t ind) const
int ring() const
Definition: GEMDetId.h:59
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
std::vector< std::string >::const_iterator strStart(size_t ind) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
Definition: GEMDetId.h:69
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
void add(GEMEtaPartition *roll)
Add EtaPartition to the chamber which takes ownership.
Definition: GEMChamber.cc:27
static const int maxStationId
Definition: GEMDetId.h:101
void setName(std::string name)
Set the station name.
Definition: GEMStation.cc:77
void add(const GEMChamber *ch)
Add chamber to the super chamber which takes ownership.
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: GEMDetId.h:53
const std::vector< DetId > & detIds() const
GEMDetId id() const
Return the GEMDetId of this super chamber.
std::vector< double >::const_iterator shapeStart(size_t ind) const
std::map< GEMDetId, std::list< GEMEtaPartition * > > m_chids
void add(GEMStation *st)
Add station to the region which takes ownership.
Definition: GEMRegion.cc:25
Definition: Bounds.h:22

Member Data Documentation

std::map<GEMDetId, std::list<GEMEtaPartition *> > GEMGeometryBuilderFromCondDB::m_chids
private

Definition at line 32 of file GEMGeometryBuilderFromCondDB.h.

Referenced by build().