DD4hep  1.32.1
Detector Description Toolkit for High Energy Physics
VolumeBuilder.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef DD4HEP_NONE
14 
15 // Framework include files
16 #include <XML/VolumeBuilder.h>
17 #include <XML/Utilities.h>
18 #include <DD4hep/Printout.h>
19 #include <DD4hep/Plugins.h>
20 #include <DD4hep/Detector.h>
22 #include <Math/Polar2D.h>
23 
24 #include <TClass.h>
25 
27 
29 VolumeBuilder::VolumeBuilder(Detector& dsc, xml_h x_parent, SensitiveDetector sd)
30  : description(dsc), x_det(x_parent), sensitive(sd)
31 {
32  if ( x_det ) {
33  name = x_det.nameStr();
34  id = x_det.id();
35  detector = DetElement(name, id);
36  }
38 }
39 
41 std::size_t VolumeBuilder::collectMaterials(xml_h element) {
42  std::size_t len = materials.size();
43  for( xml_coll_t c(element,_U(material)); c; ++c ) {
44  xml_comp_t x_c = c;
45  std::string nam = x_c.nameStr();
46  std::string val = x_c.valueStr();
47  Material mat = description.material(val);
48  materials[nam] = mat;
49  }
50  return materials.size()-len;
51 }
52 
54 void VolumeBuilder::registerShape(const std::string& nam, Solid shape) {
55  auto is = shapes.find(nam);
56  if( is == shapes.end() ) {
57  shapes[nam] = std::make_pair(xml_h(0), shape);
58  return;
59  }
60  except("VolumeBuilder","+++ Shape %s is already known to this builder unit. ",nam.c_str());
61 }
62 
64 void VolumeBuilder::registerVolume(const std::string& nam, Volume volume) {
65  auto is = volumes.find(nam);
66  if( is == volumes.end() ) {
67  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
68  "+++ Register volume: %-20s shape:%-24s vis:%s sensitive:%s",
69  nam.c_str(),
70  volume.solid()->IsA()->GetName(),
72  yes_no(volume.isSensitive()));
73  volumes[nam] = std::make_pair(xml_h(0), volume);
74  return;
75  }
76  except("VolumeBuilder","+++ Volume %s is already known to this builder unit. ",nam.c_str());
77 }
78 
80 dd4hep::Volume VolumeBuilder::volume(const std::string& nam) const {
81  auto iv = volumes.find(nam);
82  if( iv == volumes.end() ) {
83  auto ib = vol_veto.find(nam);
84  if( ib != vol_veto.end() ) {
85  // Veto'ed shape. Ignore it.
86  return Volume();
87  }
88  except("VolumeBuilder","+++ Volume %s is not known to this builder unit. ",nam.c_str());
89  }
90  Volume vol = (*iv).second.second;
91  if( !vol.isValid() ) {
92  except("VolumeBuilder","+++ Failed to access volume %s from the local cache.",nam.c_str());
93  }
94  return vol;
95 }
96 
98 dd4hep::Transform3D VolumeBuilder::getTransform(const std::string& nam) const {
99  auto it = transformations.find(nam);
100  if( it == transformations.end() ) {
101  except("VolumeBuilder","+++ Tranformation %s is not known to this builder unit. ",nam.c_str());
102  }
103  return (*it).second.second;
104 }
105 
107 dd4hep::Solid VolumeBuilder::getShape(const std::string& nam) const {
108  auto is = shapes.find(nam);
109  if( is == shapes.end() ) {
110  auto ib = shape_veto.find(nam);
111  if( ib != shape_veto.end() ) {
112  // Veto'ed shape. Ignore it.
113  return Solid();
114  }
115  except("VolumeBuilder","+++ Shape %s is not known to this builder unit. ",nam.c_str());
116  }
117  Solid solid = (*is).second.second;
118  if( !solid.isValid() ) {
119  except("VolumeBuilder","+++ Failed to access shape %s from the local cache.",nam.c_str());
120  }
121  return solid;
122 }
123 
126  xml_comp_t x = handle;
127  xml_attr_t a = handle.attr_nothrow(_U(name));
128  std::string nam;
129  if( a ) {
130  nam = handle.attr<std::string>(a);
131  auto is = shapes.find(nam);
132  if( is != shapes.end() ) {
133  except("VolumeBuilder","+++ The named shape %s is already known to this builder unit. "
134  "Cannot be overridden.",nam.c_str());
135  }
136  }
138  if( !nam.empty() ) {
139  auto iv = shape_veto.find(nam);
140  if( iv != shape_veto.end() ) {
141  return Solid();
142  }
143  }
145  a = handle.attr_nothrow(_U(build));
146  if( a ) {
147  std::string build = handle.attr<std::string>(a);
148  if( !buildMatch(build, buildType) ) {
149  printout(INFO,"VolumeBuilder",
150  "+++ Shape %s does NOT match build requirements. [Ignored]",nam.c_str());
151  if( !nam.empty() ) shape_veto.emplace(nam);
152  return Solid();
153  }
154  }
156  std::string type = x.attr<std::string>(_U(type));
157  Solid solid = xml::createShape(description, type, x);
158  if( !solid.isValid() ) {
159  except("VolumeBuilder","+++ Failed to create shape %s of type: %s",
160  nam.c_str(), type.c_str());
161  }
163  if( !nam.empty() ) {
164  solid.setName(nam);
165  shapes.emplace(nam,std::make_pair(handle,solid));
166  }
167  printout(debug ? ALWAYS : DEBUG, "VolumeBuilder",
168  "+++ Created shape of type: %s name: %s",type.c_str(), nam.c_str());
169  return solid;
170 }
171 
174  std::size_t len = shapes.size();
175  for( xml_coll_t c(handle,_U(shape)); c; ++c ) {
176  xml_elt_t x = c;
177  std::string nam = x.attr<std::string>(_U(name));
178  auto is = shapes.find(nam);
179  if( is == shapes.end() ) {
181  xml_attr_t x_build = c.attr_nothrow(_U(build));
182  if( x_build ) {
183  std::string build = c.attr<std::string>(x_build);
184  if( !buildMatch(build, buildType) ) {
185  printout(INFO,"VolumeBuilder",
186  "+++ Shape %s does NOT match build requirements. [Ignored]",nam.c_str());
187  shape_veto.emplace(nam);
188  continue;
189  }
190  }
191  std::string type = x.attr<std::string>(_U(type));
192  if( type == "Assembly" ) {
193  continue;
194  }
195  Solid solid = xml::createShape(description, type, c);
196  if( !solid.isValid() ) {
197  except("VolumeBuilder","+++ Failed to create shape %s of type: %s",
198  nam.c_str(), type.c_str());
199  }
200  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
201  "+++ Building shape from XML: %s of type: %s",
202  nam.c_str(), solid->IsA()->GetName());
203  shapes.emplace(nam, std::make_pair(c,solid));
204  continue;
205  }
206  except("VolumeBuilder","+++ Shape %s is already known to this builder unit. "
207  "Cannot be overridden.", nam.c_str());
208  }
209  return shapes.size()-len;
210 }
211 
214  std::size_t len = volumes.size();
215  xml_elt_t x_comp(0);
216  for( xml_coll_t c(handle, _U(volume)); c; ++c ) {
217  Solid solid;
218  xml_comp_t x = c;
219  std::string nam = x.attr<std::string>(_U(name));
220  xml_attr_t attr = c.attr_nothrow(_U(build));
222  if( attr ) {
223  std::string build = c.attr<std::string>(attr);
224  if( !buildMatch(build,buildType) ) {
225  printout(INFO,"VolumeBuilder",
226  "+++ Volume %s does NOT match build requirements. [Ignored]",nam.c_str());
227  continue;
228  }
229  }
232  bool is_assembly = true;
233  is_assembly |= x.child(_U(assembly),false) != 0;
234  is_assembly |= c.attr_nothrow(_U(assembly)) != 0;
235  if( is_assembly ) {
236  Assembly vol(nam);
237  Solid sol = vol.solid();
238  xml_elt_t solid_handle(0);
239  if( (solid_handle=x.child(_U(shape), false)) ) {
240  shapes.emplace(nam, std::make_pair(solid_handle,sol));
241  }
242  placeDaughters(detector, vol, x);
243  vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
244  volumes.emplace(nam,std::make_pair(c,vol));
245  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
246  "+++ Building assembly from XML: %-20s shape:%-24s vis:%s",
247  nam.c_str(), vol->GetShape()->IsA()->GetName(), x.visStr().c_str());
248  buildVolumes(c);
249  continue;
250  }
251  //
252  bool is_sensitive = c.attr_nothrow(_U(sensitive));
254  if( (attr=c.attr_nothrow(_U(type))) ) {
255  std::string typ = c.attr<std::string>(attr);
256  Volume vol = xml::createVolume(description, typ, c);
257  vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
258  volumes.emplace(nam,std::make_pair(c,vol));
260  if( is_sensitive ) {
261  vol.setSensitiveDetector(sensitive);
262  }
263  solid = vol.solid();
264  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
265  "+++ Building volume from XML: %-20s shape:%-24s vis:%s sensitive:%s",
266  nam.c_str(), solid->IsA()->GetName(), x.visStr().c_str(),
267  yes_no(is_sensitive));
268  buildVolumes(c);
269  continue;
270  }
271 
273  if( (attr=c.attr_nothrow(_U(shape))) ) {
274  std::string ref = c.attr<std::string>(attr);
275  if( !(solid=getShape(ref)).isValid() ) continue;
276  }
278  else if( (x_comp=x.child(_U(shape),false)) ) {
279  if( !(solid=makeShape(x_comp)).isValid() ) continue;
280  }
281 
283  if( solid.isValid() ) {
284  Material mat = description.material(x.attr<std::string>(_U(material)));
285  Volume vol(nam, solid, mat);
286  placeDaughters(detector, vol, x);
287  vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
288  volumes.emplace(nam,std::make_pair(c,vol));
290  if( is_sensitive ) {
292  }
293  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
294  "+++ Building volume from XML: %-20s shape:%-24s vis:%s sensitive:%s",
295  nam.c_str(), solid->IsA()->GetName(), x.visStr().c_str(),
296  yes_no(is_sensitive));
297  buildVolumes(c);
298  continue;
299  }
300  except("VolumeBuilder","+++ Failed to create volume %s - "
301  "It is neither Volume nor assembly....", nam.c_str());
302  }
303  return volumes.size()-len;
304 }
305 
308  xml_attr_t attr = c.attr_nothrow(_U(logvol));
309  if( !attr ) {
310  attr = c.attr_nothrow(_U(volume));
311  }
312  if( !attr ) {
313  except("VolumeBuilder","+++ The xml volume element has no 'logvol' or 'volume' attribute!");
314  }
315  std::string nam = c.attr<std::string>(attr);
316  if( vol_veto.find(nam) != vol_veto.end() ) {
317  return;
318  }
319  auto iv = volumes.find(nam);
320  if( iv == volumes.end() ) {
321  except("VolumeBuilder",
322  "+++ Failed to locate volume %s [typo somewhere in the XML?]",
323  nam.c_str());
324  }
325  PlacedVolume pv;
326  Volume daughter = (*iv).second.second;
327  attr = c.attr_nothrow(_U(transformation));
328  if( attr ) {
329  std::string tr_nam = c.attr<std::string>(attr);
330  auto it = transformations.find(tr_nam);
331  if( it == transformations.end() ) {
332  except("VolumeBuilder",
333  "+++ Failed to locate name transformation %s [typo in the XML?]",
334  nam.c_str());
335  }
336  const Transform3D& tr = (*it).second.second;
337  pv = vol.placeVolume(daughter, tr);
338  }
339  else {
341  pv = vol.placeVolume(daughter, tr);
342  }
343  xml_attr_t attr_nam = c.attr_nothrow(_U(name));
344  if( attr_nam ) {
345  std::string phys_nam = c.attr<std::string>(attr_nam);
346  pv->SetName(phys_nam.c_str());
347  }
348  attr = c.attr_nothrow(_U(element));
349  if( attr && !parent.isValid() ) {
350  except("VolumeBuilder",
351  "+++ Failed to set DetElement placement for volume %s [Invalid parent]",
352  nam.c_str());
353  }
354  else if( attr ) {
355  int elt_id = parent.id();
356  std::string elt = c.attr<std::string>(attr);
357  attr = c.attr_nothrow(_U(id));
358  if( attr ) {
359  elt_id = c.attr<int>(attr);
360  elt += c.attr<std::string>(attr);
361  }
362  DetElement de(parent, elt, elt_id);
363  de.setPlacement(pv);
364  placeDaughters(de, daughter, c);
365  }
366  else {
367  placeDaughters(parent, daughter, c);
368  }
369 }
370 
373  xml_attr_t attr_tr, attr_elt, attr_nam;
374  xml_h x_phys = c.child(_U(physvol));
375  xml_attr_t attr = x_phys.attr_nothrow(_U(logvol));
376  if( !attr ) {
377  attr = x_phys.attr_nothrow(_U(volume));
378  }
379  if( !attr ) {
380  except("VolumeBuilder","+++ The xml volume element has no 'logvol' or 'volume' attribute!");
381  }
382  std::string nam = x_phys.attr<std::string>(attr);
383  if( vol_veto.find(nam) != vol_veto.end() ) {
384  return;
385  }
386  auto iv = volumes.find(nam);
387  if( iv == volumes.end() ) {
388  except("VolumeBuilder",
389  "+++ Failed to locate volume %s [typo somewhere in the XML?]",
390  nam.c_str());
391  }
392  attr_elt = c.attr_nothrow(_U(element));
393  if( attr_elt && !parent.isValid() ) {
394  except("VolumeBuilder",
395  "+++ Failed to set DetElement placement for volume %s [Invalid parent]",
396  nam.c_str());
397  }
398  Volume daughter = (*iv).second.second;
399  attr_tr = c.attr_nothrow(_U(transformation));
400  Transform3D tr;
401  if( attr_tr ) {
402  std::string tr_nam = c.attr<std::string>(attr_tr);
403  auto it = transformations.find(tr_nam);
404  if( it == transformations.end() ) {
405  except("VolumeBuilder",
406  "+++ Failed to locate name transformation %s "
407  "[typo somewhere in the XML?]",
408  nam.c_str());
409  }
410  tr = (*it).second.second;
411  }
412  else {
414  }
415  Transform3D transformation(Position(0,0,0));
416  int elt_id = -1;
417  std::string elt, phys_nam;
418  attr_nam = x_phys.attr_nothrow(_U(name));
419  if( attr_nam ) {
420  phys_nam = x_phys.attr<std::string>(_U(name))+"_%d";
421  }
422  if( attr_elt ) {
423  elt_id = parent.id();
424  elt = c.attr<std::string>(attr_elt);
425  }
426  int number = c.attr<int>(_U(number));
427  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder","+++ Mother:%s place volume %s %d times.",
428  vol.name(), daughter.name(), number);
429  for(int i=0; i<number; ++i) {
430  PlacedVolume pv = vol.placeVolume(daughter, transformation);
431  if( attr_nam ) {
432  //pv->SetName(_toStd::String(i,phys_nam.c_str()).c_str());
433  }
434  if( attr_elt ) {
435  DetElement de(parent,elt,elt_id);
436  de.setPlacement(pv);
437  //placeDaughters(de, daughter, c);
438  }
439  else {
440  //placeDaughters(parent, daughter, c);
441  }
442  transformation *= tr;
443  }
444 }
445 
447 std::size_t VolumeBuilder::load(xml_h element, const std::string& tag) {
448  std::size_t count = 0;
449  for( xml_coll_t c(element,Unicode(tag)); c; ++c ) {
450  std::string ref = c.attr<std::string>(_U(ref));
451  std::unique_ptr<xml::DocumentHolder> doc(new xml::DocumentHolder(xml::DocumentHandler().load(element, c.attr_value(_U(ref)))));
452  xml_h vols = doc->root();
453  printout(debug ? ALWAYS : DEBUG, "VolumeBuilder",
454  "++ Processing xml document %s.", doc->uri().c_str());
455  included_docs[ref] = std::unique_ptr<xml::DocumentHolder>(doc.release());
456  buildShapes(vols);
457  buildTransformations(vols);
458  buildVolumes(vols);
459  ++count;
460  }
461  return count;
462 }
463 
466  DetElement null_de;
467  return placeDaughters(null_de, vol, handle);
468 }
469 
472  for( xml_coll_t c(handle,_U(physvol)); c; ++c )
473  _placeSingleVolume(parent, vol, c);
474  for( xml_coll_t c(handle,_U(paramphysvol)); c; ++c )
475  _placeParamVolumes(parent, vol, c);
476  return *this;
477 }
478 
481  std::size_t len = transformations.size();
482  for( xml_coll_t c(handle,_U(transformation)); c; ++c ) {
483  std::string nam = xml_comp_t(c).nameStr();
484  transformations.emplace(nam,std::make_pair(c,xml::createTransformation(c)));
485  }
486  return transformations.size() - len;
487 }
488 
491  return placeDetector(vol, x_det);
492 }
493 
496  xml_comp_t x = handle;
497  xml_dim_t x_pos = x_det.child(_U(position),false);
498  xml_dim_t x_rot = x_det.child(_U(rotation),false);
499  xml_dim_t x_tr = x_det.child(_U(transformation),false);
501  PlacedVolume pv;
502 
503  if( x_tr ) {
505  pv = mother.placeVolume(vol, tr);
506  }
507  else if( x_pos && x_rot ) {
509  pv = mother.placeVolume(vol, tr);
510  }
511  else if( x_pos ) {
512  pv = mother.placeVolume(vol, Position(x_pos.x(0),x_pos.y(0),x_pos.z(0)));
513  }
514  else {
515  pv = mother.placeVolume(vol);
516  }
517  vol.setVisAttributes(description, x.visStr());
518  vol.setLimitSet(description, x.limitsStr());
519  vol.setRegion(description, x.regionStr());
520  if( detector.isValid() ) {
522  }
523  return pv;
524 }
525 
526 #endif
dd4hep::xml::tools::VolumeBuilder::description
Detector & description
Definition: VolumeBuilder.h:149
dd4hep::xml::Collection_t
Class to support the access to collections of XmlNodes (or XmlElements)
Definition: XMLElements.h:636
dd4hep::xml::tools::VolumeBuilder::vol_veto
std::set< std::string > vol_veto
Definition: VolumeBuilder.h:160
dd4hep::Volume::setLimitSet
const Volume & setLimitSet(const Detector &description, const std::string &name) const
Set the limits to the volume. Note: If the name string is empty, the action is ignored.
Definition: Volumes.cpp:1290
dd4hep::xml::tools::VolumeBuilder
Helper class to build volume and shapes according to ertain patterns in the XML tree.
Definition: VolumeBuilder.h:140
dd4hep::xml::tools::VolumeBuilder::volume
Volume volume(const std::string &nam) const
Access a registered volume by name.
Definition: VolumeBuilder.cpp:80
dd4hep::SensitiveDetector
Handle class to hold the information of a sensitive detector.
Definition: DetElement.h:43
Detector.h
dd4hep::xml::tools::VolumeBuilder::shape_veto
std::set< std::string > shape_veto
Definition: VolumeBuilder.h:160
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:164
dd4hep::xml::tools::VolumeBuilder::volumes
Volumes volumes
Definition: VolumeBuilder.h:157
dd4hep::xml::tools::VolumeBuilder::x_det
xml_det_h x_det
Definition: VolumeBuilder.h:150
dd4hep::xml::tools::VolumeBuilder::buildVolumes
size_t buildVolumes(Handle_t handle)
Build all <volume> identifiers in the passed parent xml element.
Definition: VolumeBuilder.cpp:213
dd4hep::Volume::solid
Solid solid() const
Access to Solid (Shape)
Definition: Volumes.cpp:1252
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:126
dd4hep::Volume::setRegion
const Volume & setRegion(const Detector &description, const std::string &name) const
Set the regional attributes to the volume. Note: If the name string is empty, the action is ignored.
Definition: Volumes.cpp:1271
dd4hep::xml::tools::VolumeBuilder::name
std::string name
Definition: VolumeBuilder.h:152
dd4hep::Detector::pickMotherVolume
virtual Volume pickMotherVolume(const DetElement &sd) const =0
Access mother volume by detector element.
dd4hep::Solid_type< TGeoShape >
dd4hep::xml::tools::VolumeBuilder::buildType
DetectorBuildType buildType
Definition: VolumeBuilder.h:155
dd4hep::xml::Handle_t
Class to easily access the properties of single XmlElements.
Definition: XMLElements.h:380
dd4hep::xml::tools::VolumeBuilder::makeShape
Solid makeShape(Handle_t handle)
Create a new shape from the information given in the xml handle.
Definition: VolumeBuilder.cpp:125
dd4hep::Volume::isSensitive
bool isSensitive() const
Accessor if volume is sensitive (ie. is attached to a sensitive detector)
Definition: Volumes.cpp:1322
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::Assembly
Implementation class extending the ROOT assembly volumes (TGeoVolumeAssembly)
Definition: Volumes.h:762
dd4hep::Volume::placeVolume
PlacedVolume placeVolume(const Volume &volume) const
Place daughter volume. The position and rotation are the identity.
Definition: Volumes.cpp:859
dd4hep::xml::tools::VolumeBuilder::shapes
Shapes shapes
Definition: VolumeBuilder.h:156
xml_attr_t
dd4hep::xml::Attribute xml_attr_t
Definition: XML.h:27
xml_comp_t
dd4hep::xml::Component xml_comp_t
Definition: XML.h:33
dd4hep::Material
Handle class describing a material.
Definition: Objects.h:271
dd4hep::xml::tools::VolumeBuilder::detector
DetElement detector
Definition: VolumeBuilder.h:153
dd4hep::xml::tools::VolumeBuilder::placeDetector
PlacedVolume placeDetector(Volume vol)
Place the detector object into the mother volume returned by the Detector instance.
Definition: VolumeBuilder.cpp:490
dd4hep::Detector::material
virtual Material material(const std::string &name) const =0
Retrieve a matrial by its name from the detector description.
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:187
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:371
dd4hep::Volume::setSensitiveDetector
const Volume & setSensitiveDetector(const SensitiveDetector &obj) const
Assign the sensitive detector structure.
Definition: Volumes.cpp:1309
dd4hep::xml::tools::VolumeBuilder::collectMaterials
size_t collectMaterials(Handle_t element)
Collect a set of materials from the leafs of an xml tag.
Definition: VolumeBuilder.cpp:41
dd4hep::xml::tools::VolumeBuilder::_placeParamVolumes
void _placeParamVolumes(DetElement de, Volume vol, Handle_t c)
Place parametrized volumes.
Definition: VolumeBuilder.cpp:372
dd4hep::xml::Handle_t::attr_value
const XmlChar * attr_value(const Attribute attr) const
Access attribute value by the attribute (throws exception if not present)
Definition: XMLElements.cpp:867
dd4hep::xml::Element::child
Handle_t child(const Strng_t &tag_value, bool except=true) const
Access child by tag name. Thow an exception if required in case the child is not present.
Definition: XMLElements.h:914
dd4hep::xml::tools::VolumeBuilder::registerVolume
void registerVolume(const std::string &nam, Volume volume)
Register volume to map.
Definition: VolumeBuilder.cpp:64
dd4hep::xml::createShape
Solid createShape(Detector &description, const std::string &shape_type, xml::Element element)
Create a solid shape using the plugin mechanism from the attributes of the XML element.
Definition: Utilities.cpp:84
Unicode
dd4hep::xml::Strng_t Unicode
Definition: XML.h:24
dd4hep::xml::tools::VolumeBuilder::placeDaughters
VolumeBuilder & placeDaughters(Volume vol, Handle_t handle)
Build all <physvol> identifiers as PlaceVolume daughters. Ignores structure.
Definition: VolumeBuilder.cpp:465
_U
#define _U(a)
Definition: Tags.h:23
dd4hep::xml::tools::VolumeBuilder::included_docs
std::map< std::string, std::unique_ptr< xml::DocumentHolder > > included_docs
Definition: VolumeBuilder.h:148
Plugins.h
dd4hep::buildMatch
bool buildMatch(const std::string &value, DetectorBuildType match)
Check if a build type matches the current.
Definition: BuildType.cpp:79
dd4hep::xml::tools::VolumeBuilder::sensitive
SensitiveDetector sensitive
Definition: VolumeBuilder.h:154
dd4hep::xml::tools::VolumeBuilder::_placeSingleVolume
void _placeSingleVolume(DetElement de, Volume vol, Handle_t c)
Place single volumes.
Definition: VolumeBuilder.cpp:307
VolumeBuilder.h
dd4hep::xml::DocumentHolder
Class supporting the basic functionality of an XML document including ownership.
Definition: XMLElements.h:741
dd4hep::xml::Handle_t::child
Handle_t child(const XmlChar *tag, bool throw_exception=true) const
Access a single child by its tag name (unicode)
Definition: XMLElements.cpp:713
dd4hep::xml::tools::VolumeBuilder::debug
bool debug
Definition: VolumeBuilder.h:161
dd4hep::DetElement::setPlacement
DetElement & setPlacement(const PlacedVolume &volume)
Set the physical volumes of the detector element.
Definition: DetElement.cpp:330
dd4hep::Transform3D
ROOT::Math::Transform3D Transform3D
Definition: Objects.h:116
dd4hep::xml::tools::VolumeBuilder::load
size_t load(Handle_t element, const std::string &tag)
Load include tags contained in the passed XML handle.
Definition: VolumeBuilder.cpp:447
xml_h
dd4hep::xml::Handle_t xml_h
Definition: ConditionsRepository.cpp:32
dd4hep::xml::tools::VolumeBuilder::getShape
Solid getShape(const std::string &nam) const
Access element from shape cache by name. Invalid returns means 'veto'. Otherwise exception.
Definition: VolumeBuilder.cpp:107
dd4hep::Position
ROOT::Math::XYZVector Position
Definition: Objects.h:80
DetFactoryHelper.h
dd4hep::xml::createVolume
Volume createVolume(Detector &description, const std::string &type, xml::Element element)
Create a volume using the plugin mechanism from the attributes of the XML element.
Definition: Utilities.cpp:197
dd4hep::Detector::buildType
virtual DetectorBuildType buildType() const =0
Access flag to steer the detail of building of the geometry/detector description.
dd4hep::xml::DocumentHandler
Class supporting to read and parse XML documents.
Definition: DocumentHandler.h:39
dd4hep::xml::tools::VolumeBuilder::transformations
Transformations transformations
Definition: VolumeBuilder.h:159
dd4hep::xml::tools::VolumeBuilder::getTransform
Transform3D getTransform(const std::string &nam) const
Access element from transformation cache by name.
Definition: VolumeBuilder.cpp:98
dd4hep::xml::Element
User abstraction class to manipulate XML elements within a document.
Definition: XMLElements.h:769
dd4hep::Volume::setVisAttributes
const Volume & setVisAttributes(const VisAttr &obj) const
Set Visualization attributes to the volume.
Definition: Volumes.cpp:1156
dd4hep::Solid
Solid_type< TGeoShape > Solid
Definition: Shapes.h:198
dd4hep::xml::tools::VolumeBuilder::materials
Materials materials
Definition: VolumeBuilder.h:158
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::xml::tools::VolumeBuilder::buildShapes
size_t buildShapes(Handle_t handle)
Build all <shape> identifiers in the passed parent xml element.
Definition: VolumeBuilder.cpp:173
dd4hep::DetElement::id
int id() const
Get the detector identifier.
Definition: DetElement.cpp:169
dd4hep::xml::createTransformation
Transform3D createTransformation(xml::Element element)
Create layered transformation from xml information.
Definition: Utilities.cpp:42
dd4hep::Volume::setAttributes
const Volume & setAttributes(const Detector &description, const std::string &region, const std::string &limits, const std::string &vis) const
Attach attributes to the volume.
Definition: Volumes.cpp:1229
dd4hep::Volume::visAttributes
VisAttr visAttributes() const
Access the visualisation attributes.
Definition: Volumes.cpp:1239
dd4hep::xml::Handle_t::attr
T attr(const Attribute a) const
Access typed attribute value by the XmlAttr.
Definition: XMLElements.h:454
Printout.h
dd4hep::xml::tools::VolumeBuilder::DetElement
::dd4hep::DetElement DetElement
Definition: VolumeBuilder.h:142
xml_dim_t
dd4hep::xml::Dimension xml_dim_t
Definition: XML.h:31
dd4hep::xml::tools::VolumeBuilder::registerShape
void registerShape(const std::string &nam, Solid shape)
Register shape to map.
Definition: VolumeBuilder.cpp:54
dd4hep::xml::tools::VolumeBuilder::buildTransformations
size_t buildTransformations(Handle_t handle)
Build all <transformation> identifiers in the passed parent xml element.
Definition: VolumeBuilder.cpp:480
Utilities.h
dd4hep::xml::Element::attr
T attr(const XmlAttr *att) const
Access attribute with implicit return type conversion.
Definition: XMLElements.h:851
handle
void handle(const O *o, const C &c, F pmf)
Definition: LCDDConverter.cpp:1104
dd4hep::xml::Handle_t::attr_nothrow
Attribute attr_nothrow(const XmlChar *tag) const
Access attribute pointer by the attribute's unicode name (no exception thrown if not present)
Definition: XMLElements.cpp:671