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 29 of file DTGeometryParsFromDD.cc.

29 {}
DTGeometryParsFromDD::~DTGeometryParsFromDD ( )
virtual

Destructor.

Definition at line 31 of file DTGeometryParsFromDD.cc.

31 {}

Member Function Documentation

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

Definition at line 34 of file DTGeometryParsFromDD.cc.

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

Referenced by DTRecoIdealDBLoader::beginRun().

36  {
37  // cout << "DTGeometryParsFromDD::build" << endl;
38  // static const string t0 = "DTGeometryParsFromDD::build";
39  // TimeMe timer(t0,true);
40 
41  std::string attribute = "MuStructure";
42  std::string value = "MuonBarrelDT";
43 
44  // Asking only for the Muon DTs
45  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0.0)};
46  DDFilteredView fview(*cview,filter);
47  buildGeometry(fview, muonConstants, rig);
48  //cout << "RecoIdealGeometry " << rig.size() << endl;
49 }
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 52 of file DTGeometryParsFromDD.cc.

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

54  {
55  // static const string t0 = "DTGeometryParsFromDD::buildGeometry";
56  // TimeMe timer(t0,true);
57 
58  bool doChamber = fv.firstChild();
59 
60  // Loop on chambers
61  int ChamCounter=0;
62  while (doChamber){
63  ChamCounter++;
64  DDValue val("Type");
65  const DDsvalues_type params(fv.mergedSpecifics());
66  string type;
67  if (DDfetch(&params,val)) type = val.strings()[0];
68  // FIXME
69  val=DDValue("FEPos");
70  string FEPos;
71  if (DDfetch(&params,val)) FEPos = val.strings()[0];
72  insertChamber(fv,type, muonConstants,rig);
73 
74  // Loop on SLs
75  bool doSL = fv.firstChild();
76  int SLCounter=0;
77  while (doSL) {
78  SLCounter++;
79  insertSuperLayer(fv, type, muonConstants,rig);
80 
81  bool doL = fv.firstChild();
82  int LCounter=0;
83  // Loop on SLs
84  while (doL) {
85  LCounter++;
86  insertLayer(fv, type, muonConstants, rig);
87 
88  // fv.parent();
89  doL = fv.nextSibling(); // go to next layer
90  } // layers
91 
92  fv.parent();
93  doSL = fv.nextSibling(); // go to next SL
94  } // sls
95 
96  fv.parent();
97  doChamber = fv.nextSibling(); // go to next chamber
98  } // chambers
99 }
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
DDsvalues_type mergedSpecifics() const
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
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 190 of file DTGeometryParsFromDD.cc.

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

190  {
191  vector<double> par;
192  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
193  DDBooleanSolid bs(fv.logicalPart().solid());
194  DDSolid A = bs.solidA();
195  while (A.shape() != DDSolidShape::ddbox) {
196  DDBooleanSolid bs(A);
197  A = bs.solidA();
198  }
199  par=A.parameters();
200  } else {
201  par = fv.logicalPart().solid().parameters();
202  }
203  return par;
204 }
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:144
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:39
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:138
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 101 of file DTGeometryParsFromDD.cc.

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

104  {
105  MuonDDDNumbering mdddnum (muonConstants);
106  DTNumberingScheme dtnum (muonConstants);
107  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
108  DTChamberId detId(rawid);
109  //cout << "inserting Chamber " << detId << endl;
110 
111  // Chamber specific parameter (size)
112  vector<double> par;
113  par.emplace_back(DTChamberTag);
114  vector<double> size= extractParameters(fv);
115  par.insert(par.end(), size.begin(), size.end());
116 
118  // width is along local X
119  // length is along local Y
120  // thickness is long local Z
121 
122  PosRotPair posRot(plane(fv));
123 
124  rig.insert(rawid, posRot.first, posRot.second, par);
125 }
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 150 of file DTGeometryParsFromDD.cc.

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

153  {
154 
155  MuonDDDNumbering mdddnum(muonConstants);
156  DTNumberingScheme dtnum(muonConstants);
157  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
158  DTLayerId layId(rawid);
159  //cout << "inserting Layer " << layId << endl;
160 
161  // Layer specific parameter (size)
162  vector<double> par;
163  par.emplace_back(DTLayerTag);
164  vector<double> size= extractParameters(fv);
165  par.insert(par.end(), size.begin(), size.end());
166 
167  // Loop on wires
168  bool doWire = fv.firstChild();
169  int WCounter=0;
170  int firstWire=fv.copyno();
171  //float wireLength = par[1]/cm;
172  while (doWire) {
173  WCounter++;
174  doWire = fv.nextSibling(); // next wire
175  }
176  vector<double> sensSize= extractParameters(fv);
177  //int lastWire=fv.copyno();
178  par.emplace_back(firstWire);
179  par.emplace_back(WCounter);
180  par.emplace_back(sensSize[1]);
181  fv.parent();
182 
183  PosRotPair posRot(plane(fv));
184 
185  rig.insert(layId, posRot.first, posRot.second, par);
186 
187 }
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 127 of file DTGeometryParsFromDD.cc.

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

130  {
131 
132  MuonDDDNumbering mdddnum(muonConstants);
133  DTNumberingScheme dtnum(muonConstants);
134  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
135  DTSuperLayerId slId(rawid);
136  //cout << "inserting SuperLayer " << slId << endl;
137 
138  // Slayer specific parameter (size)
139  vector<double> par;
140  par.emplace_back(DTSuperLayerTag);
141  vector<double> size= extractParameters(fv);
142  par.insert(par.end(), size.begin(), size.end());
143 
144  // Ok this is the slayer position...
145  PosRotPair posRot(plane(fv));
146 
147  rig.insert(slId, posRot.first, posRot.second, par);
148 }
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 207 of file DTGeometryParsFromDD.cc.

References geant_units::operators::convertMmToCm(), idealTransformation::rotation, DDFilteredView::rotation(), and DDFilteredView::translation().

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