CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RPCGeometryBuilderFromCondDB Class Reference

#include <RPCGeometryBuilderFromCondDB.h>

Public Member Functions

RPCGeometrybuild (const RecoIdealGeometry &rgeo)
 
 RPCGeometryBuilderFromCondDB (bool comp11)
 
 ~RPCGeometryBuilderFromCondDB ()
 

Private Attributes

std::map< RPCDetId, std::list
< RPCRoll * > > 
chids
 
bool theComp11Flag
 

Detailed Description

Build the RPCGeometry from the DDD description stored in Condition DB

Author
M. Maggi - INFN Bari

Definition at line 21 of file RPCGeometryBuilderFromCondDB.h.

Constructor & Destructor Documentation

RPCGeometryBuilderFromCondDB::RPCGeometryBuilderFromCondDB ( bool  comp11)

Implementation of the RPC Geometry Builder from DDD stored in CondDB

Author
M. Maggi - INFN Bari

Definition at line 27 of file RPCGeometryBuilderFromCondDB.cc.

27  :
28  theComp11Flag(comp11)
29 { }
RPCGeometryBuilderFromCondDB::~RPCGeometryBuilderFromCondDB ( )

Definition at line 31 of file RPCGeometryBuilderFromCondDB.cc.

32 { }

Member Function Documentation

RPCGeometry * RPCGeometryBuilderFromCondDB::build ( const RecoIdealGeometry rgeo)

Definition at line 34 of file RPCGeometryBuilderFromCondDB.cc.

References RPCChamber::add(), chids, RecoIdealGeometry::detIds(), geometry, RPCDetId::layer(), python.multivaluedict::map(), mergeVDriftHistosByStation::name, pos, alignCSCRings::r, RPCDetId::region(), RPCDetId::ring(), makeMuonMisalignmentScenario::rot, TkRotation< T >::rotateAxes(), RecoIdealGeometry::rotStart(), GeomDetEnumerators::RPCBarrel, GeomDetEnumerators::RPCEndcap, RPCDetId::sector(), RecoIdealGeometry::shapeEnd(), RecoIdealGeometry::shapeStart(), RPCDetId::station(), RecoIdealGeometry::strStart(), RPCDetId::subsector(), theComp11Flag, RecoIdealGeometry::tranStart(), and tablePrinter::width.

Referenced by RPCGeometryESModule::produce().

35 {
36  const std::vector<DetId>& detids(rgeo.detIds());
38 
39  std::string name;
40  std::vector<double>::const_iterator tranStart;
41  std::vector<double>::const_iterator shapeStart;
42  std::vector<double>::const_iterator rotStart;
43  std::vector<std::string>::const_iterator strStart;
44 
45  for (unsigned int id=0; id<detids.size(); id++){
46 
47  RPCDetId rpcid(detids[id]);
48  RPCDetId chid(rpcid.region(),rpcid.ring(),rpcid.station(),
49  rpcid.sector(),rpcid.layer(),rpcid.subsector(),0);
50 
51  tranStart=rgeo.tranStart(id);
52  shapeStart=rgeo.shapeStart(id);
53  rotStart=rgeo.rotStart(id);
54  strStart=rgeo.strStart(id);
55  name=*(strStart);
56 
57  Surface::PositionType pos(*(tranStart)/cm,*(tranStart+1)/cm, *(tranStart+2)/cm);
58  // CLHEP way
59  Surface::RotationType rot(*(rotStart+0),*(rotStart+1),*(rotStart+2),
60  *(rotStart+3),*(rotStart+4),*(rotStart+5),
61  *(rotStart+6),*(rotStart+7),*(rotStart+8));
62 
63  std::vector<float> pars;
64  RPCRollSpecs* rollspecs= 0;
65  Bounds* bounds = 0;
66 
67  // if (dpar.size()==4){
68  if ( rgeo.shapeEnd(id) - shapeStart == 4 ) {
69  float width = *(shapeStart+0)/cm;
70  float length = *(shapeStart+1)/cm;
71  float thickness = *(shapeStart+2)/cm;
72  float nstrip = *(shapeStart+3);
73  //RectangularPlaneBounds*
74  bounds =
75  new RectangularPlaneBounds(width,length,thickness);
76  pars.push_back(width);
77  pars.push_back(length);
78  pars.push_back(nstrip);
79 
80  if (!theComp11Flag) {
81  //Correction of the orientation to get the REAL geometry.
82  //Change of axes for the +z part only.
83  //Including the 0 whell
84  if ( *(tranStart+2) > -1500.) { //tran[2] >-1500. ){
85  Basic3DVector<float> newX(-1.,0.,0.);
86  Basic3DVector<float> newY(0.,-1.,0.);
87  Basic3DVector<float> newZ(0.,0.,1.);
88  rot.rotateAxes (newX, newY,newZ);
89  }
90  }
91 
92 
93  rollspecs = new RPCRollSpecs(GeomDetEnumerators::RPCBarrel,name,pars);
94 
95 
96  }else{
97  float be = *(shapeStart+0)/cm;
98  float te = *(shapeStart+1)/cm;
99  float ap = *(shapeStart+2)/cm;
100  float ti = *(shapeStart+3)/cm;
101  float nstrip = *(shapeStart+4);
102  // TrapezoidalPlaneBounds*
103  bounds =
104  new TrapezoidalPlaneBounds(be,te,ap,ti);
105  pars.push_back(be); //b/2;
106  pars.push_back(te); //B/2;
107  pars.push_back(ap); //h/2;
108  pars.push_back(nstrip);
109 
110  rollspecs = new RPCRollSpecs(GeomDetEnumerators::RPCEndcap,name,pars);
111 
112  //Change of axes for the forward
113  Basic3DVector<float> newX(1.,0.,0.);
114  Basic3DVector<float> newY(0.,0.,1.);
115  // if (tran[2] > 0. )
116  newY *= -1;
117  Basic3DVector<float> newZ(0.,1.,0.);
118  rot.rotateAxes (newX, newY,newZ);
119  }
120 
121  BoundPlane* bp = new BoundPlane(pos,rot,bounds);
123  RPCRoll* r=new RPCRoll(rpcid,surf,rollspecs);
124  geometry->add(r);
125 
126  std::list<RPCRoll *> rls;
127  if (chids.find(chid)!=chids.end()){
128  rls = chids[chid];
129  }
130  rls.push_back(r);
131  chids[chid]=rls;
132  }
133  // Create the RPCChambers and store them on the Geometry
134  for( std::map<RPCDetId, std::list<RPCRoll *> >::iterator ich=chids.begin();
135  ich != chids.end(); ich++){
136  RPCDetId chid = ich->first;
137  std::list<RPCRoll * > rls = ich->second;
138 
139  // compute the overall boundplane. At the moment we use just the last
140  // surface
141  BoundPlane* bp=0;
142  for(std::list<RPCRoll *>::iterator rl=rls.begin();
143  rl!=rls.end(); rl++){
144  const BoundPlane& bps = (*rl)->surface();
145  bp = const_cast<BoundPlane *>(&bps);
146  }
147 
149  // Create the chamber
150  RPCChamber* ch = new RPCChamber (chid, surf);
151  // Add the rolls to rhe chamber
152  for(std::list<RPCRoll *>::iterator rl=rls.begin();
153  rl!=rls.end(); rl++){
154  ch->add(*rl);
155  }
156  // Add the chamber to the geometry
157  geometry->add(ch);
158 
159  }
160  return geometry;
161 }
void add(RPCRoll *rl)
Add Roll to the chamber which takes ownership.
Definition: RPCChamber.cc:50
std::map< RPCDetId, std::list< RPCRoll * > > chids
std::vector< double >::const_iterator rotStart(size_t ind) const
std::vector< std::string >::const_iterator strStart(size_t ind) const
std::vector< double >::const_iterator tranStart(size_t ind) const
const std::vector< DetId > & detIds() const
std::vector< double >::const_iterator shapeEnd(size_t ind) const
ESHandle< TrackerGeometry > geometry
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: Bounds.h:18

Member Data Documentation

std::map<RPCDetId,std::list<RPCRoll *> > RPCGeometryBuilderFromCondDB::chids
private

Definition at line 33 of file RPCGeometryBuilderFromCondDB.h.

Referenced by build().

bool RPCGeometryBuilderFromCondDB::theComp11Flag
private

Definition at line 34 of file RPCGeometryBuilderFromCondDB.h.

Referenced by build().