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

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

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

393 {
394  xos << "<LogicalPart name=\"" << lp.toString() << "\">" << std::endl;
395  xos << "<rSolid name=\"" << lp.solid().toString() << "\"/>" << std::endl;
396  xos << "<rMaterial name=\"" << lp.material().toString() << "\"/>" << std::endl;
397  xos << "</LogicalPart>" << std::endl;
398 }
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 315 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().

316 {
317  int noc = material.noOfConstituents();
318  if( noc == 0 )
319  {
320  xos << "<ElementaryMaterial name=\"" << material.toString() << "\""
321  << " density=\""
322  << std::scientific << std::setprecision(5)
323  << material.density() / mg * cm3 << "*mg/cm3\""
324  << " atomicWeight=\""
325  << std::fixed
326  << material.a() / g * mole << "*g/mole\""
327  << std::setprecision(0) << std::fixed << " atomicNumber=\"" << material.z() << "\"/>"
328  << std::endl;
329  }
330  else
331  {
332  xos << "<CompositeMaterial name=\"" << material.toString() << "\""
333  << " density=\""
334  << std::scientific << std::setprecision(5)
335  << material.density() / mg * cm3 << "*mg/cm3\""
336  << " method=\"mixture by weight\">" << std::endl;
337 
338  int j=0;
339  for (; j<noc; ++j)
340  {
341  xos << "<MaterialFraction fraction=\""
342  << std::fixed << std::setprecision(9)
343  << material.constituent(j).second << "\">" << std::endl;
344  xos << "<rMaterial name=\"" << material.constituent(j).first.name() << "\"/>" << std::endl;
345  xos << "</MaterialFraction>" << std::endl;
346  }
347  xos << "</CompositeMaterial>" << std::endl;
348  }
349 }
double a() const
returns the atomic mass
Definition: DDMaterial.cc:97
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:103
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
Definition: DDMaterial.cc:91
std::string toString() const
Definition: DDBase.h:82
double density() const
returns the density
Definition: DDMaterial.cc:109
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
Definition: DDMaterial.cc:85
void DDCoreToDDXMLOutput::position ( const DDLogicalPart parent,
const DDLogicalPart child,
DDPosData edgeToChild,
int &  rotNameSeed,
std::ostream &  xos 
)

Definition at line 400 of file DDCoreToDDXMLOutput.cc.

References DDPosData::copyno_, DDRotation::matrix(), DDPosData::rot_, rotation(), AlCaHLTBitMon_QueryRunRegistry::string, DDBase< N, C >::toString(), and DDPosData::translation().

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

405 {
406  std::string rotName = edgeToChild->rot_.toString();
407  DDRotationMatrix myIDENT;
408 
409  xos << "<PosPart copyNumber=\"" << edgeToChild->copyno_ << "\">" << std::endl;
410  xos << "<rParent name=\"" << parent.toString() << "\"/>" << std::endl;
411  xos << "<rChild name=\"" << child.toString() << "\"/>" << std::endl;
412  if( *(edgeToChild->rot_.matrix()) != myIDENT )
413  {
414  if( rotName == ":" )
415  {
416  rotation(edgeToChild->rot_, xos);
417  }
418  else
419  {
420  xos << "<rRotation name=\"" << rotName << "\"/>" << std::endl;
421  }
422  } // else let default Rotation matrix be created?
423  xos << "<Translation x=\"" << edgeToChild->translation().x() <<"*mm\""
424  << " y=\"" << edgeToChild->translation().y() <<"*mm\""
425  << " z=\"" << edgeToChild->translation().z() <<"*mm\"/>" << std::endl;
426  xos << "</PosPart>" << std::endl;
427 }
void rotation(DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
int copyno_
Definition: DDPosData.h:38
std::string toString() const
Definition: DDBase.h:82
const DDTranslation & translation() const
Definition: DDPosData.h:27
DDRotationMatrix * matrix()
Definition: DDTransform.h:92
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
DDRotation rot_
Definition: DDPosData.h:37
void DDCoreToDDXMLOutput::rotation ( DDRotation rotation,
std::ostream &  xos,
const std::string &  rotn = "" 
)

Definition at line 351 of file DDCoreToDDXMLOutput.cc.

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

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

352 {
353  double tol = 1.0e-3; // Geant4 compatible
354  DD3Vector x,y,z;
355  rotation.matrix()->GetComponents(x,y,z);
356  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system
357  // this must be -1
358  bool reflection((1.-check)>tol);
359  std::string rotName=rotation.toString();
360  if( rotName == ":" )
361  {
362  if( rotn != "" )
363  {
364  rotName = rotn;
365  std::cout << "about to try to make a new DDRotation... should fail!" << std::endl;
366  DDRotation rot( DDName(rotn), rotation.matrix() );
367  std:: cout << "new rotation: " << rot << std::endl;
368  }
369  else
370  {
371  std::cout << "WARNING: MAKING AN UNNAMED ROTATION" << std::endl;
372  }
373  }
374  if( !reflection )
375  {
376  xos << "<Rotation ";
377  }
378  else
379  {
380  xos << "<ReflectionRotation ";
381  }
382  xos << "name=\"" << rotName << "\""
383  << " phiX=\"" << x.phi()/deg << "*deg\""
384  << " thetaX=\"" << x.theta()/deg << "*deg\""
385  << " phiY=\"" << y.phi()/deg << "*deg\""
386  << " thetaY=\"" << y.theta()/deg << "*deg\""
387  << " phiZ=\"" << z.phi()/deg << "*deg\""
388  << " thetaZ=\"" << z.theta()/deg << "*deg\"/>"
389  << std::endl;
390 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
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
DDRotationMatrix * matrix()
Definition: DDTransform.h:92
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, 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, 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(), DDTrap::x1(), DDPseudoTrap::x1(), DDTrap::x2(), DDPseudoTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDTrap::y1(), DDPseudoTrap::y1(), DDTrap::y2(), DDPseudoTrap::y2(), DDTruncTubs::zHalf(), DDTubs::zhalf(), DDCutTubs::zhalf(), DDCons::zhalf(), DDPolycone::zVec(), and DDPolyhedra::zVec().

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  // return new PSolid( pstrs(solid.toString()), solid.parameters()
307  // , solid.shape(), pstrs(""), pstrs(""), pstrs("") );
308  case dd_not_init:
309  default:
310  throw cms::Exception("DDException") << "DDCoreToDDXMLOutput::solid(...) either not inited or no such solid.";
311  break;
312  }
313 }
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:140
Interface to a Box.
Definition: DDSolid.h:164
void DDCoreToDDXMLOutput::specpar ( const DDSpecifics sp,
std::ostream &  xos 
)

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

431 {
432  xos << "<SpecPar name=\"" << sp.toString() << "\" eval=\"false\">" << std::endl;
433 
434  // ========... all the selection strings out as strings by using the DDPartSelection's std::ostream function...
435  for( const auto& psit : sp.selection())
436  {
437  xos << "<PartSelector path=\"" << psit << "\"/>" << std::endl;
438  }
439 
440  // ========= ... and iterate over all DDValues...
441  for( const auto& vit : sp.specifics())
442  {
443  const DDValue & v = vit.second;
444  size_t s=v.size();
445  size_t i=0;
446  // ============ ... all actual values with the same name
447  const std::vector<std::string>& strvec = v.strings();
448  if( v.isEvaluated())
449  {
450  for(; i<s; ++i)
451  {
452  xos << "<Parameter name=\"" << v.name() << "\""
453  << " value=\"" << v[i] << "\""
454  << " eval=\"true\"/>" << std::endl;
455  }
456  }
457  else
458  {
459  for(; i<s; ++i )
460  {
461  xos << "<Parameter name=\"" << v.name() << "\""
462  << " value=\"" << strvec[i] << "\""
463  << " eval=\"false\"/>" << std::endl;
464  }
465  }
466 
467  }
468  xos << "</SpecPar>" << std::endl;
469 }
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:201
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:49
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 471 of file DDCoreToDDXMLOutput.cc.

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

472 {
473  static const std::string madeName("specparname");
474  static int numspecpars(0);
475  std::ostringstream ostr;
476  ostr << numspecpars++;
477  std::string spname = madeName + ostr.str();
478  xos << "<SpecPar name=\"" << spname << "\" eval=\"false\">" << std::endl;
479  for( const auto& psit : pssv.second ) {
480  xos << "<PartSelector path=\"" << *psit << "\"/>" << std::endl;
481  }
482 
483  // ========= ... and iterate over all DDValues...
484  for( const auto& vit : pssv.first )
485  {
486  const DDValue & v = vit.second;
487  size_t s=v.size();
488  size_t i=0;
489  // ============ ... all actual values with the same name
490  const std::vector<std::string>& strvec = v.strings();
491  if( v.isEvaluated() )
492  {
493  for(; i<s; ++i)
494  {
495  xos << "<Parameter name=\"" << v.name() << "\""
496  << " value=\"" << v[i] << "\""
497  << " eval=\"true\"/>" << std::endl;
498  }
499  }
500  else
501  {
502  for(; i<s; ++i )
503  {
504  xos << "<Parameter name=\"" << v.name() << "\""
505  << " value=\"" << strvec[i] << "\""
506  << " eval=\"false\"/>" << std::endl;
507  }
508  }
509  }
510 
511  xos << "</SpecPar>" << std::endl;
512 }
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:201
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.