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(), alcazmumu_cfi::filter, DDSpecificsFilter::matches, DDSpecificsFilter::setCriteria(), AlCaHLTBitMon_QueryRunRegistry::string, 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)
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, DDfetch(), cond::rpcobgas::detid, DDValue::doubles(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), geometry, RPCDetId::layer(), LogDebug, DDFilteredView::logicalPart(), python.multivaluedict::map(), DDName::name(), mergeVDriftHistosByStation::name, DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDSolid::parameters(), alignCSCRings::r, RPCDetId::region(), RPCDetId::ring(), makeMuonMisalignmentScenario::rot, TkRotation< T >::rotateAxes(), DDFilteredView::rotation(), GeomDetEnumerators::RPCBarrel, GeomDetEnumerators::RPCEndcap, RPCDetId::sector(), DDLogicalPart::solid(), DDFilteredView::specifics(), RPCDetId::station(), AlCaHLTBitMon_QueryRunRegistry::string, RPCDetId::subsector(), theComp11Flag, DDFilteredView::translation(), create_public_lumi_plots::width, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

Referenced by build().

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