CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
DDCoreToDDXMLOutput Class Reference

#include <DDCoreToDDXMLOutput.h>

Public Member Functions

void element (const TGeoMaterial *element, std::ostream &xos)
 
void logicalPart (const DDLogicalPart &lp, std::ostream &xos)
 
void logicalPart (const std::string &asName, std::ostream &xos)
 
void logicalPart (const TGeoVolume &lp, std::ostream &xos)
 
void material (const DDMaterial &material, std::ostream &xos)
 
void material (const std::string &matName, double density, const std::vector< cms::DDParsingContext::CompositeMaterial > &matRefs, std::ostream &xos)
 
void position (const DDLogicalPart &parent, const DDLogicalPart &child, DDPosData *edgeToChild, int &rotNameSeed, std::ostream &xos)
 
void position (const TGeoVolume &parent, const TGeoNode &child, const std::string &childName, cms::DDParsingContext &context, std::ostream &xos)
 
void rotation (const dd4hep::Rotation3D &rotation, std::ostream &xos, const cms::DDParsingContext &context, const std::string &rotn)
 
void rotation (const DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
 
void solid (const dd4hep::Solid &solid, const cms::DDParsingContext &context, std::ostream &xos)
 
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)
 
void specpar (const std::string &name, const dd4hep::SpecPar &specPar, std::ostream &xos)
 

Static Public Member Functions

static std::string trimShapeName (const std::string &solidName)
 

Public Attributes

std::string ns_
 

Detailed Description

Author
: Michael Case Revison for DD4hep
Version
: 1.0

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 40 of file DDCoreToDDXMLOutput.h.

Member Function Documentation

◆ element()

void DDCoreToDDXMLOutput::element ( const TGeoMaterial *  element,
std::ostream &  xos 
)

Definition at line 638 of file DDCoreToDDXMLOutput.cc.

638  {
639  int noc = material->GetNelements();
640  if (noc == 1) {
641  TGeoElement* elem = material->GetElement();
642  std::string nameLowerCase(elem->GetTitle());
643  // Leave first letter capitalized
644  for (size_t index = 1; index < nameLowerCase.size(); ++index) {
645  nameLowerCase[index] = tolower(nameLowerCase[index]);
646  }
647  std::string trimName(dd4hep::dd::noNamespace(material->GetName()));
648 
649  // Element title contains element name in all uppercase.
650  // Convert to lowercase and check that material name matches element name.
651  // Hydrogen is used for vacuum materials. Phosphorus is called "Phosphor"
652  // Boron is a special case because there are two isotopes defined: "Bor 10" and "Bor 11".
653  if (trimName == nameLowerCase || nameLowerCase == "Hydrogen" || nameLowerCase == "Phosphorus" ||
654  (nameLowerCase == "Boron" && trimName.compare(0, 3, "Bor") == 0)) {
655  xos << "<ElementaryMaterial name=\"" << material->GetName() << "\""
656  << " density=\"" << std::scientific << std::setprecision(5) << convertGPerCcToMgPerCc(material->GetDensity())
657  << "*mg/cm3\""
658  << " atomicWeight=\"" << std::fixed << material->GetA() << "*g/mole\"" << std::setprecision(0) << std::fixed
659  << " atomicNumber=\"" << material->GetZ() << "\"/>" << std::endl;
660  }
661  }
662 }

References convertGPerCcToMgPerCc(), alignBH_cfg::fixed, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ logicalPart() [1/3]

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

Definition at line 740 of file DDCoreToDDXMLOutput.cc.

740  {
741  xos << "<LogicalPart name=\"" << lp.toString() << "\">" << std::endl;
742  xos << "<rSolid name=\"" << lp.solid().toString() << "\"/>" << std::endl;
743  xos << "<rMaterial name=\"" << lp.material().toString() << "\"/>" << std::endl;
744  xos << "</LogicalPart>" << std::endl;
745 }

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

◆ logicalPart() [2/3]

void DDCoreToDDXMLOutput::logicalPart ( const std::string &  asName,
std::ostream &  xos 
)

Definition at line 747 of file DDCoreToDDXMLOutput.cc.

747  {
748  xos << "<LogicalPart name=\"" << asName << "\">" << std::endl;
749  xos << "<rSolid name=\"" << asName << "\"/>" << std::endl;
750  xos << "<rMaterial name=\"materials:Air\"/>" << std::endl;
751  xos << "</LogicalPart>" << std::endl;
752 }

◆ logicalPart() [3/3]

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

Definition at line 754 of file DDCoreToDDXMLOutput.cc.

754  {
755  xos << "<LogicalPart name=\"" << lp.GetName() << "\">" << std::endl;
756  auto solid = lp.GetShape();
757  if (solid != nullptr) {
758  xos << "<rSolid name=\"" << trimShapeName(solid->GetName()) << "\"/>" << std::endl;
759  }
760  auto material = lp.GetMaterial();
761  if (material != nullptr) {
762  xos << "<rMaterial name=\"" << material->GetName() << "\"/>" << std::endl;
763  }
764  xos << "</LogicalPart>" << std::endl;
765 }

◆ material() [1/2]

void DDCoreToDDXMLOutput::material ( const DDMaterial material,
std::ostream &  xos 
)

Definition at line 596 of file DDCoreToDDXMLOutput.cc.

596  {
597  int noc = material.noOfConstituents();
598  if (noc == 0) {
599  xos << "<ElementaryMaterial name=\"" << material.toString() << "\""
600  << " density=\"" << std::scientific << std::setprecision(5) << convertUnitsTo(1._mg_per_cm3, material.density())
601  << "*mg/cm3\""
602  << " atomicWeight=\"" << std::fixed << convertUnitsTo(1._g_per_mole, material.a()) << "*g/mole\""
603  << std::setprecision(0) << std::fixed << " atomicNumber=\"" << material.z() << "\"/>" << std::endl;
604  } else {
605  xos << "<CompositeMaterial name=\"" << material.toString() << "\""
606  << " density=\"" << std::scientific << std::setprecision(5) << convertUnitsTo(1._mg_per_cm3, material.density())
607  << "*mg/cm3\""
608  << " method=\"mixture by weight\">" << std::endl;
609 
610  int j = 0;
611  for (; j < noc; ++j) {
612  xos << "<MaterialFraction fraction=\"" << std::fixed << std::setprecision(9) << material.constituent(j).second
613  << "\">" << std::endl;
614  xos << "<rMaterial name=\"" << material.constituent(j).first.name() << "\"/>" << std::endl;
615  xos << "</MaterialFraction>" << std::endl;
616  }
617  xos << "</CompositeMaterial>" << std::endl;
618  }
619 }

References DDMaterial::a(), DDMaterial::constituent(), geant_units::operators::convertUnitsTo(), DDMaterial::density(), alignBH_cfg::fixed, dqmiolumiharvest::j, DDMaterial::noOfConstituents(), DDBase< N, C >::toString(), and DDMaterial::z().

◆ material() [2/2]

void DDCoreToDDXMLOutput::material ( const std::string &  matName,
double  density,
const std::vector< cms::DDParsingContext::CompositeMaterial > &  matRefs,
std::ostream &  xos 
)

Definition at line 621 of file DDCoreToDDXMLOutput.cc.

624  {
625  xos << "<CompositeMaterial name=\"" << matName << "\""
626  << " density=\"" << std::scientific << std::setprecision(5) << convertGPerCcToMgPerCc(density) << "*mg/cm3\""
627  << " method=\"mixture by weight\">" << std::endl;
628 
629  for (auto compIter = matRefs.begin(); compIter != matRefs.end(); ++compIter) {
630  xos << "<MaterialFraction fraction=\"" << std::fixed << std::setprecision(9) << compIter->fraction << "\">"
631  << std::endl;
632  xos << "<rMaterial name=\"" << compIter->name << "\"/>" << std::endl;
633  xos << "</MaterialFraction>" << std::endl;
634  }
635  xos << "</CompositeMaterial>" << std::endl;
636 }

References convertGPerCcToMgPerCc(), fastSimProducer_cff::density, and alignBH_cfg::fixed.

◆ position() [1/2]

void DDCoreToDDXMLOutput::position ( const DDLogicalPart parent,
const DDLogicalPart child,
DDPosData edgeToChild,
int &  rotNameSeed,
std::ostream &  xos 
)

Definition at line 799 of file DDCoreToDDXMLOutput.cc.

803  {
804  std::string rotName = edgeToChild->ddrot().toString();
805  DDRotationMatrix myIDENT;
806 
807  xos << "<PosPart copyNumber=\"" << edgeToChild->copyno() << "\">" << std::endl;
808  xos << "<rParent name=\"" << parent.toString() << "\"/>" << std::endl;
809  xos << "<rChild name=\"" << child.toString() << "\"/>" << std::endl;
810  if ((edgeToChild->ddrot().rotation()) != myIDENT) {
811  if (rotName == ":") {
812  rotation(edgeToChild->ddrot(), xos);
813  } else {
814  xos << "<rRotation name=\"" << rotName << "\"/>" << std::endl;
815  }
816  } // else let default Rotation matrix be created?
817  using namespace cms_rounding;
818  xos << "<Translation x=\"" << roundIfNear0(edgeToChild->translation().x()) << "*mm\""
819  << " y=\"" << roundIfNear0(edgeToChild->translation().y()) << "*mm\""
820  << " z=\"" << roundIfNear0(edgeToChild->translation().z()) << "*mm\"/>" << std::endl;
821  xos << "</PosPart>" << std::endl;
822 }

References DDPosData::copyno(), DDPosData::ddrot(), class-composition::parent, idealTransformation::rotation, DDRotation::rotation(), cms::rotation_utils::rotName(), cms_rounding::roundIfNear0(), AlCaHLTBitMon_QueryRunRegistry::string, DDBase< N, C >::toString(), and DDPosData::translation().

◆ position() [2/2]

void DDCoreToDDXMLOutput::position ( const TGeoVolume &  parent,
const TGeoNode &  child,
const std::string &  childName,
cms::DDParsingContext context,
std::ostream &  xos 
)

Definition at line 767 of file DDCoreToDDXMLOutput.cc.

771  {
772  xos << "<PosPart copyNumber=\"" << child.GetNumber() << "\">" << std::endl;
773  xos << "<rParent name=\"" << parent.GetName() << "\"/>" << std::endl;
774  xos << "<rChild name=\"" << childVolName << "\"/>" << std::endl;
775 
776  const auto matrix = child.GetMatrix();
777  if (matrix != nullptr && !matrix->IsIdentity()) {
778  auto rot = matrix->GetRotationMatrix();
781  if (rotNameStr == "NULL") {
782  rotNameStr = child.GetName(); // Phys vol name
783  rotNameStr += parent.GetName();
784  cms::DDNamespace nameSpace(context);
785  cms::rotation_utils::addRotWithNewName(nameSpace, rotNameStr, rot);
786  }
787  xos << "<rRotation name=\"" << rotNameStr << "\"/>" << std::endl;
788  }
789  }
790  auto trans = matrix->GetTranslation();
791  using namespace cms_rounding;
792  xos << "<Translation x=\"" << roundIfNear0(trans[0]) << "*mm\"";
793  xos << " y=\"" << roundIfNear0(trans[1]) << "*mm\"";
794  xos << " z=\"" << roundIfNear0(trans[2]) << "*mm\"";
795  xos << "/>" << std::endl;
796  xos << "</PosPart>" << std::endl;
797 }

References cms::rotation_utils::addRotWithNewName(), visDQMUpload::context, cms::rotation_utils::identityHash(), makeMuonMisalignmentScenario::matrix, class-composition::parent, makeMuonMisalignmentScenario::rot, cms::rotation_utils::rotHash(), cms::rotation_utils::rotName(), cms_rounding::roundIfNear0(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ rotation() [1/2]

void DDCoreToDDXMLOutput::rotation ( const dd4hep::Rotation3D &  rotation,
std::ostream &  xos,
const cms::DDParsingContext context,
const std::string &  rotn 
)

Definition at line 706 of file DDCoreToDDXMLOutput.cc.

709  {
711  rotation.GetComponents(x, y, z);
712  double a, b, c;
713  x.GetCoordinates(a, b, c);
714  x.SetCoordinates(
716  y.GetCoordinates(a, b, c);
717  y.SetCoordinates(
719  z.GetCoordinates(a, b, c);
720  z.SetCoordinates(
722  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system
723  // this must be -1
724  bool reflection((1. - check) > reflectTol);
725  if (!reflection) {
726  xos << "<Rotation ";
727  } else {
728  xos << "<ReflectionRotation ";
729  }
730  using namespace cms_rounding;
731  xos << "name=\"" << rotn << "\""
732  << " phiX=\"" << roundIfNear0(convertRadToDeg(x.phi()), tol0) << "*deg\""
733  << " thetaX=\"" << roundIfNear0(convertRadToDeg(x.theta()), tol0) << "*deg\""
734  << " phiY=\"" << roundIfNear0(convertRadToDeg(y.phi()), tol0) << "*deg\""
735  << " thetaY=\"" << roundIfNear0(convertRadToDeg(y.theta()), tol0) << "*deg\""
736  << " phiZ=\"" << roundIfNear0(convertRadToDeg(z.phi()), tol0) << "*deg\""
737  << " thetaZ=\"" << roundIfNear0(convertRadToDeg(z.theta()), tol0) << "*deg\"/>" << std::endl;
738 }

References a, b, c, RPCNoise_example::check, angle_units::operators::convertRadToDeg(), reflectTol, idealTransformation::rotation, cms_rounding::roundIfNear0(), and tol0.

◆ rotation() [2/2]

void DDCoreToDDXMLOutput::rotation ( const DDRotation rotation,
std::ostream &  xos,
const std::string &  rotn = "" 
)

Definition at line 664 of file DDCoreToDDXMLOutput.cc.

664  {
665  DD3Vector x, y, z;
666  rotation.rotation().GetComponents(x, y, z);
667  double a, b, c;
668  x.GetCoordinates(a, b, c);
669  x.SetCoordinates(
671  y.GetCoordinates(a, b, c);
672  y.SetCoordinates(
674  z.GetCoordinates(a, b, c);
675  z.SetCoordinates(
677  double check = (x.Cross(y)).Dot(z); // in case of a LEFT-handed orthogonal system
678  // this must be -1
679  bool reflection((1. - check) > reflectTol);
680  std::string rotName = rotation.toString();
681  if (rotName == ":") {
682  if (!rotn.empty()) {
683  rotName = rotn;
684  std::cout << "about to try to make a new DDRotation... should fail!" << std::endl;
685  DDRotation rot(DDName(rotn), std::make_unique<DDRotationMatrix>(rotation.rotation()));
686  std::cout << "new rotation: " << rot << std::endl;
687  } else {
688  std::cout << "WARNING: MAKING AN UNNAMED ROTATION" << std::endl;
689  }
690  }
691  if (!reflection) {
692  xos << "<Rotation ";
693  } else {
694  xos << "<ReflectionRotation ";
695  }
696  using namespace cms_rounding;
697  xos << "name=\"" << rotName << "\""
698  << " phiX=\"" << roundIfNear0(convertRadToDeg(x.phi()), tol0) << "*deg\""
699  << " thetaX=\"" << roundIfNear0(convertRadToDeg(x.theta()), tol0) << "*deg\""
700  << " phiY=\"" << roundIfNear0(convertRadToDeg(y.phi()), tol0) << "*deg\""
701  << " thetaY=\"" << roundIfNear0(convertRadToDeg(y.theta()), tol0) << "*deg\""
702  << " phiZ=\"" << roundIfNear0(convertRadToDeg(z.phi()), tol0) << "*deg\""
703  << " thetaZ=\"" << roundIfNear0(convertRadToDeg(z.theta()), tol0) << "*deg\"/>" << std::endl;
704 }

References a, b, c, RPCNoise_example::check, angle_units::operators::convertRadToDeg(), gather_cfg::cout, reflectTol, makeMuonMisalignmentScenario::rot, idealTransformation::rotation, cms::rotation_utils::rotName(), cms_rounding::roundIfNear0(), AlCaHLTBitMon_QueryRunRegistry::string, and tol0.

◆ solid() [1/2]

void DDCoreToDDXMLOutput::solid ( const dd4hep::Solid &  solid,
const cms::DDParsingContext context,
std::ostream &  xos 
)

Definition at line 100 of file DDCoreToDDXMLOutput.cc.

100  {
102  switch (shape) {
106  dd4hep::BooleanSolid rs(solid);
107  if (shape == cms::DDSolidShape::ddunion) {
108  xos << "<UnionSolid ";
109  } else if (shape == cms::DDSolidShape::ddsubtraction) {
110  xos << "<SubtractionSolid ";
111  } else if (shape == cms::DDSolidShape::ddintersection) {
112  xos << "<IntersectionSolid ";
113  }
114  xos << "name=\"" << trimShapeName(solid.name()) << "\">" << std::endl;
115  xos << "<rSolid name=\"" << trimShapeName(rs.leftShape().name()) << "\"/>" << std::endl;
116  xos << "<rSolid name=\"" << trimShapeName(rs.rightShape().name()) << "\"/>" << std::endl;
117  const Double_t* trans = rs.rightMatrix()->GetTranslation();
118  xos << "<Translation x=\"" << trans[0] << "*mm\"";
119  xos << " y=\"" << trans[1] << "*mm\"";
120  xos << " z=\"" << trans[2] << "*mm\"";
121  xos << "/>" << std::endl;
122  auto rot = rs.rightMatrix()->GetRotationMatrix();
123  // The identity rotation can be omitted.
126  xos << "<rRotation name=\"" << rotNameStr << "\"/>" << std::endl;
127  }
128  if (shape == cms::DDSolidShape::ddunion) {
129  xos << "</UnionSolid>" << std::endl;
130  } else if (shape == cms::DDSolidShape::ddsubtraction) {
131  xos << "</SubtractionSolid>" << std::endl;
132  } else if (shape == cms::DDSolidShape::ddintersection) {
133  xos << "</IntersectionSolid>" << std::endl;
134  }
135  break;
136  }
138  dd4hep::Box rs(solid);
139  xos << "<Box name=\"" << trimShapeName(rs.name()) << "\""
140  << " dx=\"" << rs.x() << "*mm\""
141  << " dy=\"" << rs.y() << "*mm\""
142  << " dz=\"" << rs.z() << "*mm\"/>" << std::endl;
143  break;
144  }
146  dd4hep::Tube rs(solid);
147  double startPhi = convertRadToDeg(rs.startPhi());
148  if (startPhi > 180. && startPhi <= 360.)
149  startPhi -= 360.;
150  // Convert large positive angles to small negative ones
151  // to match how they are usually defined
152 
153  xos << "<Tubs name=\"" << trimShapeName(rs.name()) << "\""
154  << " rMin=\"" << rs.rMin() << "*mm\""
155  << " rMax=\"" << rs.rMax() << "*mm\""
156  << " dz=\"" << rs.dZ() << "*mm\""
157  << " startPhi=\"" << startPhi << "*deg\""
158  << " deltaPhi=\"" << convertRadToDeg(rs.endPhi() - rs.startPhi()) << "*deg\"/>" << std::endl;
159  break;
160  }
162  dd4hep::Trd1 rs(solid);
163  xos << "<Trd1 name=\"" << trimShapeName(rs.name()) << "\""
164  << " dz=\"" << rs.dZ() << "*mm\""
165  << " dy1=\"" << rs.dY() << "*mm\""
166  << " dy2=\"" << rs.dY() << "*mm\""
167  << " dx1=\"" << rs.dX1() << "*mm\""
168  << " dx2=\"" << rs.dX2() << "*mm\"/>" << std::endl;
169  break;
170  }
172  dd4hep::Trd2 rs(solid);
173  xos << "<Trd1 name=\"" << trimShapeName(rs.name()) << "\""
174  << " dz=\"" << rs.dZ() << "*mm\""
175  << " dy1=\"" << rs.dY1() << "*mm\""
176  << " dy2=\"" << rs.dY2() << "*mm\""
177  << " dx1=\"" << rs.dX1() << "*mm\""
178  << " dx2=\"" << rs.dX2() << "*mm\"/>" << std::endl;
179  break;
180  }
182  dd4hep::Trap rs(solid);
183  xos << "<Trapezoid name=\"" << trimShapeName(rs.name()) << "\""
184  << " dz=\"" << rs.dZ() << "*mm\""
185  << " theta=\"" << convertRadToDeg(rs.theta()) << "*deg\""
186  << " phi=\"" << convertRadToDeg(rs.phi()) << "*deg\""
187  << " h1=\"" << rs.high1() << "*mm\""
188  << " bl1=\"" << rs.bottomLow1() << "*mm\""
189  << " tl1=\"" << rs.topLow1() << "*mm\""
190  << " alp1=\"" << convertRadToDeg(rs.alpha1()) << "*deg\""
191  << " h2=\"" << rs.high2() << "*mm\""
192  << " bl2=\"" << rs.bottomLow2() << "*mm\""
193  << " tl2=\"" << rs.topLow2() << "*mm\""
194  << " alp2=\"" << convertRadToDeg(rs.alpha2()) << "*deg\"/>" << std::endl;
195  break;
196  }
198  dd4hep::ConeSegment rs(solid);
199  double startPhi = convertRadToDeg(rs.startPhi());
200  if (startPhi > 180. && startPhi <= 360.)
201  startPhi -= 360.;
202  // Convert large positive angles to small negative ones
203  // to match how they are usually defined
204  //
205  xos << "<Cone name=\"" << trimShapeName(rs.name()) << "\""
206  << " dz=\"" << rs.dZ() << "*mm\""
207  << " rMin1=\"" << rs.rMin1() << "*mm\""
208  << " rMax1=\"" << rs.rMax1() << "*mm\""
209  << " rMin2=\"" << rs.rMin2() << "*mm\""
210  << " rMax2=\"" << rs.rMax2() << "*mm\""
211  << " startPhi=\"" << startPhi << "*deg\""
212  << " deltaPhi=\"" << convertRadToDeg(rs.endPhi() - rs.startPhi()) << "*deg\"/>" << std::endl;
213  break;
214  }
216  // <Polycone name="OCMS" startPhi="0*deg" deltaPhi="360*deg" >
217  // <ZSection z="-[CMSZ1]" rMin="[Rmin]" rMax="[CMSR2]" />
218  // <ZSection z="-[HallZ]" rMin="[Rmin]" rMax="[CMSR2]" />
219  // <ZSection z="-[HallZ]" rMin="[Rmin]" rMax="[HallR]" />
220  // <ZSection z="[HallZ]" rMin="[Rmin]" rMax="[HallR]" />
221  // <ZSection z="[HallZ]" rMin="[Rmin]" rMax="[CMSR2]" />
222  // <ZSection z="[CMSZ1]" rMin="[Rmin]" rMax="[CMSR2]" />
223  dd4hep::Polycone rs(solid);
224  xos << "<Polycone name=\"" << trimShapeName(rs.name()) << "\""
225  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
226  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
227  const std::vector<double>& zV(rs.zPlaneZ());
228  const std::vector<double>& rMinV(rs.zPlaneRmin());
229  const std::vector<double>& rMaxV(rs.zPlaneRmax());
230  for (size_t i = 0; i < zV.size(); ++i) {
231  xos << "<ZSection z=\"" << zV[i] << "*mm\""
232  << " rMin=\"" << rMinV[i] << "*mm\""
233  << " rMax=\"" << rMaxV[i] << "*mm\"/>" << std::endl;
234  }
235  xos << "</Polycone>" << std::endl;
236  break;
237  }
240  xos << "<Polyhedra name=\"" << trimShapeName(rs.name()) << "\""
241  << " numSide=\"" << rs.numEdges() << "\""
242  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
243  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
244  const std::vector<double>& zV(rs.zPlaneZ());
245  const std::vector<double>& rMinV(rs.zPlaneRmin());
246  const std::vector<double>& rMaxV(rs.zPlaneRmax());
247  for (size_t i = 0; i < zV.size(); ++i) {
248  xos << "<ZSection z=\"" << zV[i] << "*mm\""
249  << " rMin=\"" << rMinV[i] << "*mm\""
250  << " rMax=\"" << rMaxV[i] << "*mm\"/>" << std::endl;
251  }
252  xos << "</Polyhedra>" << std::endl;
253  break;
254  }
256  dd4hep::TruncatedTube rs(solid);
257  xos << "<TruncTubs name=\"" << trimShapeName(rs.name()) << "\""
258  << " zHalf=\"" << rs.dZ() << "*mm\""
259  << " rMin=\"" << rs.rMin() << "*mm\""
260  << " rMax=\"" << rs.rMax() << "*mm\""
261  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
262  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\""
263  << " cutAtStart=\"" << rs.cutAtStart() << "*mm\""
264  << " cutAtDelta=\"" << rs.cutAtDelta() << "*mm\""
265  << " cutInside=\"" << (rs.cutInside() ? "true" : "false") << "\"/>" << std::endl;
266  break;
267  }
269  dd4hep::Torus rs(solid);
270  xos << "<Torus name=\"" << trimShapeName(rs.name()) << "\""
271  << " innerRadius=\"" << rs.rMin() << "*mm\""
272  << " outerRadius=\"" << rs.rMax() << "*mm\""
273  << " torusRadius=\"" << rs.r() << "*mm\""
274  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
275  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\"/>" << std::endl;
276  break;
277  }
279  dd4hep::EllipticalTube rs(solid);
280  xos << "<EllipticalTube name=\"" << trimShapeName(rs.name()) << "\""
281  << " xSemiAxis=\"" << rs.a() << "*mm\""
282  << " ySemiAxis=\"" << rs.b() << "*mm\""
283  << " zHeight=\"" << rs.dZ() << "*mm\"/>" << std::endl;
284  break;
285  }
287  dd4hep::CutTube rs(solid);
288  const std::vector<double>& pLowNorm(rs.lowNormal());
289  const std::vector<double>& pHighNorm(rs.highNormal());
290 
291  xos << "<CutTubs name=\"" << trimShapeName(solid.name()) << "\""
292  << " dz=\"" << rs.dZ() << "*mm\""
293  << " rMin=\"" << rs.rMin() << "*mm\""
294  << " rMax=\"" << rs.rMax() << "*mm\""
295  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
296  << " deltaPhi=\"" << convertRadToDeg(rs.endPhi() - rs.startPhi()) << "*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] << "\"/>" << std::endl;
303  break;
304  }
307  std::vector<double> x = rs.x();
308  std::vector<double> y = rs.y();
309  std::vector<double> z = rs.z();
310  std::vector<double> zx = rs.zx();
311  std::vector<double> zy = rs.zy();
312  std::vector<double> zs = rs.zscale();
313 
314  xos << "<ExtrudedPolygon name=\"" << trimShapeName(rs.name()) << "\"";
315  for (unsigned int i = 0; i < x.size(); ++i)
316  xos << " <XYPoint x=\"" << x[i] << "*mm\" y=\"" << y[i] << "*mm\"/>\n";
317  for (unsigned int k = 0; k < z.size(); ++k)
318  xos << " <ZXYSection z=\"" << z[k] << "*mm\" x=\"" << zx[k] << "*mm\" y=\"" << zy[k] << "*mm scale=" << zs[k]
319  << "*mm\"/>\n";
320  xos << "</ExtrudedPolygon>\n";
321  break;
322  }
324  default:
325  throw cms::Exception("DDException")
326  << "DDCoreToDDXMLOutput::solid " << solid.name() << ", shape ID = " << static_cast<int>(shape)
327  << ", solid title = " << solid.title();
328  break;
329  }
330 }

References visDQMUpload::context, angle_units::operators::convertRadToDeg(), cms::dd_not_init, cms::ddbox, cms::ddcons, cms::ddcuttubs, cms::ddellipticaltube, cms::ddextrudedpolygon, cms::ddintersection, cms::ddpolycone, cms::ddpolyhedra, cms::DDSolidShapeMap, cms::ddsubtraction, cms::ddtorus, cms::ddtrap, cms::ddtrd1, cms::ddtrd2, cms::ddtrunctubs, cms::ddtubs, cms::ddunion, Exception, HGCalGeometryMode::ExtrudedPolygon, mps_fire::i, cms::rotation_utils::identityHash(), dqmdumpme::k, HGCalGeometryMode::Polyhedra, makeMuonMisalignmentScenario::rot, cms::rotation_utils::rotHash(), cms::rotation_utils::rotName(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::dd::value().

◆ solid() [2/2]

void DDCoreToDDXMLOutput::solid ( const DDSolid solid,
std::ostream &  xos 
)

Definition at line 332 of file DDCoreToDDXMLOutput.cc.

332  {
333  switch (solid.shape()) {
337  DDBooleanSolid rs(solid);
338  if (solid.shape() == DDSolidShape::ddunion) {
339  xos << "<UnionSolid ";
340  } else if (solid.shape() == DDSolidShape::ddsubtraction) {
341  xos << "<SubtractionSolid ";
342  } else if (solid.shape() == DDSolidShape::ddintersection) {
343  xos << "<IntersectionSolid ";
344  }
345  xos << "name=\"" << rs.toString() << "\">" << std::endl;
346  // if translation is == identity there are no parameters.
347  // if there is no rotation the name will be ":"
348  xos << "<rSolid name=\"" << rs.solidA().toString() << "\"/>" << std::endl;
349  xos << "<rSolid name=\"" << rs.solidB().toString() << "\"/>" << std::endl;
350  xos << "<Translation x=\"" << rs.translation().X() << "*mm\"";
351  xos << " y=\"" << rs.translation().Y() << "*mm\"";
352  xos << " z=\"" << rs.translation().Z() << "*mm\"";
353  xos << "/>" << std::endl;
354  std::string rotName = rs.rotation().toString();
355  if (rotName == ":") {
356  rotName = "gen:ID";
357  }
358  xos << "<rRotation name=\"" << rs.rotation().toString() << "\"/>" << std::endl;
359  if (solid.shape() == DDSolidShape::ddunion) {
360  xos << "</UnionSolid>" << std::endl;
361  } else if (solid.shape() == DDSolidShape::ddsubtraction) {
362  xos << "</SubtractionSolid>" << std::endl;
363  } else if (solid.shape() == DDSolidShape::ddintersection) {
364  xos << "</IntersectionSolid>" << std::endl;
365  }
366  break;
367  }
368  case DDSolidShape::ddbox: {
369  // <Box name="box1" dx="10*cm" dy="10*cm" dz="10*cm"/>
370  DDBox rs(solid);
371  xos << "<Box name=\"" << rs.toString() << "\"" //<< rs.toString() << "\"" //
372  << " dx=\"" << rs.halfX() << "*mm\""
373  << " dy=\"" << rs.halfY() << "*mm\""
374  << " dz=\"" << rs.halfZ() << "*mm\"/>" << std::endl;
375  break;
376  }
377  case DDSolidShape::ddtubs: {
378  // <Tubs name="TrackerSupportTubeNomex" rMin="[SupportTubeR1]+[Tol]"
379  // rMax="[SupportTubeR2]-[Tol]" dz="[SupportTubeL]"
380  // startPhi="0*deg" deltaPhi="360*deg"/>
381  DDTubs rs(solid);
382  xos << "<Tubs name=\"" << rs.toString() << "\""
383  << " rMin=\"" << rs.rIn() << "*mm\""
384  << " rMax=\"" << rs.rOut() << "*mm\""
385  << " dz=\"" << rs.zhalf() << "*mm\""
386  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
387  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\"/>" << std::endl;
388  break;
389  }
390  case DDSolidShape::ddtrap: {
391  // <Trapezoid name="UpL_CSC_for_TotemT1_Plane_2_5_7" dz="[PCB_Epoxy_Thick_3P]/2."
392  // alp1="-[Up_Signal_Side_alpL_3P]" alp2="-[Up_Signal_Side_alpL_3P]"
393  // bl1="[Max_Base_Signal_SideL_3P]/2." tl1="[Up_Min_Base_Signal_SideL_3P]/2." h1="[Up_Height_Signal_SideL_3P]/2."
394  // h2="[Up_Height_Signal_SideL_3P]/2." bl2="[Max_Base_Signal_SideL_3P]/2." tl2="[Up_Min_Base_Signal_SideL_3P]/2."/>
395  DDTrap rs(solid);
396  xos << "<Trapezoid name=\"" << rs.toString() << "\""
397  << " dz=\"" << rs.halfZ() << "*mm\""
398  << " theta=\"" << convertRadToDeg(rs.theta()) << "*deg\""
399  << " phi=\"" << convertRadToDeg(rs.phi()) << "*deg\""
400  << " h1=\"" << rs.y1() << "*mm\""
401  << " bl1=\"" << rs.x1() << "*mm\""
402  << " tl1=\"" << rs.x2() << "*mm\""
403  << " alp1=\"" << convertRadToDeg(rs.alpha1()) << "*deg\""
404  << " h2=\"" << rs.y2() << "*mm\""
405  << " bl2=\"" << rs.x3() << "*mm\""
406  << " tl2=\"" << rs.x4() << "*mm\""
407  << " alp2=\"" << convertRadToDeg(rs.alpha2()) << "*deg\"/>" << std::endl;
408  break;
409  }
410  case DDSolidShape::ddcons: {
411  DDCons rs(solid);
412  xos << "<Cone name=\"" << rs.toString() << "\""
413  << " dz=\"" << rs.zhalf() << "*mm\""
414  << " rMin1=\"" << rs.rInMinusZ() << "*mm\""
415  << " rMax1=\"" << rs.rOutMinusZ() << "*mm\""
416  << " rMin2=\"" << rs.rInPlusZ() << "*mm\""
417  << " rMax2=\"" << rs.rOutPlusZ() << "*mm\""
418  << " startPhi=\"" << convertRadToDeg(rs.phiFrom()) << "*deg\""
419  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\"/>" << std::endl;
420  break;
421  }
423  DDPolycone rs(solid);
424  xos << "<Polycone name=\"" << rs.toString() << "\""
425  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
426  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
427  const std::vector<double>& zV(rs.zVec());
428  const std::vector<double>& rV(rs.rVec());
429  for (size_t i = 0; i < zV.size(); ++i) {
430  xos << "<RZPoint r=\"" << rV[i] << "*mm\""
431  << " z=\"" << zV[i] << "*mm\"/>" << std::endl;
432  }
433  xos << "</Polycone>" << std::endl;
434  break;
435  }
437  DDPolyhedra rs(solid);
438  xos << "<Polyhedra name=\"" << rs.toString() << "\""
439  << " numSide=\"" << rs.sides() << "\""
440  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
441  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
442  const std::vector<double>& zV(rs.zVec());
443  const std::vector<double>& rV(rs.rVec());
444  for (size_t i = 0; i < zV.size(); ++i) {
445  xos << "<RZPoint r=\"" << rV[i] << "*mm\""
446  << " z=\"" << zV[i] << "*mm\"/>" << std::endl;
447  }
448  xos << "</Polyhedra>" << std::endl;
449  break;
450  }
452  // <Polycone name="OCMS" startPhi="0*deg" deltaPhi="360*deg" >
453  // <ZSection z="-[CMSZ1]" rMin="[Rmin]" rMax="[CMSR2]" />
454  // <ZSection z="-[HallZ]" rMin="[Rmin]" rMax="[CMSR2]" />
455  // <ZSection z="-[HallZ]" rMin="[Rmin]" rMax="[HallR]" />
456  // <ZSection z="[HallZ]" rMin="[Rmin]" rMax="[HallR]" />
457  // <ZSection z="[HallZ]" rMin="[Rmin]" rMax="[CMSR2]" />
458  // <ZSection z="[CMSZ1]" rMin="[Rmin]" rMax="[CMSR2]" />
459  DDPolycone rs(solid);
460  xos << "<Polycone name=\"" << rs.toString() << "\""
461  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
462  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
463  const std::vector<double>& zV(rs.zVec());
464  const std::vector<double>& rMinV(rs.rMinVec());
465  const std::vector<double>& rMaxV(rs.rMaxVec());
466  for (size_t i = 0; i < zV.size(); ++i) {
467  xos << "<ZSection z=\"" << zV[i] << "*mm\""
468  << " rMin=\"" << rMinV[i] << "*mm\""
469  << " rMax=\"" << rMaxV[i] << "*mm\"/>" << std::endl;
470  }
471  xos << "</Polycone>" << std::endl;
472  break;
473  }
475  DDPolyhedra rs(solid);
476  xos << "<Polyhedra name=\"" << rs.toString() << "\""
477  << " numSide=\"" << rs.sides() << "\""
478  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
479  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\">" << std::endl;
480  const std::vector<double>& zV(rs.zVec());
481  const std::vector<double>& rMinV(rs.rMinVec());
482  const std::vector<double>& rMaxV(rs.rMaxVec());
483  for (size_t i = 0; i < zV.size(); ++i) {
484  xos << "<ZSection z=\"" << zV[i] << "*mm\""
485  << " rMin=\"" << rMinV[i] << "*mm\""
486  << " rMax=\"" << rMaxV[i] << "*mm\"/>" << std::endl;
487  }
488  xos << "</Polyhedra>" << std::endl;
489  break;
490  }
492  // <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"/>
493  DDPseudoTrap rs(solid);
494  xos << "<PseudoTrap name=\"" << rs.toString() << "\""
495  << " dx1=\"" << rs.x1() << "*mm\""
496  << " dx2=\"" << rs.x2() << "*mm\""
497  << " dy1=\"" << rs.y1() << "*mm\""
498  << " dy2=\"" << rs.y2() << "*mm\""
499  << " dz=\"" << rs.halfZ() << "*mm\""
500  << " radius=\"" << rs.radius() << "*mm\""
501  << " atMinusZ=\"" << (rs.atMinusZ() ? "true" : "false") << "\"/>" << std::endl;
502  break;
503  }
505  // <TruncTubs name="trunctubs1" zHalf="50*cm" rMin="20*cm" rMax="40*cm"
506  // startPhi="0*deg" deltaPhi="90*deg"
507  // cutAtStart="25*cm" cutAtDelta="35*cm"/>
508  DDTruncTubs rs(solid);
509  xos << "<TruncTubs name=\"" << rs.toString() << "\""
510  << " zHalf=\"" << rs.zHalf() << "*mm\""
511  << " rMin=\"" << rs.rIn() << "*mm\""
512  << " rMax=\"" << rs.rOut() << "*mm\""
513  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
514  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\""
515  << " cutAtStart=\"" << rs.cutAtStart() << "*mm\""
516  << " cutAtDelta=\"" << rs.cutAtDelta() << "*mm\""
517  << " cutInside=\"" << (rs.cutInside() ? "true" : "false") << "\"/>" << std::endl;
518  break;
519  }
522  xos << "<ShapelessSolid name=\"" << rs.toString() << "\"/>" << std::endl;
523  break;
524  }
525  case DDSolidShape::ddtorus: {
526  // <Torus name="torus" innerRadius="7.5*cm" outerRadius="10*cm"
527  // torusRadius="30*cm" startPhi="0*deg" deltaPhi="360*deg"/>
528  DDTorus rs(solid);
529  xos << "<Torus name=\"" << rs.toString() << "\""
530  << " innerRadius=\"" << rs.rMin() << "*mm\""
531  << " outerRadius=\"" << rs.rMax() << "*mm\""
532  << " torusRadius=\"" << rs.rTorus() << "*mm\""
533  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
534  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\"/>" << std::endl;
535  break;
536  }
538  // <EllipticalTube name="CMSWall" xSemiAxis="[cavernData:CMSWallEDX]"
539  // ySemiAxis="[cavernData:CMSWallEDY]"
540  // zHeight="[cms:HallZ]"/>
542  xos << "<EllipticalTube name=\"" << rs.toString() << "\""
543  << " xSemiAxis=\"" << rs.xSemiAxis() << "*mm\""
544  << " ySemiAxis=\"" << rs.ySemiAxis() << "*mm\""
545  << " zHeight=\"" << rs.zHeight() << "*mm\"/>" << std::endl;
546  break;
547  }
549  // <Tubs name="TrackerSupportTubeNomex" rMin="[SupportTubeR1]+[Tol]"
550  // rMax="[SupportTubeR2]-[Tol]" dz="[SupportTubeL]"
551  // startPhi="0*deg" deltaPhi="360*deg"/>
552  DDCutTubs rs(solid);
553  const std::array<double, 3>& pLowNorm(rs.lowNorm());
554  const std::array<double, 3>& pHighNorm(rs.highNorm());
555 
556  xos << "<CutTubs name=\"" << rs.toString() << "\""
557  << " dz=\"" << rs.zhalf() << "*mm\""
558  << " rMin=\"" << rs.rIn() << "*mm\""
559  << " rMax=\"" << rs.rOut() << "*mm\""
560  << " startPhi=\"" << convertRadToDeg(rs.startPhi()) << "*deg\""
561  << " deltaPhi=\"" << convertRadToDeg(rs.deltaPhi()) << "*deg\""
562  << " lx=\"" << pLowNorm[0] << "\""
563  << " ly=\"" << pLowNorm[1] << "\""
564  << " lz=\"" << pLowNorm[2] << "\""
565  << " tx=\"" << pHighNorm[0] << "\""
566  << " ty=\"" << pHighNorm[1] << "\""
567  << " tz=\"" << pHighNorm[2] << "\"/>" << std::endl;
568  break;
569  }
572  std::vector<double> x = rs.xVec();
573  std::vector<double> y = rs.yVec();
574  std::vector<double> z = rs.zVec();
575  std::vector<double> zx = rs.zxVec();
576  std::vector<double> zy = rs.zyVec();
577  std::vector<double> zs = rs.zscaleVec();
578 
579  xos << "<ExtrudedPolygon name=\"" << rs.toString() << "\"";
580  for (unsigned int i = 0; i < x.size(); ++i)
581  xos << " <XYPoint x=\"" << x[i] << "*mm\" y=\"" << y[i] << "*mm\"/>\n";
582  for (unsigned int k = 0; k < z.size(); ++k)
583  xos << " <ZXYSection z=\"" << z[k] << "*mm\" x=\"" << zx[k] << "*mm\" y=\"" << zy[k] << "*mm scale=" << zs[k]
584  << "*mm\"/>\n";
585  xos << "</ExtrudedPolygon>\n";
586  break;
587  }
589  default:
590  throw cms::Exception("DDException")
591  << "DDCoreToDDXMLOutput::solid(...) " << solid.name() << " either not inited or no such solid.";
592  break;
593  }
594 }

References DDTrap::alpha1(), DDTrap::alpha2(), DDPseudoTrap::atMinusZ(), angle_units::operators::convertRadToDeg(), DDTruncTubs::cutAtDelta(), DDTruncTubs::cutAtStart(), DDTruncTubs::cutInside(), dd_not_init, ddbox, ddcons, ddcuttubs, ddellipticaltube, ddextrudedpolygon, ddintersection, ddpolycone_rrz, ddpolycone_rz, ddpolyhedra_rrz, ddpolyhedra_rz, ddpseudotrap, 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, dqmdumpme::k, DDCutTubs::lowNorm(), DDBase< N, C >::name(), 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(), cms::rotation_utils::rotName(), 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(), DDTrap::x1(), DDPseudoTrap::x1(), DDTrap::x2(), DDPseudoTrap::x2(), DDTrap::x3(), DDTrap::x4(), DDEllipticalTube::xSemiAxis(), DDExtrudedPolygon::xVec(), DDTrap::y1(), DDPseudoTrap::y1(), DDTrap::y2(), DDPseudoTrap::y2(), DDEllipticalTube::ySemiAxis(), DDExtrudedPolygon::yVec(), DDTruncTubs::zHalf(), DDTubs::zhalf(), DDCutTubs::zhalf(), DDCons::zhalf(), DDEllipticalTube::zHeight(), DDExtrudedPolygon::zscaleVec(), DDPolycone::zVec(), DDPolyhedra::zVec(), DDExtrudedPolygon::zVec(), DDExtrudedPolygon::zxVec(), and DDExtrudedPolygon::zyVec().

◆ specpar() [1/3]

void DDCoreToDDXMLOutput::specpar ( const DDSpecifics sp,
std::ostream &  xos 
)

Definition at line 824 of file DDCoreToDDXMLOutput.cc.

824  {
825  xos << "<SpecPar name=\"" << sp.toString() << "\" eval=\"false\">" << std::endl;
826 
827  // ========... all the selection strings out as strings by using the DDPartSelection's std::ostream function...
828  for (const auto& psit : sp.selection()) {
829  xos << "<PartSelector path=\"" << psit << "\"/>" << std::endl;
830  }
831 
832  // ========= ... and iterate over all DDValues...
833  for (const auto& vit : sp.specifics()) {
834  const DDValue& v = vit.second;
835  size_t s = v.size();
836  size_t i = 0;
837  // ============ ... all actual values with the same name
838  const std::vector<std::string>& strvec = v.strings();
839  if (v.isEvaluated()) {
840  for (; i < s; ++i) {
841  xos << "<Parameter name=\"" << v.name() << "\""
842  << " value=\"" << v[i] << "\""
843  << " eval=\"true\"/>" << std::endl;
844  }
845  } else {
846  for (; i < s; ++i) {
847  xos << "<Parameter name=\"" << v.name() << "\""
848  << " value=\"" << strvec[i] << "\""
849  << " eval=\"false\"/>" << std::endl;
850  }
851  }
852  }
853  xos << "</SpecPar>" << std::endl;
854 }

References mps_fire::i, alignCSCRings::s, DDSpecifics::selection(), DDSpecifics::specifics(), DDBase< N, C >::toString(), and findQualityFiles::v.

◆ specpar() [2/3]

void DDCoreToDDXMLOutput::specpar ( const std::pair< DDsvalues_type, std::set< const DDPartSelection * >> &  pssv,
std::ostream &  xos 
)

Definition at line 880 of file DDCoreToDDXMLOutput.cc.

881  {
882  static const std::string madeName("specparname");
883  static int numspecpars(0);
884  std::ostringstream ostr;
885  ostr << numspecpars++;
886  std::string spname = madeName + ostr.str();
887  xos << "<SpecPar name=\"" << spname << "\" eval=\"false\">" << std::endl;
888  for (const auto& psit : pssv.second) {
889  xos << "<PartSelector path=\"" << *psit << "\"/>" << std::endl;
890  }
891 
892  // ========= ... and iterate over all DDValues...
893  for (const auto& vit : pssv.first) {
894  const DDValue& v = vit.second;
895  size_t s = v.size();
896  size_t i = 0;
897  // ============ ... all actual values with the same name
898  const std::vector<std::string>& strvec = v.strings();
899  if (v.isEvaluated()) {
900  for (; i < s; ++i) {
901  xos << "<Parameter name=\"" << v.name() << "\""
902  << " value=\"" << v[i] << "\""
903  << " eval=\"true\"/>" << std::endl;
904  }
905  } else {
906  for (; i < s; ++i) {
907  xos << "<Parameter name=\"" << v.name() << "\""
908  << " value=\"" << strvec[i] << "\""
909  << " eval=\"false\"/>" << std::endl;
910  }
911  }
912  }
913 
914  xos << "</SpecPar>" << std::endl;
915 }

References mps_fire::i, alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and findQualityFiles::v.

◆ specpar() [3/3]

void DDCoreToDDXMLOutput::specpar ( const std::string &  name,
const dd4hep::SpecPar &  specPar,
std::ostream &  xos 
)

Definition at line 856 of file DDCoreToDDXMLOutput.cc.

856  {
857  xos << "<SpecPar name=\"" << name << "\" eval=\"false\">" << std::endl;
858 
859  for (const auto& psit : specPar.paths) {
860  xos << "<PartSelector path=\"" << psit << "\"/>" << std::endl;
861  }
862 
863  for (const auto& vit : specPar.spars) {
864  for (const auto& sit : vit.second) {
865  xos << "<Parameter name=\"" << vit.first << "\""
866  << " value=\"" << sit << "\""
867  << " eval=\"false\"/>" << std::endl;
868  }
869  }
870  for (const auto& vit : specPar.numpars) {
871  for (const auto& sit : vit.second) {
872  xos << "<Parameter name=\"" << vit.first << "\""
873  << " value=\"" << sit << "\""
874  << " eval=\"true\"/>" << std::endl;
875  }
876  }
877  xos << "</SpecPar>" << std::endl;
878 }

References Skims_PA_cff::name.

◆ trimShapeName()

std::string DDCoreToDDXMLOutput::trimShapeName ( const std::string &  solidName)
static

Definition at line 93 of file DDCoreToDDXMLOutput.cc.

93  {
94  size_t trimPt = solidName.find("_shape_0x");
95  if (trimPt != std::string::npos)
96  return (solidName.substr(0, trimPt));
97  return (solidName);
98 }

Referenced by OutputDD4hepToDDL::beginRun().

Member Data Documentation

◆ ns_

std::string DDCoreToDDXMLOutput::ns_

Definition at line 78 of file DDCoreToDDXMLOutput.h.

cms::DDSolidShape::ddellipticaltube
DDSpecifics::selection
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:34
DDAxes::y
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
cms::rotation_utils::rotHash
std::string rotHash(const Double_t *rot)
Definition: DDNamespace.cc:25
mps_fire.i
i
Definition: mps_fire.py:428
DDEllipticalTube
Definition: DDSolid.h:363
DDCons
Definition: DDSolid.h:292
DDSolidShape::ddtrap
cms::DDSolidShape::ddtubs
DDSolidShape::ddtorus
makeMuonMisalignmentScenario.matrix
list matrix
Definition: makeMuonMisalignmentScenario.py:141
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
angle_units::operators::convertRadToDeg
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
cms::DDNamespace
Definition: DDNamespace.h:22
DDSolidShape::ddpseudotrap
DDSolidShape::ddpolyhedra_rrz
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DDLogicalPart::material
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
Definition: DDLogicalPart.cc:118
cms::DDSolidShape::ddtorus
DDAxes::x
findQualityFiles.v
v
Definition: findQualityFiles.py:179
DDSpecifics::specifics
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:36
cms::DDSolidShape::ddcuttubs
cms::DDSolidShape::ddcons
DDTorus
Definition: DDSolid.h:306
DDPseudoTrap
Definition: DDSolid.h:117
DDCutTubs
Definition: DDSolid.h:278
cms::rotation_utils::addRotWithNewName
static void addRotWithNewName(cms::DDNamespace &ns, std::string &name, const dd4hep::Rotation3D &rot)
Definition: DDCoreToDDXMLOutput.cc:60
visDQMUpload.context
context
Definition: visDQMUpload.py:37
DDCoreToDDXMLOutput::material
void material(const DDMaterial &material, std::ostream &xos)
Definition: DDCoreToDDXMLOutput.cc:596
DDBooleanSolid
Definition: DDSolid.h:184
cms::DDSolidShape::ddtrunctubs
alignCSCRings.s
s
Definition: alignCSCRings.py:92
RPCNoise_example.check
check
Definition: RPCNoise_example.py:71
DDTruncTubs
A truncated tube section.
Definition: DDSolid.h:139
DDPosData::ddrot
const DDRotation & ddrot() const
Definition: DDPosData.h:32
DDSolidShape::ddtubs
geant_units::operators::convertUnitsTo
constexpr NumType convertUnitsTo(double desiredUnits, NumType val)
Definition: GeantUnits.h:100
DDBox
Interface to a Box.
Definition: DDSolid.h:167
DDBase::toString
std::string toString() const
Definition: DDBase.h:63
cms::DDSolidShape::ddunion
cms::DDSolidShape::ddtrd1
DDSolidShape::ddtrunctubs
DDSolidShape::ddpolyhedra_rz
DDAxes::z
convertGPerCcToMgPerCc
static constexpr NumType convertGPerCcToMgPerCc(NumType gPerCc)
Definition: DDCoreToDDXMLOutput.cc:37
DDCoreToDDXMLOutput::rotation
void rotation(const DDRotation &rotation, std::ostream &xos, const std::string &rotn="")
Definition: DDCoreToDDXMLOutput.cc:664
DDPosData::copyno
int copyno() const
Definition: DDPosData.h:33
cms::DDSolidShape::ddpolyhedra
dqmdumpme.k
k
Definition: dqmdumpme.py:60
b
double b
Definition: hdecay.h:118
cms::dd::value
Mapping::value_type::value_type value(Mapping a, const std::string &name)
Definition: DDSolidShapes.h:42
cms::DDSolidShape
DDSolidShape
Definition: DDSolidShapes.h:73
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: PGeometricDetBuilder.cc:20
DDCoreToDDXMLOutput::solid
void solid(const DDSolid &solid, std::ostream &xos)
Definition: DDCoreToDDXMLOutput.cc:332
DDSolidShape::ddellipticaltube
DDTrap
Interface to a Trapezoid.
Definition: DDSolid.h:88
tol0
static constexpr double tol0
Definition: DDCoreToDDXMLOutput.cc:42
a
double a
Definition: hdecay.h:119
cms::DDSolidShape::ddpolycone
cms::rotation_utils::identityHash
static const std::string identityHash("1.00000000.00000000.00000000.00000001.00000000.00000000.00000000.00000001.0000000")
DDSolidShape::ddcons
DDRotation::rotation
const DDRotationMatrix & rotation() const
Returns the read-only rotation-matrix.
Definition: DDTransform.h:81
cms::DDSolidShape::ddtrap
cms::DDSolidShape::ddbox
DDShapelessSolid
This is simply a handle on the solid.
Definition: DDSolid.h:178
cms_rounding
Definition: Rounding.h:8
cms_rounding::roundIfNear0
constexpr valType roundIfNear0(valType value, double tolerance=1.e-7)
Definition: Rounding.h:11
cms::DDSolidShape::ddextrudedpolygon
DDSolidShape::dd_not_init
DDExtrudedPolygon
Definition: DDSolid.h:249
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDPolyhedra
Definition: DDSolid.h:235
reflectTol
static constexpr double reflectTol
Definition: DDCoreToDDXMLOutput.cc:43
DDPosData::translation
const DDTranslation & translation() const
Definition: DDPosData.h:27
cms::DDSolidShape::ddintersection
DDRotationMatrix
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
Definition: DDRotationMatrix.h:8
cms::rotation_utils::rotName
static const std::string & rotName(const T &rot, const cms::DDParsingContext &context)
Definition: DDCoreToDDXMLOutput.cc:81
DDSolidShape::ddbox
DDValue
Definition: DDValue.h:22
HGCalGeometryMode::Polyhedra
Definition: HGCalGeometryMode.h:37
cms::DDSolidShape::ddtrd2
Exception
Definition: hltDiff.cc:245
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
HGCalGeometryMode::ExtrudedPolygon
Definition: HGCalGeometryMode.h:37
cms::DDSolidShape::ddsubtraction
cms::DDSolidShape::dd_not_init
DDSolidShape::ddextrudedpolygon
DDCoreToDDXMLOutput::trimShapeName
static std::string trimShapeName(const std::string &solidName)
Definition: DDCoreToDDXMLOutput.cc:93
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDSolidShape::ddshapeless
DDPolycone
Definition: DDSolid.h:222
DDRotation
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:57
ROOT::Math::XYZVector
Transform3DPJ::Vector XYZVector
Definition: Transform3DPJ.cc:34
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
DDSolidShape::ddcuttubs
DDSolidShape::ddpolycone_rrz
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
DDSolidShape::ddsubtraction
DDSolidShape::ddintersection
child
Definition: simpleInheritance.h:11
class-composition.parent
parent
Definition: class-composition.py:98
DDLogicalPart::solid
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
Definition: DDLogicalPart.cc:120
DDSolidShape::ddunion
DDSolidShape::ddpolycone_rz
cms::DDSolidShapeMap
const std::array< const cms::dd::NameValuePair< DDSolidShape >, 21 > DDSolidShapeMap
Definition: DDSolidShapes.h:99
fastSimProducer_cff.density
density
Definition: fastSimProducer_cff.py:61
DDTubs
Definition: DDSolid.h:266