test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  DDValue val(attribute, value, 0.0);
37 
38  // Asking only for the MuonRPC's
40  filter.setCriteria(val, // name & value of a variable
43  true, // compare strings otherwise doubles
44  true // use merged-specifics or simple-specifics
45  );
46  DDFilteredView fview(*cview);
47  fview.addFilter(filter);
48 
49  this->buildGeometry(fview, muonConstants, rgeo);
50 }
51 
53  const MuonDDDConstants& muonConstants, RecoIdealGeometry& rgeo)
54 {
55  for ( bool doSubDets = fview.firstChild(); doSubDets==true; doSubDets = fview.nextSibling() ) {
56 
57  // Get the Base Muon Number
58  MuonDDDNumbering mdddnum(muonConstants);
60 
61  // Get the The Rpc det Id
62  RPCNumberingScheme rpcnum(muonConstants);
63  const int detid = rpcnum.baseNumberToUnitNumber(mbn);
64  RPCDetId rpcid(detid);
65 
66  DDValue numbOfStrips("nStrips");
67 
68  std::vector<const DDsvalues_type* > specs(fview.specifics());
69  int nStrips=0;
70  for (auto is=specs.begin();is!=specs.end(); is++){
71  if (DDfetch( *is, numbOfStrips)){
72  nStrips=int(numbOfStrips.doubles()[0]);
73  }
74  }
75  if (nStrips == 0 ) std::cout <<"No strip found!!"<<std::endl;
76 
77  const std::vector<double> dpar = fview.logicalPart().solid().parameters();
78 
79  const std::string name=fview.logicalPart().name().name();
80  const std::vector<std::string> strpars = {name};
81  DDTranslation tran = fview.translation();
82 
83  DDRotationMatrix rota = fview.rotation();//.Inverse();
84  DD3Vector x, y, z;
85  rota.GetComponents(x,y,z);
86  std::vector<double> pars;
87  if (dpar.size()==3){
88  const double width = dpar[0];
89  const double length = dpar[1];
90  const double thickness = dpar[2];
91  pars = {width, length, thickness, numbOfStrips.doubles()[0]};
92  }
93  else{
94  pars = {
95  dpar[4] /*b/2*/, dpar[8] /*B/2*/, dpar[0] /*h/2*/,
96  0.4,
97  numbOfStrips.doubles()[0] /*h/2*/
98  };
99  }
100 
101  const std::vector<double> vtra = {tran.x(), tran.y(), tran.z()};
102  const std::vector<double> vrot = {x.X(), x.Y(), x.Z(),
103  y.X(), y.Y(), y.Z(),
104  z.X(), z.Y(), z.Z()};
105  rgeo.insert(rpcid.rawId(),vtra,vrot, pars,strpars);
106  }
107 
108 }
virtual int baseNumberToUnitNumber(const MuonBaseNumber &)
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:157
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:137
const N & name() const
Definition: DDBase.h:78
void addFilter(const DDFilter &, DDLogOp op=DDLogOp::AND)
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:80
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
bool firstChild()
set the current node to the first child ...
tuple cout
Definition: gather_cfg.py:145
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
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:253
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:33