1 #include "DD4hep/DetFactoryHelper.h" 2 #include "DD4hep/DetectorHelper.h" 3 #include "DD4hep/DD4hepUnits.h" 4 #include "DD4hep/GeoHandler.h" 5 #include "DD4hep/Printout.h" 6 #include "DD4hep/Plugins.h" 7 #include "DD4hep/detail/SegmentationsInterna.h" 8 #include "DD4hep/detail/DetectorInterna.h" 9 #include "DD4hep/detail/ObjectsInterna.h" 11 #include "XML/Utilities.h" 19 #include "TGeoManager.h" 20 #include "TGeoMaterial.h" 39 UInt_t unique_mat_id = 0xAFFEFEED;
42 class include_constants;
47 class ConstantsSection;
54 class MaterialSection;
58 class RotationSection;
60 class DDLReflectionRotation;
69 class LogicalPartSection;
73 class DDLExtrudedPolygon;
90 class DDLIntersectionSolid;
91 class DDLSubtractionSolid;
107 template <>
void Converter<debug>::operator()(xml_h element)
const;
108 template <>
void Converter<print_xml_doc>::operator()(xml_h element)
const;
109 template <>
void Converter<disabled_algo>::operator()(xml_h element)
const;
112 template <>
void Converter<ConstantsSection>::operator()(xml_h element)
const;
113 template <>
void Converter<DDLConstant>::operator()(xml_h element)
const;
114 template <>
void Converter<DDRegistry>::operator()(xml_h element)
const;
117 template <>
void Converter<vissection>::operator()(xml_h element)
const;
119 template <>
void Converter<vis>::operator()(xml_h element)
const;
122 template <>
void Converter<MaterialSection>::operator()(xml_h element)
const;
123 template <>
void Converter<DDLElementaryMaterial>::operator()(xml_h element)
const;
124 template <>
void Converter<DDLCompositeMaterial>::operator()(xml_h element)
const;
127 template <>
void Converter<RotationSection>::operator()(xml_h element)
const;
129 template <>
void Converter<DDLRotation>::operator()(xml_h element)
const;
131 template <>
void Converter<DDLReflectionRotation>::operator()(xml_h element)
const;
133 template <>
void Converter<DDLRotationSequence>::operator()(xml_h element)
const;
135 template <>
void Converter<DDLRotationByAxis>::operator()(xml_h element)
const;
136 template <>
void Converter<DDLTransform3D>::operator()(xml_h element)
const;
139 template <>
void Converter<LogicalPartSection>::operator()(xml_h element)
const;
140 template <>
void Converter<DDLLogicalPart>::operator()(xml_h element)
const;
143 template <>
void Converter<PosPartSection>::operator()(xml_h element)
const;
145 template <>
void Converter<DDLPosPart>::operator()(xml_h element)
const;
147 template <>
void Converter<DDLDivision>::operator()(xml_h element)
const;
150 template <>
void Converter<SpecParSection>::operator()(xml_h element)
const;
151 template <>
void Converter<SpecPar>::operator()(xml_h element)
const;
152 template <>
void Converter<PartSelector>::operator()(xml_h element)
const;
153 template <>
void Converter<Parameter>::operator()(xml_h element)
const;
156 template <>
void Converter<SolidSection>::operator()(xml_h element)
const;
158 template <>
void Converter<DDLUnionSolid>::operator()(xml_h element)
const;
160 template <>
void Converter<DDLSubtractionSolid>::operator()(xml_h element)
const;
162 template <>
void Converter<DDLIntersectionSolid>::operator()(xml_h element)
const;
164 template <>
void Converter<DDLPseudoTrap>::operator()(xml_h element)
const;
166 template <>
void Converter<DDLExtrudedPolygon>::operator()(xml_h element)
const;
168 template <>
void Converter<DDLShapeless>::operator()(xml_h element)
const;
170 template <>
void Converter<DDLTrapezoid>::operator()(xml_h element)
const;
172 template <>
void Converter<DDLPolycone>::operator()(xml_h element)
const;
174 template <>
void Converter<DDLPolyhedra>::operator()(xml_h element)
const;
176 template <>
void Converter<DDLEllipticalTube>::operator()(xml_h element)
const;
178 template <>
void Converter<DDLTorus>::operator()(xml_h element)
const;
180 template <>
void Converter<DDLTubs>::operator()(xml_h element)
const;
182 template <>
void Converter<DDLCutTubs>::operator()(xml_h element)
const;
184 template <>
void Converter<DDLTruncTubs>::operator()(xml_h element)
const;
186 template <>
void Converter<DDLSphere>::operator()(xml_h element)
const;
188 template <>
void Converter<DDLTrd1>::operator()(xml_h element)
const;
190 template <>
void Converter<DDLTrd2>::operator()(xml_h element)
const;
192 template <>
void Converter<DDLCone>::operator()(xml_h element)
const;
194 template <>
void Converter<DDLBox>::operator()(xml_h element)
const;
196 template <>
void Converter<DDLAlgorithm>::operator()(xml_h element)
const;
198 template <>
void Converter<DDLVector>::operator()(xml_h element)
const;
201 template <>
void Converter<include_load>::operator()(xml_h element)
const;
203 template <>
void Converter<include_unload>::operator()(xml_h element)
const;
205 template <>
void Converter<include_constants>::operator()(xml_h element)
const;
209 template <>
void Converter<ConstantsSection>::operator()( xml_h element )
const {
217 template <>
void Converter<vissection>::operator()(xml_h element)
const {
223 template <>
void Converter<MaterialSection>::operator()(xml_h element)
const {
225 xml_coll_t( element,
DD_CMU(ElementaryMaterial)).for_each(Converter<DDLElementaryMaterial>(
description,ns.context(),optional));
226 xml_coll_t( element,
DD_CMU(CompositeMaterial)).for_each(Converter<DDLCompositeMaterial>(
description,ns.context(),optional));
229 template <>
void Converter<RotationSection>::operator()(xml_h element)
const {
231 xml_coll_t( element,
DD_CMU(Rotation)).for_each(Converter<DDLRotation>(
description,ns.context(),optional));
232 xml_coll_t( element,
DD_CMU(ReflectionRotation)).for_each(Converter<DDLReflectionRotation>(
description,ns.context(),optional));
233 xml_coll_t( element,
DD_CMU(RotationSequence)).for_each(Converter<DDLRotationSequence>(
description,ns.context(),optional));
234 xml_coll_t( element,
DD_CMU(RotationByAxis)).for_each(Converter<DDLRotationByAxis>(
description,ns.context(),optional));
237 template <>
void Converter<PosPartSection>::operator()( xml_h element )
const {
239 xml_coll_t( element,
DD_CMU( Division )).for_each( Converter<DDLDivision>(
description, ns.context(), optional ));
240 xml_coll_t( element,
DD_CMU( PosPart )).for_each( Converter<DDLPosPart>(
description, ns.context(), optional ));
244 template <>
void Converter<SpecParSection>::operator()( xml_h element )
const {
246 xml_coll_t( element,
DD_CMU( SpecPar )).for_each( Converter<SpecPar>(
description, ns.context(), optional ));
249 template <>
void Converter<SpecPar>::operator()( xml_h element )
const {
251 xml_coll_t( element,
DD_CMU( PartSelector )).for_each( Converter<PartSelector>(
description, ns.context(), optional ));
252 xml_coll_t( element,
DD_CMU( Parameter )).for_each( Converter<Parameter>(
description, ns.context(), optional ));
256 template <>
void Converter<LogicalPartSection>::operator()(xml_h element)
const {
258 xml_coll_t( element,
DD_CMU(LogicalPart)).for_each(Converter<DDLLogicalPart>(
description,ns.context(),optional));
261 template <>
void Converter<disabled_algo>::operator()(xml_h element)
const {
267 template <>
void Converter<SolidSection>::operator()(xml_h element)
const {
269 for(xml_coll_t solid(element, _U(star)); solid; ++solid) {
270 string tag = solid.tag();
272 switch(
hash( solid.tag()))
277 case hash(
"Polycone"):
278 Converter<DDLPolycone>(
description,ns.context(),optional)(solid);
280 case hash(
"Polyhedra"):
281 Converter<DDLPolyhedra>(
description,ns.context(),optional)(solid);
286 case hash(
"CutTubs"):
287 Converter<DDLCutTubs>(
description,ns.context(),optional)(solid);
289 case hash(
"TruncTubs"):
290 Converter<DDLTruncTubs>(
description,ns.context(),optional)(solid);
296 Converter<DDLTrd1>(
description,ns.context(),optional)(solid);
299 Converter<DDLTrd2>(
description,ns.context(),optional)(solid);
307 case hash(
"EllipticalTube"):
313 case hash(
"PseudoTrap"):
316 case hash(
"ExtrudedPolygon"):
317 Converter<DDLExtrudedPolygon>(
description,ns.context(),optional)(solid);
319 case hash(
"Trapezoid"):
322 case hash(
"UnionSolid"):
323 Converter<DDLUnionSolid>(
description,ns.context(),optional)(solid);
325 case hash(
"SubtractionSolid"):
326 Converter<DDLSubtractionSolid>(
description,ns.context(),optional)(solid);
328 case hash(
"IntersectionSolid"):
329 Converter<DDLIntersectionSolid>(
description,ns.context(),optional)(solid);
331 case hash(
"ShapelessSolid"):
332 Converter<DDLShapeless>(
description,ns.context(),optional)(solid);
335 throw std::runtime_error(
"Request to process unknown shape '" + xml_dim_t(solid).nameStr() +
"' [" + tag +
"]");
342 template <>
void Converter<DDLConstant>::operator()(xml_h element)
const {
344 DDRegistry*
res = _option<DDRegistry>();
345 xml_dim_t constant = element;
346 xml_dim_t par = constant.parent();
347 bool eval = par.hasAttr(_U(eval)) ? par.attr<
bool>(_U(eval)) :
false;
348 string val = constant.valueStr();
349 string nam = constant.nameStr();
350 string real = ns.prepend(nam);
351 string typ = eval ?
"number" :
"string";
352 size_t idx = val.find(
'[');
354 if( constant.hasAttr(_U(
type)) )
355 typ = constant.typeStr();
357 if( idx == string::npos || typ ==
"string" ) {
359 ns.addConstant( nam, val, typ );
360 res->allConst[real] =
val;
361 res->originalConst[real] =
val;
364 printout(
INFO,
"DD4CMS",
"++ Unresolved constant: %s = %s [%s]. Try to resolve later. [%s]",
365 real.c_str(), val.c_str(), typ.c_str(), e.what());
370 while ( idx != string::npos ) {
372 size_t idp = val.find(
':',idx);
373 size_t idq = val.find(
']',idx);
374 if( idp == string::npos || idp > idq )
375 val.insert(idx,ns.name());
376 else if( idp != string::npos && idp < idq )
378 idx = val.find(
'[',idx);
380 printout(ns.context()->debug_constants ? ALWAYS :
DEBUG,
381 "Constant",
"Unresolved: %s -> %s",real.c_str(),val.c_str());
382 res->allConst[real] =
val;
383 res->originalConst[real] =
val;
384 res->unresolvedConst[real] =
val;
395 template <>
void Converter<vis>::operator()(xml_h e)
const {
397 VisAttr attr(e.attr<
string>(_U(
name)));
398 float red = e.hasAttr(_U(
r)) ? e.attr<
float>(_U(
r)) : 1.0
f;
399 float green = e.hasAttr(_U(
g)) ? e.attr<
float>(_U(
g)) : 1.0
f;
400 float blue = e.hasAttr(_U(
b)) ? e.attr<
float>(_U(
b)) : 1.0
f;
402 printout(ns.context()->debug_visattr ? ALWAYS :
DEBUG,
"Compact",
403 "++ Converting VisAttr structure: %-16s. R=%.3f G=%.3f B=%.3f",
405 attr.setColor(red, green, blue);
406 if(e.hasAttr(_U(
alpha)))
407 attr.setAlpha(e.attr<
float>(_U(
alpha)));
408 if(e.hasAttr(_U(visible)))
409 attr.setVisible(e.attr<
bool>(_U(visible)));
413 attr.setLineStyle(VisAttr::SOLID);
414 else if(ls ==
"broken")
415 attr.setLineStyle(VisAttr::DASHED);
418 attr.setLineStyle(VisAttr::SOLID);
420 if(e.hasAttr(_U(drawingStyle))) {
421 string ds = e.attr<
string>(_U(drawingStyle));
422 if(ds ==
"wireframe")
423 attr.setDrawingStyle(VisAttr::WIREFRAME);
424 else if(ds ==
"solid")
425 attr.setDrawingStyle(VisAttr::SOLID);
428 attr.setDrawingStyle(VisAttr::SOLID);
430 if(e.hasAttr(_U(showDaughters)))
431 attr.setShowDaughters(e.attr<
bool>(_U(showDaughters)));
433 attr.setShowDaughters(
true);
438 template <>
void Converter<DDLElementaryMaterial>::operator()(xml_h element)
const {
440 xml_dim_t xmat( element);
441 string nam = ns.prepend(xmat.nameStr());
443 TGeoMaterial* mat = mgr.GetMaterial(nam.c_str());
444 if(
nullptr == mat ) {
445 const char* matname = nam.c_str();
446 double density = xmat.density();
447 double atomicNumber = xmat.attr<
double>(
DD_CMU(atomicNumber));
448 TGeoElementTable* tab = mgr.GetElementTable();
449 TGeoMixture*
mix =
new TGeoMixture(nam.c_str(), 1, density);
450 TGeoElement* elt = tab->FindElement(xmat.nameStr().c_str());
452 printout(ns.context()->debug_materials ? ALWAYS :
DEBUG,
"DD4CMS",
453 "+++ Converting material %-48s Density: %.3f.",
454 (
'"'+nam+
'"').c_str(), density);
458 "+++ Converter<ElementaryMaterial> No element present with name:%s [FAKE IT]",
460 int n =
int(atomicNumber/2e0);
462 elt =
new TGeoElement(xmat.nameStr().c_str(),
"CMS element",
n,atomicNumber);
464 if( elt->Z() == 0 ) {
465 int n =
int(atomicNumber/2e0);
467 elt =
new TGeoElement((xmat.nameStr()+
"-CMS").c_str(),
"CMS element",
n,atomicNumber);
469 mix->AddElement(elt, 1.0);
472 TGeoMedium* medium = mgr.GetMedium(matname);
473 if(
nullptr == medium) {
475 medium =
new TGeoMedium(matname, unique_mat_id, mix);
476 medium->SetTitle(
"material");
477 medium->SetUniqueID(unique_mat_id);
483 template <>
void Converter<DDLCompositeMaterial>::operator()(xml_h element)
const {
485 xml_dim_t xmat( element);
486 string nam = ns.prepend(xmat.nameStr());
488 TGeoMaterial* mat = mgr.GetMaterial(nam.c_str());
489 if(
nullptr == mat ) {
490 const char* matname = nam.c_str();
491 double density = xmat.density();
492 xml_coll_t composites(xmat,
DD_CMU(MaterialFraction));
493 TGeoMixture* mix =
new TGeoMixture(nam.c_str(), composites.size(), density);
495 printout(ns.context()->debug_materials ? ALWAYS :
DEBUG,
"DD4CMS",
496 "++ Converting material %-48s Density: %.3f.",
497 (
'"'+nam+
'"').c_str(), density);
499 for( composites.reset(); composites; ++composites ) {
500 xml_dim_t xfrac(composites);
501 xml_dim_t xfrac_mat(xfrac.child(
DD_CMU(rMaterial)));
503 string fracname = ns.realName(xfrac_mat.nameStr());
505 TGeoMaterial* frac_mat = mgr.GetMaterial(fracname.c_str());
507 mix->AddElement(frac_mat, fraction);
510 printout(
WARNING,
"DD4CMS",
"+++ Composite material \"%s\" not present!",
515 TGeoMedium* medium = mgr.GetMedium(matname);
516 if(
nullptr == medium ) {
518 medium =
new TGeoMedium(matname, unique_mat_id, mix);
519 medium->SetTitle(
"material");
520 medium->SetUniqueID(unique_mat_id);
526 template <>
void Converter<DDLRotation>::operator()(xml_h element)
const {
529 xml_dim_t xrot( element);
530 string nam = xrot.nameStr();
531 double thetaX = xrot.hasAttr(
DD_CMU(thetaX)) ? ns.attr<
double>(xrot,
DD_CMU(thetaX)) : 0e0;
532 double phiX = xrot.hasAttr(
DD_CMU(phiX)) ? ns.attr<
double>(xrot,
DD_CMU(phiX)) : 0e0;
533 double thetaY = xrot.hasAttr(
DD_CMU(thetaY)) ? ns.attr<
double>(xrot,
DD_CMU(thetaY)) : 0e0;
534 double phiY = xrot.hasAttr(
DD_CMU(phiY)) ? ns.attr<
double>(xrot,
DD_CMU(phiY)) : 0e0;
535 double thetaZ = xrot.hasAttr(
DD_CMU(thetaZ)) ? ns.attr<
double>(xrot,
DD_CMU(thetaZ)) : 0e0;
536 double phiZ = xrot.hasAttr(
DD_CMU(phiZ)) ? ns.attr<
double>(xrot,
DD_CMU(phiZ)) : 0e0;
539 "DD4CMS",
"+++ Adding rotation: %-32s: (theta/phi)[rad] X: %6.3f %6.3f Y: %6.3f %6.3f Z: %6.3f %6.3f",
541 ns.addRotation(nam, rot);
545 template <>
void Converter<DDLReflectionRotation>::operator()( xml_h element )
const {
548 xml_dim_t xrot( element );
549 string name = xrot.nameStr();
550 double thetaX = xrot.hasAttr(
DD_CMU( thetaX )) ? ns.attr<
double>( xrot,
DD_CMU( thetaX )) : 0e0;
551 double phiX = xrot.hasAttr(
DD_CMU( phiX )) ? ns.attr<
double>( xrot,
DD_CMU( phiX )) : 0e0;
552 double thetaY = xrot.hasAttr(
DD_CMU( thetaY )) ? ns.attr<
double>( xrot,
DD_CMU( thetaY )) : 0e0;
553 double phiY = xrot.hasAttr(
DD_CMU( phiY )) ? ns.attr<
double>( xrot,
DD_CMU( phiY )) : 0e0;
554 double thetaZ = xrot.hasAttr(
DD_CMU( thetaZ )) ? ns.attr<
double>( xrot,
DD_CMU( thetaZ )) : 0e0;
555 double phiZ = xrot.hasAttr(
DD_CMU( phiZ )) ? ns.attr<
double>( xrot,
DD_CMU( phiZ )) : 0e0;
557 "DD4CMS",
"+++ Adding reflection rotation: %-32s: (theta/phi)[rad] X: %6.3f %6.3f Y: %6.3f %6.3f Z: %6.3f %6.3f",
559 Rotation3D rot =
makeRotReflect( thetaX, phiX, thetaY, phiY, thetaZ, phiZ );
560 ns.addRotation( name, rot );
564 template <>
void Converter<DDLRotationSequence>::operator()(xml_h element)
const {
567 xml_dim_t xrot( element);
568 string nam = xrot.nameStr();
570 xml_coll_t rotations(xrot,
DD_CMU(RotationByAxis));
571 for( rotations.reset(); rotations; ++rotations ) {
572 string axis = ns.attr<
string>(rotations,
DD_CMU(axis));
573 double angle = ns.attr<
double>(rotations,_U(angle));
576 "DD4CMS",
"+ Adding rotation to: %-29s: (axis/angle)[rad] Axis: %s Angle: %6.3f",
577 nam.c_str(), axis.c_str(),
angle);
582 rot.GetComponents(xx,xy,xz,yx,yy,yz,zx,zy,zz);
584 "DD4CMS",
"+++ Adding rotation sequence: %-23s: %6.3f %6.3f %6.3f, %6.3f %6.3f %6.3f, %6.3f %6.3f %6.3f",
585 ns.prepend(nam).c_str(),
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz);
586 ns.addRotation(nam, rot);
590 template <>
void Converter<DDLRotationByAxis>::operator()(xml_h element)
const {
593 xml_dim_t xrot( element);
594 xml_dim_t par(xrot.parent());
595 if( xrot.hasAttr(_U(name))) {
596 string nam = xrot.nameStr();
597 string axis = ns.attr<
string>(xrot,
DD_CMU(axis));
598 double angle = ns.attr<
double>(xrot,_U(angle));
602 "DD4CMS",
"+++ Adding rotation: %-32s: (axis/angle)[rad] Axis: %s Angle: %6.3f",
603 ns.prepend(nam).c_str(), axis.c_str(),
angle);
604 ns.addRotation(nam, rot);
609 template <>
void Converter<DDLLogicalPart>::operator()(xml_h element)
const {
611 xml_dim_t
e(element);
612 string sol = e.child(
DD_CMU(rSolid)).attr<
string>(_U(name));
613 string mat = e.child(
DD_CMU(rMaterial)).attr<
string>(_U(name));
614 ns.addVolume(
Volume(e.nameStr(), ns.solid(sol), ns.material(mat)));
618 template <>
void Converter<DDLTransform3D>::operator()( xml_h element )
const {
620 Transform3D* tr = _option<Transform3D>();
621 xml_dim_t
e(element);
622 xml_dim_t translation = e.child(
DD_CMU( Translation ),
false );
624 xml_dim_t refRotation = e.child(
DD_CMU( rRotation ),
false );
628 if( translation.ptr()) {
629 double x = ns.attr<
double>( translation, _U( x ));
630 double y = ns.attr<
double>( translation, _U( y ));
631 double z = ns.attr<
double>( translation, _U( z ));
632 pos = Position(x,y,z);
634 if( rotation.ptr()) {
635 double x = ns.attr<
double>(
rotation, _U( x ));
636 double y = ns.attr<
double>(
rotation, _U( y ));
637 double z = ns.attr<
double>(
rotation, _U( z ));
638 rot = RotationZYX(z,y,x);
640 else if( refRotation.ptr()) {
641 string rotName = refRotation.nameStr();
643 rotName = ns.name() + rotName;
645 rot = ns.rotation( rotName );
647 *tr = Transform3D( rot, pos );
651 template <>
void Converter<DDLPosPart>::operator()( xml_h element )
const {
653 xml_dim_t
e( element );
654 int copy = e.attr<
int>(
DD_CMU( copyNumber ));
655 string parentName = ns.attr<
string>( e.child(
DD_CMU( rParent )), _U( name ));
656 string childName = ns.attr<
string>( e.child(
DD_CMU( rChild )), _U( name ));
660 childName = ns.name() + childName;
663 printout( ns.context()->debug_placements ? ALWAYS :
DEBUG,
"DD4CMS",
664 "+++ %s Parent: %-24s [%s] Child: %-32s [%s] copy:%d",
666 parentName.c_str(), parent.isValid() ?
"VALID" :
"INVALID",
667 childName.c_str(), child.isValid() ?
"VALID" :
"INVALID",
671 if( child.isValid()) {
674 pv = parent.placeVolume( child, copy, transform );
677 printout(
ERROR,
"DD4CMS",
"+++ Placement FAILED! Parent:%s Child:%s Valid:%s",
678 parent.name(), childName.c_str(), yes_no( child.isValid()));
683 template <>
void Converter<PartSelector>::operator()( xml_h element )
const {
685 xml_dim_t
e( element );
686 xml_dim_t specPar = e.parent();
687 string specParName = specPar.attr<
string>( _U( name ));
688 string path = e.attr<
string>(
DD_CMU( path ));
690 printout(ns.context()->debug_specpars ? ALWAYS :
DEBUG,
"DD4CMS",
691 "+++ PartSelector for %s path: %s", specParName.c_str(), path.c_str());
695 template <>
void Converter<Parameter>::operator()( xml_h element )
const {
697 xml_dim_t
e( element );
698 string name = e.nameStr();
700 bool eval = e.hasAttr( _U( eval )) ? e.attr<
bool>( _U( eval )) :
false;
701 string type = eval ?
"number" :
"string";
703 printout(ns.context()->debug_specpars ? ALWAYS :
DEBUG,
"DD4CMS",
704 "+++ Parameter: %s value %s is %s", name.c_str(), value.c_str(), type.c_str());
707 template <
typename TYPE>
710 xml_dim_t
e(element);
711 string nam = e.nameStr();
716 if( e.hasChild(
DD_CMU(rSolid)) ) {
717 for(xml_coll_t
c(element,
DD_CMU(rSolid)); cnt<2 &&
c; ++
c, ++cnt)
718 solids[cnt] = ns.
solid(c.attr<
string>(_U(name)));
721 if( (solids[0] = ns.
solid(e.attr<
string>(
DD_CMU(firstSolid)))).isValid() ) ++cnt;
722 if( (solids[1] = ns.
solid(e.attr<
string>(
DD_CMU(secondSolid)))).isValid() ) ++cnt;
725 except(
"DD4CMS",
"+++ Failed to create boolean solid %s. Found only %d parts.",nam.c_str(), cnt);
728 "+++ BooleanSolid: %s Left: %-32s Right: %-32s",
729 nam.c_str(), solids[0]->GetName(), solids[1]->GetName());
731 if( solids[0].isValid() && solids[1].isValid() ) {
733 Converter<DDLTransform3D>(*context->
description,context,&trafo)(element);
734 boolean = TYPE(solids[0],solids[1],trafo);
736 if( !
boolean.isValid() )
737 except(
"DD4CMS",
"+++ FAILED to construct subtraction solid: %s",nam.c_str());
742 template <>
void Converter<DDLUnionSolid>::operator()(xml_h element)
const {
743 convert_boolean<UnionSolid>(_param<cms::DDParsingContext>(),element);
747 template <>
void Converter<DDLSubtractionSolid>::operator()(xml_h element)
const {
748 convert_boolean<SubtractionSolid>(_param<cms::DDParsingContext>(),element);
752 template <>
void Converter<DDLIntersectionSolid>::operator()(xml_h element)
const {
753 convert_boolean<IntersectionSolid>(_param<cms::DDParsingContext>(),element);
757 template <>
void Converter<DDLPolycone>::operator()(xml_h element)
const {
759 xml_dim_t
e(element);
760 string nam = e.nameStr();
761 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
763 vector<double>
z, rmin, rmax,
r;
765 for(xml_coll_t rzpoint( element,
DD_CMU(RZPoint)); rzpoint; ++rzpoint) {
766 z.emplace_back(ns.
attr<
double>(rzpoint,_U(z)));
767 r.emplace_back(ns.
attr<
double>(rzpoint,_U(r)));
770 for(xml_coll_t zplane(element,
DD_CMU(ZSection)); zplane; ++zplane) {
773 z.emplace_back(ns.
attr<
double>(zplane,_U(z)));
776 "+ Polycone: startPhi=%10.3f [rad] deltaPhi=%10.3f [rad] %4ld z-planes",
778 ns.
addSolid(nam, Polycone(startPhi,deltaPhi,rmin,rmax,z));
782 "+ Polycone: startPhi=%10.3f [rad] deltaPhi=%10.3f [rad] %4ld z-planes and %4ld radii",
783 startPhi,
deltaPhi, z.size(), r.size());
784 ns.
addSolid(nam, Polycone(startPhi,deltaPhi,r,z));
789 template <>
void Converter<DDLExtrudedPolygon>::operator()(xml_h element)
const {
791 xml_dim_t
e(element);
792 string nam = e.nameStr();
793 vector<double> pt_x, pt_y, sec_x, sec_y, sec_z, sec_scale;
795 for(xml_coll_t sec(element,
DD_CMU(ZXYSection)); sec; ++sec) {
796 sec_z.emplace_back(ns.
attr<
double>(sec,_U(
z)));
797 sec_x.emplace_back(ns.
attr<
double>(sec,_U(
x)));
798 sec_y.emplace_back(ns.
attr<
double>(sec,_U(
y)));
801 for(xml_coll_t
pt( element,
DD_CMU(XYPoint));
pt; ++
pt) {
802 pt_x.emplace_back(ns.
attr<
double>(
pt,_U(
x)));
803 pt_y.emplace_back(ns.
attr<
double>(
pt,_U(
y)));
806 "+ ExtrudedPolygon: %4ld points %4ld zxy sections",
807 pt_x.size(), sec_z.size());
812 template <>
void Converter<DDLPolyhedra>::operator()(xml_h element)
const {
814 xml_dim_t
e(element);
815 string nam = e.nameStr();
816 double numSide = ns.
attr<
int>(
e,
DD_CMU(numSide));
817 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
819 vector<double>
z, rmin, rmax;
821 for(xml_coll_t zplane(element,
DD_CMU(RZPoint)); zplane; ++zplane) {
822 rmin.emplace_back(0.0);
823 rmax.emplace_back(ns.
attr<
double>(zplane,_U(
r)));
824 z.emplace_back(ns.
attr<
double>(zplane,_U(z)));
826 for(xml_coll_t zplane(element,
DD_CMU(ZSection)); zplane; ++zplane) {
829 z.emplace_back(ns.
attr<
double>(zplane,_U(z)));
832 "+ Polyhedra:startPhi=%8.3f [rad] deltaPhi=%8.3f [rad] %4d sides %4ld z-planes",
833 startPhi,
deltaPhi, numSide, z.size());
838 template <>
void Converter<DDLSphere>::operator()(xml_h element)
const {
840 xml_dim_t
e(element);
841 string nam = e.nameStr();
844 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
846 double startTheta = ns.
attr<
double>(
e,
DD_CMU(startTheta));
847 double deltaTheta = ns.
attr<
double>(
e,
DD_CMU(deltaTheta));
849 "+ Sphere: r_inner=%8.3f [cm] r_outer=%8.3f [cm]" 850 " startPhi=%8.3f [rad] deltaPhi=%8.3f startTheta=%8.3f delteTheta=%8.3f [rad]",
851 rinner, router, startPhi,
deltaPhi, startTheta, deltaTheta);
852 ns.
addSolid(nam, Sphere(rinner, router, startTheta, deltaTheta, startPhi, deltaPhi));
856 template <>
void Converter<DDLTorus>::operator()(xml_h element)
const {
858 xml_dim_t
e(element);
859 string nam = e.nameStr();
863 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
866 "+ Torus: r=%10.3f [cm] r_inner=%10.3f [cm] r_outer=%10.3f [cm]" 867 " startPhi=%10.3f [rad] deltaPhi=%10.3f [rad]",
869 ns.
addSolid(nam, Torus(r, rinner, router, startPhi, deltaPhi));
873 template <>
void Converter<DDLPseudoTrap>::operator()(xml_h element)
const {
875 xml_dim_t
e(element);
876 string nam = e.nameStr();
881 double dz = ns.
attr<
double>(
e,_U(dz));
883 bool atMinusZ = ns.
attr<
bool> (
e,
DD_CMU(atMinusZ));
885 "+ Pseudotrap: dz=%8.3f [cm] dx1:%.3f dy1:%.3f dx2=%.3f dy2=%.3f radius:%.3f atMinusZ:%s",
886 dz, dx1, dy1, dx2, dy2,
r, yes_no(atMinusZ));
887 ns.
addSolid(nam, PseudoTrap(dx1, dx2, dy1, dy2, dz, r, atMinusZ));
891 template <>
void Converter<DDLTrapezoid>::operator()(xml_h element)
const {
893 xml_dim_t
e(element);
894 string nam = e.nameStr();
895 double dz = ns.
attr<
double>(
e,_U(dz));
904 double phi = ns.
attr<
double>(
e,_U(phi),0.0);
905 double theta = ns.
attr<
double>(
e,_U(theta),0.0);
908 "+ Trapezoid: dz=%10.3f [cm] alp1:%.3f bl1=%.3f tl1=%.3f alp2=%.3f bl2=%.3f tl2=%.3f h2=%.3f phi=%.3f theta=%.3f",
909 dz, alp1, bl1, tl1, h1, alp2, bl2, tl2, h2,
phi,
theta);
910 ns.
addSolid( nam, Trap( dz, theta, phi, h1, bl1, tl1, alp1, h2, bl2, tl2, alp2 ));
914 template <>
void Converter<DDLTrd1>::operator()(xml_h element)
const {
916 xml_dim_t
e( element );
917 string nam = e.nameStr();
920 double dx2 = ns.
attr<
double>(
e,
DD_CMU( dx2 ), 0.0 );
921 double dy2 = ns.
attr<
double>(
e,
DD_CMU( dy2 ), dy1 );
922 assert( dy1 == dy2 );
925 "+ Trd1: dz=%8.3f [cm] dx1:%.3f dy1:%.3f dx2:%.3f dy2:%.3f",
926 dz, dx1, dy1, dx2, dy2);
927 ns.
addSolid( nam, Trd1( dx1, dx2, dy1, dz ));
931 template <>
void Converter<DDLTrd2>::operator()(xml_h element)
const {
933 xml_dim_t
e( element );
934 string nam = e.nameStr();
937 double dx2 = ns.
attr<
double>(
e,
DD_CMU( dx2 ), 0.0 );
938 double dy2 = ns.
attr<
double>(
e,
DD_CMU( dy2 ), dy1 );
941 "+ Trd1: dz=%8.3f [cm] dx1:%.3f dy1:%.3f dx2:%.3f dy2:%.3f",
942 dz, dx1, dy1, dx2, dy2);
943 ns.
addSolid( nam, Trd2( dx1, dx2, dy1, dy2, dz ));
947 template <>
void Converter<DDLTubs>::operator()(xml_h element)
const {
949 xml_dim_t
e(element);
950 string nam = e.nameStr();
954 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi),0.0);
957 "+ Tubs: dz=%8.3f [cm] rmin=%8.3f [cm] rmax=%8.3f [cm]" 958 " startPhi=%8.3f [rad] deltaPhi=%8.3f [rad]",
dz, rmin, rmax, startPhi,
deltaPhi );
959 ns.
addSolid(nam, Tube( rmin, rmax, dz, startPhi, startPhi + deltaPhi ));
963 template <>
void Converter<DDLCutTubs>::operator()(xml_h element)
const {
965 xml_dim_t
e(element);
966 string nam = e.nameStr();
970 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
979 "+ CutTube: dz=%8.3f [cm] rmin=%8.3f [cm] rmax=%8.3f [cm]" 980 " startPhi=%8.3f [rad] deltaPhi=%8.3f [rad]...",
982 ns.
addSolid(nam, CutTube(rmin,rmax,dz,startPhi,deltaPhi,lx,ly,lz,tx,ty,tz));
986 template <>
void Converter<DDLTruncTubs>::operator()(xml_h element)
const {
988 xml_dim_t
e(element);
989 string nam = e.nameStr();
993 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
995 double cutAtStart = ns.
attr<
double>(
e,
DD_CMU(cutAtStart));
996 double cutAtDelta = ns.
attr<
double>(
e,
DD_CMU(cutAtDelta));
997 bool cutInside = ns.
attr<
bool>(
e,
DD_CMU(cutInside));
999 "+ TruncTube:zHalf=%8.3f [cm] rmin=%8.3f [cm] rmax=%8.3f [cm]" 1000 " startPhi=%8.3f [rad] deltaPhi=%8.3f [rad] atStart=%8.3f [cm] atDelta=%8.3f [cm] inside:%s",
1001 zhalf, rmin, rmax, startPhi,
deltaPhi, cutAtStart, cutAtDelta, yes_no(cutInside));
1002 ns.
addSolid(nam, TruncatedTube(zhalf,rmin,rmax,startPhi,deltaPhi,cutAtStart,cutAtDelta,cutInside));
1006 template <>
void Converter<DDLEllipticalTube>::operator()(xml_h element)
const {
1008 xml_dim_t
e(element);
1009 string nam = e.nameStr();
1014 "+ EllipticalTube xSemiAxis=%8.3f [cm] ySemiAxis=%8.3f [cm] zHeight=%8.3f [cm]",
dx,
dy,
dz);
1015 ns.
addSolid(nam, EllipticalTube(dx,dy,dz));
1019 template <>
void Converter<DDLCone>::operator()(xml_h element)
const {
1021 xml_dim_t
e(element);
1022 string nam = e.nameStr();
1024 double rmin1 = ns.
attr<
double>(
e,
DD_CMU(rMin1));
1025 double rmin2 = ns.
attr<
double>(
e,
DD_CMU(rMin2));
1026 double rmax1 = ns.
attr<
double>(
e,
DD_CMU(rMax1));
1027 double rmax2 = ns.
attr<
double>(
e,
DD_CMU(rMax2));
1028 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
1032 "+ Cone: dz=%8.3f [cm]" 1033 " rmin1=%8.3f [cm] rmax1=%8.3f [cm]" 1034 " rmin2=%8.3f [cm] rmax2=%8.3f [cm]" 1035 " startPhi=%8.3f [rad] deltaPhi=%8.3f [rad]",
1036 dz, rmin1, rmax1, rmin2, rmax2, startPhi,
deltaPhi);
1037 ns.
addSolid(nam, ConeSegment(dz,rmin1,rmax1,rmin2,rmax2,startPhi,phi2));
1041 template <>
void Converter<DDLShapeless>::operator()(xml_h element)
const {
1043 xml_dim_t
e(element);
1044 string nam = e.nameStr();
1046 "+ Shapeless: THIS ONE CAN ONLY BE USED AT THE VOLUME LEVEL -> Assembly%s", nam.c_str());
1051 template <>
void Converter<DDLBox>::operator()(xml_h element)
const {
1053 xml_dim_t
e(element);
1054 string nam = e.nameStr();
1059 "+ Box: dx=%10.3f [cm] dy=%10.3f [cm] dz=%10.3f [cm]",
dx,
dy,
dz);
1064 template <>
void Converter<include_load>::operator()(xml_h element)
const {
1065 string fname = element.attr<
string>(_U(ref));
1068 doc = xml::DocumentHandler().load( fp.fullPath());
1069 printout(_param<cms::DDParsingContext>()->debug_includes ? ALWAYS : DEBUG,
1070 "DD4CMS",
"+++ Processing the CMS detector description %s", fname.c_str());
1071 _option<DDRegistry>()->
includes.emplace_back( doc );
1075 template <>
void Converter<include_unload>::operator()(xml_h element)
const {
1076 string fname = xml::DocumentHandler::system_path(element);
1077 xml::DocumentHolder(xml_elt_t( element).document()).assign(
nullptr);
1078 printout(_param<cms::DDParsingContext>()->debug_includes ? ALWAYS : DEBUG,
1079 "DD4CMS",
"+++ Finished processing %s",fname.c_str());
1083 template <>
void Converter<include_constants>::operator()(xml_h element)
const {
1084 xml_coll_t( element,
DD_CMU(ConstantsSection)).for_each(Converter<ConstantsSection>(description,param,optional));
1096 std::map<std::string, DDAxes> axesmap {{
"x",
DDAxes::x },
1105 template <>
void Converter<DDLDivision>::operator()( xml_h element )
const {
1107 xml_dim_t
e( element );
1108 string childName = e.nameStr();
1110 childName = ns.
name() + childName;
1112 string parentName = ns.
attr<
string>(
e,
DD_CMU( parent ));
1113 if( strchr( parentName.c_str(),
NAMESPACE_SEP ) ==
nullptr )
1114 parentName = ns.
name() + parentName;
1115 string axis = ns.
attr<
string>(
e,
DD_CMU( axis ));
1121 int nReplicas = e.hasAttr(
DD_CMU( nReplicas )) ? ns.
attr<
int>(
e,
DD_CMU( nReplicas )) : 0;
1124 "DD4CMS",
"+++ Start executing Division of %s along %s (%d) with offset %6.3f and %6.3f to produce %s....",
1125 parentName.c_str(), axis.c_str(), axesmap[axis],
offset,
width, childName.c_str());
1129 const TGeoShape* shape = parent.solid();
1130 TClass*
cl = shape->IsA();
1132 const TGeoTubeSeg* sh = (
const TGeoTubeSeg* )shape;
1133 double widthInDeg =
ConvertTo( width, deg );
1134 double startInDeg =
ConvertTo( offset, deg );
1135 int numCopies = (
int )(( sh->GetPhi2() - sh->GetPhi1())/ widthInDeg );
1137 "DD4CMS",
"+++ ...divide %s along %s (%d) with offset %6.3f deg and %6.3f deg to produce %d copies",
1138 parent.solid().type(), axis.c_str(), axesmap[axis], startInDeg, widthInDeg, numCopies );
1139 Volume child = parent.divide( childName, static_cast<int>( axesmap[axis]),
1140 numCopies, startInDeg, widthInDeg );
1145 "+++ %s Parent: %-24s [%s] Child: %-32s [%s] is multivolume [%s]",
1147 parentName.c_str(), parent.isValid() ?
"VALID" :
"INVALID",
1148 child.name(), child.isValid() ?
"VALID" :
"INVALID",
1149 child->IsVolumeMulti() ?
"YES" :
"NO" );
1152 double dy =
static_cast<const TGeoTrd1*
>(shape)->GetDy();
1154 "DD4CMS",
"+++ ...divide %s along %s (%d) with offset %6.3f cm and %6.3f cm to produce %d copies in %6.3f",
1155 parent.solid().type(), axis.c_str(), axesmap[axis], -dy + offset +
width,
width, nReplicas,
dy );
1156 Volume child = parent.divide( childName, static_cast<int>( axesmap[axis]),
1157 nReplicas, -dy + offset + width, width );
1162 "+++ %s Parent: %-24s [%s] Child: %-32s [%s] is multivolume [%s]",
1164 parentName.c_str(), parent.isValid() ?
"VALID" :
"INVALID",
1165 child.name(), child.isValid() ?
"VALID" :
"INVALID",
1166 child->IsVolumeMulti() ?
"YES" :
"NO" );
1169 printout(
ERROR,
"DD4CMS",
"++ FAILED Division of a %s is not implemented yet!", parent.solid().type());
1174 template <>
void Converter<DDLAlgorithm>::operator()( xml_h element )
const {
1176 xml_dim_t
e( element );
1177 string name = e.nameStr();
1179 printout(
INFO,
"DD4CMS",
"+++ Skip disabled algorithms: %s", name.c_str());
1185 string type =
"DDCMS_" + ns.
realName( name );
1186 while(( idx = type.find(
NAMESPACE_SEP )) != string::npos ) type[
idx] =
'_';
1191 "DD4CMS",
"+++ Start executing algorithm %s....", type.c_str());
1196 "DD4CMS",
"+++ Executed algorithm: %08lX = %s", ret, name.c_str());
1201 DetElement det(PluginService::Create<NamedObject*>(type, &description, ns.
context(), &element, &
sd));
1204 if( sd.isValid() ) {
1205 det->flag |= DetElement::Object::HAVE_SENSITIVE_DETECTOR;
1207 if( seg.isValid() ) {
1208 seg->sensitive =
sd;
1209 seg->detector = det;
1212 if(!det.isValid()) {
1215 except(
"DD4CMS",
"Failed to execute subdetector creation plugin. " + dbg.missingFactory(type));
1217 description.addDetector(det);
1219 printout(
ERROR,
"DD4CMS",
"++ FAILED NOT ADDING SUBDETECTOR %08lX = %s",ret, name.c_str());
1224 printout(
ERROR,
"DD4CMS",
"++ FAILED to convert subdetector: %s: %s", name.c_str(), exc.what());
1228 printout(
ERROR,
"DD4CMS",
"++ FAILED to convert subdetector: %s: %s", name.c_str(),
"UNKNONW Exception");
1233 template <
class InputIt,
class ForwardIt,
class BinOp>
1235 ForwardIt s_first, ForwardIt s_last,
1238 while( first != last ) {
1239 const auto pos = std::find_first_of( first, last, s_first, s_last );
1240 binary_op( first, pos );
1241 if( pos == last )
break;
1252 cbegin( delims ), cend( delims ),
1255 output.emplace_back(stod(
string(
first,
second )));
1267 cbegin( delims ), cend( delims ),
1278 template <>
void Converter<DDLVector>::operator()( xml_h element )
const {
1282 xml_dim_t
e( element );
1283 string name = e.nameStr();
1284 string type = ns.
attr<
string>(
e, _U( type ));
1285 string nEntries = ns.
attr<
string>(
e,
DD_CMU( nEntries ));
1286 string val = e.text();
1287 val.erase( remove_if( val.begin(), val.end(), [](
unsigned char x ){
return isspace( x ); }), val.end());
1290 "DD4CMS",
"+++ Vector<%s>: %s[%s]: %s", type.c_str(), name.c_str(),
1291 nEntries.c_str(), val.c_str());
1294 registry->insert( {
name, results } );
1297 template <>
void Converter<debug>::operator()(xml_h dbg)
const {
1312 template <>
void Converter<DDRegistry>::operator()(xml_h )
const {
1314 DDRegistry* res = _option<DDRegistry>();
1318 "DD4CMS",
"+++ RESOLVING %ld unknown constants.....", res->unresolvedConst.size());
1322 while( !res->unresolvedConst.empty()) {
1323 for(
auto i : res->unresolvedConst ) {
1324 const string& n =
i.first;
1326 string&
v =
i.second;
1328 for( idx = v.find(
'[', 0 ); idx != string::npos; idx = v.find(
'[', idx + 1 )) {
1329 idq = v.find(
']', idx + 1 );
1330 rep = v.substr( idx + 1, idq - idx - 1 );
1331 auto r = res->allConst.find( rep );
1332 if(
r != res->allConst.end()) {
1333 rep =
"(" + (*r).second +
")";
1334 v.replace( idx, idq - idx + 1, rep );
1337 if( v.find(
']') == string::npos ) {
1338 if( v.find(
"-+") != string::npos || v.find(
"+-") != string::npos ) {
1339 while(( idx = v.find(
"-+" )) != string::npos )
1340 v.replace( idx, 2,
"-" );
1341 while(( idx = v.find(
"+-" )) != string::npos )
1342 v.replace( idx, 2,
"-" );
1345 "DD4CMS",
"+++ [%06ld] ---------- %-40s = %s",
1346 res->unresolvedConst.size() - 1, n.c_str(), res->originalConst[
n].c_str());
1347 ns.addConstantNS( n, v,
"number" );
1348 res->unresolvedConst.erase(n);
1353 if( !res->unresolvedConst.empty()) {
1354 for(
const auto& e : res->unresolvedConst )
1355 printout(
ERROR,
"DD4CMS",
"+++ Unresolved constant: %-40s = %s.", e.first.c_str(), e.second.c_str());
1356 except(
"DD4CMS",
"++ FAILED to resolve %ld constant entries:", res->unresolvedConst.size());
1358 res->unresolvedConst.clear();
1359 res->originalConst.clear();
1360 res->allConst.clear();
1363 template <>
void Converter<print_xml_doc>::operator()(xml_h element)
const {
1364 string fname = xml::DocumentHandler::system_path(element);
1365 printout(_param<cms::DDParsingContext>()->debug_includes ? ALWAYS : DEBUG,
1366 "DD4CMS",
"+++ Processing data from: %s",fname.c_str());
1380 xml_elt_t dddef(element);
1381 string fname = xml::DocumentHandler::system_path(element);
1382 bool open_geometry = dddef.hasChild(
DD_CMU(open_geometry));
1383 bool close_geometry = dddef.hasChild(
DD_CMU(close_geometry));
1385 xml_coll_t(dddef, _U(
debug)).for_each(Converter<debug>(det,&context));
1390 printout(
INFO,
"DD4CMS",
"+++ Processing the CMS detector description %s",fname.c_str());
1393 Converter<print_xml_doc> print_doc(det,&context);
1396 print_doc((doc=dddef.document()).
root());
1397 xml_coll_t(dddef,
DD_CMU(DisabledAlgo)).for_each(Converter<disabled_algo>(det,&context,&res));
1398 xml_coll_t(dddef,
DD_CMU(ConstantsSection)).for_each(Converter<ConstantsSection>(det,&context,&res));
1399 xml_coll_t(dddef,
DD_CMU(VisSection)).for_each(Converter<vissection>(det,&context));
1400 xml_coll_t(dddef,
DD_CMU(RotationSection)).for_each(Converter<RotationSection>(det,&context));
1401 xml_coll_t(dddef,
DD_CMU(MaterialSection)).for_each(Converter<MaterialSection>(det,&context));
1403 xml_coll_t(dddef,
DD_CMU(IncludeSection)).for_each(
DD_CMU(Include), Converter<include_load>(det,&context,&res));
1405 for(xml::Document
d : res.includes ) {
1406 print_doc((doc=d).
root());
1407 Converter<include_constants>(det,&context,&res)((doc=d).root());
1410 Converter<DDRegistry>(det,&context,&res)(dddef);
1412 for(xml::Document d : res.includes ) {
1413 print_doc((doc=d).
root());
1414 xml_coll_t(d.root(),
DD_CMU(MaterialSection)).for_each(Converter<MaterialSection>(det,&context));
1416 if( open_geometry ) {
1417 context.geo_inited =
true;
1421 for(xml::Document d : res.includes ) {
1422 print_doc((doc=d).
root());
1423 xml_coll_t(d.root(),
DD_CMU(RotationSection)).for_each(Converter<RotationSection>(det,&context));
1425 for(xml::Document d : res.includes ) {
1426 print_doc((doc=d).
root());
1427 xml_coll_t(d.root(),
DD_CMU(SolidSection)).for_each(Converter<SolidSection>(det,&context));
1429 for(xml::Document d : res.includes ) {
1430 print_doc((doc=d).
root());
1431 xml_coll_t(d.root(),
DD_CMU(LogicalPartSection)).for_each(Converter<LogicalPartSection>(det,&context));
1433 for(xml::Document d : res.includes ) {
1434 print_doc((doc=d).
root());
1435 xml_coll_t(d.root(),
DD_CMU(
Algorithm)).for_each(Converter<DDLAlgorithm>(det,&context));
1437 for(xml::Document d : res.includes ) {
1438 print_doc((doc=d).
root());
1439 xml_coll_t(d.root(),
DD_CMU(PosPartSection)).for_each(Converter<PosPartSection>(det,&context));
1441 for(xml::Document d : res.includes ) {
1442 print_doc((doc=d).
root());
1443 xml_coll_t(d.root(),
DD_CMU(SpecParSection)).for_each(Converter<SpecParSection>(det,&context));
1447 for(xml::Document d : res.includes ) Converter<include_unload>(det,&context,&res)(d.root());
1449 print_doc((doc=dddef.document()).
root());
1451 xml_coll_t(dddef,
DD_CMU(SolidSection)).for_each(Converter<SolidSection>(det,&context));
1452 xml_coll_t(dddef,
DD_CMU(LogicalPartSection)).for_each(Converter<LogicalPartSection>(det,&context));
1453 xml_coll_t(dddef,
DD_CMU(
Algorithm)).for_each(Converter<DDLAlgorithm>(det,&context));
1454 xml_coll_t(dddef,
DD_CMU(PosPartSection)).for_each(Converter<PosPartSection>(det,&context));
1455 xml_coll_t(dddef,
DD_CMU(SpecParSection)).for_each(Converter<SpecParSection>(det,&context));
1458 printout(
ERROR,
"DD4CMS",
"Exception while processing xml source:%s",doc.uri().c_str());
1459 printout(
ERROR,
"DD4CMS",
"----> %s", e.what());
1464 if( close_geometry ) {
1467 printout(
INFO,
"DDDefinition",
"+++ Finished processing %s",fname.c_str());
DDLPosPart handles PosPart elements.
dd4hep::Volume volume(const std::string &name, bool exc=true) const
DDLSphere processes all Sphere elements.
DDLDivision processes Division elements.
std::map< std::string, std::string > allConst
cms::DDDetector::DDVectorsMap DDVectorsMap
std::set< std::string > disabledAlgs
ROOT::Math::Plane3D::Vector Vector
DDLVector handles Rotation and ReflectionRotation elements.
dd4hep::Detector * description
Geom::Theta< T > theta() const
DDLEllipticalTube processes all EllipticalTube elements.
dd4hep::Volume addVolume(dd4hep::Volume vol) const
Add rotation matrix to current namespace.
dd4hep::Solid solid(const std::string &name) const
DDLAlgorithm processes Algorithm elements.
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
dd4hep::Rotation3D makeRotation3D(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
DDParsingContext *const context() const
U second(std::pair< T, U > const &p)
void addConstantNS(const std::string &name, const std::string &value, const std::string &type) const
DDLBox processes Box elements.
DDLElementaryMaterial processes ElementaryMaterial elements.
vector< string > splitString(const string &str, const string &delims=",")
std::string realName(const std::string &) const
T attr(xml_elt_t element, const xml_tag_t &name) const
DDLCone processes all Cone elements.
vector< double > splitNumeric(const string &str, const string &delims=",")
std::unordered_map< std::string, dd4hep::Volume > volumes
dd4hep::Rotation3D makeRotReflect(double thetaX, double phiX, double thetaY, double phiY, double thetaZ, double phiZ)
constexpr unsigned int hash(const char *str, int h=0)
static void convert_boolean(cms::DDParsingContext *context, xml_h element)
Namespace of DDCMS conversion namespace.
DDLTubs processes Tubs elements.
std::map< std::string, std::string > originalConst
dd4hep::Solid addSolid(const std::string &name, dd4hep::Solid solid) const
DDLLogicalPart processes LogicalPart elements.
const std::string & name() const
DDLRotationByAxis handles RotationByAxis elements.
std::unordered_map< std::string, std::vector< double >> DDVectorsMap
DDLCompositeMaterial processes all CompositeMaterial elements.
std::map< std::string, std::string > unresolvedConst
#define ConvertTo(_x, _y)
std::vector< xml::Document > includes
static long load_dddefinition(Detector &det, xml_h element)
Converter for <DDDefinition> tags.
DDAxes
analagous to geant4/source/global/HEPGeometry/include/geomdefs.hh
DDLRotationSequence handles a set of Rotations.
void for_each_token(InputIt first, InputIt last, ForwardIt s_first, ForwardIt s_last, BinOp binary_op)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
DDParsingContext * setContext()