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
GEMGeometryParsFromDD Class Reference

#include <GEMGeometryParsFromDD.h>

Public Member Functions

void build (const DDCompactView *cview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)
 
 GEMGeometryParsFromDD ()
 
 ~GEMGeometryParsFromDD ()
 

Private Member Functions

void buildGeometry (DDFilteredView &fview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)
 

Detailed Description

Build the GEMGeometry ftom the DDD description

Author
M. Maggi - INFN Bari

Definition at line 19 of file GEMGeometryParsFromDD.h.

Constructor & Destructor Documentation

GEMGeometryParsFromDD::GEMGeometryParsFromDD ( )

Implementation of the GEM Geometry Builder from DDD

Author
M. Maggi - INFN Bari

Definition at line 24 of file GEMGeometryParsFromDD.cc.

25 { }
GEMGeometryParsFromDD::~GEMGeometryParsFromDD ( )

Definition at line 27 of file GEMGeometryParsFromDD.cc.

28 { }

Member Function Documentation

void GEMGeometryParsFromDD::build ( const DDCompactView cview,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rgeo 
)

Definition at line 31 of file GEMGeometryParsFromDD.cc.

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

Referenced by GEMRecoIdealDBLoader::beginRun().

33 {
34  std::string attribute = "ReadOutName"; // could come from .orcarc
35  std::string value = "MuonGEMHits"; // could come from .orcarc
36  DDValue val(attribute, value, 0.0);
37 
38  // Asking only for the MuonGEM's
40  filter.setCriteria(val, // name & value of a variable
42  DDLogOp::AND,
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 }
void buildGeometry(DDFilteredView &fview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rgeo)
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:245
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32
void GEMGeometryParsFromDD::buildGeometry ( DDFilteredView fview,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rgeo 
)
private

Definition at line 53 of file GEMGeometryParsFromDD.cc.

References GEMNumberingScheme::baseNumberToUnitNumber(), DDfetch(), cond::rpcobgas::detid, DDValue::doubles(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), RecoIdealGeometry::insert(), LogDebug, DDFilteredView::logicalPart(), DDName::name(), mergeVDriftHistosByStation::name, DDBase< N, C >::name(), DDFilteredView::nextSibling(), DDSolid::parameters(), DetId::rawId(), DDFilteredView::rotation(), DDLogicalPart::solid(), DDFilteredView::specifics(), AlCaHLTBitMon_QueryRunRegistry::string, DDFilteredView::translation(), x, y, and z.

Referenced by build().

54 {
55 
56  bool doSubDets = fview.firstChild();
57 
58  while (doSubDets){
59 
60  // Get the Base Muon Number
61  MuonDDDNumbering mdddnum(muonConstants);
62  MuonBaseNumber mbn = mdddnum.geoHistoryToBaseNumber(fview.geoHistory());
63 
64  // Get the The GEM det Id
65  GEMNumberingScheme gemnum(muonConstants);
66  int detid = 0;
67 
68  detid = gemnum.baseNumberToUnitNumber(mbn);
69  GEMDetId gemid(detid);
70 
71  DDValue numbOfStrips("nStrips");
72  DDValue numbOfPads("nPads");
73 
74  std::vector<const DDsvalues_type* > specs(fview.specifics());
75  std::vector<const DDsvalues_type* >::iterator is = specs.begin();
76  double nStrips = 0., nPads = 0.;
77  for (;is!=specs.end(); is++)
78  {
79  if (DDfetch( *is, numbOfStrips)) nStrips = numbOfStrips.doubles()[0];
80  if (DDfetch( *is, numbOfPads)) nPads = numbOfPads.doubles()[0];
81  }
82  LogDebug("GEMGeometryBuilderFromDDD") << ((nStrips == 0. ) ? ("No nStrips found!!") : (""));
83  LogDebug("GEMGeometryBuilderFromDDD") << ((nPads == 0. ) ? ("No nPads found!!") : (""));
84  //std::cout <<"# strips, pads: "<< nStrips<<", "<<nPads<<std::endl;
85 
86  std::vector<double> dpar = fview.logicalPart().solid().parameters();
87 
88  std::vector<std::string> strpars;
89  std::string name = fview.logicalPart().name().name();
90  strpars.push_back(name);
91  DDTranslation tran = fview.translation();
92 
93  DDRotationMatrix rota = fview.rotation();//.Inverse();
94  DD3Vector x, y, z;
95  rota.GetComponents(x,y,z);
96  std::vector<double> pars;
97  pars.push_back(dpar[4]); //b/2;
98  pars.push_back(dpar[8]); //B/2;
99  pars.push_back(dpar[0]); //h/2;
100  pars.push_back(0.4); // XXX: what is that? hardcoded thickness?
101  pars.push_back(nStrips);
102  pars.push_back(nPads);
103 
104  std::vector<double> vtra(3);
105  std::vector<double> vrot(9);
106  vtra[0]=(float) 1.0 * (tran.x());
107  vtra[1]=(float) 1.0 * (tran.y());
108  vtra[2]=(float) 1.0 * (tran.z());
109  vrot[0]=(float) 1.0 * x.X();
110  vrot[1]=(float) 1.0 * x.Y();
111  vrot[2]=(float) 1.0 * x.Z();
112  vrot[3]=(float) 1.0 * y.X();
113  vrot[4]=(float) 1.0 * y.Y();
114  vrot[5]=(float) 1.0 * y.Z();
115  vrot[6]=(float) 1.0 * z.X();
116  vrot[7]=(float) 1.0 * z.Y();
117  vrot[8]=(float) 1.0 * z.Z();
118  rgeo.insert(gemid.rawId(), vtra, vrot, pars, strpars);
119  doSubDets = fview.nextSibling(); // go to next layer
120  }
121 
122 }
#define LogDebug(id)
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:78
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.
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
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 ...
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