CMS 3D CMS Logo

RPCGeometryParsFromDD.cc
Go to the documentation of this file.
1 
8 
13 
17 
19 
20 #include "CLHEP/Units/GlobalSystemOfUnits.h"
21 
22 #include <iostream>
23 #include <algorithm>
24 
26 { }
27 
29 { }
30 
32  const MuonDDDConstants& muonConstants, RecoIdealGeometry& rgeo )
33 {
34  const std::string attribute = "ReadOutName";
35  const std::string value = "MuonRPCHits";
36 
37  // Asking only for the MuonRPC's
38  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
39  DDFilteredView fview(*cview,filter);
40 
41  this->buildGeometry(fview, muonConstants, rgeo);
42 }
43 
45  const MuonDDDConstants& muonConstants, RecoIdealGeometry& rgeo)
46 {
47  for ( bool doSubDets = fview.firstChild(); doSubDets==true; doSubDets = fview.nextSibling() ) {
48 
49  // Get the Base Muon Number
50  MuonDDDNumbering mdddnum(muonConstants);
52 
53  // Get the The Rpc det Id
54  RPCNumberingScheme rpcnum(muonConstants);
55  const int detid = rpcnum.baseNumberToUnitNumber(mbn);
56  RPCDetId rpcid(detid);
57 
58  DDValue numbOfStrips("nStrips");
59 
60  std::vector<const DDsvalues_type* > specs(fview.specifics());
61  int nStrips=0;
62  for (auto & spec : specs){
63  if (DDfetch( spec, numbOfStrips)){
64  nStrips=int(numbOfStrips.doubles()[0]);
65  }
66  }
67  if (nStrips == 0 ) std::cout <<"No strip found!!"<<std::endl;
68 
69  const std::vector<double> dpar = fview.logicalPart().solid().parameters();
70 
71  const std::string name=fview.logicalPart().name().name();
72  const std::vector<std::string> strpars = {name};
73  const DDTranslation& tran = fview.translation();
74 
75  const DDRotationMatrix& rota = fview.rotation();//.Inverse();
76  DD3Vector x, y, z;
77  rota.GetComponents(x,y,z);
78  std::vector<double> pars;
79  if (dpar.size()==3){
80  const double width = dpar[0];
81  const double length = dpar[1];
82  const double thickness = dpar[2];
83  pars = {width, length, thickness, numbOfStrips.doubles()[0]};
84  }
85  else{
86  pars = {
87  dpar[4] /*b/2*/, dpar[8] /*B/2*/, dpar[0] /*h/2*/,
88  0.4,
89  numbOfStrips.doubles()[0] /*h/2*/
90  };
91  }
92 
93  const std::vector<double> vtra = {tran.x(), tran.y(), tran.z()};
94  const std::vector<double> vrot = {x.X(), x.Y(), x.Z(),
95  y.X(), y.Y(), y.Z(),
96  z.X(), z.Y(), z.Z()};
97  rgeo.insert(rpcid.rawId(),vtra,vrot, pars,strpars);
98  }
99 
100 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
void build(const DDCompactView *cview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const std::vector< double > & doubles() const
a reference to the double-valued values stored in the given instance of DDValue
Definition: DDValue.cc:140
const N & name() const
Definition: DDBase.h:78
int baseNumberToUnitNumber(const MuonBaseNumber &) override
void buildGeometry(DDFilteredView &fview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)
bool nextSibling()
set the current node to the next sibling ...
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
type of data representation of DDCompactView
Definition: DDCompactView.h:90
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:81
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
Definition: value.py:1
bool firstChild()
set the current node to the first child ...
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< const DDsvalues_type * > specifics() const
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history)
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::string & name() const
Returns the name.
Definition: DDName.cc:90