CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
DDCoreToDDXMLOutput Class Reference

#include <DDCoreToDDXMLOutput.h>

Public Member Functions

void logicalPart (const DDLogicalPart &lp, std::ostream &xos)
 
void material (const DDMaterial &material, std::ostream &xos)
 
void position (const DDLogicalPart &parent, const DDLogicalPart &child, DDPosData *edgeToChild, int &rotNameSeed, std::ostream &xos)
 
void rotation (const DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
 
void solid (const DDSolid &solid, std::ostream &xos)
 
void specpar (const DDSpecifics &sp, std::ostream &xos)
 
void specpar (const std::pair< DDsvalues_type, std::set< const DDPartSelection * > > &pssv, std::ostream &xos)
 

Public Attributes

std::string ns_
 
double tol_
 

Detailed Description

Author
: Michael Case Initial Version
Version
: 0.0
Date
: 17.10.08

Description: The idea is to store one large XML file containing the XML elements in DDL (Detector Description Language). In doing so, all DDAlgorithms or other code generated DD in-memory components should be reproduced without the need for them to run again if the geometry is read into DDLParser again.

Definition at line 35 of file DDCoreToDDXMLOutput.h.

Member Function Documentation

void DDCoreToDDXMLOutput::logicalPart ( const DDLogicalPart lp,
std::ostream &  xos 
)

Definition at line 349 of file DDCoreToDDXMLOutput.cc.

References DDLogicalPart::material(), DDLogicalPart::solid(), and DDBase< N, C >::toString().

Referenced by OutputMagneticFieldDDToDDL::beginRun(), and OutputDDToDDL::beginRun().

349  {
350  xos << "<LogicalPart name=\"" << lp.toString() << "\">" << std::endl;
351  xos << "<rSolid name=\"" << lp.solid().toString() << "\"/>" << std::endl;
352  xos << "<rMaterial name=\"" << lp.material().toString() << "\"/>" << std::endl;
353  xos << "</LogicalPart>" << std::endl;
354 }
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
std::string toString() const
Definition: DDBase.h:63
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
void DDCoreToDDXMLOutput::material ( const DDMaterial material,
std::ostream &  xos 
)

Definition at line 292 of file DDCoreToDDXMLOutput.cc.

References DDMaterial::a(), DDMaterial::constituent(), geant_units::operators::convertUnitsTo(), DDMaterial::density(), alignBH_cfg::fixed, dqmiolumiharvest::j, DDMaterial::noOfConstituents(), DDBase< N, C >::toString(), and DDMaterial::z().

Referenced by OutputMagneticFieldDDToDDL::beginRun(), and OutputDDToDDL::beginRun().

292  {
293  int noc = material.noOfConstituents();
294  if (noc == 0) {
295  xos << "<ElementaryMaterial name=\"" << material.toString() << "\""
296  << " density=\"" << std::scientific << std::setprecision(5) << convertUnitsTo(1._mg_per_cm3, material.density())
297  << "*mg/cm3\""
298  << " atomicWeight=\"" << std::fixed << convertUnitsTo(1._g_per_mole, material.a()) << "*g/mole\""
299  << std::setprecision(0) << std::fixed << " atomicNumber=\"" << material.z() << "\"/>" << std::endl;
300  } else {
301  xos << "<CompositeMaterial name=\"" << material.toString() << "\""
302  << " density=\"" << std::scientific << std::setprecision(5) << convertUnitsTo(1._mg_per_cm3, material.density())
303  << "*mg/cm3\""
304  << " method=\"mixture by weight\">" << std::endl;
305 
306  int j = 0;
307  for (; j < noc; ++j) {
308  xos << "<MaterialFraction fraction=\"" << std::fixed << std::setprecision(9) << material.constituent(j).second
309  << "\">" << std::endl;
310  xos << "<rMaterial name=\"" << material.constituent(j).first.name() << "\"/>" << std::endl;
311  xos << "</MaterialFraction>" << std::endl;
312  }
313  xos << "</CompositeMaterial>" << std::endl;
314  }
315 }
double a() const
returns the atomic mass
Definition: DDMaterial.cc:76
constexpr NumType convertUnitsTo(long double desiredUnits, NumType val)
Definition: GeantUnits.h:87
double z() const
retruns the atomic number
Definition: DDMaterial.cc:78
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
Definition: DDMaterial.cc:74
std::string toString() const
Definition: DDBase.h:63
double density() const
returns the density
Definition: DDMaterial.cc:80
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
Definition: DDMaterial.cc:72
void DDCoreToDDXMLOutput::position ( const DDLogicalPart parent,
const DDLogicalPart child,
DDPosData edgeToChild,
int &  rotNameSeed,
std::ostream &  xos 
)

Definition at line 356 of file DDCoreToDDXMLOutput.cc.

References DDPosData::copyno(), DDPosData::ddrot(), idealTransformation::rotation, DDRotation::rotation(), AlCaHLTBitMon_QueryRunRegistry::string, DDBase< N, C >::toString(), and DDPosData::translation().

Referenced by OutputMagneticFieldDDToDDL::beginRun(), and OutputDDToDDL::beginRun().

360  {
361  std::string rotName = edgeToChild->ddrot().toString();
362  DDRotationMatrix myIDENT;
363 
364  xos << "<PosPart copyNumber=\"" << edgeToChild->copyno() << "\">" << std::endl;
365  xos << "<rParent name=\"" << parent.toString() << "\"/>" << std::endl;
366  xos << "<rChild name=\"" << child.toString() << "\"/>" << std::endl;
367  if ((edgeToChild->ddrot().rotation()) != myIDENT) {
368  if (rotName == ":") {
369  rotation(edgeToChild->ddrot(), xos);
370  } else {
371  xos << "<rRotation name=\"" << rotName << "\"/>" << std::endl;
372  }
373  } // else let default Rotation matrix be created?
374  xos << "<Translation x=\"" << edgeToChild->translation().x() << "*mm\""
375  << " y=\"" << edgeToChild->translation().y() << "*mm\""
376  << " z=\"" << edgeToChild->translation().z() << "*mm\"/>" << std::endl;
377  xos << "</PosPart>" << std::endl;
378 }
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const DDRotation & ddrot() const
Definition: DDPosData.h:32
std::string toString() const
Definition: DDBase.h:63
int copyno() const
Definition: DDPosData.h:33
const DDTranslation & translation() const
Definition: DDPosData.h:27
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:81
void rotation(const DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
void DDCoreToDDXMLOutput::rotation ( const DDRotation rotation,
std::ostream &  xos,
const std::string &  rotn = "" 
)

Definition at line 317 of file DDCoreToDDXMLOutput.cc.

References RPCNoise_example::check, angle_units::operators::convertRadToDeg(), gather_cfg::cout, makeMuonMisalignmentScenario::rot, DDRotation::rotation(), AlCaHLTBitMon_QueryRunRegistry::string, and DDBase< N, C >::toString().

Referenced by OutputMagneticFieldDDToDDL::beginRun(), and OutputDDToDDL::beginRun().

317  {
318  double tol = 1.0e-3; // Geant4 compatible
319  DD3Vector x, y, z;
320  rotation.rotation().GetComponents(x, y, z);
321  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system
322  // this must be -1
323  bool reflection((1. - check) > tol);
324  std::string rotName = rotation.toString();
325  if (rotName == ":") {
326  if (!rotn.empty()) {
327  rotName = rotn;
328  std::cout << "about to try to make a new DDRotation... should fail!" << std::endl;
329  DDRotation rot(DDName(rotn), std::make_unique<DDRotationMatrix>(rotation.rotation()));
330  std::cout << "new rotation: " << rot << std::endl;
331  } else {
332  std::cout << "WARNING: MAKING AN UNNAMED ROTATION" << std::endl;
333  }
334  }
335  if (!reflection) {
336  xos << "<Rotation ";
337  } else {
338  xos << "<ReflectionRotation ";
339  }
340  xos << "name=\"" << rotName << "\""
341  << " phiX=\"" << convertRadToDeg(x.phi()) << "*deg\""
342  << " thetaX=\"" << convertRadToDeg(x.theta()) << "*deg\""
343  << " phiY=\"" << convertRadToDeg(y.phi()) << "*deg\""
344  << " thetaY=\"" << convertRadToDeg(y.theta()) << "*deg\""
345  << " phiZ=\"" << convertRadToDeg(z.phi()) << "*deg\""
346  << " thetaZ=\"" << convertRadToDeg(z.theta()) << "*deg\"/>" << std::endl;
347 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
std::string toString() const
Definition: DDBase.h:63
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:81
void DDCoreToDDXMLOutput::solid ( const DDSolid solid,
std::ostream &  xos 
)

Definition at line 26 of file DDCoreToDDXMLOutput.cc.

References DDTrap::alpha1(), DDTrap::alpha2(), DDPseudoTrap::atMinusZ(), angle_units::operators::convertRadToDeg(), DDTruncTubs::cutAtDelta(), DDTruncTubs::cutAtStart(), DDTruncTubs::cutInside(), dd_not_init, ddbox, ddcons, ddcuttubs, ddellipticaltube, ddextrudedpolygon, ddintersection, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddshapeless, ddsubtraction, ddtorus, ddtrap, ddtrunctubs, ddtubs, ddunion, DDTruncTubs::deltaPhi(), DDPolycone::deltaPhi(), DDPolyhedra::deltaPhi(), DDTubs::deltaPhi(), DDCutTubs::deltaPhi(), DDCons::deltaPhi(), DDTorus::deltaPhi(), Exception, DDBox::halfX(), DDBox::halfY(), DDTrap::halfZ(), DDPseudoTrap::halfZ(), DDBox::halfZ(), DDCutTubs::highNorm(), mps_fire::i, dqmdumpme::k, DDCutTubs::lowNorm(), DDBase< N, C >::name(), DDTrap::phi(), DDCons::phiFrom(), DDPseudoTrap::radius(), DDTruncTubs::rIn(), DDTubs::rIn(), DDCutTubs::rIn(), DDCons::rInMinusZ(), DDCons::rInPlusZ(), DDTorus::rMax(), DDPolycone::rMaxVec(), DDPolyhedra::rMaxVec(), DDTorus::rMin(), DDPolycone::rMinVec(), DDPolyhedra::rMinVec(), DDBooleanSolid::rotation(), DDTruncTubs::rOut(), DDTubs::rOut(), DDCutTubs::rOut(), DDCons::rOutMinusZ(), DDCons::rOutPlusZ(), DDTorus::rTorus(), DDPolycone::rVec(), DDPolyhedra::rVec(), DDSolid::shape(), DDPolyhedra::sides(), DDBooleanSolid::solidA(), DDBooleanSolid::solidB(), DDTruncTubs::startPhi(), DDPolycone::startPhi(), DDPolyhedra::startPhi(), DDTubs::startPhi(), DDCutTubs::startPhi(), DDTorus::startPhi(), AlCaHLTBitMon_QueryRunRegistry::string, DDTrap::theta(), DDBase< N, C >::toString(), DDBooleanSolid::translation(), DDTrap::x1(), DDPseudoTrap::x1(), DDTrap::x2(), DDPseudoTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDEllipticalTube::xSemiAxis(), DDExtrudedPolygon::xVec(), DDTrap::y1(), DDPseudoTrap::y1(), DDTrap::y2(), DDPseudoTrap::y2(), DDEllipticalTube::ySemiAxis(), DDExtrudedPolygon::yVec(), DDTruncTubs::zHalf(), DDTubs::zhalf(), DDCutTubs::zhalf(), DDCons::zhalf(), DDEllipticalTube::zHeight(), DDExtrudedPolygon::zscaleVec(), DDPolycone::zVec(), DDPolyhedra::zVec(), DDExtrudedPolygon::zVec(), DDExtrudedPolygon::zxVec(), and DDExtrudedPolygon::zyVec().

Referenced by OutputMagneticFieldDDToDDL::beginRun(), and OutputDDToDDL::beginRun().

26  {
27  switch (solid.shape()) {
31  DDBooleanSolid rs(solid);
32  if (solid.shape() == DDSolidShape::ddunion) {
33  xos << "<UnionSolid ";
34  } else if (solid.shape() == DDSolidShape::ddsubtraction) {
35  xos << "<SubtractionSolid ";
36  } else if (solid.shape() == DDSolidShape::ddintersection) {
37  xos << "<IntersectionSolid ";
38  }
39  xos << "name=\"" << rs.toString() << "\">" << std::endl;
40  // if translation is == identity there are no parameters.
41  // if there is no rotation the name will be ":"
42  xos << "<rSolid name=\"" << rs.solidA().toString() << "\"/>" << std::endl;
43  xos << "<rSolid name=\"" << rs.solidB().toString() << "\"/>" << std::endl;
44  xos << "<Translation x=\"" << rs.translation().X() << "*mm\"";
45  xos << " y=\"" << rs.translation().Y() << "*mm\"";
46  xos << " z=\"" << rs.translation().Z() << "*mm\"";
47  xos << "/>" << std::endl;
48  std::string rotName = rs.rotation().toString();
49  if (rotName == ":") {
50  rotName = "gen:ID";
51  }
52  xos << "<rRotation name=\"" << rs.rotation().toString() << "\"/>" << std::endl;
53  if (solid.shape() == DDSolidShape::ddunion) {
54  xos << "</UnionSolid>" << std::endl;
55  } else if (solid.shape() == DDSolidShape::ddsubtraction) {
56  xos << "</SubtractionSolid>" << std::endl;
57  } else if (solid.shape() == DDSolidShape::ddintersection) {
58  xos << "</IntersectionSolid>" << std::endl;
59  }
60  break;
61  }
62  case DDSolidShape::ddbox: {
63  // <Box name="box1" dx="10*cm" dy="10*cm" dz="10*cm"/>
64  DDBox rs(solid);
65  xos << "<Box name=\"" << rs.toString() << "\"" //<< rs.toString() << "\"" //
66  << " dx=\"" << rs.halfX() << "*mm\""
67  << " dy=\"" << rs.halfY() << "*mm\""
68  << " dz=\"" << rs.halfZ() << "*mm\"/>" << std::endl;
69  break;
70  }
71  case DDSolidShape::ddtubs: {
72  // <Tubs name="TrackerSupportTubeNomex" rMin="[SupportTubeR1]+[Tol]"
73  // rMax="[SupportTubeR2]-[Tol]" dz="[SupportTubeL]"
74  // startPhi="0*deg" deltaPhi="360*deg"/>
75  DDTubs rs(solid);
76  xos << "<Tubs name=\"" << rs.toString() << "\""
77  << " rMin=\"" << rs.rIn() << "*mm\""
78  << " rMax=\"" << rs.rOut() << "*mm\""
79  << " dz=\"" << rs.zhalf() << "*mm\""
80  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
81  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\"/>" << std::endl;
82  break;
83  }
84  case DDSolidShape::ddtrap: {
85  // <Trapezoid name="UpL_CSC_for_TotemT1_Plane_2_5_7" dz="[PCB_Epoxy_Thick_3P]/2."
86  // alp1="-[Up_Signal_Side_alpL_3P]" alp2="-[Up_Signal_Side_alpL_3P]"
87  // bl1="[Max_Base_Signal_SideL_3P]/2." tl1="[Up_Min_Base_Signal_SideL_3P]/2." h1="[Up_Height_Signal_SideL_3P]/2."
88  // h2="[Up_Height_Signal_SideL_3P]/2." bl2="[Max_Base_Signal_SideL_3P]/2." tl2="[Up_Min_Base_Signal_SideL_3P]/2."/>
89  DDTrap rs(solid);
90  xos << "<Trapezoid name=\"" << rs.toString() << "\""
91  << " dz=\"" << rs.halfZ() << "*mm\""
92  << " theta=\"" << convertRadToDeg(rs.theta()) << "*deg\""
93  << " phi=\"" << convertRadToDeg(rs.phi()) << "*deg\""
94  << " h1=\"" << rs.y1() << "*mm\""
95  << " bl1=\"" << rs.x1() << "*mm\""
96  << " tl1=\"" << rs.x2() << "*mm\""
97  << " alp1=\"" << convertRadToDeg(rs.alpha1()) << "*deg\""
98  << " h2=\"" << rs.y2() << "*mm\""
99  << " bl2=\"" << rs.x3() << "*mm\""
100  << " tl2=\"" << rs.x4() << "*mm\""
101  << " alp2=\"" << convertRadToDeg(rs.alpha2()) << "*deg\"/>" << std::endl;
102  break;
103  }
104  case DDSolidShape::ddcons: {
105  DDCons rs(solid);
106  xos << "<Cone name=\"" << rs.toString() << "\""
107  << " dz=\"" << rs.zhalf() << "*mm\""
108  << " rMin1=\"" << rs.rInMinusZ() << "*mm\""
109  << " rMax1=\"" << rs.rOutMinusZ() << "*mm\""
110  << " rMin2=\"" << rs.rInPlusZ() << "*mm\""
111  << " rMax2=\"" << rs.rOutPlusZ() << "*mm\""
112  << " startPhi=\"" << convertRadToDeg(rs.phiFrom()) << "*deg\""
113  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\"/>" << std::endl;
114  break;
115  }
117  DDPolycone rs(solid);
118  xos << "<Polycone name=\"" << rs.toString() << "\""
119  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
120  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
121  const std::vector<double>& zV(rs.zVec());
122  const std::vector<double>& rV(rs.rVec());
123  for (size_t i = 0; i < zV.size(); ++i) {
124  xos << "<RZPoint r=\"" << rV[i] << "*mm\""
125  << " z=\"" << zV[i] << "*mm\"/>" << std::endl;
126  }
127  xos << "</Polycone>" << std::endl;
128  break;
129  }
131  DDPolyhedra rs(solid);
132  xos << "<Polyhedra name=\"" << rs.toString() << "\""
133  << " numSide=\"" << rs.sides() << "\""
134  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
135  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
136  const std::vector<double>& zV(rs.zVec());
137  const std::vector<double>& rV(rs.rVec());
138  for (size_t i = 0; i < zV.size(); ++i) {
139  xos << "<RZPoint r=\"" << rV[i] << "*mm\""
140  << " z=\"" << zV[i] << "*mm\"/>" << std::endl;
141  }
142  xos << "</Polyhedra>" << std::endl;
143  break;
144  }
146  // <Polycone name="OCMS" startPhi="0*deg" deltaPhi="360*deg" >
147  // <ZSection z="-[CMSZ1]" rMin="[Rmin]" rMax="[CMSR2]" />
148  // <ZSection z="-[HallZ]" rMin="[Rmin]" rMax="[CMSR2]" />
149  // <ZSection z="-[HallZ]" rMin="[Rmin]" rMax="[HallR]" />
150  // <ZSection z="[HallZ]" rMin="[Rmin]" rMax="[HallR]" />
151  // <ZSection z="[HallZ]" rMin="[Rmin]" rMax="[CMSR2]" />
152  // <ZSection z="[CMSZ1]" rMin="[Rmin]" rMax="[CMSR2]" />
153  DDPolycone rs(solid);
154  xos << "<Polycone name=\"" << rs.toString() << "\""
155  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
156  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
157  const std::vector<double>& zV(rs.zVec());
158  const std::vector<double>& rMinV(rs.rMinVec());
159  const std::vector<double>& rMaxV(rs.rMaxVec());
160  for (size_t i = 0; i < zV.size(); ++i) {
161  xos << "<ZSection z=\"" << zV[i] << "*mm\""
162  << " rMin=\"" << rMinV[i] << "*mm\""
163  << " rMax=\"" << rMaxV[i] << "*mm\"/>" << std::endl;
164  }
165  xos << "</Polycone>" << std::endl;
166  break;
167  }
169  DDPolyhedra rs(solid);
170  xos << "<Polyhedra name=\"" << rs.toString() << "\""
171  << " numSide=\"" << rs.sides() << "\""
172  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
173  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
174  const std::vector<double>& zV(rs.zVec());
175  const std::vector<double>& rMinV(rs.rMinVec());
176  const std::vector<double>& rMaxV(rs.rMaxVec());
177  for (size_t i = 0; i < zV.size(); ++i) {
178  xos << "<ZSection z=\"" << zV[i] << "*mm\""
179  << " rMin=\"" << rMinV[i] << "*mm\""
180  << " rMax=\"" << rMaxV[i] << "*mm\"/>" << std::endl;
181  }
182  xos << "</Polyhedra>" << std::endl;
183  break;
184  }
186  // <PseudoTrap name="YE3_b" dx1="0.395967*m" dx2="1.86356*m" dy1="0.130*m" dy2="0.130*m" dz="2.73857*m" radius="-1.5300*m" atMinusZ="true"/>
187  DDPseudoTrap rs(solid);
188  xos << "<PseudoTrap name=\"" << rs.toString() << "\""
189  << " dx1=\"" << rs.x1() << "*mm\""
190  << " dx2=\"" << rs.x2() << "*mm\""
191  << " dy1=\"" << rs.y1() << "*mm\""
192  << " dy2=\"" << rs.y2() << "*mm\""
193  << " dz=\"" << rs.halfZ() << "*mm\""
194  << " radius=\"" << rs.radius() << "*mm\""
195  << " atMinusZ=\"" << (rs.atMinusZ() ? "true" : "false") << "\"/>" << std::endl;
196  break;
197  }
199  // <TruncTubs name="trunctubs1" zHalf="50*cm" rMin="20*cm" rMax="40*cm"
200  // startPhi="0*deg" deltaPhi="90*deg"
201  // cutAtStart="25*cm" cutAtDelta="35*cm"/>
202  DDTruncTubs rs(solid);
203  xos << "<TruncTubs name=\"" << rs.toString() << "\""
204  << " zHalf=\"" << rs.zHalf() << "*mm\""
205  << " rMin=\"" << rs.rIn() << "*mm\""
206  << " rMax=\"" << rs.rOut() << "*mm\""
207  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
208  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\""
209  << " cutAtStart=\"" << rs.cutAtStart() << "*mm\""
210  << " cutAtDelta=\"" << rs.cutAtDelta() << "*mm\""
211  << " cutInside=\"" << (rs.cutInside() ? "true" : "false") << "\"/>" << std::endl;
212  break;
213  }
215  DDShapelessSolid rs(solid);
216  xos << "<ShapelessSolid name=\"" << rs.toString() << "\"/>" << std::endl;
217  break;
218  }
219  case DDSolidShape::ddtorus: {
220  // <Torus name="torus" innerRadius="7.5*cm" outerRadius="10*cm"
221  // torusRadius="30*cm" startPhi="0*deg" deltaPhi="360*deg"/>
222  DDTorus rs(solid);
223  xos << "<Torus name=\"" << rs.toString() << "\""
224  << " innerRadius=\"" << rs.rMin() << "*mm\""
225  << " outerRadius=\"" << rs.rMax() << "*mm\""
226  << " torusRadius=\"" << rs.rTorus() << "*mm\""
227  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
228  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\"/>" << std::endl;
229  break;
230  }
232  // <EllipticalTube name="CMSWall" xSemiAxis="[cavernData:CMSWallEDX]"
233  // ySemiAxis="[cavernData:CMSWallEDY]"
234  // zHeight="[cms:HallZ]"/>
235  DDEllipticalTube rs(solid);
236  xos << "<EllipticalTube name=\"" << rs.toString() << "\""
237  << " xSemiAxis=\"" << rs.xSemiAxis() << "*mm\""
238  << " ySemiAxis=\"" << rs.ySemiAxis() << "*mm\""
239  << " zHeight=\"" << rs.zHeight() << "*mm\"/>" << std::endl;
240  break;
241  }
243  // <Tubs name="TrackerSupportTubeNomex" rMin="[SupportTubeR1]+[Tol]"
244  // rMax="[SupportTubeR2]-[Tol]" dz="[SupportTubeL]"
245  // startPhi="0*deg" deltaPhi="360*deg"/>
246  DDCutTubs rs(solid);
247  const std::array<double, 3>& pLowNorm(rs.lowNorm());
248  const std::array<double, 3>& pHighNorm(rs.highNorm());
249 
250  xos << "<CutTubs name=\"" << rs.toString() << "\""
251  << " dz=\"" << rs.zhalf() << "*mm\""
252  << " rMin=\"" << rs.rIn() << "*mm\""
253  << " rMax=\"" << rs.rOut() << "*mm\""
254  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
255  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\""
256  << " lx=\"" << pLowNorm[0] << "\""
257  << " ly=\"" << pLowNorm[1] << "\""
258  << " lz=\"" << pLowNorm[2] << "\""
259  << " tx=\"" << pHighNorm[0] << "\""
260  << " ty=\"" << pHighNorm[1] << "\""
261  << " tz=\"" << pHighNorm[2] << "\"/>" << std::endl;
262  break;
263  }
265  DDExtrudedPolygon rs(solid);
266  std::vector<double> x = rs.xVec();
267  std::vector<double> y = rs.yVec();
268  std::vector<double> z = rs.zVec();
269  std::vector<double> zx = rs.zxVec();
270  std::vector<double> zy = rs.zyVec();
271  std::vector<double> zs = rs.zscaleVec();
272 
273  xos << "<ExtrudedPolygon name=\"" << rs.toString() << "\"";
274  for (unsigned int i = 0; i < x.size(); ++i)
275  xos << " <XYPoint x=\"" << x[i] << "*mm\" y=\"" << y[i] << "*mm\"/>\n";
276  for (unsigned int k = 0; k < z.size(); ++k)
277  xos << " <ZXYSection z=\"" << z[k] << "*mm\" x=\"" << zx[k] << "*mm\" y=\"" << zy[k] << "*mm scale=" << zs[k]
278  << "*mm\"/>\n";
279  xos << "</ExtrudedPolygon>\n";
280  break;
281  }
282  // return new PSolid( pstrs(solid.toString()), solid.parameters()
283  // , solid.shape(), pstrs(""), pstrs(""), pstrs("") );
285  default:
286  throw cms::Exception("DDException")
287  << "DDCoreToDDXMLOutput::solid(...) " << solid.name() << " either not inited or no such solid.";
288  break;
289  }
290 }
A truncated tube section.
Definition: DDSolid.h:128
const N & name() const
Definition: DDBase.h:59
This is simply a handle on the solid.
Definition: DDSolid.h:167
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
Interface to a Trapezoid.
Definition: DDSolid.h:77
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
Interface to a Box.
Definition: DDSolid.h:156
void DDCoreToDDXMLOutput::specpar ( const DDSpecifics sp,
std::ostream &  xos 
)

Definition at line 380 of file DDCoreToDDXMLOutput.cc.

References mps_fire::i, DDValue::isEvaluated(), DDValue::name(), alignCSCRings::s, DDSpecifics::selection(), DDValue::size(), DDSpecifics::specifics(), DDValue::strings(), DDBase< N, C >::toString(), and findQualityFiles::v.

Referenced by OutputMagneticFieldDDToDDL::beginRun(), and OutputDDToDDL::beginRun().

380  {
381  xos << "<SpecPar name=\"" << sp.toString() << "\" eval=\"false\">" << std::endl;
382 
383  // ========... all the selection strings out as strings by using the DDPartSelection's std::ostream function...
384  for (const auto& psit : sp.selection()) {
385  xos << "<PartSelector path=\"" << psit << "\"/>" << std::endl;
386  }
387 
388  // ========= ... and iterate over all DDValues...
389  for (const auto& vit : sp.specifics()) {
390  const DDValue& v = vit.second;
391  size_t s = v.size();
392  size_t i = 0;
393  // ============ ... all actual values with the same name
394  const std::vector<std::string>& strvec = v.strings();
395  if (v.isEvaluated()) {
396  for (; i < s; ++i) {
397  xos << "<Parameter name=\"" << v.name() << "\""
398  << " value=\"" << v[i] << "\""
399  << " eval=\"true\"/>" << std::endl;
400  }
401  } else {
402  for (; i < s; ++i) {
403  xos << "<Parameter name=\"" << v.name() << "\""
404  << " value=\"" << strvec[i] << "\""
405  << " eval=\"false\"/>" << std::endl;
406  }
407  }
408  }
409  xos << "</SpecPar>" << std::endl;
410 }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:53
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:152
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
Definition: DDValue.h:60
std::string toString() const
Definition: DDBase.h:63
const DDsvalues_type & specifics() const
Reference to the user-data attached to all nodes selected by the selections-strings given through sel...
Definition: DDSpecifics.cc:36
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:67
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:34
void DDCoreToDDXMLOutput::specpar ( const std::pair< DDsvalues_type, std::set< const DDPartSelection * > > &  pssv,
std::ostream &  xos 
)

Definition at line 412 of file DDCoreToDDXMLOutput.cc.

References mps_fire::i, DDValue::isEvaluated(), DDValue::name(), alignCSCRings::s, DDValue::size(), AlCaHLTBitMon_QueryRunRegistry::string, DDValue::strings(), and findQualityFiles::v.

413  {
414  static const std::string madeName("specparname");
415  static int numspecpars(0);
416  std::ostringstream ostr;
417  ostr << numspecpars++;
418  std::string spname = madeName + ostr.str();
419  xos << "<SpecPar name=\"" << spname << "\" eval=\"false\">" << std::endl;
420  for (const auto& psit : pssv.second) {
421  xos << "<PartSelector path=\"" << *psit << "\"/>" << std::endl;
422  }
423 
424  // ========= ... and iterate over all DDValues...
425  for (const auto& vit : pssv.first) {
426  const DDValue& v = vit.second;
427  size_t s = v.size();
428  size_t i = 0;
429  // ============ ... all actual values with the same name
430  const std::vector<std::string>& strvec = v.strings();
431  if (v.isEvaluated()) {
432  for (; i < s; ++i) {
433  xos << "<Parameter name=\"" << v.name() << "\""
434  << " value=\"" << v[i] << "\""
435  << " eval=\"true\"/>" << std::endl;
436  }
437  } else {
438  for (; i < s; ++i) {
439  xos << "<Parameter name=\"" << v.name() << "\""
440  << " value=\"" << strvec[i] << "\""
441  << " eval=\"false\"/>" << std::endl;
442  }
443  }
444  }
445 
446  xos << "</SpecPar>" << std::endl;
447 }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:53
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:152
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
Definition: DDValue.h:60
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:67

Member Data Documentation

std::string DDCoreToDDXMLOutput::ns_
double DDCoreToDDXMLOutput::tol_

Definition at line 56 of file DDCoreToDDXMLOutput.h.