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

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

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

411 {
412  xos << "<LogicalPart name=\"" << lp.toString() << "\">" << std::endl;
413  xos << "<rSolid name=\"" << lp.solid().toString() << "\"/>" << std::endl;
414  xos << "<rMaterial name=\"" << lp.material().toString() << "\"/>" << std::endl;
415  xos << "</LogicalPart>" << std::endl;
416 }
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:82
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 333 of file DDCoreToDDXMLOutput.cc.

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

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

334 {
335  int noc = material.noOfConstituents();
336  if( noc == 0 )
337  {
338  xos << "<ElementaryMaterial name=\"" << material.toString() << "\""
339  << " density=\""
340  << std::scientific << std::setprecision(5)
341  << material.density() / mg * cm3 << "*mg/cm3\""
342  << " atomicWeight=\""
343  << std::fixed
344  << material.a() / g * mole << "*g/mole\""
345  << std::setprecision(0) << std::fixed << " atomicNumber=\"" << material.z() << "\"/>"
346  << std::endl;
347  }
348  else
349  {
350  xos << "<CompositeMaterial name=\"" << material.toString() << "\""
351  << " density=\""
352  << std::scientific << std::setprecision(5)
353  << material.density() / mg * cm3 << "*mg/cm3\""
354  << " method=\"mixture by weight\">" << std::endl;
355 
356  int j=0;
357  for (; j<noc; ++j)
358  {
359  xos << "<MaterialFraction fraction=\""
360  << std::fixed << std::setprecision(9)
361  << material.constituent(j).second << "\">" << std::endl;
362  xos << "<rMaterial name=\"" << material.constituent(j).first.name() << "\"/>" << std::endl;
363  xos << "</MaterialFraction>" << std::endl;
364  }
365  xos << "</CompositeMaterial>" << std::endl;
366  }
367 }
double a() const
returns the atomic mass
Definition: DDMaterial.cc:96
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
double z() const
retruns the atomic number
Definition: DDMaterial.cc:102
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
Definition: DDMaterial.cc:90
std::string toString() const
Definition: DDBase.h:82
double density() const
returns the density
Definition: DDMaterial.cc:108
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
Definition: DDMaterial.cc:84
void DDCoreToDDXMLOutput::position ( const DDLogicalPart parent,
const DDLogicalPart child,
DDPosData edgeToChild,
int &  rotNameSeed,
std::ostream &  xos 
)

Definition at line 418 of file DDCoreToDDXMLOutput.cc.

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

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

423 {
424  std::string rotName = edgeToChild->ddrot().toString();
425  DDRotationMatrix myIDENT;
426 
427  xos << "<PosPart copyNumber=\"" << edgeToChild->copyno() << "\">" << std::endl;
428  xos << "<rParent name=\"" << parent.toString() << "\"/>" << std::endl;
429  xos << "<rChild name=\"" << child.toString() << "\"/>" << std::endl;
430  if( *(edgeToChild->ddrot().rotation()) != myIDENT )
431  {
432  if( rotName == ":" )
433  {
434  rotation(edgeToChild->ddrot(), xos);
435  }
436  else
437  {
438  xos << "<rRotation name=\"" << rotName << "\"/>" << std::endl;
439  }
440  } // else let default Rotation matrix be created?
441  xos << "<Translation x=\"" << edgeToChild->translation().x() <<"*mm\""
442  << " y=\"" << edgeToChild->translation().y() <<"*mm\""
443  << " z=\"" << edgeToChild->translation().z() <<"*mm\"/>" << std::endl;
444  xos << "</PosPart>" << std::endl;
445 }
const DDRotationMatrix * rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:91
const DDRotation & ddrot() const
Definition: DDPosData.h:34
std::string toString() const
Definition: DDBase.h:82
int copyno() const
Definition: DDPosData.h:35
const DDTranslation & translation() const
Definition: DDPosData.h:29
void rotation(const DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
void DDCoreToDDXMLOutput::rotation ( const DDRotation rotation,
std::ostream &  xos,
const std::string &  rotn = "" 
)

Definition at line 369 of file DDCoreToDDXMLOutput.cc.

References trackerTree::check(), gather_cfg::cout, makeMuonMisalignmentScenario::rot, DDRotation::rotation(), AlCaHLTBitMon_QueryRunRegistry::string, DDBase< N, C >::toString(), x, y, and z.

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

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

Definition at line 26 of file DDCoreToDDXMLOutput.cc.

References DDTrap::alpha1(), DDTrap::alpha2(), DDPseudoTrap::atMinusZ(), 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(), x, DDTrap::x1(), DDPseudoTrap::x1(), DDTrap::x2(), DDPseudoTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDEllipticalTube::xSemiAxis(), DDExtrudedPolygon::xVec(), y, DDTrap::y1(), DDPseudoTrap::y1(), DDTrap::y2(), DDPseudoTrap::y2(), DDEllipticalTube::ySemiAxis(), DDExtrudedPolygon::yVec(), z, 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().

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

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

449 {
450  xos << "<SpecPar name=\"" << sp.toString() << "\" eval=\"false\">" << std::endl;
451 
452  // ========... all the selection strings out as strings by using the DDPartSelection's std::ostream function...
453  for( const auto& psit : sp.selection())
454  {
455  xos << "<PartSelector path=\"" << psit << "\"/>" << std::endl;
456  }
457 
458  // ========= ... and iterate over all DDValues...
459  for( const auto& vit : sp.specifics())
460  {
461  const DDValue & v = vit.second;
462  size_t s=v.size();
463  size_t i=0;
464  // ============ ... all actual values with the same name
465  const std::vector<std::string>& strvec = v.strings();
466  if( v.isEvaluated())
467  {
468  for(; i<s; ++i)
469  {
470  xos << "<Parameter name=\"" << v.name() << "\""
471  << " value=\"" << v[i] << "\""
472  << " eval=\"true\"/>" << std::endl;
473  }
474  }
475  else
476  {
477  for(; i<s; ++i )
478  {
479  xos << "<Parameter name=\"" << v.name() << "\""
480  << " value=\"" << strvec[i] << "\""
481  << " eval=\"false\"/>" << std::endl;
482  }
483  }
484 
485  }
486  xos << "</SpecPar>" << std::endl;
487 }
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:82
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:45
void DDCoreToDDXMLOutput::specpar ( const std::pair< DDsvalues_type, std::set< const DDPartSelection * > > &  pssv,
std::ostream &  xos 
)

Definition at line 489 of file DDCoreToDDXMLOutput.cc.

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

490 {
491  static const std::string madeName("specparname");
492  static int numspecpars(0);
493  std::ostringstream ostr;
494  ostr << numspecpars++;
495  std::string spname = madeName + ostr.str();
496  xos << "<SpecPar name=\"" << spname << "\" eval=\"false\">" << std::endl;
497  for( const auto& psit : pssv.second ) {
498  xos << "<PartSelector path=\"" << *psit << "\"/>" << std::endl;
499  }
500 
501  // ========= ... and iterate over all DDValues...
502  for( const auto& vit : pssv.first )
503  {
504  const DDValue & v = vit.second;
505  size_t s=v.size();
506  size_t i=0;
507  // ============ ... all actual values with the same name
508  const std::vector<std::string>& strvec = v.strings();
509  if( v.isEvaluated() )
510  {
511  for(; i<s; ++i)
512  {
513  xos << "<Parameter name=\"" << v.name() << "\""
514  << " value=\"" << v[i] << "\""
515  << " eval=\"true\"/>" << std::endl;
516  }
517  }
518  else
519  {
520  for(; i<s; ++i )
521  {
522  xos << "<Parameter name=\"" << v.name() << "\""
523  << " value=\"" << strvec[i] << "\""
524  << " eval=\"false\"/>" << std::endl;
525  }
526  }
527  }
528 
529  xos << "</SpecPar>" << std::endl;
530 }
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.