CMS 3D CMS Logo

DTGeometryBuilderFromDDD.cc
Go to the documentation of this file.
1 
10 
21 #include <string>
22 
23 using namespace std;
24 using namespace geant_units;
25 using namespace geant_units::operators;
26 
27 #include <string>
28 #include <utility>
29 
30 using namespace std;
31 
33 
35 
37  const DDCompactView* cview,
38  const MuonGeometryConstants& muonConstants) {
39  // cout << "DTGeometryBuilderFromDDD::build" << endl;
40  // static const string t0 = "DTGeometryBuilderFromDDD::build";
41  // TimeMe timer(t0,true);
42 
43  std::string attribute = "MuStructure";
44  std::string value = "MuonBarrelDT";
45 
46  // Asking only for the Muon DTs
48 
49  DDFilteredView fview(*cview, filter);
50  buildGeometry(theGeometry, fview, muonConstants);
51 }
52 
54  DDFilteredView& fv,
55  const MuonGeometryConstants& muonConstants) const {
56  edm::LogVerbatim("DTGeometryBuilder") << "(0) DTGeometryBuilder - DDD ";
57 
58  bool doChamber = fv.firstChild();
59 
60  // Loop on chambers
61  int ChamCounter = 0;
62  while (doChamber) {
63  ChamCounter++;
64  DDValue val("Type");
66  string type;
67  if (DDfetch(&params, val))
68  type = val.strings()[0];
69  // FIXME
70  val = DDValue("FEPos");
71  string FEPos;
72  if (DDfetch(&params, val))
73  FEPos = val.strings()[0];
74  DTChamber* chamber = buildChamber(fv, type, muonConstants);
75 
76  // Loop on SLs
77  bool doSL = fv.firstChild();
78  int SLCounter = 0;
79  while (doSL) {
80  SLCounter++;
81  DTSuperLayer* sl = buildSuperLayer(fv, chamber, type, muonConstants);
82  theGeometry.add(sl);
83 
84  bool doL = fv.firstChild();
85  int LCounter = 0;
86  // Loop on SLs
87  while (doL) {
88  LCounter++;
89  DTLayer* layer = buildLayer(fv, sl, type, muonConstants);
90  theGeometry.add(layer);
91 
92  fv.parent();
93  doL = fv.nextSibling(); // go to next layer
94  } // layers
95 
96  fv.parent();
97  doSL = fv.nextSibling(); // go to next SL
98  } // sls
99  theGeometry.add(chamber);
100 
101  fv.parent();
102  doChamber = fv.nextSibling(); // go to next chamber
103  } // chambers
104 }
105 
107  const string& type,
108  const MuonGeometryConstants& muonConstants) const {
109  MuonGeometryNumbering mdddnum(muonConstants);
110  DTNumberingScheme dtnum(muonConstants);
111  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
112  DTChamberId detId(rawid);
113 
114  // Chamber specific parameter (size)
115  // FIXME: some trouble for boolean solids?
116  vector<double> par = extractParameters(fv);
117 
119  // width is along local X. r-phi dimension - different in different chambers
120  // length is along local Y. z dimension - constant 125.55 cm
121  // thickness is long local Z. radial thickness - almost constant about 18 cm
122 
123  edm::LogVerbatim("DTGeometryBuilder") << "(1) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
124  << " par[2]: " << par[2];
125 
126  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
127 
128  DTChamber* chamber = new DTChamber(detId, surf);
129 
130  return chamber;
131 }
132 
135  const std::string& type,
136  const MuonGeometryConstants& muonConstants) const {
137  MuonGeometryNumbering mdddnum(muonConstants);
138  DTNumberingScheme dtnum(muonConstants);
139  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
140  DTSuperLayerId slId(rawid);
141 
142  // Slayer specific parameter (size)
143  vector<double> par = extractParameters(fv);
144 
145  edm::LogVerbatim("DTGeometryBuilder") << "(2) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
146  << " par[2]: " << par[2];
147 
148  // r-phi dimension - different in different chambers
149  // z dimension - constant 126.8 cm
150  // radial thickness - almost constant about 20 cm
151 
152  // Ok this is the s-layer position...
153  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
154 
155  DTSuperLayer* slayer = new DTSuperLayer(slId, surf, chamber);
156 
157  //LocalPoint lpos(10,20,30);
158  //GlobalPoint gpos=slayer->toGlobal(lpos);
159 
160  // add to the chamber
161  chamber->add(slayer);
162  return slayer;
163 }
164 
166  DTSuperLayer* sl,
167  const std::string& type,
168  const MuonGeometryConstants& muonConstants) const {
169  MuonGeometryNumbering mdddnum(muonConstants);
170  DTNumberingScheme dtnum(muonConstants);
171  int rawid = dtnum.getDetId(mdddnum.geoHistoryToBaseNumber(fv.geoHistory()));
172  DTLayerId layId(rawid);
173 
174  // Layer specific parameter (size)
175  vector<double> par = extractParameters(fv);
176  // width -- r-phi dimension - different in different chambers
177  // length -- z dimension - constant 126.8 cm
178  // thickness -- radial thickness - almost constant about 20 cm
179 
180  RCPPlane surf(plane(fv, dtGeometryBuilder::getRecPlaneBounds(par.begin())));
181 
182  edm::LogVerbatim("DTGeometryBuilder") << "(3) detId: " << rawid << " par[0]: " << par[0] << " par[1]: " << par[1]
183  << " par[2]: " << par[2];
184 
185  // Loop on wires
186  bool doWire = fv.firstChild();
187  int WCounter = 0;
188  int firstWire = fv.copyno();
189  par = extractParameters(fv);
190  float wireLength = convertMmToCm(par[1]);
191 
192  edm::LogVerbatim("DTGeometryBuilder") << "(4) detId: " << rawid
193  << " wireLenght in ddd, wpar[1] in dd4hep: " << wireLength
194  << " firstWire: " << firstWire;
195 
196  while (doWire) {
197  WCounter++;
198  doWire = fv.nextSibling(); // next wire
199  }
200  //int lastWire=fv.copyno();
201  DTTopology topology(firstWire, WCounter, wireLength);
202 
203  DTLayerType layerType;
204 
205  DTLayer* layer = new DTLayer(layId, surf, topology, layerType, sl);
206 
207  sl->add(layer);
208  return layer;
209 }
210 
212  vector<double> par;
213  if (fv.logicalPart().solid().shape() != DDSolidShape::ddbox) {
215  DDSolid A = bs.solidA();
216  while (A.shape() != DDSolidShape::ddbox) {
218  A = bs.solidA();
219  }
220  par = A.parameters();
221  } else {
222  par = fv.logicalPart().solid().parameters();
223  }
224  return par;
225 }
226 
228  // extract the position
229  const DDTranslation& trans(fv.translation());
230 
231  const Surface::PositionType posResult(
232  float(convertMmToCm(trans.x())), float(convertMmToCm(trans.y())), float(convertMmToCm(trans.z())));
233  LogTrace("DTGeometryBuilderFromDDD") << "DTGeometryBuilderFromDDD::plane "
234  << " posResult: " << posResult << std::endl;
235  // now the rotation
236  // 'active' and 'passive' rotations are inverse to each other
237  const DDRotationMatrix& rotation = fv.rotation(); //REMOVED .Inverse();
238  DD3Vector x, y, z;
239  rotation.GetComponents(x, y, z);
240  // std::cout << "INVERSE rotation by its own operator: "<< fv.rotation() << std::endl;
241  // std::cout << "INVERSE rotation manually: "
242  // << x.X() << ", " << x.Y() << ", " << x.Z() << std::endl
243  // << y.X() << ", " << y.Y() << ", " << y.Z() << std::endl
244  // << z.X() << ", " << z.Y() << ", " << z.Z() << std::endl;
245 
246  Surface::RotationType rotResult(float(x.X()),
247  float(x.Y()),
248  float(x.Z()),
249  float(y.X()),
250  float(y.Y()),
251  float(y.Z()),
252  float(z.X()),
253  float(z.Y()),
254  float(z.Z()));
255 
256  // std::cout << "rotation by its own operator: "<< tmp << std::endl;
257  // DD3Vector tx, ty,tz;
258  // tmp.GetComponents(tx, ty, tz);
259  // std::cout << "rotation manually: "
260  // << tx.X() << ", " << tx.Y() << ", " << tx.Z() << std::endl
261  // << ty.X() << ", " << ty.Y() << ", " << ty.Z() << std::endl
262  // << tz.X() << ", " << tz.Y() << ", " << tz.Z() << std::endl;
263 
264  return RCPPlane(new Plane(posResult, rotResult, bounds));
265 }
DTGeometry
Definition: DTGeometry.h:28
TkRotation< float >
DTSuperLayerId
Definition: DTSuperLayerId.h:12
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
MuonGeometryNumbering::geoHistoryToBaseNumber
MuonBaseNumber geoHistoryToBaseNumber(const DDGeoHistory &history) const
Definition: MuonGeometryNumbering.cc:38
dtGeometryBuilder::getRecPlaneBounds
RectangularPlaneBounds * getRecPlaneBounds(const std::vector< double >::const_iterator &shapeStart)
Definition: DTGeometryBuilderFromCondDB.cc:80
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
DTChamber
Definition: DTChamber.h:24
Bounds
Definition: Bounds.h:18
MuonGeometryNumbering.h
ReferenceCountingPointer< Plane >
DTSuperLayer
Definition: DTSuperLayer.h:24
geant_units::operators
Definition: GeantUnits.h:18
DDFilteredView::parent
bool parent()
set the current node to the parent node ...
Definition: DDFilteredView.cc:161
DTGeometryBuilderFromDDD::plane
RCPPlane plane(const DDFilteredView &fv, Bounds *bounds) const
Definition: DTGeometryBuilderFromDDD.cc:227
DTNumberingScheme::getDetId
int getDetId(const MuonBaseNumber &num) const
Definition: DTNumberingScheme.cc:74
DTTopology
Definition: DTTopology.h:28
DDBooleanSolid
Definition: DDSolid.h:184
DTGeometryBuilderFromDDD.h
DDSolid::shape
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:123
cms::cuda::bs
bs
Definition: HistoContainer.h:76
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
DDFilteredView.h
DDTranslation
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DTGeometryBuilderFromDDD::build
void build(DTGeometry &theGeometry, const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
Definition: DTGeometryBuilderFromDDD.cc:36
RectangularPlaneBounds.h
DDSolid.h
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
Point3DBase< float, GlobalTag >
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
DTChamberId.h
DTLayerId
Definition: DTLayerId.h:12
DTLayer.h
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
DTSuperLayer::add
void add(DTLayer *l)
Add layer to the SL which owns it.
Definition: DTSuperLayer.cc:47
DTGeometry.h
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: PGeometricDetBuilder.cc:20
DTGeometryBuilderFromDDD::buildSuperLayer
DTSuperLayer * buildSuperLayer(DDFilteredView &fv, DTChamber *chamber, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the SL
Definition: DTGeometryBuilderFromDDD.cc:133
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
DTGeometryBuilderFromDDD::buildLayer
DTLayer * buildLayer(DDFilteredView &fv, DTSuperLayer *sl, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the layer
Definition: DTGeometryBuilderFromDDD.cc:165
GeantUnits.h
DTGeometry::add
void add(DTChamber *ch)
Add a DTChamber to Geometry.
Definition: DTGeometry.cc:42
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
MuonBaseNumber.h
DDFilter.h
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
DTNumberingScheme.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTLayer
Definition: DTLayer.h:25
heppy_batch.val
val
Definition: heppy_batch.py:351
std
Definition: JetResolutionObject.h:76
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
DDSolidShape::ddbox
DTGeometryBuilderFromDDD::buildChamber
DTChamber * buildChamber(DDFilteredView &fv, const std::string &type, const MuonGeometryConstants &muonConstants) const
create the chamber
Definition: DTGeometryBuilderFromDDD.cc:106
DDValue
Definition: DDValue.h:22
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
DDFilteredView::translation
const DDTranslation & translation() const
The absolute translation of the current node.
Definition: DDFilteredView.cc:26
DTLayerType
Definition: DTLayerType.h:15
Plane
Definition: Plane.h:16
DTGeometryBuilderFromDDD::~DTGeometryBuilderFromDDD
virtual ~DTGeometryBuilderFromDDD()
Destructor.
Definition: DTGeometryBuilderFromDDD.cc:34
DTGeometryBuilderFromDDD::buildGeometry
void buildGeometry(DTGeometry &theGeometry, DDFilteredView &fv, const MuonGeometryConstants &muonConstants) const
Definition: DTGeometryBuilderFromDDD.cc:53
DDSolid::parameters
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:125
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
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:63
DTChamber.h
geant_units
Definition: GeantUnits.h:11
DTChamberId
Definition: DTChamberId.h:14
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
DTGeometryBuilderFromDDD::extractParameters
std::vector< double > extractParameters(DDFilteredView &fv) const
get parameter also for boolean solid.
Definition: DTGeometryBuilderFromDDD.cc:211
DTGeometryBuilderFromDDD::DTGeometryBuilderFromDDD
DTGeometryBuilderFromDDD()
Constructor.
Definition: DTGeometryBuilderFromDDD.cc:32
DDsvalues_type
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
A
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