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 Member Functions | Private Attributes
RPCGeometryBuilderFromDDD Class Reference

#include <RPCGeometryBuilderFromDDD.h>

Public Member Functions

RPCGeometrybuild (const DDCompactView *cview, const MuonDDDConstants &muonConstants)
 
 RPCGeometryBuilderFromDDD (bool comp11)
 
 ~RPCGeometryBuilderFromDDD ()
 

Private Member Functions

RPCGeometrybuildGeometry (DDFilteredView &fview, const MuonDDDConstants &muonConstants)
 

Private Attributes

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

Detailed Description

Build the RPCGeometry ftom the DDD description

Author
Port of: MuDDDRPCBuilder, MuonRPCGeometryBuilder (ORCA)
M. Maggi - INFN Bari

Definition at line 23 of file RPCGeometryBuilderFromDDD.h.

Constructor & Destructor Documentation

RPCGeometryBuilderFromDDD::RPCGeometryBuilderFromDDD ( bool  comp11)

Implementation of the RPC Geometry Builder from DDD

Author
Port of: MuDDDRPCBuilder (ORCA)
M. Maggi - INFN Bari

Definition at line 28 of file RPCGeometryBuilderFromDDD.cc.

28  : theComp11Flag(comp11)
29 { }
RPCGeometryBuilderFromDDD::~RPCGeometryBuilderFromDDD ( )

Definition at line 31 of file RPCGeometryBuilderFromDDD.cc.

32 { }

Member Function Documentation

RPCGeometry * RPCGeometryBuilderFromDDD::build ( const DDCompactView cview,
const MuonDDDConstants muonConstants 
)

Definition at line 34 of file RPCGeometryBuilderFromDDD.cc.

References DDFilteredView::addFilter(), DDSpecificsFilter::AND, buildGeometry(), align_tpl::filter, DDSpecificsFilter::matches, DDSpecificsFilter::setCriteria(), and relativeConstraints::value.

Referenced by RPCGeometryESModule::produce().

35 {
36  std::string attribute = "ReadOutName"; // could come from .orcarc
37  std::string value = "MuonRPCHits"; // could come from .orcarc
38  DDValue val(attribute, value, 0.0);
39 
40  // Asking only for the MuonRPC's
42  filter.setCriteria(val, // name & value of a variable
45  true, // compare strings otherwise doubles
46  true // use merged-specifics or simple-specifics
47  );
48  DDFilteredView fview(*cview);
49  fview.addFilter(filter);
50 
51  return this->buildGeometry(fview, muonConstants);
52 }
RPCGeometry * buildGeometry(DDFilteredView &fview, const MuonDDDConstants &muonConstants)
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
Definition: align_tpl.py:86
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37
RPCGeometry * RPCGeometryBuilderFromDDD::buildGeometry ( DDFilteredView fview,
const MuonDDDConstants muonConstants 
)
private

Definition at line 54 of file RPCGeometryBuilderFromDDD.cc.

References RPCChamber::add(), RPCGeometry::add(), RPCNumberingScheme::baseNumberToUnitNumber(), chids, gather_cfg::cout, DDfetch(), cond::rpcobgas::detid, DDValue::doubles(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), geometry, RPCDetId::layer(), DDFilteredView::logicalPart(), Association::map, AlCaRecoCosmics_cfg::name, DDName::name(), DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDSolid::parameters(), pos, csvReporter::r, RPCDetId::region(), RPCDetId::ring(), TkRotation< T >::rotateAxes(), DDFilteredView::rotation(), GeomDetEnumerators::RPCBarrel, GeomDetEnumerators::RPCEndcap, RPCDetId::sector(), DDLogicalPart::solid(), DDFilteredView::specifics(), RPCDetId::station(), RPCDetId::subsector(), theComp11Flag, DDFilteredView::translation(), tablePrinter::width, ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::y, and z.

Referenced by build().

55 {
56 #ifdef LOCAL_DEBUG
57  std::cout <<"Building the geometry service"<<std::endl;
58 #endif
60 
61 #ifdef LOCAL_DEBUG
62  std::cout << "About to run through the RPC structure" << std::endl;
63  std::cout <<" First logical part "
64  <<fview.logicalPart().name().name()<<std::endl;
65 #endif
66  bool doSubDets = fview.firstChild();
67 
68 #ifdef LOCAL_DEBUG
69  std::cout << "doSubDets = " << doSubDets << std::endl;
70 #endif
71  while (doSubDets){
72 
73 #ifdef LOCAL_DEBUG
74  std::cout <<"start the loop"<<std::endl;
75 #endif
76 
77  // Get the Base Muon Number
78  MuonDDDNumbering mdddnum(muonConstants);
79 #ifdef LOCAL_DEBUG
80  std::cout <<"Getting the Muon base Number"<<std::endl;
81 #endif
82  MuonBaseNumber mbn=mdddnum.geoHistoryToBaseNumber(fview.geoHistory());
83 
84 #ifdef LOCAL_DEBUG
85  std::cout <<"Start the Rpc Numbering Schema"<<std::endl;
86 #endif
87  // Get the The Rpc det Id
88  RPCNumberingScheme rpcnum(muonConstants);
89  int detid = 0;
90 
91 #ifdef LOCAL_DEBUG
92  std::cout <<"Getting the Unit Number"<<std::endl;
93 #endif
94  detid = rpcnum.baseNumberToUnitNumber(mbn);
95 #ifdef LOCAL_DEBUG
96  std::cout <<"Getting the RPC det Id "<<detid <<std::endl;
97 #endif
98  RPCDetId rpcid(detid);
99  RPCDetId chid(rpcid.region(),rpcid.ring(),rpcid.station(),rpcid.sector(),rpcid.layer(),rpcid.subsector(),0);
100 
101 #ifdef LOCAL_DEBUG
102  std::cout <<"The RPCDetid is "<<rpcid<<std::endl;
103 #endif
104 
105  DDValue numbOfStrips("nStrips");
106 
107  std::vector<const DDsvalues_type* > specs(fview.specifics());
108  std::vector<const DDsvalues_type* >::iterator is=specs.begin();
109  int nStrips=0;
110  for (;is!=specs.end(); is++){
111  if (DDfetch( *is, numbOfStrips)){
112  nStrips=int(numbOfStrips.doubles()[0]);
113  }
114  }
115 #ifdef LOCAL_DEBUG
116  if (nStrips == 0 )
117  std::cout <<"No strip found!!"<<std::endl;
118 #endif
119 
120  std::vector<double> dpar=fview.logicalPart().solid().parameters();
121  std::string name=fview.logicalPart().name().name();
122  DDTranslation tran = fview.translation();
123  //removed .Inverse after comparing to DT...
124  DDRotationMatrix rota = fview.rotation();//.Inverse();
125  Surface::PositionType pos(tran.x()/cm,tran.y()/cm, tran.z()/cm);
126  // CLHEP way
127 // Surface::RotationType rot(rota.xx(),rota.xy(),rota.xz(),
128 // rota.yx(),rota.yy(),rota.yz(),
129 // rota.zx(),rota.zy(),rota.zz());
130 
131 //ROOT::Math way
132  DD3Vector x, y, z;
133  rota.GetComponents(x,y,z);
134  // doesn't this just re-inverse???
135  Surface::RotationType rot (float(x.X()),float(x.Y()),float(x.Z()),
136  float(y.X()),float(y.Y()),float(y.Z()),
137  float(z.X()),float(z.Y()),float(z.Z()));
138 
139  std::vector<float> pars;
140  RPCRollSpecs* rollspecs= 0;
141  Bounds* bounds = 0;
142 
143 
144 
145  if (dpar.size()==3){
146  float width = dpar[0]/cm;
147  float length = dpar[1]/cm;
148  float thickness = dpar[2]/cm;
149  //RectangularPlaneBounds*
150  bounds =
151  new RectangularPlaneBounds(width,length,thickness);
152  pars.push_back(width);
153  pars.push_back(length);
154  pars.push_back(numbOfStrips.doubles()[0]); //h/2;
155 
156  if (!theComp11Flag) {
157  //Correction of the orientation to get the REAL geometry.
158  //Change of axes for the +z part only.
159  //Including the 0 whell
160  if (tran.z() >-1500. ){
161  Basic3DVector<float> newX(-1.,0.,0.);
162  Basic3DVector<float> newY(0.,-1.,0.);
163  Basic3DVector<float> newZ(0.,0.,1.);
164  rot.rotateAxes (newX, newY,newZ);
165  }
166  }
167 
168  rollspecs = new RPCRollSpecs(GeomDetEnumerators::RPCBarrel,name,pars);
169 #ifdef LOCAL_DEBUG
170  std::cout <<"Barrel "<<name
171  <<" par "<<width
172  <<" "<<length<<" "<<thickness;
173 #endif
174  }else{
175  float be = dpar[4]/cm;
176  float te = dpar[8]/cm;
177  float ap = dpar[0]/cm;
178  float ti = 0.4/cm;
179  // TrapezoidalPlaneBounds*
180  bounds =
181  new TrapezoidalPlaneBounds(be,te,ap,ti);
182  pars.push_back(dpar[4]/cm); //b/2;
183  pars.push_back(dpar[8]/cm); //B/2;
184  pars.push_back(dpar[0]/cm); //h/2;
185  pars.push_back(numbOfStrips.doubles()[0]); //h/2;
186 
187 #ifdef LOCAL_DEBUG
188  std::cout <<"Forward "<<name
189  <<" par "<<dpar[4]/cm
190  <<" "<<dpar[8]/cm<<" "<<dpar[3]/cm<<" "
191  <<dpar[0];
192 #endif
193 
194  rollspecs = new RPCRollSpecs(GeomDetEnumerators::RPCEndcap,name,pars);
195 
196  //Change of axes for the forward
197  Basic3DVector<float> newX(1.,0.,0.);
198  Basic3DVector<float> newY(0.,0.,1.);
199  // if (tran.z() > 0. )
200  newY *= -1;
201  Basic3DVector<float> newZ(0.,1.,0.);
202  rot.rotateAxes (newX, newY,newZ);
203 
204  }
205 #ifdef LOCAL_DEBUG
206  std::cout <<" Number of strips "<<nStrips<<std::endl;
207 #endif
208 
209 
210 
211  BoundPlane* bp = new BoundPlane(pos,rot,bounds);
213  RPCRoll* r=new RPCRoll(rpcid,surf,rollspecs);
214  geometry->add(r);
215 
216 
217  std::list<RPCRoll *> rls;
218  if (chids.find(chid)!=chids.end()){
219  rls = chids[chid];
220  }
221  rls.push_back(r);
222  chids[chid]=rls;
223 
224  doSubDets = fview.nextSibling(); // go to next layer
225  }
226  // Create the RPCChambers and store them on the Geometry
227  for( std::map<RPCDetId, std::list<RPCRoll *> >::iterator ich=chids.begin();
228  ich != chids.end(); ich++){
229  RPCDetId chid = ich->first;
230  std::list<RPCRoll * > rls = ich->second;
231 
232  // compute the overall boundplane. At the moment we use just the last
233  // surface
234  BoundPlane* bp=0;
235  for(std::list<RPCRoll *>::iterator rl=rls.begin();
236  rl!=rls.end(); rl++){
237  const BoundPlane& bps = (*rl)->surface();
238  bp = const_cast<BoundPlane *>(&bps);
239  }
240 
242  // Create the chamber
243  RPCChamber* ch = new RPCChamber (chid, surf);
244  // Add the rolls to rhe chamber
245  for(std::list<RPCRoll *>::iterator rl=rls.begin();
246  rl!=rls.end(); rl++){
247  ch->add(*rl);
248  }
249  // Add the chamber to the geometry
250  geometry->add(ch);
251  }
252  return geometry;
253 }
const std::vector< double > & parameters() const
Don&#39;t use (only meant to be used by DDbox(), DDtub(), ...)
Definition: DDSolid.cc:153
void add(RPCRoll *rl)
Add Roll to the chamber which takes ownership.
Definition: RPCChamber.cc:50
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:88
bool nextSibling()
set the current node to the next sibling ...
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:102
void add(RPCRoll *roll)
Add a RPC roll to the Geometry.
Definition: RPCGeometry.cc:76
dictionary map
Definition: Association.py:160
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Definition: DDAxes.h:10
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
std::map< RPCDetId, std::list< RPCRoll * > > chids
ESHandle< TrackerGeometry > geometry
const DDSolid & solid() const
Returns a reference object of the solid being the shape of this LogicalPart.
bool firstChild()
set the current node to the first child ...
tuple cout
Definition: gather_cfg.py:41
Definition: Bounds.h:18
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< const DDsvalues_type * > specifics() const
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:87

Member Data Documentation

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

Definition at line 36 of file RPCGeometryBuilderFromDDD.h.

Referenced by buildGeometry().

bool RPCGeometryBuilderFromDDD::theComp11Flag
private

Definition at line 38 of file RPCGeometryBuilderFromDDD.h.

Referenced by buildGeometry().