CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 25 of file DDCoreToDDXMLOutput.h.

Member Function Documentation

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

Definition at line 360 of file DDCoreToDDXMLOutput.cc.

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

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

361 {
362  xos << "<LogicalPart name=\"" << lp.toString() << "\">" << std::endl;
363  xos << "<rSolid name=\"" << lp.solid().toString() << "\"/>" << std::endl;
364  xos << "<rMaterial name=\"" << lp.material().toString() << "\"/>" << std::endl;
365  xos << "</LogicalPart>" << std::endl;
366 }
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:86
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 280 of file DDCoreToDDXMLOutput.cc.

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

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

281 {
282  int noc = material.noOfConstituents();
283  if( noc == 0 )
284  {
285  xos << "<ElementaryMaterial name=\"" << material.toString() << "\""
286  << " density=\""
287  << std::scientific << std::setprecision(5)
288  << material.density() / mg * cm3 << "*mg/cm3\""
289  << " atomicWeight=\""
290  << std::fixed
291  << material.a() / g * mole << "*g/mole\""
292  << std::setprecision(0) << std::fixed << " atomicNumber=\"" << material.z() << "\"/>"
293  << std::endl;
294  }
295  else
296  {
297  xos << "<CompositeMaterial name=\"" << material.toString() << "\""
298  << " density=\""
299  << std::scientific << std::setprecision(5)
300  << material.density() / mg * cm3 << "*mg/cm3\""
301  << " method=\"mixture by weight\">" << std::endl;
302 
303  int j=0;
304  for (; j<noc; ++j)
305  {
306  xos << "<MaterialFraction fraction=\""
307  << std::fixed << std::setprecision(9)
308  << material.constituent(j).second << "\">" << std::endl;
309  xos << "<rMaterial name=\"" << material.constituent(j).first.name() << "\"/>" << std::endl;
310  xos << "</MaterialFraction>" << std::endl;
311  }
312  xos << "</CompositeMaterial>" << std::endl;
313  }
314  // return temp;
315 }
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:89
int j
Definition: DBlmapReader.cc:9
std::string toString() const
Definition: DDBase.h:86
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:83
void DDCoreToDDXMLOutput::position ( const DDLogicalPart parent,
const DDLogicalPart child,
DDPosData edgeToChild,
int &  rotNameSeed,
std::ostream &  xos 
)

Definition at line 368 of file DDCoreToDDXMLOutput.cc.

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

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

374 {
375  std::string rotName = edgeToChild->rot_.toString();
376  DDRotationMatrix myIDENT;
377 
378  xos << "<PosPart copyNumber=\"" << edgeToChild->copyno_ << "\">" << std::endl;
379  xos << "<rParent name=\"" << parent.toString() << "\"/>" << std::endl;
380  xos << "<rChild name=\"" << child.toString() << "\"/>" << std::endl;
381  if( *(edgeToChild->rot_.matrix()) != myIDENT )
382  {
383  if( rotName == ":" )
384  {
385  rotation(edgeToChild->rot_, xos);
386  }
387  else
388  {
389  xos << "<rRotation name=\"" << rotName << "\"/>" << std::endl;
390  }
391  } // else let default Rotation matrix be created?
392  // xos << std::fixed << std::setprecision(4);
393  xos << "<Translation x=\"" << edgeToChild->translation().x() <<"*mm\""
394  << " y=\"" << edgeToChild->translation().y() <<"*mm\""
395  << " z=\"" << edgeToChild->translation().z() <<"*mm\"/>" << std::endl;
396  // xos << std::fixed << std::setprecision(6);
397  xos << "</PosPart>" << std::endl;
398 }
void rotation(DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
int copyno_
Definition: DDPosData.h:52
std::string toString() const
Definition: DDBase.h:86
const DDTranslation & translation() const
Definition: DDPosData.h:37
DDRotationMatrix * matrix()
Definition: DDTransform.h:94
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
DDRotation rot_
Definition: DDPosData.h:49
void DDCoreToDDXMLOutput::rotation ( DDRotation rotation,
std::ostream &  xos,
const std::string &  rotn = "" 
)

Definition at line 317 of file DDCoreToDDXMLOutput.cc.

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

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

318 {
319  double tol = 1.0e-3; // Geant4 compatible
320  DD3Vector x,y,z;
321  rotation.matrix()->GetComponents(x,y,z);
322  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system
323  // this must be -1
324  bool reflection((1.-check)>tol);
325  std::string rotName=rotation.toString();
326  if( rotName == ":" )
327  {
328  if( rotn != "" )
329  {
330  rotName = rotn;
331  std::cout << "about to try to make a new DDRotation... should fail!" << std::endl;
332  DDRotation rot( DDName(rotn), rotation.matrix() );
333  std:: cout << "new rotation: " << rot << std::endl;
334  }
335  else
336  {
337  std::cout << "WARNING: MAKING AN UNNAMED ROTATION" << std::endl;
338  }
339  }
340  if( !reflection )
341  {
342  xos << "<Rotation ";
343  }
344  else
345  {
346  xos << "<ReflectionRotation ";
347  }
348  // xos << std::fixed << std::setprecision(4);
349  xos << "name=\"" << rotName << "\""
350  << " phiX=\"" << x.phi()/deg << "*deg\""
351  << " thetaX=\"" << x.theta()/deg << "*deg\""
352  << " phiY=\"" << y.phi()/deg << "*deg\""
353  << " thetaY=\"" << y.theta()/deg << "*deg\""
354  << " phiZ=\"" << z.phi()/deg << "*deg\""
355  << " thetaZ=\"" << z.theta()/deg << "*deg\"/>"
356  << std::endl;
357  // xos << std::fixed << std::setprecision(6);
358 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
float float float z
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
bool check(const std::string &)
std::string toString() const
Definition: DDBase.h:86
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
DDRotationMatrix * matrix()
Definition: DDTransform.h:94
void DDCoreToDDXMLOutput::solid ( const DDSolid solid,
std::ostream &  xos 
)

Definition at line 15 of file DDCoreToDDXMLOutput.cc.

References DDTrap::alpha1(), DDTrap::alpha2(), DDPseudoTrap::atMinusZ(), DDTruncTubs::cutAtDelta(), DDTruncTubs::cutAtStart(), DDTruncTubs::cutInside(), dd_not_init, ddbox, ddcons, 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(), DDCons::deltaPhi(), DDTorus::deltaPhi(), Exception, DDBox::halfX(), DDBox::halfY(), DDTrap::halfZ(), DDPseudoTrap::halfZ(), DDBox::halfZ(), i, DDTrap::phi(), DDCons::phiFrom(), DDPseudoTrap::radius(), DDTruncTubs::rIn(), DDTubs::rIn(), DDCons::rInMinusZ(), DDCons::rInPlusZ(), DDTorus::rMax(), DDPolycone::rMaxVec(), DDPolyhedra::rMaxVec(), DDTorus::rMin(), DDPolycone::rMinVec(), DDPolyhedra::rMinVec(), DDBooleanSolid::rotation(), DDTruncTubs::rOut(), DDTubs::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(), 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(), DDCons::zhalf(), DDPolycone::zVec(), and DDPolyhedra::zVec().

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

16 {
17  switch( solid.shape())
18  {
19  case ddunion:
20  case ddsubtraction:
21  case ddintersection:
22  {
23  DDBooleanSolid rs( solid );
24  if( solid.shape() == ddunion )
25  {
26  xos << "<UnionSolid ";
27  }
28  else if( solid.shape() == ddsubtraction )
29  {
30  xos << "<SubtractionSolid ";
31  }
32  else if( solid.shape() == ddintersection )
33  {
34  xos << "<IntersectionSolid ";
35  }
36  xos << "name=\"" << rs.toString() << "\">" << std::endl;
37  // if translation is == identity there are no parameters.
38  // if there is no rotation the name will be ":"
39  xos << "<rSolid name=\"" << rs.solidA().toString() << "\"/>" << std::endl;
40  xos << "<rSolid name=\"" << rs.solidB().toString() << "\"/>" << std::endl;
41  xos << "<Translation x=\"" << rs.translation().X() << "*mm\"";
42  xos << " y=\"" << rs.translation().Y() << "*mm\"";
43  xos << " z=\"" << rs.translation().Z() << "*mm\"";
44  xos << "/>" << std::endl;
45  std::string rotName = rs.rotation().toString();
46  if( rotName == ":" )
47  {
48  rotName = "gen:ID";
49  }
50  xos << "<rRotation name=\"" << rs.rotation().toString() << "\"/>" << std::endl;
51  if( solid.shape() == ddunion )
52  {
53  xos << "</UnionSolid>" << std::endl;
54  }
55  else if( solid.shape() == ddsubtraction )
56  {
57  xos << "</SubtractionSolid>" << std::endl;
58  }
59  else if( solid.shape() == ddintersection )
60  {
61  xos << "</IntersectionSolid>" << std::endl;
62  }
63  break;
64  }
65  case ddreflected:
66  {
67  /*
68  <ReflectionSolid name="trd2mirror">
69  <rSolid name="trd2"/>
70  </ReflectionSolid>
71  */
72  DDReflectionSolid rs(solid);
73  xos << "<ReflectionSolid name=\"" << rs.toString() << "\">" << std::endl;
74  xos << "<rSolid name=\"" << rs.unreflected().toString() << "\">" << std::endl;
75  xos << "</ReflectionSolid>" << std::endl;
76  break;
77  }
78  case ddbox:
79  {
80  // <Box name="box1" dx="10*cm" dy="10*cm" dz="10*cm"/>
81  DDBox rs(solid);
82  xos << "<Box name=\"" << rs.toString() << "\"" //<< rs.toString() << "\"" //
83  << " dx=\"" << rs.halfX() << "*mm\""
84  << " dy=\"" << rs.halfY() << "*mm\""
85  << " dz=\"" << rs.halfZ() << "*mm\"/>"
86  << std::endl;
87  break;
88  }
89  case ddtubs:
90  {
91  // <Tubs name="TrackerSupportTubeNomex" rMin="[SupportTubeR1]+[Tol]"
92  // rMax="[SupportTubeR2]-[Tol]" dz="[SupportTubeL]"
93  // startPhi="0*deg" deltaPhi="360*deg"/>
94  DDTubs rs(solid);
95  xos << "<Tubs name=\"" << rs.toString() << "\""
96  << " rMin=\"" << rs.rIn() << "*mm\""
97  << " rMax=\"" << rs.rOut() << "*mm\""
98  << " dz=\"" << rs.zhalf() << "*mm\""
99  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
100  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\"/>"
101  << std::endl;
102  break;
103  }
104  case ddtrap:
105  {
106  // <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]"
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() << "\"" //rs.toString() << "\"" //
111  << " dz=\"" << rs.halfZ() << "*mm\""
112  << " theta=\"" << rs.theta()/deg << "*deg\""
113  << " phi=\"" << rs.phi()/deg << "*deg\""
114  << " h1=\"" << rs.y1() << "*mm\""
115  << " bl1=\"" << rs.x1() << "*mm\""
116  << " tl1=\"" << rs.x2() << "*mm\""
117  << " alp1=\"" << rs.alpha1()/deg << "*deg\""
118  << " h2=\"" << rs.y2() << "*mm\""
119  << " bl2=\"" << rs.x3() << "*mm\""
120  << " tl2=\"" << rs.x4() << "*mm\""
121  << " alp2=\"" << rs.alpha2()/deg << "*deg\"/>"
122  << std::endl;
123  break;
124  }
125  case 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=\"" << rs.phiFrom()/deg << "*deg\""
135  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\"/>"
136  << std::endl;
137  break;
138  }
139  case ddpolycone_rz:
140  {
141  DDPolycone rs(solid);
142  xos << "<Polycone name=\"" << rs.toString() << "\""
143  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
144  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*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  }
156  case ddpolyhedra_rz:
157  {
158  DDPolyhedra rs(solid);
159  xos << "<Polyhedra name=\"" << rs.toString() << "\""
160  << " numSide=\"" << rs.sides() << "\""
161  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
162  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*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  }
174  case ddpolycone_rrz:
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=\"" << rs.startPhi()/deg << "*deg\""
186  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*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  }
200  case ddpolyhedra_rrz:
201  {
202  DDPolyhedra rs(solid);
203  xos << "<Polyhedra name=\"" << rs.toString() << "\""
204  << " numSide=\"" << rs.sides() << "\""
205  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
206  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*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  }
220  case ddpseudotrap:
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  }
235  case ddtrunctubs:
236  {
237  // <TruncTubs name="trunctubs1" zHalf="50*cm" rMin="20*cm" rMax="40*cm" startPhi="0*deg" deltaPhi="90*deg" cutAtStart="25*cm" cutAtDelta="35*cm"/>
238  DDTruncTubs rs(solid);
239  xos << "<TruncTubs name=\"" << rs.toString() << "\""
240  << " zHalf=\"" << rs.zHalf() << "*mm\""
241  << " rMin=\"" << rs.rIn() << "*mm\""
242  << " rMax=\"" << rs.rOut() << "*mm\""
243  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
244  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\""
245  << " cutAtStart=\"" << rs.cutAtStart() << "*mm\""
246  << " cutAtDelta=\"" << rs.cutAtDelta() << "*mm\""
247  << " cutInside=\"" << ( rs.cutInside() ? "true" : "false" ) << "\"/>"
248  << std::endl;
249  break;
250  }
251  case ddshapeless:
252  {
253  DDShapelessSolid rs(solid);
254  xos << "<ShapelessSolid name=\"" << rs.toString() << "\"/>"
255  << std::endl;
256  break;
257  }
258  case ddtorus:
259  {
260  // <Torus name="torus" innerRadius="7.5*cm" outerRadius="10*cm" torusRadius="30*cm" startPhi="0*deg" deltaPhi="360*deg"/>
261  DDTorus rs(solid);
262  xos << "<Torus name=\"" << rs.toString() << "\""
263  << " innerRadius=\"" << rs.rMin() << "*mm\""
264  << " outerRadius=\"" << rs.rMax() << "*mm\""
265  << " torusRadius=\"" << rs.rTorus() << "*mm\""
266  << " startPhi=\"" << rs.startPhi()/deg << "*deg\""
267  << " deltaPhi=\"" << rs.deltaPhi()/deg << "*deg\"/>"
268  << std::endl;
269  break;
270  }
271  // return new PSolid( pstrs(solid.toString()), solid.parameters()
272  // , solid.shape(), pstrs(""), pstrs(""), pstrs("") );
273  case dd_not_init:
274  default:
275  throw cms::Exception("DDException") << "DDCoreToDDXMLOutput::solid(...) either not inited or no such solid.";
276  break;
277  }
278 }
int i
Definition: DBlmapReader.cc:9
A truncated tube section.
Definition: DDSolid.h:132
This is simply a handle on the solid.
Definition: DDSolid.h:175
Interface to a Trapezoid.
Definition: DDSolid.h:77
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
Interface to a Box.
Definition: DDSolid.h:162
void DDCoreToDDXMLOutput::specpar ( const DDSpecifics sp,
std::ostream &  xos 
)

Definition at line 401 of file DDCoreToDDXMLOutput.cc.

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

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

402 {
403  xos << "<SpecPar name=\"" << sp.toString() << "\" eval=\"false\">" << std::endl;
404 
405  // ========... all the selection strings out as strings by using the DDPartSelection's std::ostream function...
406  const std::vector<DDPartSelection> sels = sp.selection();
407  std::vector<DDPartSelection>::const_iterator psit = sels.begin();
408  std::vector<DDPartSelection>::const_iterator psendit = sels.end();
409  for(; psit != psendit ; ++psit)
410  {
411  xos << "<PartSelector path=\"" << *psit << "\"/>" << std::endl;
412  }
413 
414  // ========= ... and iterate over all DDValues...
415  DDsvalues_type::const_iterator vit(sp.specifics().begin()), ved(sp.specifics().end());
416  for(; vit != ved; ++vit)
417  {
418  const DDValue & v = vit->second;
419  size_t s=v.size();
420  size_t i=0;
421  // ============ ... all actual values with the same name
422  const std::vector<std::string>& strvec = v.strings();
423  if( v.isEvaluated())
424  {
425  for(; i<s; ++i)
426  {
427  xos << "<Parameter name=\"" << v.name() << "\""
428  << " value=\"" << v[i] << "\""
429  << " eval=\"true\"/>" << std::endl;
430  }
431  }
432  else
433  {
434  for(; i<s; ++i )
435  {
436  xos << "<Parameter name=\"" << v.name() << "\""
437  << " value=\"" << strvec[i] << "\""
438  << " eval=\"false\"/>" << std::endl;
439  }
440  }
441 
442  }
443  xos << "</SpecPar>" << std::endl;
444 }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:55
int i
Definition: DBlmapReader.cc:9
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:203
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:62
std::string toString() const
Definition: DDBase.h:86
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:59
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:69
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:53
void DDCoreToDDXMLOutput::specpar ( const std::pair< DDsvalues_type, std::set< const DDPartSelection * > > &  pssv,
std::ostream &  xos 
)

Definition at line 446 of file DDCoreToDDXMLOutput.cc.

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

447 {
448  static std::string madeName("specparname");
449  static int numspecpars(0);
450  std::ostringstream ostr;
451  ostr << numspecpars++;
452  std::string spname = madeName + ostr.str();
453  xos << "<SpecPar name=\"" << spname << "\" eval=\"false\">" << std::endl;
454  std::set<const DDPartSelection*>::const_iterator psit = pssv.second.begin();
455  std::set<const DDPartSelection*>::const_iterator psendit = pssv.second.end();
456  for (; psit != psendit; ++psit) {
457  xos << "<PartSelector path=\"" << *(*psit) << "\"/>" << std::endl;
458  }
459 
460  // ========= ... and iterate over all DDValues...
461 
462  DDsvalues_type::const_iterator vit(pssv.first.begin()), ved(pssv.first.end());
463  for(; vit != ved; ++vit)
464  {
465  const DDValue & v = vit->second;
466  size_t s=v.size();
467  size_t i=0;
468  // ============ ... all actual values with the same name
469  const std::vector<std::string>& strvec = v.strings();
470  if( v.isEvaluated() )
471  {
472  for(; i<s; ++i)
473  {
474  xos << "<Parameter name=\"" << v.name() << "\""
475  << " value=\"" << v[i] << "\""
476  << " eval=\"true\"/>" << std::endl;
477  }
478  }
479  else
480  {
481  for(; i<s; ++i )
482  {
483  xos << "<Parameter name=\"" << v.name() << "\""
484  << " value=\"" << strvec[i] << "\""
485  << " eval=\"false\"/>" << std::endl;
486  }
487  }
488  }
489 
490  xos << "</SpecPar>" << std::endl;
491 }
const std::string & name(void) const
the name of the DDValue
Definition: DDValue.h:55
int i
Definition: DBlmapReader.cc:9
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
Definition: DDValue.cc:203
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:62
unsigned int size() const
the size of the stored value-pairs (std::string,double)
Definition: DDValue.h:69

Member Data Documentation

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

Definition at line 46 of file DDCoreToDDXMLOutput.h.