DD4hep  1.30.0
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  Solid solid = xml::createShape(description, type, c);
193  if ( !solid.isValid() ) {
194  except("VolumeBuilder","+++ Failed to create shape %s of type: %s",
195  nam.c_str(), type.c_str());
196  }
197  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
198  "+++ Building shape from XML: %s of type: %s",
199  nam.c_str(), solid->IsA()->GetName());
200  shapes.emplace(nam,std::make_pair(c,solid));
201  continue;
202  }
203  except("VolumeBuilder","+++ Shape %s is already known to this builder unit. "
204  "Cannot be overridden.",nam.c_str());
205  }
206  return shapes.size()-len;
207 }
208 
211  std::size_t len = volumes.size();
212  xml_elt_t x_comp(0);
213  for( xml_coll_t c(handle,_U(volume)); c; ++c ) {
214  Solid solid;
215  xml_comp_t x = c;
216  std::string nam = x.attr<std::string>(_U(name));
217  xml_attr_t attr = c.attr_nothrow(_U(build));
219  if ( attr ) {
220  std::string build = c.attr<std::string>(attr);
221  if ( !buildMatch(build,buildType) ) {
222  printout(INFO,"VolumeBuilder",
223  "+++ Volume %s does NOT match build requirements. [Ignored]",nam.c_str());
224  continue;
225  }
226  }
227  bool is_sensitive = c.attr_nothrow(_U(sensitive));
229  if ( (attr=c.attr_nothrow(_U(type))) ) {
230  std::string typ = c.attr<std::string>(attr);
231  Volume vol = xml::createVolume(description, typ, c);
232  vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
233  volumes.emplace(nam,std::make_pair(c,vol));
235  if ( is_sensitive ) {
236  vol.setSensitiveDetector(sensitive);
237  }
238  solid = vol.solid();
239  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
240  "+++ Building volume from XML: %-20s shape:%-24s vis:%s sensitive:%s",
241  nam.c_str(), solid->IsA()->GetName(), x.visStr().c_str(),
242  yes_no(is_sensitive));
243  buildVolumes(c);
244  continue;
245  }
246 
248  if ( (attr=c.attr_nothrow(_U(shape))) ) {
249  std::string ref = c.attr<std::string>(attr);
250  if ( !(solid=getShape(ref)).isValid() ) continue;
251  }
253  else if ( (x_comp=x.child(_U(shape),false)) ) {
254  if ( !(solid=makeShape(x_comp)).isValid() ) continue;
255  }
256 
258  if ( solid.isValid() ) {
259  Material mat = description.material(x.attr<std::string>(_U(material)));
260  Volume vol(nam, solid, mat);
261  placeDaughters(detector, vol, x);
262  vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
263  volumes.emplace(nam,std::make_pair(c,vol));
265  if ( is_sensitive ) {
267  }
268  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
269  "+++ Building volume from XML: %-20s shape:%-24s vis:%s sensitive:%s",
270  nam.c_str(), solid->IsA()->GetName(), x.visStr().c_str(),
271  yes_no(is_sensitive));
272  buildVolumes(c);
273  continue;
274  }
275  bool is_assembly = true;
276  is_assembly |= x.child(_U(assembly),false) != 0;
277  is_assembly |= c.attr_nothrow(_U(assembly)) != 0;
278  if ( is_assembly ) {
279  Assembly vol(nam);
280  placeDaughters(detector, vol, x);
281  vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
282  volumes.emplace(nam,std::make_pair(c,vol));
283  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
284  "+++ Building assembly from XML: %-20s shape:%-24s vis:%s",
285  nam.c_str(), vol->GetShape()->IsA()->GetName(), x.visStr().c_str());
286  buildVolumes(c);
287  continue;
288  }
289  except("VolumeBuilder","+++ Failed to create volume %s - "
290  "It is neither Volume nor assembly....", nam.c_str());
291  }
292  return volumes.size()-len;
293 }
294 
297  xml_attr_t attr = c.attr_nothrow(_U(logvol));
298  if ( !attr ) {
299  attr = c.attr_nothrow(_U(volume));
300  }
301  if ( !attr ) {
302  except("VolumeBuilder","+++ The xml volume element has no 'logvol' or 'volume' attribute!");
303  }
304  std::string nam = c.attr<std::string>(attr);
305  if ( vol_veto.find(nam) != vol_veto.end() ) {
306  return;
307  }
308  auto iv = volumes.find(nam);
309  if ( iv == volumes.end() ) {
310  except("VolumeBuilder",
311  "+++ Failed to locate volume %s [typo somewhere in the XML?]",
312  nam.c_str());
313  }
314  PlacedVolume pv;
315  Volume daughter = (*iv).second.second;
316  attr = c.attr_nothrow(_U(transformation));
317  if ( attr ) {
318  std::string tr_nam = c.attr<std::string>(attr);
319  auto it = transformations.find(tr_nam);
320  if ( it == transformations.end() ) {
321  except("VolumeBuilder",
322  "+++ Failed to locate name transformation %s [typo in the XML?]",
323  nam.c_str());
324  }
325  const Transform3D& tr = (*it).second.second;
326  pv = vol.placeVolume(daughter, tr);
327  }
328  else {
330  pv = vol.placeVolume(daughter, tr);
331  }
332  xml_attr_t attr_nam = c.attr_nothrow(_U(name));
333  if ( attr_nam ) {
334  std::string phys_nam = c.attr<std::string>(attr_nam);
335  pv->SetName(phys_nam.c_str());
336  }
337  attr = c.attr_nothrow(_U(element));
338  if ( attr && !parent.isValid() ) {
339  except("VolumeBuilder",
340  "+++ Failed to set DetElement placement for volume %s [Invalid parent]",
341  nam.c_str());
342  }
343  else if ( attr ) {
344  int elt_id = parent.id();
345  std::string elt = c.attr<std::string>(attr);
346  attr = c.attr_nothrow(_U(id));
347  if ( attr ) {
348  elt_id = c.attr<int>(attr);
349  elt += c.attr<std::string>(attr);
350  }
351  DetElement de(parent, elt, elt_id);
352  de.setPlacement(pv);
353  placeDaughters(de, daughter, c);
354  }
355  else {
356  placeDaughters(parent, daughter, c);
357  }
358 }
359 
362  xml_attr_t attr_tr, attr_elt, attr_nam;
363  xml_h x_phys = c.child(_U(physvol));
364  xml_attr_t attr = x_phys.attr_nothrow(_U(logvol));
365  if ( !attr ) {
366  attr = x_phys.attr_nothrow(_U(volume));
367  }
368  if ( !attr ) {
369  except("VolumeBuilder","+++ The xml volume element has no 'logvol' or 'volume' attribute!");
370  }
371  std::string nam = x_phys.attr<std::string>(attr);
372  if ( vol_veto.find(nam) != vol_veto.end() ) {
373  return;
374  }
375  auto iv = volumes.find(nam);
376  if ( iv == volumes.end() ) {
377  except("VolumeBuilder",
378  "+++ Failed to locate volume %s [typo somewhere in the XML?]",
379  nam.c_str());
380  }
381  attr_elt = c.attr_nothrow(_U(element));
382  if ( attr_elt && !parent.isValid() ) {
383  except("VolumeBuilder",
384  "+++ Failed to set DetElement placement for volume %s [Invalid parent]",
385  nam.c_str());
386  }
387  Volume daughter = (*iv).second.second;
388  attr_tr = c.attr_nothrow(_U(transformation));
389  Transform3D tr;
390  if ( attr_tr ) {
391  std::string tr_nam = c.attr<std::string>(attr_tr);
392  auto it = transformations.find(tr_nam);
393  if ( it == transformations.end() ) {
394  except("VolumeBuilder",
395  "+++ Failed to locate name transformation %s "
396  "[typo somewhere in the XML?]",
397  nam.c_str());
398  }
399  tr = (*it).second.second;
400  }
401  else {
403  }
404  Transform3D transformation(Position(0,0,0));
405  int elt_id = -1;
406  std::string elt, phys_nam;
407  attr_nam = x_phys.attr_nothrow(_U(name));
408  if ( attr_nam ) {
409  phys_nam = x_phys.attr<std::string>(_U(name))+"_%d";
410  }
411  if ( attr_elt ) {
412  elt_id = parent.id();
413  elt = c.attr<std::string>(attr_elt);
414  }
415  int number = c.attr<int>(_U(number));
416  printout(debug ? ALWAYS : DEBUG,"VolumeBuilder","+++ Mother:%s place volume %s %d times.",
417  vol.name(), daughter.name(), number);
418  for(int i=0; i<number; ++i) {
419  PlacedVolume pv = vol.placeVolume(daughter, transformation);
420  if ( attr_nam ) {
421  //pv->SetName(_toStd::String(i,phys_nam.c_str()).c_str());
422  }
423  if ( attr_elt ) {
424  DetElement de(parent,elt,elt_id);
425  de.setPlacement(pv);
426  //placeDaughters(de, daughter, c);
427  }
428  else {
429  //placeDaughters(parent, daughter, c);
430  }
431  transformation *= tr;
432  }
433 }
434 
436 std::size_t VolumeBuilder::load(xml_h element, const std::string& tag) {
437  std::size_t count = 0;
438  for( xml_coll_t c(element,Unicode(tag)); c; ++c ) {
439  std::string ref = c.attr<std::string>(_U(ref));
440  std::unique_ptr<xml::DocumentHolder> doc(new xml::DocumentHolder(xml::DocumentHandler().load(element, c.attr_value(_U(ref)))));
441  xml_h vols = doc->root();
442  printout(debug ? ALWAYS : DEBUG, "VolumeBuilder",
443  "++ Processing xml document %s.", doc->uri().c_str());
444  included_docs[ref] = std::unique_ptr<xml::DocumentHolder>(doc.release());
445  buildShapes(vols);
446  buildTransformations(vols);
447  buildVolumes(vols);
448  ++count;
449  }
450  return count;
451 }
452 
455  DetElement null_de;
456  return placeDaughters(null_de, vol, handle);
457 }
458 
461  for( xml_coll_t c(handle,_U(physvol)); c; ++c )
462  _placeSingleVolume(parent, vol, c);
463  for( xml_coll_t c(handle,_U(paramphysvol)); c; ++c )
464  _placeParamVolumes(parent, vol, c);
465  return *this;
466 }
467 
470  std::size_t len = transformations.size();
471  for( xml_coll_t c(handle,_U(transformation)); c; ++c ) {
472  std::string nam = xml_comp_t(c).nameStr();
473  transformations.emplace(nam,std::make_pair(c,xml::createTransformation(c)));
474  }
475  return transformations.size() - len;
476 }
477 
480  return placeDetector(vol, x_det);
481 }
482 
485  xml_comp_t x = handle;
486  xml_dim_t x_pos = x_det.child(_U(position),false);
487  xml_dim_t x_rot = x_det.child(_U(rotation),false);
488  xml_dim_t x_tr = x_det.child(_U(transformation),false);
490  PlacedVolume pv;
491 
492  if ( x_tr ) {
494  pv = mother.placeVolume(vol, tr);
495  }
496  else if ( x_pos && x_rot ) {
498  pv = mother.placeVolume(vol, tr);
499  }
500  else if ( x_pos ) {
501  pv = mother.placeVolume(vol, Position(x_pos.x(0),x_pos.y(0),x_pos.z(0)));
502  }
503  else {
504  pv = mother.placeVolume(vol);
505  }
506  vol.setVisAttributes(description, x.visStr());
507  vol.setLimitSet(description, x.limitsStr());
508  vol.setRegion(description, x.regionStr());
509  if ( detector.isValid() ) {
511  }
512  return pv;
513 }
514 
515 #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:1261
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:44
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:173
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:210
dd4hep::Volume::solid
Solid solid() const
Access to Solid (Shape)
Definition: Volumes.cpp:1223
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
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:1242
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:1293
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:830
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:272
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:479
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:188
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:378
dd4hep::Volume::setSensitiveDetector
const Volume & setSensitiveDetector(const SensitiveDetector &obj) const
Assign the sensitive detector structure.
Definition: Volumes.cpp:1280
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:361
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:864
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:454
_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:296
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:710
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:117
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:436
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:81
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:1127
dd4hep::Solid
Solid_type< TGeoShape > Solid
Definition: Shapes.h:197
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:1200
dd4hep::Volume::visAttributes
VisAttr visAttributes() const
Access the visualisation attributes.
Definition: Volumes.cpp:1210
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:469
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:1105
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:668