16 #include "Math/GenVector/Cartesian3D.h" 17 #include "Math/GenVector/DisplacementVector3D.h" 18 #include "Math/GenVector/Rotation3D.h" 29 switch( solid.
shape())
38 xos <<
"<UnionSolid ";
42 xos <<
"<SubtractionSolid ";
46 xos <<
"<IntersectionSolid ";
48 xos <<
"name=\"" << rs.
toString() <<
"\">" << std::endl;
51 xos <<
"<rSolid name=\"" << rs.
solidA().
toString() <<
"\"/>" << std::endl;
52 xos <<
"<rSolid name=\"" << rs.
solidB().
toString() <<
"\"/>" << std::endl;
53 xos <<
"<Translation x=\"" << rs.
translation().X() <<
"*mm\"";
56 xos <<
"/>" << std::endl;
62 xos <<
"<rRotation name=\"" << rs.
rotation().
toString() <<
"\"/>" << std::endl;
65 xos <<
"</UnionSolid>" << std::endl;
69 xos <<
"</SubtractionSolid>" << std::endl;
73 xos <<
"</IntersectionSolid>" << std::endl;
81 xos <<
"<Box name=\"" << rs.
toString() <<
"\"" 82 <<
" dx=\"" << rs.
halfX() <<
"*mm\"" 83 <<
" dy=\"" << rs.
halfY() <<
"*mm\"" 84 <<
" dz=\"" << rs.
halfZ() <<
"*mm\"/>" 94 xos <<
"<Tubs name=\"" << rs.
toString() <<
"\"" 95 <<
" rMin=\"" << rs.
rIn() <<
"*mm\"" 96 <<
" rMax=\"" << rs.
rOut() <<
"*mm\"" 97 <<
" dz=\"" << rs.
zhalf() <<
"*mm\"" 110 xos <<
"<Trapezoid name=\"" << rs.
toString() <<
"\"" 111 <<
" dz=\"" << rs.
halfZ() <<
"*mm\"" 114 <<
" h1=\"" << rs.
y1() <<
"*mm\"" 115 <<
" bl1=\"" << rs.
x1() <<
"*mm\"" 116 <<
" tl1=\"" << rs.
x2() <<
"*mm\"" 118 <<
" h2=\"" << rs.
y2() <<
"*mm\"" 119 <<
" bl2=\"" << rs.
x3() <<
"*mm\"" 120 <<
" tl2=\"" << rs.
x4() <<
"*mm\"" 128 xos <<
"<Cone name=\"" << rs.
toString() <<
"\"" 129 <<
" dz=\"" << rs.
zhalf() <<
"*mm\"" 130 <<
" rMin1=\"" << rs.
rInMinusZ() <<
"*mm\"" 132 <<
" rMin2=\"" << rs.
rInPlusZ() <<
"*mm\"" 133 <<
" rMax2=\"" << rs.
rOutPlusZ() <<
"*mm\"" 142 xos <<
"<Polycone name=\"" << rs.
toString() <<
"\"" 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\"/>" 153 xos <<
"</Polycone>" << std::endl;
159 xos <<
"<Polyhedra name=\"" << rs.
toString() <<
"\"" 160 <<
" numSide=\"" << rs.
sides() <<
"\"" 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\"/>" 171 xos <<
"</Polyhedra>" << std::endl;
184 xos <<
"<Polycone name=\"" << rs.
toString() <<
"\"" 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\"/>" 197 xos <<
"</Polycone>" << std::endl;
203 xos <<
"<Polyhedra name=\"" << rs.
toString() <<
"\"" 204 <<
" numSide=\"" << rs.
sides() <<
"\"" 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\"/>" 217 xos <<
"</Polyhedra>" << std::endl;
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" ) <<
"\"/>" 241 xos <<
"<TruncTubs name=\"" << rs.
toString() <<
"\"" 242 <<
" zHalf=\"" << rs.
zHalf() <<
"*mm\"" 243 <<
" rMin=\"" << rs.
rIn() <<
"*mm\"" 244 <<
" rMax=\"" << rs.
rOut() <<
"*mm\"" 247 <<
" cutAtStart=\"" << rs.
cutAtStart() <<
"*mm\"" 248 <<
" cutAtDelta=\"" << rs.
cutAtDelta() <<
"*mm\"" 249 <<
" cutInside=\"" << ( rs.
cutInside() ?
"true" :
"false" ) <<
"\"/>" 256 xos <<
"<ShapelessSolid name=\"" << rs.
toString() <<
"\"/>" 265 xos <<
"<Torus name=\"" << rs.
toString() <<
"\"" 266 <<
" innerRadius=\"" << rs.
rMin() <<
"*mm\"" 267 <<
" outerRadius=\"" << rs.
rMax() <<
"*mm\"" 268 <<
" torusRadius=\"" << rs.
rTorus() <<
"*mm\"" 280 xos <<
"<EllipticalTube name=\"" << rs.
toString() <<
"\"" 281 <<
" xSemiAxis=\"" << rs.
xSemiAxis() <<
"*mm\"" 282 <<
" ySemiAxis=\"" << rs.
ySemiAxis() <<
"*mm\"" 283 <<
" zHeight=\"" << rs.
zHeight() <<
"*mm\"/>" 293 const std::array<double, 3> &pLowNorm(rs.
lowNorm());
294 const std::array<double, 3> &pHighNorm(rs.
highNorm());
296 xos <<
"<CutTubs name=\"" << rs.
toString() <<
"\"" 297 <<
" dz=\"" << rs.
zhalf() <<
"*mm\"" 298 <<
" rMin=\"" << rs.
rIn() <<
"*mm\"" 299 <<
" rMax=\"" << rs.
rOut() <<
"*mm\"" 302 <<
" lx=\"" << pLowNorm[0] <<
"\"" 303 <<
" ly=\"" << pLowNorm[1] <<
"\"" 304 <<
" lz=\"" << pLowNorm[2] <<
"\"" 305 <<
" tx=\"" << pHighNorm[0] <<
"\"" 306 <<
" ty=\"" << pHighNorm[1] <<
"\"" 307 <<
" tz=\"" << pHighNorm[2] <<
"\"/>" 314 std::vector<double> x = rs.
xVec();
315 std::vector<double> y = rs.
yVec();
316 std::vector<double> z = rs.
zVec();
317 std::vector<double> zx = rs.
zxVec();
318 std::vector<double> zy = rs.
zyVec();
321 xos <<
"<ExtrudedPolygon name=\"" << rs.
toString() <<
"\"";
322 for(
unsigned int i : x )
323 xos <<
" <XYPoint x=\"" << x[
i] <<
"*mm\" y=\"" << y[
i] <<
"*mm\"/>\n";
324 for(
unsigned int k : z )
325 xos <<
" <ZXYSection z=\"" << z[
k] <<
"*mm\" x=\"" << zx[
k] <<
"*mm\" y=\"" << zy[
k] <<
"*mm scale=" << zs[
k] <<
"*mm\"/>\n";
326 xos <<
"</ExtrudedPolygon>\n";
333 throw cms::Exception(
"DDException") <<
"DDCoreToDDXMLOutput::solid(...) " << solid.
name() <<
" either not inited or no such solid.";
343 xos <<
"<ElementaryMaterial name=\"" << material.
toString() <<
"\"" 345 << std::scientific << std::setprecision(5)
347 <<
" atomicWeight=\"" 350 << std::setprecision(0) <<
std::fixed <<
" atomicNumber=\"" << material.
z() <<
"\"/>" 355 xos <<
"<CompositeMaterial name=\"" << material.
toString() <<
"\"" 357 << std::scientific << std::setprecision(5)
359 <<
" method=\"mixture by weight\">" << std::endl;
364 xos <<
"<MaterialFraction fraction=\"" 366 << material.
constituent(j).second <<
"\">" << std::endl;
367 xos <<
"<rMaterial name=\"" << material.
constituent(j).first.name() <<
"\"/>" << std::endl;
368 xos <<
"</MaterialFraction>" << std::endl;
370 xos <<
"</CompositeMaterial>" << std::endl;
380 rotation.
rotation().GetComponents(x,y,z);
381 double check = (x.Cross(y)).Dot(z);
383 bool reflection((1.-check)>tol);
390 std::cout <<
"about to try to make a new DDRotation... should fail!" << std::endl;
392 std:: cout <<
"new rotation: " << rot << std::endl;
396 std::cout <<
"WARNING: MAKING AN UNNAMED ROTATION" << std::endl;
405 xos <<
"<ReflectionRotation ";
407 xos <<
"name=\"" << rotName <<
"\"" 419 xos <<
"<LogicalPart name=\"" << lp.
toString() <<
"\">" << std::endl;
420 xos <<
"<rSolid name=\"" << lp.
solid().
toString() <<
"\"/>" << std::endl;
421 xos <<
"<rMaterial name=\"" << lp.
material().
toString() <<
"\"/>" << std::endl;
422 xos <<
"</LogicalPart>" << std::endl;
434 xos <<
"<PosPart copyNumber=\"" << edgeToChild->
copyno() <<
"\">" << std::endl;
435 xos <<
"<rParent name=\"" << parent.
toString() <<
"\"/>" << std::endl;
436 xos <<
"<rChild name=\"" << child.
toString() <<
"\"/>" << std::endl;
445 xos <<
"<rRotation name=\"" << rotName <<
"\"/>" << std::endl;
448 xos <<
"<Translation x=\"" << edgeToChild->
translation().x() <<
"*mm\"" 449 <<
" y=\"" << edgeToChild->
translation().y() <<
"*mm\"" 450 <<
" z=\"" << edgeToChild->
translation().z() <<
"*mm\"/>" << std::endl;
451 xos <<
"</PosPart>" << std::endl;
457 xos <<
"<SpecPar name=\"" << sp.
toString() <<
"\" eval=\"false\">" << std::endl;
462 xos <<
"<PartSelector path=\"" << psit <<
"\"/>" << std::endl;
472 const std::vector<std::string>& strvec = v.
strings();
477 xos <<
"<Parameter name=\"" << v.
name() <<
"\"" 478 <<
" value=\"" << v[
i] <<
"\"" 479 <<
" eval=\"true\"/>" << std::endl;
486 xos <<
"<Parameter name=\"" << v.
name() <<
"\"" 487 <<
" value=\"" << strvec[
i] <<
"\"" 488 <<
" eval=\"false\"/>" << std::endl;
493 xos <<
"</SpecPar>" << std::endl;
499 static int numspecpars(0);
500 std::ostringstream ostr;
501 ostr << numspecpars++;
503 xos <<
"<SpecPar name=\"" << spname <<
"\" eval=\"false\">" << std::endl;
504 for(
const auto& psit : pssv.second ) {
505 xos <<
"<PartSelector path=\"" << *psit <<
"\"/>" << std::endl;
509 for(
const auto& vit : pssv.first )
515 const std::vector<std::string>& strvec = v.
strings();
520 xos <<
"<Parameter name=\"" << v.
name() <<
"\"" 521 <<
" value=\"" << v[
i] <<
"\"" 522 <<
" eval=\"true\"/>" << std::endl;
529 xos <<
"<Parameter name=\"" << v.
name() <<
"\"" 530 <<
" value=\"" << strvec[
i] <<
"\"" 531 <<
" eval=\"false\"/>" << std::endl;
536 xos <<
"</SpecPar>" << std::endl;
const std::string & name(void) const
the name of the DDValue
double a() const
returns the atomic mass
double startPhi(void) const
double cutAtStart(void) const
truncation at begin of the tube-section
double halfZ(void) const
half of the z-Axis
Relative position of a child-volume inside a parent-volume.
bool cutInside(void) const
true, if truncation is on the inner side of the tube-section
std::vector< double > rVec(void) const
A truncated tube section.
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
double zHalf(void) const
half of the z-Axis
double y2(void) const
half length along y on +z
constexpr NumType convertUnitsTo(long double desiredUnits, NumType val)
std::vector< double > rMaxVec(void) const
double deltaPhi(void) const
angular span of the tube-section
DDMaterial is used to define and access material information.
std::vector< double > rMaxVec(void) const
double phi(void) const
Azimuthal angle of the line joining the centres of the faces at -/+pDz.
This is simply a handle on the solid.
std::array< double, 3 > highNorm(void) const
double rTorus(void) const
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
std::vector< double > rVec(void) const
double cutAtDelta(void) const
truncation at end of the tube-section
std::vector< double > yVec(void) const
double phiFrom(void) const
DDName is used to identify DDD entities uniquely.
constexpr NumType convertRadToDeg(NumType radians)
double rIn(void) const
inner radius
void specpar(const DDSpecifics &sp, std::ostream &xos)
double rOutMinusZ(void) const
double rOutPlusZ(void) const
std::vector< double > zyVec(void) const
DDTranslation translation(void) const
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
A DDSolid represents the shape of a part.
double y1(void) const
half length along y on -z
DDSolid solidB(void) const
Represents a uniquely identifyable rotation matrix.
bool isEvaluated(void) const
true, if values are numerical evaluated; else false.
std::vector< double > xVec(void) const
std::array< double, 3 > lowNorm(void) const
double z() const
retruns the atomic number
double x4(void) const
Half-length along x of the side at y=+pDy2 of the face at +pDz.
DDRotation rotation(void) const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
bool atMinusZ(void) const
true, if cut-out or rounding is on the -z side
double halfZ(void) const
half of the z-Axis
std::vector< double > rMinVec(void) const
double startPhi(void) const
double startPhi(void) const
void position(const DDLogicalPart &parent, const DDLogicalPart &child, DDPosData *edgeToChild, int &rotNameSeed, std::ostream &xos)
double xSemiAxis(void) const
double deltaPhi(void) const
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
Interface to a Trapezoid.
double y1(void) const
Half-length along y of the face at -pDz.
const DDRotation & ddrot() const
double rInMinusZ(void) const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
DDSolidShape shape(void) const
The type of the solid.
double ySemiAxis(void) const
void logicalPart(const DDLogicalPart &lp, std::ostream &xos)
std::vector< double > rMinVec(void) const
double deltaPhi(void) const
const std::vector< std::string > & strings() const
a reference to the std::string-valued values stored in the given instance of DDValue ...
DDSolid solidA(void) const
double deltaPhi(void) const
double deltaPhi(void) const
double startPhi(void) const
std::string toString() const
std::vector< double > zVec(void) const
std::vector< double > zxVec(void) const
double density() const
returns the density
std::vector< double > zVec(void) const
double deltaPhi(void) const
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
double alpha2(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy2 to the centre at y=+pDy2 of t...
double startPhi(void) const
angular start of the tube-section
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
const DDsvalues_type & specifics() const
Reference to the user-data attached to all nodes selected by the selections-strings given through sel...
const DDTranslation & translation() const
double zHeight(void) const
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
double deltaPhi(void) const
double y2(void) const
Half-length along y of the face at +pDz.
void material(const DDMaterial &material, std::ostream &xos)
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
double rInPlusZ(void) const
unsigned int size() const
the size of the stored value-pairs (std::string,double)
double x2(void) const
half length along x on +z
void rotation(const DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
void solid(const DDSolid &solid, std::ostream &xos)
double rOut(void) const
outer radius
double theta(void) const
Polar angle of the line joining the centres of the faces at -/+pDz.
std::vector< double > zscaleVec(void) const
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
double x3(void) const
Half-length along x of the side at y=-pDy2 of the face at +pDz.
std::vector< double > zVec(void) const
Interface to attach user specific data to nodes in the expanded-view.
double x1(void) const
half length along x on -z
double startPhi(void) const
double radius(void) const
radius of the cut-out (neg.) or rounding (pos.)
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.