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 417 of file DDCoreToDDXMLOutput.cc.

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

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

418 {
419  xos << "<LogicalPart name=\"" << lp.toString() << "\">" << std::endl;
420  xos << "<rSolid name=\"" << lp.solid().toString() << "\"/>" << std::endl;
421  xos << "<rMaterial name=\"" << lp.material().toString() << "\"/>" << std::endl;
422  xos << "</LogicalPart>" << std::endl;
423 }
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:78
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 338 of file DDCoreToDDXMLOutput.cc.

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

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

339 {
340  int noc = material.noOfConstituents();
341  if( noc == 0 )
342  {
343  xos << "<ElementaryMaterial name=\"" << material.toString() << "\""
344  << " density=\""
345  << std::scientific << std::setprecision(5)
346  << convertUnitsTo(1._mg_per_cm3, material.density()) << "*mg/cm3\""
347  << " atomicWeight=\""
348  << std::fixed
349  << convertUnitsTo(1._g_per_mole, material.a()) << "*g/mole\""
350  << std::setprecision(0) << std::fixed << " atomicNumber=\"" << material.z() << "\"/>"
351  << std::endl;
352  }
353  else
354  {
355  xos << "<CompositeMaterial name=\"" << material.toString() << "\""
356  << " density=\""
357  << std::scientific << std::setprecision(5)
358  << convertUnitsTo(1._mg_per_cm3, material.density()) << "*mg/cm3\""
359  << " method=\"mixture by weight\">" << std::endl;
360 
361  int j=0;
362  for (; j<noc; ++j)
363  {
364  xos << "<MaterialFraction fraction=\""
365  << std::fixed << std::setprecision(9)
366  << material.constituent(j).second << "\">" << std::endl;
367  xos << "<rMaterial name=\"" << material.constituent(j).first.name() << "\"/>" << std::endl;
368  xos << "</MaterialFraction>" << std::endl;
369  }
370  xos << "</CompositeMaterial>" << std::endl;
371  }
372 }
double a() const
returns the atomic mass
Definition: DDMaterial.cc:93
constexpr NumType convertUnitsTo(long double desiredUnits, NumType val)
Definition: GeantUnits.h:128
double z() const
retruns the atomic number
Definition: DDMaterial.cc:99
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
Definition: DDMaterial.cc:87
std::string toString() const
Definition: DDBase.h:78
double density() const
returns the density
Definition: DDMaterial.cc:104
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
Definition: DDMaterial.cc:82
void DDCoreToDDXMLOutput::position ( const DDLogicalPart parent,
const DDLogicalPart child,
DDPosData edgeToChild,
int &  rotNameSeed,
std::ostream &  xos 
)

Definition at line 425 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().

430 {
431  std::string rotName = edgeToChild->ddrot().toString();
432  DDRotationMatrix myIDENT;
433 
434  xos << "<PosPart copyNumber=\"" << edgeToChild->copyno() << "\">" << std::endl;
435  xos << "<rParent name=\"" << parent.toString() << "\"/>" << std::endl;
436  xos << "<rChild name=\"" << child.toString() << "\"/>" << std::endl;
437  if(( edgeToChild->ddrot().rotation()) != myIDENT )
438  {
439  if( rotName == ":" )
440  {
441  rotation(edgeToChild->ddrot(), xos);
442  }
443  else
444  {
445  xos << "<rRotation name=\"" << rotName << "\"/>" << std::endl;
446  }
447  } // else let default Rotation matrix be created?
448  xos << "<Translation x=\"" << edgeToChild->translation().x() <<"*mm\""
449  << " y=\"" << edgeToChild->translation().y() <<"*mm\""
450  << " z=\"" << edgeToChild->translation().z() <<"*mm\"/>" << std::endl;
451  xos << "</PosPart>" << std::endl;
452 }
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const DDRotation & ddrot() const
Definition: DDPosData.h:34
std::string toString() const
Definition: DDBase.h:78
int copyno() const
Definition: DDPosData.h:35
const DDTranslation & translation() const
Definition: DDPosData.h:29
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:93
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 375 of file DDCoreToDDXMLOutput.cc.

References trackerTree::check(), geant_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().

377 {
378  double tol = 1.0e-3; // Geant4 compatible
379  DD3Vector x,y,z;
380  rotation.rotation().GetComponents(x,y,z);
381  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system
382  // this must be -1
383  bool reflection((1.-check)>tol);
384  std::string rotName=rotation.toString();
385  if( rotName == ":" )
386  {
387  if( !rotn.empty() )
388  {
389  rotName = rotn;
390  std::cout << "about to try to make a new DDRotation... should fail!" << std::endl;
391  DDRotation rot( DDName(rotn), std::make_unique<DDRotationMatrix>( rotation.rotation()));
392  std:: cout << "new rotation: " << rot << std::endl;
393  }
394  else
395  {
396  std::cout << "WARNING: MAKING AN UNNAMED ROTATION" << std::endl;
397  }
398  }
399  if( !reflection )
400  {
401  xos << "<Rotation ";
402  }
403  else
404  {
405  xos << "<ReflectionRotation ";
406  }
407  xos << "name=\"" << rotName << "\""
408  << " phiX=\"" << convertRadToDeg( x.phi() ) << "*deg\""
409  << " thetaX=\"" << convertRadToDeg( x.theta() ) << "*deg\""
410  << " phiY=\"" << convertRadToDeg( y.phi() ) << "*deg\""
411  << " thetaY=\"" << convertRadToDeg( y.theta() ) << "*deg\""
412  << " phiZ=\"" << convertRadToDeg( z.phi() ) << "*deg\""
413  << " thetaZ=\"" << convertRadToDeg( z.theta() ) << "*deg\"/>"
414  << std::endl;
415 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
constexpr NumType convertRadToDeg(NumType radians)
Definition: GeantUnits.h:98
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:68
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:78
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:93
def check(config)
Definition: trackerTree.py:14
void DDCoreToDDXMLOutput::solid ( const DDSolid solid,
std::ostream &  xos 
)

Definition at line 27 of file DDCoreToDDXMLOutput.cc.

References DDTrap::alpha1(), DDTrap::alpha2(), DDPseudoTrap::atMinusZ(), geant_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, gen::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().

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

Definition at line 455 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().

456 {
457  xos << "<SpecPar name=\"" << sp.toString() << "\" eval=\"false\">" << std::endl;
458 
459  // ========... all the selection strings out as strings by using the DDPartSelection's std::ostream function...
460  for( const auto& psit : sp.selection())
461  {
462  xos << "<PartSelector path=\"" << psit << "\"/>" << std::endl;
463  }
464 
465  // ========= ... and iterate over all DDValues...
466  for( const auto& vit : sp.specifics())
467  {
468  const DDValue & v = vit.second;
469  size_t s=v.size();
470  size_t i=0;
471  // ============ ... all actual values with the same name
472  const std::vector<std::string>& strvec = v.strings();
473  if( v.isEvaluated())
474  {
475  for(; i<s; ++i)
476  {
477  xos << "<Parameter name=\"" << v.name() << "\""
478  << " value=\"" << v[i] << "\""
479  << " eval=\"true\"/>" << std::endl;
480  }
481  }
482  else
483  {
484  for(; i<s; ++i )
485  {
486  xos << "<Parameter name=\"" << v.name() << "\""
487  << " value=\"" << strvec[i] << "\""
488  << " eval=\"false\"/>" << std::endl;
489  }
490  }
491 
492  }
493  xos << "</SpecPar>" << std::endl;
494 }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:54
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:204
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:61
std::string toString() const
Definition: DDBase.h:78
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:50
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:68
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:44
void DDCoreToDDXMLOutput::specpar ( const std::pair< DDsvalues_type, std::set< const DDPartSelection * > > &  pssv,
std::ostream &  xos 
)

Definition at line 496 of file DDCoreToDDXMLOutput.cc.

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

497 {
498  static const std::string madeName("specparname");
499  static int numspecpars(0);
500  std::ostringstream ostr;
501  ostr << numspecpars++;
502  std::string spname = madeName + ostr.str();
503  xos << "<SpecPar name=\"" << spname << "\" eval=\"false\">" << std::endl;
504  for( const auto& psit : pssv.second ) {
505  xos << "<PartSelector path=\"" << *psit << "\"/>" << std::endl;
506  }
507 
508  // ========= ... and iterate over all DDValues...
509  for( const auto& vit : pssv.first )
510  {
511  const DDValue & v = vit.second;
512  size_t s=v.size();
513  size_t i=0;
514  // ============ ... all actual values with the same name
515  const std::vector<std::string>& strvec = v.strings();
516  if( v.isEvaluated() )
517  {
518  for(; i<s; ++i)
519  {
520  xos << "<Parameter name=\"" << v.name() << "\""
521  << " value=\"" << v[i] << "\""
522  << " eval=\"true\"/>" << std::endl;
523  }
524  }
525  else
526  {
527  for(; i<s; ++i )
528  {
529  xos << "<Parameter name=\"" << v.name() << "\""
530  << " value=\"" << strvec[i] << "\""
531  << " eval=\"false\"/>" << std::endl;
532  }
533  }
534  }
535 
536  xos << "</SpecPar>" << std::endl;
537 }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:54
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:204
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:61
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:68

Member Data Documentation

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

Definition at line 56 of file DDCoreToDDXMLOutput.h.