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

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

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

358 {
359  xos << "<LogicalPart name=\"" << lp.toString() << "\">" << std::endl;
360  xos << "<rSolid name=\"" << lp.solid().toString() << "\"/>" << std::endl;
361  xos << "<rMaterial name=\"" << lp.material().toString() << "\"/>" << std::endl;
362  xos << "</LogicalPart>" << std::endl;
363 }
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 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 }
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: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:83
void DDCoreToDDXMLOutput::position ( const DDLogicalPart parent,
const DDLogicalPart child,
DDPosData edgeToChild,
int &  rotNameSeed,
std::ostream &  xos 
)

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

370 {
371  std::string rotName = edgeToChild->rot_.toString();
372  DDRotationMatrix myIDENT;
373 
374  xos << "<PosPart copyNumber=\"" << edgeToChild->copyno_ << "\">" << std::endl;
375  xos << "<rParent name=\"" << parent.toString() << "\"/>" << std::endl;
376  xos << "<rChild name=\"" << child.toString() << "\"/>" << std::endl;
377  if( *(edgeToChild->rot_.matrix()) != myIDENT )
378  {
379  if( rotName == ":" )
380  {
381  rotation(edgeToChild->rot_, xos);
382  }
383  else
384  {
385  xos << "<rRotation name=\"" << rotName << "\"/>" << std::endl;
386  }
387  } // else let default Rotation matrix be created?
388  xos << "<Translation x=\"" << edgeToChild->translation().x() <<"*mm\""
389  << " y=\"" << edgeToChild->translation().y() <<"*mm\""
390  << " z=\"" << edgeToChild->translation().z() <<"*mm\"/>" << std::endl;
391  xos << "</PosPart>" << std::endl;
392 }
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:94
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 316 of file DDCoreToDDXMLOutput.cc.

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

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

317 {
318  double tol = 1.0e-3; // Geant4 compatible
319  DD3Vector x,y,z;
320  rotation.matrix()->GetComponents(x,y,z);
321  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system
322  // this must be -1
323  bool reflection((1.-check)>tol);
324  std::string rotName=rotation.toString();
325  if( rotName == ":" )
326  {
327  if( rotn != "" )
328  {
329  rotName = rotn;
330  std::cout << "about to try to make a new DDRotation... should fail!" << std::endl;
331  DDRotation rot( DDName(rotn), rotation.matrix() );
332  std:: cout << "new rotation: " << rot << std::endl;
333  }
334  else
335  {
336  std::cout << "WARNING: MAKING AN UNNAMED ROTATION" << std::endl;
337  }
338  }
339  if( !reflection )
340  {
341  xos << "<Rotation ";
342  }
343  else
344  {
345  xos << "<ReflectionRotation ";
346  }
347  xos << "name=\"" << rotName << "\""
348  << " phiX=\"" << x.phi()/deg << "*deg\""
349  << " thetaX=\"" << x.theta()/deg << "*deg\""
350  << " phiY=\"" << y.phi()/deg << "*deg\""
351  << " thetaY=\"" << y.theta()/deg << "*deg\""
352  << " phiZ=\"" << z.phi()/deg << "*deg\""
353  << " thetaZ=\"" << z.theta()/deg << "*deg\"/>"
354  << std::endl;
355 }
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
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:82
tuple cout
Definition: gather_cfg.py:121
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 395 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().

396 {
397  xos << "<SpecPar name=\"" << sp.toString() << "\" eval=\"false\">" << std::endl;
398 
399  // ========... all the selection strings out as strings by using the DDPartSelection's std::ostream function...
400  for( const auto& psit : sp.selection())
401  {
402  xos << "<PartSelector path=\"" << psit << "\"/>" << std::endl;
403  }
404 
405  // ========= ... and iterate over all DDValues...
406  for( const auto& vit : sp.specifics())
407  {
408  const DDValue & v = vit.second;
409  size_t s=v.size();
410  size_t i=0;
411  // ============ ... all actual values with the same name
412  const std::vector<std::string>& strvec = v.strings();
413  if( v.isEvaluated())
414  {
415  for(; i<s; ++i)
416  {
417  xos << "<Parameter name=\"" << v.name() << "\""
418  << " value=\"" << v[i] << "\""
419  << " eval=\"true\"/>" << std::endl;
420  }
421  }
422  else
423  {
424  for(; i<s; ++i )
425  {
426  xos << "<Parameter name=\"" << v.name() << "\""
427  << " value=\"" << strvec[i] << "\""
428  << " eval=\"false\"/>" << std::endl;
429  }
430  }
431 
432  }
433  xos << "</SpecPar>" << std::endl;
434 }
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: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:43
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:38
void DDCoreToDDXMLOutput::specpar ( const std::pair< DDsvalues_type, std::set< const DDPartSelection * > > &  pssv,
std::ostream &  xos 
)

Definition at line 436 of file DDCoreToDDXMLOutput.cc.

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

437 {
438  static const std::string madeName("specparname");
439  static int numspecpars(0);
440  std::ostringstream ostr;
441  ostr << numspecpars++;
442  std::string spname = madeName + ostr.str();
443  xos << "<SpecPar name=\"" << spname << "\" eval=\"false\">" << std::endl;
444  for( const auto& psit : pssv.second ) {
445  xos << "<PartSelector path=\"" << *psit << "\"/>" << std::endl;
446  }
447 
448  // ========= ... and iterate over all DDValues...
449  for( const auto& vit : pssv.first )
450  {
451  const DDValue & v = vit.second;
452  size_t s=v.size();
453  size_t i=0;
454  // ============ ... all actual values with the same name
455  const std::vector<std::string>& strvec = v.strings();
456  if( v.isEvaluated() )
457  {
458  for(; i<s; ++i)
459  {
460  xos << "<Parameter name=\"" << v.name() << "\""
461  << " value=\"" << v[i] << "\""
462  << " eval=\"true\"/>" << std::endl;
463  }
464  }
465  else
466  {
467  for(; i<s; ++i )
468  {
469  xos << "<Parameter name=\"" << v.name() << "\""
470  << " value=\"" << strvec[i] << "\""
471  << " eval=\"false\"/>" << std::endl;
472  }
473  }
474  }
475 
476  xos << "</SpecPar>" << std::endl;
477 }
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.