CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions
DTGeometryParsFromDD Class Reference

#include <DTGeometryParsFromDD.h>

Public Types

enum  DTDetTag { DTChamberTag, DTSuperLayerTag, DTLayerTag }
 

Public Member Functions

void build (const DDCompactView *cview, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig)
 
 DTGeometryParsFromDD ()
 Constructor. More...
 
virtual ~DTGeometryParsFromDD ()
 Destructor. More...
 

Private Types

typedef std::pair< std::vector< double >, std::vector< double > > PosRotPair
 

Private Member Functions

void buildGeometry (DDFilteredView &fv, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig) const
 
std::vector< double > extractParameters (DDFilteredView &fv) const
 get parameter also for boolean solid. More...
 
void insertChamber (DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig) const
 create the chamber More...
 
void insertLayer (DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig) const
 create the layer More...
 
void insertSuperLayer (DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig) const
 create the SL More...
 
PosRotPair plane (const DDFilteredView &fv) const
 

Detailed Description

Build the DTGeometry from the DDD description.

Author
Stefano Lacaprara lacap.nosp@m.rara.nosp@m.@pd.i.nosp@m.nfn..nosp@m.it INFN LNL

Definition at line 24 of file DTGeometryParsFromDD.h.

Member Typedef Documentation

typedef std::pair<std::vector<double>, std::vector<double> > DTGeometryParsFromDD::PosRotPair
private

Definition at line 60 of file DTGeometryParsFromDD.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

DTGeometryParsFromDD::DTGeometryParsFromDD ( )

Constructor.

Definition at line 32 of file DTGeometryParsFromDD.cc.

32 {}
DTGeometryParsFromDD::~DTGeometryParsFromDD ( )
virtual

Destructor.

Definition at line 34 of file DTGeometryParsFromDD.cc.

34 {}

Member Function Documentation

void DTGeometryParsFromDD::build ( const DDCompactView cview,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rig 
)

Definition at line 37 of file DTGeometryParsFromDD.cc.

References ALCARECOTkAlBeamHalo_cff::filter, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DTRecoIdealDBLoader::beginRun().

39  {
40  // cout << "DTGeometryParsFromDD::build" << endl;
41  // static const string t0 = "DTGeometryParsFromDD::build";
42  // TimeMe timer(t0,true);
43 
44  std::string attribute = "MuStructure";
45  std::string value = "MuonBarrelDT";
46 
47  // Asking only for the Muon DTs
48  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
49  DDFilteredView fview(*cview,filter);
50  buildGeometry(fview, muonConstants, rig);
51  //cout << "RecoIdealGeometry " << rig.size() << endl;
52 }
Definition: value.py:1
void buildGeometry(DDFilteredView &fv, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig) const
void DTGeometryParsFromDD::buildGeometry ( DDFilteredView fv,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rig 
) const
private

Definition at line 55 of file DTGeometryParsFromDD.cc.

References DDfetch(), DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), DDFilteredView::nextSibling(), DDFilteredView::parent(), DDValue::strings(), and heppy_batch::val.

57  {
58  // static const string t0 = "DTGeometryParsFromDD::buildGeometry";
59  // TimeMe timer(t0,true);
60 
61  bool doChamber = fv.firstChild();
62 
63  // Loop on chambers
64  int ChamCounter=0;
65  while (doChamber){
66  ChamCounter++;
67  DDValue val("Type");
68  const DDsvalues_type params(fv.mergedSpecifics());
69  string type;
70  if (DDfetch(&params,val)) type = val.strings()[0];
71  // FIXME
72  val=DDValue("FEPos");
73  string FEPos;
74  if (DDfetch(&params,val)) FEPos = val.strings()[0];
75  insertChamber(fv,type, muonConstants,rig);
76 
77  // Loop on SLs
78  bool doSL = fv.firstChild();
79  int SLCounter=0;
80  while (doSL) {
81  SLCounter++;
82  insertSuperLayer(fv, type, muonConstants,rig);
83 
84  bool doL = fv.firstChild();
85  int LCounter=0;
86  // Loop on SLs
87  while (doL) {
88  LCounter++;
89  insertLayer(fv, type, muonConstants, rig);
90 
91  // fv.parent();
92  doL = fv.nextSibling(); // go to next layer
93  } // layers
94 
95  fv.parent();
96  doSL = fv.nextSibling(); // go to next SL
97  } // sls
98 
99  fv.parent();
100  doChamber = fv.nextSibling(); // go to next chamber
101  } // chambers
102 }
type
Definition: HCALResponse.h:21
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
void insertChamber(DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig) const
create the chamber
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
void insertLayer(DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig) const
create the layer
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
DDsvalues_type mergedSpecifics() const
bool firstChild()
set the current node to the first child ...
void insertSuperLayer(DDFilteredView &fv, const std::string &type, const MuonDDDConstants &muonConstants, RecoIdealGeometry &rig) const
create the SL
vector< double > DTGeometryParsFromDD::extractParameters ( DDFilteredView fv) const
private

get parameter also for boolean solid.

Definition at line 193 of file DTGeometryParsFromDD.cc.

References patCaloMETCorrections_cff::A, ddbox, DDFilteredView::logicalPart(), DDSolid::parameters(), DDSolid::shape(), DDLogicalPart::solid(), and DDBooleanSolid::solidA().

193  {
194  vector<double> par;
195  if (fv.logicalPart().solid().shape() != ddbox) {
196  DDBooleanSolid bs(fv.logicalPart().solid());
197  DDSolid A = bs.solidA();
198  while (A.shape() != ddbox) {
199  DDBooleanSolid bs(A);
200  A = bs.solidA();
201  }
202  par=A.parameters();
203  } else {
204  par = fv.logicalPart().solid().parameters();
205  }
206  return par;
207 }
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 DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
void DTGeometryParsFromDD::insertChamber ( DDFilteredView fv,
const std::string &  type,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rig 
) const
private

create the chamber

SL the definition of length, width, thickness depends on the local reference frame of the Det

Definition at line 104 of file DTGeometryParsFromDD.cc.

References DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), RecoIdealGeometry::insert(), and findQualityFiles::size.

107  {
108  MuonDDDNumbering mdddnum (muonConstants);
109  DTNumberingScheme dtnum (muonConstants);
110  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
111  DTChamberId detId(rawid);
112  //cout << "inserting Chamber " << detId << endl;
113 
114  // Chamber specific parameter (size)
115  vector<double> par;
116  par.emplace_back(DTChamberTag);
117  vector<double> size= extractParameters(fv);
118  par.insert(par.end(), size.begin(), size.end());
119 
121  // width is along local X
122  // length is along local Y
123  // thickness is long local Z
124 
125  PosRotPair posRot(plane(fv));
126 
127  rig.insert(rawid, posRot.first, posRot.second, par);
128 }
size
Write out results.
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
std::pair< std::vector< double >, std::vector< double > > PosRotPair
PosRotPair plane(const DDFilteredView &fv) const
void DTGeometryParsFromDD::insertLayer ( DDFilteredView fv,
const std::string &  type,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rig 
) const
private

create the layer

Definition at line 153 of file DTGeometryParsFromDD.cc.

References DDFilteredView::copyno(), DDFilteredView::firstChild(), DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), RecoIdealGeometry::insert(), DDFilteredView::nextSibling(), DDFilteredView::parent(), and findQualityFiles::size.

156  {
157 
158  MuonDDDNumbering mdddnum(muonConstants);
159  DTNumberingScheme dtnum(muonConstants);
160  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
161  DTLayerId layId(rawid);
162  //cout << "inserting Layer " << layId << endl;
163 
164  // Layer specific parameter (size)
165  vector<double> par;
166  par.emplace_back(DTLayerTag);
167  vector<double> size= extractParameters(fv);
168  par.insert(par.end(), size.begin(), size.end());
169 
170  // Loop on wires
171  bool doWire = fv.firstChild();
172  int WCounter=0;
173  int firstWire=fv.copyno();
174  //float wireLength = par[1]/cm;
175  while (doWire) {
176  WCounter++;
177  doWire = fv.nextSibling(); // next wire
178  }
179  vector<double> sensSize= extractParameters(fv);
180  //int lastWire=fv.copyno();
181  par.emplace_back(firstWire);
182  par.emplace_back(WCounter);
183  par.emplace_back(sensSize[1]);
184  fv.parent();
185 
186  PosRotPair posRot(plane(fv));
187 
188  rig.insert(layId, posRot.first, posRot.second, par);
189 
190 }
size
Write out results.
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
int copyno() const
Copy number associated with the current node.
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
std::pair< std::vector< double >, std::vector< double > > PosRotPair
bool firstChild()
set the current node to the first child ...
PosRotPair plane(const DDFilteredView &fv) const
void DTGeometryParsFromDD::insertSuperLayer ( DDFilteredView fv,
const std::string &  type,
const MuonDDDConstants muonConstants,
RecoIdealGeometry rig 
) const
private

create the SL

Definition at line 130 of file DTGeometryParsFromDD.cc.

References DDFilteredView::geoHistory(), MuonDDDNumbering::geoHistoryToBaseNumber(), DTNumberingScheme::getDetId(), RecoIdealGeometry::insert(), and findQualityFiles::size.

133  {
134 
135  MuonDDDNumbering mdddnum(muonConstants);
136  DTNumberingScheme dtnum(muonConstants);
137  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
138  DTSuperLayerId slId(rawid);
139  //cout << "inserting SuperLayer " << slId << endl;
140 
141  // Slayer specific parameter (size)
142  vector<double> par;
143  par.emplace_back(DTSuperLayerTag);
144  vector<double> size= extractParameters(fv);
145  par.insert(par.end(), size.begin(), size.end());
146 
147  // Ok this is the slayer position...
148  PosRotPair posRot(plane(fv));
149 
150  rig.insert(slId, posRot.first, posRot.second, par);
151 }
size
Write out results.
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
std::pair< std::vector< double >, std::vector< double > > PosRotPair
PosRotPair plane(const DDFilteredView &fv) const
DTGeometryParsFromDD::PosRotPair DTGeometryParsFromDD::plane ( const DDFilteredView fv) const
private

Definition at line 210 of file DTGeometryParsFromDD.cc.

References objects.autophobj::float, idealTransformation::rotation, DDFilteredView::rotation(), DDFilteredView::translation(), and x().

210  {
211  // extract the position
212  const DDTranslation & trans(fv.translation());
213 
214  std::vector<double> gtran( 3 );
215  gtran[0] = (float) 1.0 * (trans.x() / cm);
216  gtran[1] = (float) 1.0 * (trans.y() / cm);
217  gtran[2] = (float) 1.0 * (trans.z() / cm);
218 
219  // now the rotation
220  // DDRotationMatrix tmp = fv.rotation();
221  // === DDD uses 'active' rotations - see CLHEP user guide ===
222  // ORCA uses 'passive' rotation.
223  // 'active' and 'passive' rotations are inverse to each other
224  // DDRotationMatrix tmp = fv.rotation();
225  const DDRotationMatrix& rotation = fv.rotation();//REMOVED .Inverse();
226  DD3Vector x, y, z;
227  rotation.GetComponents(x,y,z);
228 // std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl;
229 // std::cout << "INVERSE rotation manually: "
230 // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
231 // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
232 // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
233 
234  std::vector<double> grmat( 9 );
235  grmat[0] = (float) 1.0 * x.X();
236  grmat[1] = (float) 1.0 * x.Y();
237  grmat[2] = (float) 1.0 * x.Z();
238 
239  grmat[3] = (float) 1.0 * y.X();
240  grmat[4] = (float) 1.0 * y.Y();
241  grmat[5] = (float) 1.0 * y.Z();
242 
243  grmat[6] = (float) 1.0 * z.X();
244  grmat[7] = (float) 1.0 * z.Y();
245  grmat[8] = (float) 1.0 * z.Z();
246 
247 // std::cout << "rotation by its own operator: "<< tmp << std::endl;
248 // DD3Vector tx, ty,tz;
249 // tmp.GetComponents(tx, ty, tz);
250 // std::cout << "rotation manually: "
251 // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
252 // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
253 // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
254 
255  return pair<std::vector<double>, std::vector<double> >(gtran, grmat);
256 }
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
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
const DDTranslation & translation() const
The absolute translation of the current node.
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.