CMS 3D CMS Logo

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