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" 37 UInt_t unique_mat_id = 0xAFFEFEED;
40 class include_constants;
45 class ConstantsSection;
53 class MaterialSection;
57 class RotationSection;
59 class DDLReflectionRotation;
68 class LogicalPartSection;
72 class DDLExtrudedPolygon;
89 class DDLIntersectionSolid;
90 class DDLSubtractionSolid;
106 template <>
void Converter<debug>::operator()(xml_h element)
const;
107 template <>
void Converter<print_xml_doc>::operator()(xml_h element)
const;
108 template <>
void Converter<disabled_algo>::operator()(xml_h element)
const;
111 template <>
void Converter<ConstantsSection>::operator()(xml_h element)
const;
112 template <>
void Converter<DDLConstant>::operator()(xml_h element)
const;
113 template <>
void Converter<DDRegistry>::operator()(xml_h element)
const;
116 template <>
void Converter<vissection>::operator()(xml_h element)
const;
118 template <>
void Converter<vis>::operator()(xml_h element)
const;
121 template <>
void Converter<MaterialSection>::operator()(xml_h element)
const;
122 template <>
void Converter<DDLElementaryMaterial>::operator()(xml_h element)
const;
123 template <>
void Converter<DDLCompositeMaterial>::operator()(xml_h element)
const;
126 template <>
void Converter<RotationSection>::operator()(xml_h element)
const;
128 template <>
void Converter<DDLRotation>::operator()(xml_h element)
const;
130 template <>
void Converter<DDLReflectionRotation>::operator()(xml_h element)
const;
132 template <>
void Converter<DDLRotationSequence>::operator()(xml_h element)
const;
134 template <>
void Converter<DDLRotationByAxis>::operator()(xml_h element)
const;
135 template <>
void Converter<DDLTransform3D>::operator()(xml_h element)
const;
138 template <>
void Converter<LogicalPartSection>::operator()(xml_h element)
const;
139 template <>
void Converter<DDLLogicalPart>::operator()(xml_h element)
const;
142 template <>
void Converter<PosPartSection>::operator()(xml_h element)
const;
144 template <>
void Converter<DDLPosPart>::operator()(xml_h element)
const;
146 template <>
void Converter<DDLDivision>::operator()(xml_h element)
const;
149 template <>
void Converter<SpecParSection>::operator()(xml_h element)
const;
150 template <>
void Converter<SpecPar>::operator()(xml_h element)
const;
151 template <>
void Converter<PartSelector>::operator()(xml_h element)
const;
152 template <>
void Converter<Parameter>::operator()(xml_h element)
const;
155 template <>
void Converter<SolidSection>::operator()(xml_h element)
const;
157 template <>
void Converter<DDLUnionSolid>::operator()(xml_h element)
const;
159 template <>
void Converter<DDLSubtractionSolid>::operator()(xml_h element)
const;
161 template <>
void Converter<DDLIntersectionSolid>::operator()(xml_h element)
const;
163 template <>
void Converter<DDLPseudoTrap>::operator()(xml_h element)
const;
165 template <>
void Converter<DDLExtrudedPolygon>::operator()(xml_h element)
const;
167 template <>
void Converter<DDLShapeless>::operator()(xml_h element)
const;
169 template <>
void Converter<DDLTrapezoid>::operator()(xml_h element)
const;
171 template <>
void Converter<DDLPolycone>::operator()(xml_h element)
const;
173 template <>
void Converter<DDLPolyhedra>::operator()(xml_h element)
const;
175 template <>
void Converter<DDLEllipticalTube>::operator()(xml_h element)
const;
177 template <>
void Converter<DDLTorus>::operator()(xml_h element)
const;
179 template <>
void Converter<DDLTubs>::operator()(xml_h element)
const;
181 template <>
void Converter<DDLCutTubs>::operator()(xml_h element)
const;
183 template <>
void Converter<DDLTruncTubs>::operator()(xml_h element)
const;
185 template <>
void Converter<DDLSphere>::operator()(xml_h element)
const;
187 template <>
void Converter<DDLTrd1>::operator()(xml_h element)
const;
189 template <>
void Converter<DDLTrd2>::operator()(xml_h element)
const;
191 template <>
void Converter<DDLCone>::operator()(xml_h element)
const;
193 template <>
void Converter<DDLBox>::operator()(xml_h element)
const;
195 template <>
void Converter<DDLAlgorithm>::operator()(xml_h element)
const;
197 template <>
void Converter<DDLVector>::operator()(xml_h element)
const;
200 template <>
void Converter<include_load>::operator()(xml_h element)
const;
202 template <>
void Converter<include_unload>::operator()(xml_h element)
const;
204 template <>
void Converter<include_constants>::operator()(xml_h element)
const;
208 template <>
void Converter<ConstantsSection>::operator()( xml_h element )
const {
216 template <>
void Converter<vissection>::operator()(xml_h element)
const {
222 template <>
void Converter<MaterialSection>::operator()(xml_h element)
const {
224 xml_coll_t( element,
DD_CMU(ElementaryMaterial)).for_each(Converter<DDLElementaryMaterial>(
description,ns.context(),optional));
225 xml_coll_t( element,
DD_CMU(CompositeMaterial)).for_each(Converter<DDLCompositeMaterial>(
description,ns.context(),optional));
228 template <>
void Converter<RotationSection>::operator()(xml_h element)
const {
230 xml_coll_t( element,
DD_CMU(Rotation)).for_each(Converter<DDLRotation>(
description,ns.context(),optional));
231 xml_coll_t( element,
DD_CMU(ReflectionRotation)).for_each(Converter<DDLReflectionRotation>(
description,ns.context(),optional));
232 xml_coll_t( element,
DD_CMU(RotationSequence)).for_each(Converter<DDLRotationSequence>(
description,ns.context(),optional));
233 xml_coll_t( element,
DD_CMU(RotationByAxis)).for_each(Converter<DDLRotationByAxis>(
description,ns.context(),optional));
236 template <>
void Converter<PosPartSection>::operator()( xml_h element )
const {
238 xml_coll_t( element,
DD_CMU( Division )).for_each( Converter<DDLDivision>(
description, ns.context(), optional ));
239 xml_coll_t( element,
DD_CMU( PosPart )).for_each( Converter<DDLPosPart>(
description, ns.context(), optional ));
243 template <>
void Converter<SpecParSection>::operator()( xml_h element )
const {
245 xml_coll_t( element,
DD_CMU( SpecPar )).for_each( Converter<SpecPar>(
description, ns.context(), optional ));
248 template <>
void Converter<SpecPar>::operator()( xml_h element )
const {
250 xml_coll_t( element,
DD_CMU( PartSelector )).for_each( Converter<PartSelector>(
description, ns.context(), optional ));
251 xml_coll_t( element,
DD_CMU( Parameter )).for_each( Converter<Parameter>(
description, ns.context(), optional ));
255 template <>
void Converter<LogicalPartSection>::operator()(xml_h element)
const {
257 xml_coll_t( element,
DD_CMU(LogicalPart)).for_each(Converter<DDLLogicalPart>(
description,ns.context(),optional));
260 template <>
void Converter<disabled_algo>::operator()(xml_h element)
const {
266 template <>
void Converter<SolidSection>::operator()(xml_h element)
const {
268 for(xml_coll_t solid(element, _U(star)); solid; ++solid) {
269 string tag = solid.tag();
271 switch(
hash( solid.tag()))
276 case hash(
"Polycone"):
277 Converter<DDLPolycone>(
description,ns.context(),optional)(solid);
279 case hash(
"Polyhedra"):
280 Converter<DDLPolyhedra>(
description,ns.context(),optional)(solid);
285 case hash(
"CutTubs"):
286 Converter<DDLCutTubs>(
description,ns.context(),optional)(solid);
288 case hash(
"TruncTubs"):
289 Converter<DDLTruncTubs>(
description,ns.context(),optional)(solid);
295 Converter<DDLTrd1>(
description,ns.context(),optional)(solid);
298 Converter<DDLTrd2>(
description,ns.context(),optional)(solid);
306 case hash(
"EllipticalTube"):
312 case hash(
"PseudoTrap"):
315 case hash(
"ExtrudedPolygon"):
316 Converter<DDLExtrudedPolygon>(
description,ns.context(),optional)(solid);
318 case hash(
"Trapezoid"):
321 case hash(
"UnionSolid"):
322 Converter<DDLUnionSolid>(
description,ns.context(),optional)(solid);
324 case hash(
"SubtractionSolid"):
325 Converter<DDLSubtractionSolid>(
description,ns.context(),optional)(solid);
327 case hash(
"IntersectionSolid"):
328 Converter<DDLIntersectionSolid>(
description,ns.context(),optional)(solid);
330 case hash(
"ShapelessSolid"):
331 Converter<DDLShapeless>(
description,ns.context(),optional)(solid);
334 throw std::runtime_error(
"Request to process unknown shape '" + xml_dim_t(solid).nameStr() +
"' [" + tag +
"]");
341 template <>
void Converter<DDLConstant>::operator()(xml_h element)
const {
343 DDRegistry*
res = _option<DDRegistry>();
344 xml_dim_t constant = element;
345 xml_dim_t par = constant.parent();
346 bool eval = par.hasAttr(_U(eval)) ? par.attr<
bool>(_U(eval)) :
false;
347 string val = constant.valueStr();
348 string nam = constant.nameStr();
349 string real = ns.prepend(nam);
350 string typ = eval ?
"number" :
"string";
351 size_t idx = val.find(
'[');
353 if( constant.hasAttr(_U(
type)) )
354 typ = constant.typeStr();
356 if( idx == string::npos || typ ==
"string" ) {
358 ns.addConstant( nam, val, typ );
359 res->allConst[real] =
val;
360 res->originalConst[real] =
val;
363 printout(
INFO,
"DD4CMS",
"++ Unresolved constant: %s = %s [%s]. Try to resolve later. [%s]",
364 real.c_str(), val.c_str(), typ.c_str(), e.what());
369 while ( idx != string::npos ) {
371 size_t idp = val.find(
':',idx);
372 size_t idq = val.find(
']',idx);
373 if( idp == string::npos || idp > idq )
374 val.insert(idx,ns.name());
375 else if( idp != string::npos && idp < idq )
377 idx = val.find(
'[',idx);
379 printout(ns.context()->debug_constants ? ALWAYS :
DEBUG,
380 "Constant",
"Unresolved: %s -> %s",real.c_str(),val.c_str());
381 res->allConst[real] =
val;
382 res->originalConst[real] =
val;
383 res->unresolvedConst[real] =
val;
394 template <>
void Converter<vis>::operator()(xml_h e)
const {
396 VisAttr attr(e.attr<
string>(_U(
name)));
397 float red = e.hasAttr(_U(
r)) ? e.attr<
float>(_U(
r)) : 1.0
f;
398 float green = e.hasAttr(_U(
g)) ? e.attr<
float>(_U(
g)) : 1.0
f;
399 float blue = e.hasAttr(_U(
b)) ? e.attr<
float>(_U(
b)) : 1.0
f;
401 printout(ns.context()->debug_visattr ? ALWAYS :
DEBUG,
"Compact",
402 "++ Converting VisAttr structure: %-16s. R=%.3f G=%.3f B=%.3f",
404 attr.setColor(red, green, blue);
405 if(e.hasAttr(_U(
alpha)))
406 attr.setAlpha(e.attr<
float>(_U(
alpha)));
407 if(e.hasAttr(_U(visible)))
408 attr.setVisible(e.attr<
bool>(_U(visible)));
412 attr.setLineStyle(VisAttr::SOLID);
413 else if(ls ==
"broken")
414 attr.setLineStyle(VisAttr::DASHED);
417 attr.setLineStyle(VisAttr::SOLID);
419 if(e.hasAttr(_U(drawingStyle))) {
420 string ds = e.attr<
string>(_U(drawingStyle));
421 if(ds ==
"wireframe")
422 attr.setDrawingStyle(VisAttr::WIREFRAME);
423 else if(ds ==
"solid")
424 attr.setDrawingStyle(VisAttr::SOLID);
427 attr.setDrawingStyle(VisAttr::SOLID);
429 if(e.hasAttr(_U(showDaughters)))
430 attr.setShowDaughters(e.attr<
bool>(_U(showDaughters)));
432 attr.setShowDaughters(
true);
437 template <>
void Converter<DDLElementaryMaterial>::operator()(xml_h element)
const {
439 xml_dim_t xmat( element);
440 string nam = ns.prepend(xmat.nameStr());
442 TGeoMaterial* mat = mgr.GetMaterial(nam.c_str());
443 if(
nullptr == mat ) {
444 const char* matname = nam.c_str();
445 double density = xmat.density();
446 double atomicNumber = xmat.attr<
double>(
DD_CMU(atomicNumber));
447 TGeoElementTable* tab = mgr.GetElementTable();
448 TGeoMixture*
mix =
new TGeoMixture(nam.c_str(), 1, density);
449 TGeoElement* elt = tab->FindElement(xmat.nameStr().c_str());
451 printout(ns.context()->debug_materials ? ALWAYS :
DEBUG,
"DD4CMS",
452 "+++ Converting material %-48s Density: %.3f.",
453 (
'"'+nam+
'"').c_str(), density);
457 "+++ Converter<ElementaryMaterial> No element present with name:%s [FAKE IT]",
459 int n =
int(atomicNumber/2e0);
461 elt =
new TGeoElement(xmat.nameStr().c_str(),
"CMS element",
n,atomicNumber);
463 if( elt->Z() == 0 ) {
464 int n =
int(atomicNumber/2e0);
466 elt =
new TGeoElement((xmat.nameStr()+
"-CMS").c_str(),
"CMS element",
n,atomicNumber);
468 mix->AddElement(elt, 1.0);
471 TGeoMedium* medium = mgr.GetMedium(matname);
472 if(
nullptr == medium) {
474 medium =
new TGeoMedium(matname, unique_mat_id, mix);
475 medium->SetTitle(
"material");
476 medium->SetUniqueID(unique_mat_id);
482 template <>
void Converter<DDLCompositeMaterial>::operator()(xml_h element)
const {
484 xml_dim_t xmat( element);
485 string nam = ns.prepend(xmat.nameStr());
487 TGeoMaterial* mat = mgr.GetMaterial(nam.c_str());
488 if(
nullptr == mat ) {
489 const char* matname = nam.c_str();
490 double density = xmat.density();
491 xml_coll_t composites(xmat,
DD_CMU(MaterialFraction));
492 TGeoMixture* mix =
new TGeoMixture(nam.c_str(), composites.size(), density);
494 printout(ns.context()->debug_materials ? ALWAYS :
DEBUG,
"DD4CMS",
495 "++ Converting material %-48s Density: %.3f.",
496 (
'"'+nam+
'"').c_str(), density);
498 for( composites.reset(); composites; ++composites ) {
499 xml_dim_t xfrac(composites);
500 xml_dim_t xfrac_mat(xfrac.child(
DD_CMU(rMaterial)));
502 string fracname = ns.realName(xfrac_mat.nameStr());
504 TGeoMaterial* frac_mat = mgr.GetMaterial(fracname.c_str());
506 mix->AddElement(frac_mat, fraction);
509 printout(
WARNING,
"DD4CMS",
"+++ Composite material \"%s\" not present!",
514 TGeoMedium* medium = mgr.GetMedium(matname);
515 if(
nullptr == medium ) {
517 medium =
new TGeoMedium(matname, unique_mat_id, mix);
518 medium->SetTitle(
"material");
519 medium->SetUniqueID(unique_mat_id);
525 template <>
void Converter<DDLRotation>::operator()(xml_h element)
const {
528 xml_dim_t xrot( element);
529 string nam = xrot.nameStr();
530 double thetaX = xrot.hasAttr(
DD_CMU(thetaX)) ? ns.attr<
double>(xrot,
DD_CMU(thetaX)) : 0e0;
531 double phiX = xrot.hasAttr(
DD_CMU(phiX)) ? ns.attr<
double>(xrot,
DD_CMU(phiX)) : 0e0;
532 double thetaY = xrot.hasAttr(
DD_CMU(thetaY)) ? ns.attr<
double>(xrot,
DD_CMU(thetaY)) : 0e0;
533 double phiY = xrot.hasAttr(
DD_CMU(phiY)) ? ns.attr<
double>(xrot,
DD_CMU(phiY)) : 0e0;
534 double thetaZ = xrot.hasAttr(
DD_CMU(thetaZ)) ? ns.attr<
double>(xrot,
DD_CMU(thetaZ)) : 0e0;
535 double phiZ = xrot.hasAttr(
DD_CMU(phiZ)) ? ns.attr<
double>(xrot,
DD_CMU(phiZ)) : 0e0;
538 "DD4CMS",
"+++ Adding rotation: %-32s: (theta/phi)[rad] X: %6.3f %6.3f Y: %6.3f %6.3f Z: %6.3f %6.3f",
540 ns.addRotation(nam, rot);
544 template <>
void Converter<DDLReflectionRotation>::operator()( xml_h element )
const {
547 xml_dim_t xrot( element );
548 string name = xrot.nameStr();
549 double thetaX = xrot.hasAttr(
DD_CMU( thetaX )) ? ns.attr<
double>( xrot,
DD_CMU( thetaX )) : 0e0;
550 double phiX = xrot.hasAttr(
DD_CMU( phiX )) ? ns.attr<
double>( xrot,
DD_CMU( phiX )) : 0e0;
551 double thetaY = xrot.hasAttr(
DD_CMU( thetaY )) ? ns.attr<
double>( xrot,
DD_CMU( thetaY )) : 0e0;
552 double phiY = xrot.hasAttr(
DD_CMU( phiY )) ? ns.attr<
double>( xrot,
DD_CMU( phiY )) : 0e0;
553 double thetaZ = xrot.hasAttr(
DD_CMU( thetaZ )) ? ns.attr<
double>( xrot,
DD_CMU( thetaZ )) : 0e0;
554 double phiZ = xrot.hasAttr(
DD_CMU( phiZ )) ? ns.attr<
double>( xrot,
DD_CMU( phiZ )) : 0e0;
556 "DD4CMS",
"+++ Adding reflection rotation: %-32s: (theta/phi)[rad] X: %6.3f %6.3f Y: %6.3f %6.3f Z: %6.3f %6.3f",
558 Rotation3D rot =
makeRotReflect( thetaX, phiX, thetaY, phiY, thetaZ, phiZ );
559 ns.addRotation( name, rot );
563 template <>
void Converter<DDLRotationSequence>::operator()(xml_h element)
const {
566 xml_dim_t xrot( element);
567 string nam = xrot.nameStr();
569 xml_coll_t rotations(xrot,
DD_CMU(RotationByAxis));
570 for( rotations.reset(); rotations; ++rotations ) {
571 string axis = ns.attr<
string>(rotations,
DD_CMU(axis));
572 double angle = ns.attr<
double>(rotations,_U(angle));
575 "DD4CMS",
"+ Adding rotation to: %-29s: (axis/angle)[rad] Axis: %s Angle: %6.3f",
576 nam.c_str(), axis.c_str(),
angle);
581 rot.GetComponents(xx,xy,xz,yx,yy,yz,zx,zy,zz);
583 "DD4CMS",
"+++ Adding rotation sequence: %-23s: %6.3f %6.3f %6.3f, %6.3f %6.3f %6.3f, %6.3f %6.3f %6.3f",
584 ns.prepend(nam).c_str(),
xx,
xy,
xz, yx,
yy,
yz, zx, zy,
zz);
585 ns.addRotation(nam, rot);
589 template <>
void Converter<DDLRotationByAxis>::operator()(xml_h element)
const {
592 xml_dim_t xrot( element);
593 xml_dim_t par(xrot.parent());
594 if( xrot.hasAttr(_U(name))) {
595 string nam = xrot.nameStr();
596 string axis = ns.attr<
string>(xrot,
DD_CMU(axis));
597 double angle = ns.attr<
double>(xrot,_U(angle));
601 "DD4CMS",
"+++ Adding rotation: %-32s: (axis/angle)[rad] Axis: %s Angle: %6.3f",
602 ns.prepend(nam).c_str(), axis.c_str(),
angle);
603 ns.addRotation(nam, rot);
608 template <>
void Converter<DDLLogicalPart>::operator()(xml_h element)
const {
610 xml_dim_t
e(element);
611 string sol = e.child(
DD_CMU(rSolid)).attr<
string>(_U(name));
612 string mat = e.child(
DD_CMU(rMaterial)).attr<
string>(_U(name));
613 ns.addVolume(
Volume(e.nameStr(), ns.solid(sol), ns.material(mat)));
617 template <>
void Converter<DDLTransform3D>::operator()( xml_h element )
const {
619 Transform3D* tr = _option<Transform3D>();
620 xml_dim_t
e(element);
621 xml_dim_t translation = e.child(
DD_CMU( Translation ),
false );
623 xml_dim_t refRotation = e.child(
DD_CMU( rRotation ),
false );
627 if( translation.ptr()) {
628 double x = ns.attr<
double>( translation, _U( x ));
629 double y = ns.attr<
double>( translation, _U( y ));
630 double z = ns.attr<
double>( translation, _U( z ));
631 pos = Position(x,y,z);
633 if( rotation.ptr()) {
634 double x = ns.attr<
double>(
rotation, _U( x ));
635 double y = ns.attr<
double>(
rotation, _U( y ));
636 double z = ns.attr<
double>(
rotation, _U( z ));
637 rot = RotationZYX(z,y,x);
639 else if( refRotation.ptr()) {
640 string rotName = refRotation.nameStr();
642 rotName = ns.name() + rotName;
644 rot = ns.rotation( rotName );
646 *tr = Transform3D( rot, pos );
650 template <>
void Converter<DDLPosPart>::operator()( xml_h element )
const {
652 xml_dim_t
e( element );
653 int copy = e.attr<
int>(
DD_CMU( copyNumber ));
654 string parentName = ns.attr<
string>( e.child(
DD_CMU( rParent )), _U( name ));
655 string childName = ns.attr<
string>( e.child(
DD_CMU( rChild )), _U( name ));
659 childName = ns.name() + childName;
662 printout( ns.context()->debug_placements ? ALWAYS :
DEBUG,
"DD4CMS",
663 "+++ %s Parent: %-24s [%s] Child: %-32s [%s] copy:%d",
665 parentName.c_str(), parent.isValid() ?
"VALID" :
"INVALID",
666 childName.c_str(), child.isValid() ?
"VALID" :
"INVALID",
670 if( child.isValid()) {
673 pv = parent.placeVolume( child, copy, transform );
676 printout(
ERROR,
"DD4CMS",
"+++ Placement FAILED! Parent:%s Child:%s Valid:%s",
677 parent.name(), childName.c_str(), yes_no( child.isValid()));
682 template <>
void Converter<PartSelector>::operator()( xml_h element )
const {
684 xml_dim_t
e( element );
685 xml_dim_t specPar = e.parent();
686 string specParName = specPar.attr<
string>( _U( name ));
687 string path = e.attr<
string>(
DD_CMU( path ));
689 printout(ns.context()->debug_specpars ? ALWAYS :
DEBUG,
"DD4CMS",
690 "+++ PartSelector for %s path: %s", specParName.c_str(), path.c_str());
694 template <>
void Converter<Parameter>::operator()( xml_h element )
const {
696 xml_dim_t
e( element );
697 string name = e.nameStr();
699 bool eval = e.hasAttr( _U( eval )) ? e.attr<
bool>( _U( eval )) :
false;
700 string type = eval ?
"number" :
"string";
702 printout(ns.context()->debug_specpars ? ALWAYS :
DEBUG,
"DD4CMS",
703 "+++ Parameter: %s value %s is %s", name.c_str(), value.c_str(), type.c_str());
706 template <
typename TYPE>
709 xml_dim_t
e(element);
710 string nam = e.nameStr();
715 if( e.hasChild(
DD_CMU(rSolid)) ) {
716 for(xml_coll_t
c(element,
DD_CMU(rSolid)); cnt<2 &&
c; ++
c, ++cnt)
717 solids[cnt] = ns.
solid(c.attr<
string>(_U(name)));
720 if( (solids[0] = ns.
solid(e.attr<
string>(
DD_CMU(firstSolid)))).isValid() ) ++cnt;
721 if( (solids[1] = ns.
solid(e.attr<
string>(
DD_CMU(secondSolid)))).isValid() ) ++cnt;
724 except(
"DD4CMS",
"+++ Failed to create boolean solid %s. Found only %d parts.",nam.c_str(), cnt);
727 "+++ BooleanSolid: %s Left: %-32s Right: %-32s",
728 nam.c_str(), solids[0]->GetName(), solids[1]->GetName());
730 if( solids[0].isValid() && solids[1].isValid() ) {
732 Converter<DDLTransform3D>(*context->
description,context,&trafo)(element);
733 boolean = TYPE(solids[0],solids[1],trafo);
735 if( !
boolean.isValid() )
736 except(
"DD4CMS",
"+++ FAILED to construct subtraction solid: %s",nam.c_str());
741 template <>
void Converter<DDLUnionSolid>::operator()(xml_h element)
const {
742 convert_boolean<UnionSolid>(_param<cms::DDParsingContext>(),element);
746 template <>
void Converter<DDLSubtractionSolid>::operator()(xml_h element)
const {
747 convert_boolean<SubtractionSolid>(_param<cms::DDParsingContext>(),element);
751 template <>
void Converter<DDLIntersectionSolid>::operator()(xml_h element)
const {
752 convert_boolean<IntersectionSolid>(_param<cms::DDParsingContext>(),element);
756 template <>
void Converter<DDLPolycone>::operator()(xml_h element)
const {
758 xml_dim_t
e(element);
759 string nam = e.nameStr();
760 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
762 vector<double>
z, rmin, rmax,
r;
764 for(xml_coll_t rzpoint( element,
DD_CMU(RZPoint)); rzpoint; ++rzpoint) {
765 z.emplace_back(ns.
attr<
double>(rzpoint,_U(z)));
766 r.emplace_back(ns.
attr<
double>(rzpoint,_U(r)));
769 for(xml_coll_t zplane(element,
DD_CMU(ZSection)); zplane; ++zplane) {
772 z.emplace_back(ns.
attr<
double>(zplane,_U(z)));
775 "+ Polycone: startPhi=%10.3f [rad] deltaPhi=%10.3f [rad] %4ld z-planes",
777 ns.
addSolid(nam, Polycone(startPhi,deltaPhi,rmin,rmax,z));
781 "+ Polycone: startPhi=%10.3f [rad] deltaPhi=%10.3f [rad] %4ld z-planes and %4ld radii",
782 startPhi,
deltaPhi, z.size(), r.size());
783 ns.
addSolid(nam, Polycone(startPhi,deltaPhi,r,z));
788 template <>
void Converter<DDLExtrudedPolygon>::operator()(xml_h element)
const {
790 xml_dim_t
e(element);
791 string nam = e.nameStr();
792 vector<double> pt_x, pt_y, sec_x, sec_y, sec_z, sec_scale;
794 for(xml_coll_t sec(element,
DD_CMU(ZXYSection)); sec; ++sec) {
795 sec_z.emplace_back(ns.
attr<
double>(sec,_U(
z)));
796 sec_x.emplace_back(ns.
attr<
double>(sec,_U(
x)));
797 sec_y.emplace_back(ns.
attr<
double>(sec,_U(
y)));
800 for(xml_coll_t
pt( element,
DD_CMU(XYPoint));
pt; ++
pt) {
801 pt_x.emplace_back(ns.
attr<
double>(
pt,_U(
x)));
802 pt_y.emplace_back(ns.
attr<
double>(
pt,_U(
y)));
805 "+ ExtrudedPolygon: %4ld points %4ld zxy sections",
806 pt_x.size(), sec_z.size());
811 template <>
void Converter<DDLPolyhedra>::operator()(xml_h element)
const {
813 xml_dim_t
e(element);
814 string nam = e.nameStr();
815 double numSide = ns.
attr<
int>(
e,
DD_CMU(numSide));
816 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
818 vector<double>
z, rmin, rmax;
820 for(xml_coll_t zplane(element,
DD_CMU(RZPoint)); zplane; ++zplane) {
821 rmin.emplace_back(0.0);
822 rmax.emplace_back(ns.
attr<
double>(zplane,_U(
r)));
823 z.emplace_back(ns.
attr<
double>(zplane,_U(z)));
825 for(xml_coll_t zplane(element,
DD_CMU(ZSection)); zplane; ++zplane) {
828 z.emplace_back(ns.
attr<
double>(zplane,_U(z)));
831 "+ Polyhedra:startPhi=%8.3f [rad] deltaPhi=%8.3f [rad] %4d sides %4ld z-planes",
832 startPhi,
deltaPhi, numSide, z.size());
837 template <>
void Converter<DDLSphere>::operator()(xml_h element)
const {
839 xml_dim_t
e(element);
840 string nam = e.nameStr();
843 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
845 double startTheta = ns.
attr<
double>(
e,
DD_CMU(startTheta));
846 double deltaTheta = ns.
attr<
double>(
e,
DD_CMU(deltaTheta));
848 "+ Sphere: r_inner=%8.3f [cm] r_outer=%8.3f [cm]" 849 " startPhi=%8.3f [rad] deltaPhi=%8.3f startTheta=%8.3f delteTheta=%8.3f [rad]",
850 rinner, router, startPhi,
deltaPhi, startTheta, deltaTheta);
851 ns.
addSolid(nam, Sphere(rinner, router, startTheta, deltaTheta, startPhi, deltaPhi));
855 template <>
void Converter<DDLTorus>::operator()(xml_h element)
const {
857 xml_dim_t
e(element);
858 string nam = e.nameStr();
862 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
865 "+ Torus: r=%10.3f [cm] r_inner=%10.3f [cm] r_outer=%10.3f [cm]" 866 " startPhi=%10.3f [rad] deltaPhi=%10.3f [rad]",
868 ns.
addSolid(nam, Torus(r, rinner, router, startPhi, deltaPhi));
872 template <>
void Converter<DDLPseudoTrap>::operator()(xml_h element)
const {
874 xml_dim_t
e(element);
875 string nam = e.nameStr();
880 double dz = ns.
attr<
double>(
e,_U(dz));
882 bool atMinusZ = ns.
attr<
bool> (
e,
DD_CMU(atMinusZ));
884 "+ Pseudotrap: dz=%8.3f [cm] dx1:%.3f dy1:%.3f dx2=%.3f dy2=%.3f radius:%.3f atMinusZ:%s",
885 dz, dx1, dy1, dx2, dy2,
r, yes_no(atMinusZ));
886 ns.
addSolid(nam, PseudoTrap(dx1, dx2, dy1, dy2, dz, r, atMinusZ));
890 template <>
void Converter<DDLTrapezoid>::operator()(xml_h element)
const {
892 xml_dim_t
e(element);
893 string nam = e.nameStr();
894 double dz = ns.
attr<
double>(
e,_U(dz));
903 double phi = ns.
attr<
double>(
e,_U(phi),0.0);
904 double theta = ns.
attr<
double>(
e,_U(theta),0.0);
907 "+ Trapezoid: dz=%10.3f [cm] alp1:%.3f bl1=%.3f tl1=%.3f alp2=%.3f bl2=%.3f tl2=%.3f h2=%.3f phi=%.3f theta=%.3f",
908 dz, alp1, bl1, tl1, h1, alp2, bl2, tl2, h2,
phi,
theta);
909 ns.
addSolid( nam, Trap( dz, theta, phi, h1, bl1, tl1, alp1, h2, bl2, tl2, alp2 ));
913 template <>
void Converter<DDLTrd1>::operator()(xml_h element)
const {
915 xml_dim_t
e( element );
916 string nam = e.nameStr();
919 double dx2 = ns.
attr<
double>(
e,
DD_CMU( dx2 ), 0.0 );
920 double dy2 = ns.
attr<
double>(
e,
DD_CMU( dy2 ), dy1 );
921 assert( dy1 == dy2 );
924 "+ Trd1: dz=%8.3f [cm] dx1:%.3f dy1:%.3f dx2:%.3f dy2:%.3f",
925 dz, dx1, dy1, dx2, dy2);
926 ns.
addSolid( nam, Trd1( dx1, dx2, dy1, dz ));
930 template <>
void Converter<DDLTrd2>::operator()(xml_h element)
const {
932 xml_dim_t
e( element );
933 string nam = e.nameStr();
936 double dx2 = ns.
attr<
double>(
e,
DD_CMU( dx2 ), 0.0 );
937 double dy2 = ns.
attr<
double>(
e,
DD_CMU( dy2 ), dy1 );
940 "+ Trd1: dz=%8.3f [cm] dx1:%.3f dy1:%.3f dx2:%.3f dy2:%.3f",
941 dz, dx1, dy1, dx2, dy2);
942 ns.
addSolid( nam, Trd2( dx1, dx2, dy1, dy2, dz ));
946 template <>
void Converter<DDLTubs>::operator()(xml_h element)
const {
948 xml_dim_t
e(element);
949 string nam = e.nameStr();
953 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi),0.0);
956 "+ Tubs: dz=%8.3f [cm] rmin=%8.3f [cm] rmax=%8.3f [cm]" 957 " startPhi=%8.3f [rad] deltaPhi=%8.3f [rad]",
dz, rmin, rmax, startPhi,
deltaPhi );
958 ns.
addSolid(nam, Tube( rmin, rmax, dz, startPhi, startPhi + deltaPhi ));
962 template <>
void Converter<DDLCutTubs>::operator()(xml_h element)
const {
964 xml_dim_t
e(element);
965 string nam = e.nameStr();
969 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
978 "+ CutTube: dz=%8.3f [cm] rmin=%8.3f [cm] rmax=%8.3f [cm]" 979 " startPhi=%8.3f [rad] deltaPhi=%8.3f [rad]...",
981 ns.
addSolid(nam, CutTube(rmin,rmax,dz,startPhi,deltaPhi,lx,ly,lz,tx,ty,tz));
985 template <>
void Converter<DDLTruncTubs>::operator()(xml_h element)
const {
987 xml_dim_t
e(element);
988 string nam = e.nameStr();
992 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
994 double cutAtStart = ns.
attr<
double>(
e,
DD_CMU(cutAtStart));
995 double cutAtDelta = ns.
attr<
double>(
e,
DD_CMU(cutAtDelta));
996 bool cutInside = ns.
attr<
bool>(
e,
DD_CMU(cutInside));
998 "+ TruncTube:zHalf=%8.3f [cm] rmin=%8.3f [cm] rmax=%8.3f [cm]" 999 " startPhi=%8.3f [rad] deltaPhi=%8.3f [rad] atStart=%8.3f [cm] atDelta=%8.3f [cm] inside:%s",
1000 zhalf, rmin, rmax, startPhi,
deltaPhi, cutAtStart, cutAtDelta, yes_no(cutInside));
1001 ns.
addSolid(nam, TruncatedTube(zhalf,rmin,rmax,startPhi,deltaPhi,cutAtStart,cutAtDelta,cutInside));
1005 template <>
void Converter<DDLEllipticalTube>::operator()(xml_h element)
const {
1007 xml_dim_t
e(element);
1008 string nam = e.nameStr();
1013 "+ EllipticalTube xSemiAxis=%8.3f [cm] ySemiAxis=%8.3f [cm] zHeight=%8.3f [cm]",
dx,
dy,
dz);
1014 ns.
addSolid(nam, EllipticalTube(dx,dy,dz));
1018 template <>
void Converter<DDLCone>::operator()(xml_h element)
const {
1020 xml_dim_t
e(element);
1021 string nam = e.nameStr();
1023 double rmin1 = ns.
attr<
double>(
e,
DD_CMU(rMin1));
1024 double rmin2 = ns.
attr<
double>(
e,
DD_CMU(rMin2));
1025 double rmax1 = ns.
attr<
double>(
e,
DD_CMU(rMax1));
1026 double rmax2 = ns.
attr<
double>(
e,
DD_CMU(rMax2));
1027 double startPhi = ns.
attr<
double>(
e,
DD_CMU(startPhi));
1031 "+ Cone: dz=%8.3f [cm]" 1032 " rmin1=%8.3f [cm] rmax1=%8.3f [cm]" 1033 " rmin2=%8.3f [cm] rmax2=%8.3f [cm]" 1034 " startPhi=%8.3f [rad] deltaPhi=%8.3f [rad]",
1035 dz, rmin1, rmax1, rmin2, rmax2, startPhi,
deltaPhi);
1036 ns.
addSolid(nam, ConeSegment(dz,rmin1,rmax1,rmin2,rmax2,startPhi,phi2));
1040 template <>
void Converter<DDLShapeless>::operator()(xml_h element)
const {
1042 xml_dim_t
e(element);
1043 string nam = e.nameStr();
1045 "+ Shapeless: THIS ONE CAN ONLY BE USED AT THE VOLUME LEVEL -> Assembly%s", nam.c_str());
1050 template <>
void Converter<DDLBox>::operator()(xml_h element)
const {
1052 xml_dim_t
e(element);
1053 string nam = e.nameStr();
1058 "+ Box: dx=%10.3f [cm] dy=%10.3f [cm] dz=%10.3f [cm]",
dx,
dy,
dz);
1063 template <>
void Converter<include_load>::operator()(xml_h element)
const {
1064 string fname = element.attr<
string>(_U(ref));
1067 doc = xml::DocumentHandler().load( fp.fullPath());
1068 printout(_param<cms::DDParsingContext>()->debug_includes ? ALWAYS : DEBUG,
1069 "DD4CMS",
"+++ Processing the CMS detector description %s", fname.c_str());
1070 _option<DDRegistry>()->
includes.emplace_back( doc );
1074 template <>
void Converter<include_unload>::operator()(xml_h element)
const {
1075 string fname = xml::DocumentHandler::system_path(element);
1076 xml::DocumentHolder(xml_elt_t( element).document()).assign(
nullptr);
1077 printout(_param<cms::DDParsingContext>()->debug_includes ? ALWAYS : DEBUG,
1078 "DD4CMS",
"+++ Finished processing %s",fname.c_str());
1082 template <>
void Converter<include_constants>::operator()(xml_h element)
const {
1083 xml_coll_t( element,
DD_CMU(ConstantsSection)).for_each(Converter<ConstantsSection>(description,param,optional));
1095 std::map<std::string, DDAxes> axesmap {{
"x",
DDAxes::x },
1104 template <>
void Converter<DDLDivision>::operator()( xml_h element )
const {
1106 xml_dim_t
e( element );
1107 string childName = e.nameStr();
1109 childName = ns.
name() + childName;
1111 string parentName = ns.
attr<
string>(
e,
DD_CMU( parent ));
1112 if( strchr( parentName.c_str(),
NAMESPACE_SEP ) ==
nullptr )
1113 parentName = ns.
name() + parentName;
1114 string axis = ns.
attr<
string>(
e,
DD_CMU( axis ));
1120 int nReplicas = e.hasAttr(
DD_CMU( nReplicas )) ? ns.
attr<
int>(
e,
DD_CMU( nReplicas )) : 0;
1123 "DD4CMS",
"+++ Start executing Division of %s along %s (%d) with offset %6.3f and %6.3f to produce %s....",
1124 parentName.c_str(), axis.c_str(), axesmap[axis],
offset,
width, childName.c_str());
1128 const TGeoShape* shape = parent.solid();
1129 TClass*
cl = shape->IsA();
1131 const TGeoTubeSeg* sh = (
const TGeoTubeSeg* )shape;
1132 double widthInDeg =
ConvertTo( width, deg );
1133 double startInDeg =
ConvertTo( offset, deg );
1134 int numCopies = (
int )(( sh->GetPhi2() - sh->GetPhi1())/ widthInDeg );
1136 "DD4CMS",
"+++ ...divide %s along %s (%d) with offset %6.3f deg and %6.3f deg to produce %d copies",
1137 parent.solid().type(), axis.c_str(), axesmap[axis], startInDeg, widthInDeg, numCopies );
1138 Volume child = parent.divide( childName, static_cast<int>( axesmap[axis]),
1139 numCopies, startInDeg, widthInDeg );
1144 "+++ %s Parent: %-24s [%s] Child: %-32s [%s] is multivolume [%s]",
1146 parentName.c_str(), parent.isValid() ?
"VALID" :
"INVALID",
1147 child.name(), child.isValid() ?
"VALID" :
"INVALID",
1148 child->IsVolumeMulti() ?
"YES" :
"NO" );
1151 double dy =
static_cast<const TGeoTrd1*
>(shape)->GetDy();
1153 "DD4CMS",
"+++ ...divide %s along %s (%d) with offset %6.3f cm and %6.3f cm to produce %d copies in %6.3f",
1154 parent.solid().type(), axis.c_str(), axesmap[axis], -dy + offset +
width,
width, nReplicas,
dy );
1155 Volume child = parent.divide( childName, static_cast<int>( axesmap[axis]),
1156 nReplicas, -dy + offset + width, width );
1161 "+++ %s Parent: %-24s [%s] Child: %-32s [%s] is multivolume [%s]",
1163 parentName.c_str(), parent.isValid() ?
"VALID" :
"INVALID",
1164 child.name(), child.isValid() ?
"VALID" :
"INVALID",
1165 child->IsVolumeMulti() ?
"YES" :
"NO" );
1168 printout(
ERROR,
"DD4CMS",
"++ FAILED Division of a %s is not implemented yet!", parent.solid().type());
1173 template <>
void Converter<DDLAlgorithm>::operator()( xml_h element )
const {
1175 xml_dim_t
e( element );
1176 string name = e.nameStr();
1178 printout(
INFO,
"DD4CMS",
"+++ Skip disabled algorithms: %s", name.c_str());
1184 string type =
"DDCMS_" + ns.
realName( name );
1185 while(( idx = type.find(
NAMESPACE_SEP )) != string::npos ) type[
idx] =
'_';
1190 "DD4CMS",
"+++ Start executing algorithm %s....", type.c_str());
1195 "DD4CMS",
"+++ Executed algorithm: %08lX = %s", ret, name.c_str());
1200 DetElement det(PluginService::Create<NamedObject*>(type, &description, ns.
context(), &element, &
sd));
1203 if( sd.isValid() ) {
1204 det->flag |= DetElement::Object::HAVE_SENSITIVE_DETECTOR;
1206 if( seg.isValid() ) {
1207 seg->sensitive =
sd;
1208 seg->detector = det;
1211 if(!det.isValid()) {
1214 except(
"DD4CMS",
"Failed to execute subdetector creation plugin. " + dbg.missingFactory(type));
1216 description.addDetector(det);
1218 printout(
ERROR,
"DD4CMS",
"++ FAILED NOT ADDING SUBDETECTOR %08lX = %s",ret, name.c_str());
1223 printout(
ERROR,
"DD4CMS",
"++ FAILED to convert subdetector: %s: %s", name.c_str(), exc.what());
1227 printout(
ERROR,
"DD4CMS",
"++ FAILED to convert subdetector: %s: %s", name.c_str(),
"UNKNONW Exception");
1232 template <
class InputIt,
class ForwardIt,
class BinOp>
1234 ForwardIt s_first, ForwardIt s_last,
1237 while( first != last ) {
1238 const auto pos = std::find_first_of( first, last, s_first, s_last );
1239 binary_op( first, pos );
1240 if( pos == last )
break;
1251 cbegin( delims ), cend( delims ),
1254 output.emplace_back(stod(
string(
first,
second )));
1266 cbegin( delims ), cend( delims ),
1277 template <>
void Converter<DDLVector>::operator()( xml_h element )
const {
1281 xml_dim_t
e( element );
1282 string name = e.nameStr();
1283 string type = ns.
attr<
string>(
e, _U( type ));
1284 string nEntries = ns.
attr<
string>(
e,
DD_CMU( nEntries ));
1285 string val = e.text();
1286 val.erase( remove_if( val.begin(), val.end(), [](
unsigned char x ){
return isspace( x ); }), val.end());
1289 "DD4CMS",
"+++ Vector<%s>: %s[%s]: %s", type.c_str(), name.c_str(),
1290 nEntries.c_str(), val.c_str());
1293 registry->insert( {
name, results } );
1296 template <>
void Converter<debug>::operator()(xml_h dbg)
const {
1311 template <>
void Converter<DDRegistry>::operator()(xml_h )
const {
1313 DDRegistry* res = _option<DDRegistry>();
1317 "DD4CMS",
"+++ RESOLVING %ld unknown constants.....", res->unresolvedConst.size());
1318 while( !res->unresolvedConst.empty()) {
1319 for(
auto i : res->unresolvedConst ) {
1320 const string& n =
i.first;
1322 string&
v =
i.second;
1324 for( idx = v.find(
'[', 0 ); idx != string::npos; idx = v.find(
'[', idx + 1 )) {
1325 idq = v.find(
']', idx + 1 );
1326 rep = v.substr( idx + 1, idq - idx - 1 );
1327 auto r = res->allConst.find( rep );
1328 if(
r != res->allConst.end()) {
1329 rep =
"(" + (*r).second +
")";
1330 v.replace( idx, idq - idx + 1, rep );
1333 if( v.find(
']') == string::npos ) {
1334 if( v.find(
"-+") != string::npos || v.find(
"+-") != string::npos ) {
1335 while(( idx = v.find(
"-+" )) != string::npos )
1336 v.replace( idx, 2,
"-" );
1337 while(( idx = v.find(
"+-" )) != string::npos )
1338 v.replace( idx, 2,
"-" );
1341 "DD4CMS",
"+++ [%06ld] ---------- %-40s = %s",
1342 res->unresolvedConst.size() - 1, n.c_str(), res->originalConst[
n].c_str());
1343 ns.addConstantNS( n, v,
"number" );
1344 res->unresolvedConst.erase( n );
1349 if( !res->unresolvedConst.empty()) {
1350 for(
const auto& e : res->unresolvedConst )
1351 printout(
ERROR,
"DD4CMS",
"+++ Unresolved constant: %-40s = %s.", e.first.c_str(), e.second.c_str());
1352 except(
"DD4CMS",
"++ FAILED to resolve %ld constant entries:", res->unresolvedConst.size());
1354 res->unresolvedConst.clear();
1355 res->originalConst.clear();
1356 res->allConst.clear();
1359 template <>
void Converter<print_xml_doc>::operator()(xml_h element)
const {
1360 string fname = xml::DocumentHandler::system_path(element);
1361 printout(_param<cms::DDParsingContext>()->debug_includes ? ALWAYS : DEBUG,
1362 "DD4CMS",
"+++ Processing data from: %s",fname.c_str());
1369 xml_elt_t dddef(element);
1370 string fname = xml::DocumentHandler::system_path(element);
1371 bool open_geometry = dddef.hasChild(
DD_CMU(open_geometry));
1372 bool close_geometry = dddef.hasChild(
DD_CMU(close_geometry));
1374 xml_coll_t(dddef, _U(
debug)).for_each(Converter<debug>(det,&context));
1379 printout(
INFO,
"DD4CMS",
"+++ Processing the CMS detector description %s",fname.c_str());
1382 Converter<print_xml_doc> print_doc(det,&context);
1385 print_doc((doc=dddef.document()).
root());
1386 xml_coll_t(dddef,
DD_CMU(DisabledAlgo)).for_each(Converter<disabled_algo>(det,&context,&res));
1387 xml_coll_t(dddef,
DD_CMU(ConstantsSection)).for_each(Converter<ConstantsSection>(det,&context,&res));
1388 xml_coll_t(dddef,
DD_CMU(VisSection)).for_each(Converter<vissection>(det,&context));
1389 xml_coll_t(dddef,
DD_CMU(RotationSection)).for_each(Converter<RotationSection>(det,&context));
1390 xml_coll_t(dddef,
DD_CMU(MaterialSection)).for_each(Converter<MaterialSection>(det,&context));
1392 xml_coll_t(dddef,
DD_CMU(IncludeSection)).for_each(
DD_CMU(Include), Converter<include_load>(det,&context,&res));
1394 for(xml::Document
d : res.includes ) {
1395 print_doc((doc=d).
root());
1396 Converter<include_constants>(det,&context,&res)((doc=d).root());
1399 Converter<DDRegistry>(det,&context,&res)(dddef);
1401 for(xml::Document d : res.includes ) {
1402 print_doc((doc=d).
root());
1403 xml_coll_t(d.root(),
DD_CMU(MaterialSection)).for_each(Converter<MaterialSection>(det,&context));
1405 if( open_geometry ) {
1406 context.geo_inited =
true;
1410 for(xml::Document d : res.includes ) {
1411 print_doc((doc=d).
root());
1412 xml_coll_t(d.root(),
DD_CMU(RotationSection)).for_each(Converter<RotationSection>(det,&context));
1414 for(xml::Document d : res.includes ) {
1415 print_doc((doc=d).
root());
1416 xml_coll_t(d.root(),
DD_CMU(SolidSection)).for_each(Converter<SolidSection>(det,&context));
1418 for(xml::Document d : res.includes ) {
1419 print_doc((doc=d).
root());
1420 xml_coll_t(d.root(),
DD_CMU(LogicalPartSection)).for_each(Converter<LogicalPartSection>(det,&context));
1422 for(xml::Document d : res.includes ) {
1423 print_doc((doc=d).
root());
1424 xml_coll_t(d.root(),
DD_CMU(
Algorithm)).for_each(Converter<DDLAlgorithm>(det,&context));
1426 for(xml::Document d : res.includes ) {
1427 print_doc((doc=d).
root());
1428 xml_coll_t(d.root(),
DD_CMU(PosPartSection)).for_each(Converter<PosPartSection>(det,&context));
1430 for(xml::Document d : res.includes ) {
1431 print_doc((doc=d).
root());
1432 xml_coll_t(d.root(),
DD_CMU(SpecParSection)).for_each(Converter<SpecParSection>(det,&context));
1436 for(xml::Document d : res.includes ) Converter<include_unload>(det,&context,&res)(d.root());
1438 print_doc((doc=dddef.document()).
root());
1440 xml_coll_t(dddef,
DD_CMU(SolidSection)).for_each(Converter<SolidSection>(det,&context));
1441 xml_coll_t(dddef,
DD_CMU(LogicalPartSection)).for_each(Converter<LogicalPartSection>(det,&context));
1442 xml_coll_t(dddef,
DD_CMU(
Algorithm)).for_each(Converter<DDLAlgorithm>(det,&context));
1443 xml_coll_t(dddef,
DD_CMU(PosPartSection)).for_each(Converter<PosPartSection>(det,&context));
1444 xml_coll_t(dddef,
DD_CMU(SpecParSection)).for_each(Converter<SpecParSection>(det,&context));
1447 printout(
ERROR,
"DD4CMS",
"Exception while processing xml source:%s",doc.uri().c_str());
1448 printout(
ERROR,
"DD4CMS",
"----> %s", e.what());
1453 if( close_geometry ) {
1456 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
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)
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.
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()