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 MuonGeometryConstants &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 MuonGeometryConstants &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 MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig) const
 create the chamber More...
 
void insertLayer (DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig) const
 create the layer More...
 
void insertSuperLayer (DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &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

◆ PosRotPair

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

Definition at line 59 of file DTGeometryParsFromDD.h.

Member Enumeration Documentation

◆ DTDetTag

Enumerator
DTChamberTag 
DTSuperLayerTag 
DTLayerTag 

Definition at line 35 of file DTGeometryParsFromDD.h.

Constructor & Destructor Documentation

◆ DTGeometryParsFromDD()

DTGeometryParsFromDD::DTGeometryParsFromDD ( )

Constructor.

Definition at line 29 of file DTGeometryParsFromDD.cc.

29 {}

◆ ~DTGeometryParsFromDD()

DTGeometryParsFromDD::~DTGeometryParsFromDD ( )
virtual

Destructor.

Definition at line 31 of file DTGeometryParsFromDD.cc.

31 {}

Member Function Documentation

◆ build()

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

Definition at line 33 of file DTGeometryParsFromDD.cc.

35  {
36  // cout << "DTGeometryParsFromDD::build" << endl;
37  // static const string t0 = "DTGeometryParsFromDD::build";
38  // TimeMe timer(t0,true);
39 
40  std::string attribute = "MuStructure";
41  std::string value = "MuonBarrelDT";
42 
43  // Asking only for the Muon DTs
45  DDFilteredView fview(*cview, filter);
46  buildGeometry(fview, muonConstants, rig);
47  //cout << "RecoIdealGeometry " << rig.size() << endl;
48 }

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

Referenced by DTRecoIdealDBLoader::beginRun().

◆ buildGeometry()

void DTGeometryParsFromDD::buildGeometry ( DDFilteredView fv,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rig 
) const
private

Definition at line 50 of file DTGeometryParsFromDD.cc.

52  {
53  // static const string t0 = "DTGeometryParsFromDD::buildGeometry";
54  // TimeMe timer(t0,true);
55 
56  bool doChamber = fv.firstChild();
57 
58  // Loop on chambers
59  int ChamCounter = 0;
60  while (doChamber) {
61  ChamCounter++;
62  DDValue val("Type");
64  string type;
65  if (DDfetch(&params, val))
66  type = val.strings()[0];
67  // FIXME
68  val = DDValue("FEPos");
69  string FEPos;
70  if (DDfetch(&params, val))
71  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 }

References DDfetch(), DDFilteredView::firstChild(), DDFilteredView::mergedSpecifics(), DDFilteredView::nextSibling(), CalibrationSummaryClient_cfi::params, DDFilteredView::parent(), and heppy_batch::val.

◆ extractParameters()

vector< double > DTGeometryParsFromDD::extractParameters ( DDFilteredView fv) const
private

get parameter also for boolean solid.

Definition at line 186 of file DTGeometryParsFromDD.cc.

186  {
187  vector<double> par;
188  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
190  DDSolid A = bs.solidA();
191  while (A.shape() != DDSolidShape::ddbox) {
193  A = bs.solidA();
194  }
195  par = A.parameters();
196  } else {
197  par = fv.logicalPart().solid().parameters();
198  }
199  return par;
200 }

References cms::cuda::bs, ddbox, DDFilteredView::logicalPart(), DDSolid::parameters(), DDSolid::shape(), and DDLogicalPart::solid().

◆ insertChamber()

void DTGeometryParsFromDD::insertChamber ( DDFilteredView fv,
const std::string &  type,
const MuonGeometryConstants 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.

104  {
105  MuonGeometryNumbering 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 }

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

◆ insertLayer()

void DTGeometryParsFromDD::insertLayer ( DDFilteredView fv,
const std::string &  type,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rig 
) const
private

create the layer

Definition at line 149 of file DTGeometryParsFromDD.cc.

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

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

◆ insertSuperLayer()

void DTGeometryParsFromDD::insertSuperLayer ( DDFilteredView fv,
const std::string &  type,
const MuonGeometryConstants muonConstants,
RecoIdealGeometry rig 
) const
private

create the SL

Definition at line 127 of file DTGeometryParsFromDD.cc.

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

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

◆ plane()

DTGeometryParsFromDD::PosRotPair DTGeometryParsFromDD::plane ( const DDFilteredView fv) const
private

Definition at line 202 of file DTGeometryParsFromDD.cc.

202  {
203  // extract the position
204  const DDTranslation& trans(fv.translation());
205 
206  std::vector<double> gtran(3);
207  gtran[0] = convertMmToCm(trans.x());
208  gtran[1] = convertMmToCm(trans.y());
209  gtran[2] = convertMmToCm(trans.z());
210 
211  // now the rotation
212  // 'active' and 'passive' rotations are inverse to each other
213  const DDRotationMatrix& rotation = fv.rotation(); //REMOVED .Inverse();
214  DD3Vector x, y, z;
215  rotation.GetComponents(x, y, z);
216  // std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl;
217  // std::cout << "INVERSE rotation manually: "
218  // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
219  // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
220  // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
221 
222  std::vector<double> grmat(9);
223  grmat[0] = x.X();
224  grmat[1] = x.Y();
225  grmat[2] = x.Z();
226 
227  grmat[3] = y.X();
228  grmat[4] = y.Y();
229  grmat[5] = y.Z();
230 
231  grmat[6] = z.X();
232  grmat[7] = z.Y();
233  grmat[8] = z.Z();
234 
235  // std::cout << "rotation by its own operator: "<< tmp << std::endl;
236  // DD3Vector tx, ty,tz;
237  // tmp.GetComponents(tx, ty, tz);
238  // std::cout << "rotation manually: "
239  // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
240  // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
241  // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
242 
243  return pair<std::vector<double>, std::vector<double> >(gtran, grmat);
244 }

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

DTSuperLayerId
Definition: DTSuperLayerId.h:12
DDAxes::y
DTGeometryParsFromDD::insertLayer
void insertLayer(DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig) const
create the layer
Definition: DTGeometryParsFromDD.cc:149
DTGeometryParsFromDD::insertChamber
void insertChamber(DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig) const
create the chamber
Definition: DTGeometryParsFromDD.cc:101
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
DDFilteredView::mergedSpecifics
DDsvalues_type mergedSpecifics() const
Definition: DDFilteredView.cc:42
DDFilteredView::logicalPart
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
Definition: DDFilteredView.cc:16
DTGeometryParsFromDD::DTChamberTag
Definition: DTGeometryParsFromDD.h:35
DDAxes::x
DDFilteredView::parent
bool parent()
set the current node to the parent node ...
Definition: DDFilteredView.cc:161
DDBooleanSolid
Definition: DDSolid.h:173
DDSolid::shape
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
DTGeometryParsFromDD::plane
PosRotPair plane(const DDFilteredView &fv) const
Definition: DTGeometryParsFromDD.cc:202
cms::cuda::bs
bs
Definition: HistoContainer.h:127
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
DTGeometryParsFromDD::buildGeometry
void buildGeometry(DDFilteredView &fv, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig) const
Definition: DTGeometryParsFromDD.cc:50
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDAxes::z
DTGeometryParsFromDD::DTSuperLayerTag
Definition: DTGeometryParsFromDD.h:35
DDFilteredView::nextSibling
bool nextSibling()
set the current node to the next sibling ...
Definition: DDFilteredView.cc:124
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
DTLayerId
Definition: DTLayerId.h:12
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: PGeometricDetBuilder.cc:19
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
DTGeometryParsFromDD::extractParameters
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
Definition: DTGeometryParsFromDD.cc:186
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:39
value
Definition: value.py:1
DDFilteredView::geoHistory
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Definition: DDFilteredView.cc:30
DTGeometryParsFromDD::PosRotPair
std::pair< std::vector< double >, std::vector< double > > PosRotPair
Definition: DTGeometryParsFromDD.h:59
heppy_batch.val
val
Definition: heppy_batch.py:351
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
DDSolidShape::ddbox
DDValue
Definition: DDValue.h:21
DDFilteredView::translation
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:26
DTGeometryParsFromDD::DTLayerTag
Definition: DTGeometryParsFromDD.h:35
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:121
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
DDFilteredView::rotation
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Definition: DDFilteredView.cc:28
MuonGeometryNumbering
Definition: MuonGeometryNumbering.h:24
DDFilteredView
Definition: DDFilteredView.h:20
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
DTGeometryParsFromDD::insertSuperLayer
void insertSuperLayer(DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig) const
create the SL
Definition: DTGeometryParsFromDD.cc:127
DTChamberId
Definition: DTChamberId.h:14
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
A
RecoIdealGeometry::insert
bool insert(DetId id, const std::vector< double > &trans, const std::vector< double > &rot, const std::vector< double > &pars)
Definition: RecoIdealGeometry.h:33
DDLogicalPart::solid
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: DDLogicalPart.cc:120
DDFilteredView::copyno
int copyno() const
Copy number associated with the current node.
Definition: DDFilteredView.cc:48
DTNumberingScheme
Definition: DTNumberingScheme.h:20
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443