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 != "" )
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, ddextrudedpolygon, ddintersection, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, ddreflected, 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(), 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(), DDReflectionSolid::unreflected(), x, DDTrap::x1(), DDPseudoTrap::x1(), DDTrap::x2(), DDPseudoTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDExtrudedPolygon::xVec(), y, DDTrap::y1(), DDPseudoTrap::y1(), DDTrap::y2(), DDPseudoTrap::y2(), DDExtrudedPolygon::yVec(), z, DDTruncTubs::zHalf(), DDTubs::zhalf(), DDCutTubs::zhalf(), DDCons::zhalf(), 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  {
30  case ddunion:
31  case ddsubtraction:
32  case ddintersection:
33  {
34  DDBooleanSolid rs( solid );
35  if( solid.shape() == ddunion )
36  {
37  xos << "<UnionSolid ";
38  }
39  else if( solid.shape() == ddsubtraction )
40  {
41  xos << "<SubtractionSolid ";
42  }
43  else if( solid.shape() == 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() == ddunion )
63  {
64  xos << "</UnionSolid>" << std::endl;
65  }
66  else if( solid.shape() == ddsubtraction )
67  {
68  xos << "</SubtractionSolid>" << std::endl;
69  }
70  else if( solid.shape() == ddintersection )
71  {
72  xos << "</IntersectionSolid>" << std::endl;
73  }
74  break;
75  }
76  case ddreflected:
77  {
78  /*
79  <ReflectionSolid name="trd2mirror">
80  <rSolid name="trd2"/>
81  </ReflectionSolid>
82  */
83  DDReflectionSolid rs(solid);
84  xos << "<ReflectionSolid name=\"" << rs.toString() << "\">" << std::endl;
85  xos << "<rSolid name=\"" << rs.unreflected().toString() << "\">" << std::endl;
86  xos << "</ReflectionSolid>" << std::endl;
87  break;
88  }
89  case ddbox:
90  {
91  // <Box name="box1" dx="10*cm" dy="10*cm" dz="10*cm"/>
92  DDBox rs(solid);
93  xos << "<Box name=\"" << rs.toString() << "\"" //<< rs.toString() << "\"" //
94  << " dx=\"" << rs.halfX() << "*mm\""
95  << " dy=\"" << rs.halfY() << "*mm\""
96  << " dz=\"" << rs.halfZ() << "*mm\"/>"
97  << std::endl;
98  break;
99  }
100  case ddtubs:
101  {
102  // <Tubs name="TrackerSupportTubeNomex" rMin="[SupportTubeR1]+[Tol]"
103  // rMax="[SupportTubeR2]-[Tol]" dz="[SupportTubeL]"
104  // startPhi="0*deg" deltaPhi="360*deg"/>
105  DDTubs rs(solid);
106  xos << "<Tubs name=\"" << rs.toString() << "\""
107  << " rMin=\"" << rs.rIn() << "*mm\""
108  << " rMax=\"" << rs.rOut() << "*mm\""
109  << " dz=\"" << rs.zhalf() << "*mm\""
110  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
111  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\"/>"
112  << std::endl;
113  break;
114  }
115  case ddtrap:
116  {
117  // <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]"
118  // bl1="[Max_Base_Signal_SideL_3P]/2." tl1="[Up_Min_Base_Signal_SideL_3P]/2." h1="[Up_Height_Signal_SideL_3P]/2."
119  // h2="[Up_Height_Signal_SideL_3P]/2." bl2="[Max_Base_Signal_SideL_3P]/2." tl2="[Up_Min_Base_Signal_SideL_3P]/2."/>
120  DDTrap rs(solid);
121  xos << "<Trapezoid name=\"" << rs.toString() << "\"" //rs.toString() << "\"" //
122  << " dz=\"" << rs.halfZ() << "*mm\""
123  << " theta=\"" << rs.theta()/deg << "*deg\""
124  << " phi=\"" << rs.phi()/deg << "*deg\""
125  << " h1=\"" << rs.y1() << "*mm\""
126  << " bl1=\"" << rs.x1() << "*mm\""
127  << " tl1=\"" << rs.x2() << "*mm\""
128  << " alp1=\"" << rs.alpha1()/deg << "*deg\""
129  << " h2=\"" << rs.y2() << "*mm\""
130  << " bl2=\"" << rs.x3() << "*mm\""
131  << " tl2=\"" << rs.x4() << "*mm\""
132  << " alp2=\"" << rs.alpha2()/deg << "*deg\"/>"
133  << std::endl;
134  break;
135  }
136  case ddcons:
137  {
138  DDCons rs(solid);
139  xos << "<Cone name=\"" << rs.toString() << "\""
140  << " dz=\"" << rs.zhalf() << "*mm\""
141  << " rMin1=\"" << rs.rInMinusZ() << "*mm\""
142  << " rMax1=\"" << rs.rOutMinusZ() << "*mm\""
143  << " rMin2=\"" << rs.rInPlusZ() << "*mm\""
144  << " rMax2=\"" << rs.rOutPlusZ() << "*mm\""
145  << " startPhi=\"" << rs.phiFrom()/deg << "*deg\""
146  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\"/>"
147  << std::endl;
148  break;
149  }
150  case ddpolycone_rz:
151  {
152  DDPolycone rs(solid);
153  xos << "<Polycone name=\"" << rs.toString() << "\""
154  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
155  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\">"
156  << std::endl;
157  const std::vector<double> & zV(rs.zVec());
158  const std::vector<double> & rV(rs.rVec());
159  for ( size_t i = 0; i < zV.size(); ++i ) {
160  xos << "<RZPoint r=\"" << rV[i] << "*mm\""
161  << " z=\"" << zV[i] << "*mm\"/>"
162  << std::endl;
163  }
164  xos << "</Polycone>" << std::endl;
165  break;
166  }
167  case ddpolyhedra_rz:
168  {
169  DDPolyhedra rs(solid);
170  xos << "<Polyhedra name=\"" << rs.toString() << "\""
171  << " numSide=\"" << rs.sides() << "\""
172  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
173  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\">"
174  << std::endl;
175  const std::vector<double> & zV(rs.zVec());
176  const std::vector<double> & rV(rs.rVec());
177  for ( size_t i = 0; i < zV.size(); ++i ) {
178  xos << "<RZPoint r=\"" << rV[i] << "*mm\""
179  << " z=\"" << zV[i] << "*mm\"/>"
180  << std::endl;
181  }
182  xos << "</Polyhedra>" << std::endl;
183  break;
184  }
185  case ddpolycone_rrz:
186  {
187  // <Polycone name="OCMS" startPhi="0*deg" deltaPhi="360*deg" >
188  // <ZSection z="-[CMSZ1]" rMin="[Rmin]" rMax="[CMSR2]" />
189  // <ZSection z="-[HallZ]" rMin="[Rmin]" rMax="[CMSR2]" />
190  // <ZSection z="-[HallZ]" rMin="[Rmin]" rMax="[HallR]" />
191  // <ZSection z="[HallZ]" rMin="[Rmin]" rMax="[HallR]" />
192  // <ZSection z="[HallZ]" rMin="[Rmin]" rMax="[CMSR2]" />
193  // <ZSection z="[CMSZ1]" rMin="[Rmin]" rMax="[CMSR2]" />
194  DDPolycone rs(solid);
195  xos << "<Polycone name=\"" << rs.toString() << "\""
196  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
197  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\">"
198  << std::endl;
199  const std::vector<double> & zV(rs.zVec());
200  const std::vector<double> & rMinV(rs.rMinVec());
201  const std::vector<double> & rMaxV(rs.rMaxVec());
202  for ( size_t i = 0; i < zV.size(); ++i ) {
203  xos << "<ZSection z=\"" << zV[i] << "*mm\""
204  << " rMin=\"" << rMinV[i] << "*mm\""
205  << " rMax=\"" << rMaxV[i] << "*mm\"/>"
206  << std::endl;
207  }
208  xos << "</Polycone>" << std::endl;
209  break;
210  }
211  case ddpolyhedra_rrz:
212  {
213  DDPolyhedra rs(solid);
214  xos << "<Polyhedra name=\"" << rs.toString() << "\""
215  << " numSide=\"" << rs.sides() << "\""
216  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
217  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\">"
218  << std::endl;
219  const std::vector<double> & zV(rs.zVec());
220  const std::vector<double> & rMinV(rs.rMinVec());
221  const std::vector<double> & rMaxV(rs.rMaxVec());
222  for ( size_t i = 0; i < zV.size(); ++i ) {
223  xos << "<ZSection z=\"" << zV[i] << "*mm\""
224  << " rMin=\"" << rMinV[i] << "*mm\""
225  << " rMax=\"" << rMaxV[i] << "*mm\"/>"
226  << std::endl;
227  }
228  xos << "</Polyhedra>" << std::endl;
229  break;
230  }
231  case ddpseudotrap:
232  {
233  // <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"/>
234  DDPseudoTrap rs(solid);
235  xos << "<PseudoTrap name=\"" << rs.toString() << "\""
236  << " dx1=\"" << rs.x1() << "*mm\""
237  << " dx2=\"" << rs.x2() << "*mm\""
238  << " dy1=\"" << rs.y1() << "*mm\""
239  << " dy2=\"" << rs.y2() << "*mm\""
240  << " dz=\"" << rs.halfZ() << "*mm\""
241  << " radius=\"" << rs.radius() << "*mm\""
242  << " atMinusZ=\"" << ( rs.atMinusZ() ? "true" : "false" ) << "\"/>"
243  << std::endl;
244  break;
245  }
246  case ddtrunctubs:
247  {
248  // <TruncTubs name="trunctubs1" zHalf="50*cm" rMin="20*cm" rMax="40*cm" startPhi="0*deg" deltaPhi="90*deg" cutAtStart="25*cm" cutAtDelta="35*cm"/>
249  DDTruncTubs rs(solid);
250  xos << "<TruncTubs name=\"" << rs.toString() << "\""
251  << " zHalf=\"" << rs.zHalf() << "*mm\""
252  << " rMin=\"" << rs.rIn() << "*mm\""
253  << " rMax=\"" << rs.rOut() << "*mm\""
254  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
255  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\""
256  << " cutAtStart=\"" << rs.cutAtStart() << "*mm\""
257  << " cutAtDelta=\"" << rs.cutAtDelta() << "*mm\""
258  << " cutInside=\"" << ( rs.cutInside() ? "true" : "false" ) << "\"/>"
259  << std::endl;
260  break;
261  }
262  case ddshapeless:
263  {
264  DDShapelessSolid rs(solid);
265  xos << "<ShapelessSolid name=\"" << rs.toString() << "\"/>"
266  << std::endl;
267  break;
268  }
269  case ddtorus:
270  {
271  // <Torus name="torus" innerRadius="7.5*cm" outerRadius="10*cm" torusRadius="30*cm" startPhi="0*deg" deltaPhi="360*deg"/>
272  DDTorus rs(solid);
273  xos << "<Torus name=\"" << rs.toString() << "\""
274  << " innerRadius=\"" << rs.rMin() << "*mm\""
275  << " outerRadius=\"" << rs.rMax() << "*mm\""
276  << " torusRadius=\"" << rs.rTorus() << "*mm\""
277  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
278  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\"/>"
279  << std::endl;
280  break;
281  }
282  case ddcuttubs:
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  }
306  case ddextrudedpolygon:
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("") );
326  case dd_not_init:
327  default:
328  throw cms::Exception("DDException") << "DDCoreToDDXMLOutput::solid(...) either not inited or no such solid.";
329  break;
330  }
331 }
A truncated tube section.
Definition: DDSolid.h:134
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:144
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.