DD4hep  1.35.0
Detector Description Toolkit for High Energy Physics
Geant4VolumeManager.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 
14 // Framework include files
15 #include <DD4hep/Printout.h>
16 #include <DD4hep/Volumes.h>
17 #include <DD4hep/DetElement.h>
18 #include <DD4hep/DetectorTools.h>
19 #include <DD4hep/VolumeManager.h>
23 #include <DDG4/Geant4Mapping.h>
24 
25 // Geant4 include files
26 #include <G4VTouchable.hh>
27 #include <G4LogicalVolume.hh>
28 #include <G4VPhysicalVolume.hh>
29 
30 // C/C++ include files
31 #include <set>
32 #include <stdexcept>
33 #include <string>
34 #include <utility>
35 #include <vector>
36 
37 //#define VOLMGR_HAVE_DEBUG_INFO 1
38 
39 #ifdef VOLMGR_HAVE_DEBUG_INFO
40 namespace dd4hep {
43  namespace sim {
44 
45  class Geant4GeometryInfo::DebugInfo {
46  public:
47  typedef std::vector<const G4VPhysicalVolume*> Geant4PlacementPath;
48  std::map<Geant4PlacementPath, Placement> g4Paths;
49  };
50  } // End namespace sim
51 } // End namespace dd4hep
52 #endif
53 
54 using namespace dd4hep::sim;
55 using namespace dd4hep;
56 
58 using VolIDDescriptor = std::pair<VolumeID,std::vector<std::pair<const BitFieldElement*, VolumeID> > >;
59 
60 namespace {
61 
63 
68  struct Populator {
69 
70  typedef std::vector<const TGeoNode*> Chain;
71  // typedef std::map<VolumeID,Geant4TouchableHandler::Geant4PlacementPath> Registries;
72  typedef std::set<VolumeID> Registries;
73 
75  const Detector& m_detDesc;
77  Registries m_entries;
79  Geant4GeometryInfo& m_geo;
81  bool m_debug { false };
82 
84  Populator(const Detector& description, Geant4GeometryInfo& g, bool dbg)
85  : m_detDesc(description), m_geo(g), m_debug(dbg)
86  {
87 #ifdef VOLMGR_HAVE_DEBUG_INFO
88  if ( nullptr == g.g4DebugInfo ) {
89  g.g4DebugInfo = new Geant4GeometryInfo::DebugInfo();
90  }
91 #endif
92  }
94  ~Populator() {
95 #ifdef VOLMGR_HAVE_DEBUG_INFO
96  if ( g.g4DebugInfo ) {
97  delete g.g4DebugInfo;
98  g.g4DebugInfo = nullptr;
99  }
100 #endif
101  }
102 
103 
105  void populate(DetElement e) {
106  const DetElement::Children& children = e.children();
107  m_entries.clear();
108  for( const auto& i : children ) {
109  DetElement de = i.second;
110  PlacedVolume pv = de.placement();
111  if( pv.isValid() ) {
112  Chain chain;
115  m_entries.clear();
116  chain.emplace_back(m_detDesc.world().placement().ptr());
117  scanPhysicalVolume(pv.ptr(), std::move(ids), sd, chain);
118  continue;
119  }
120  printout(WARNING, "Geant4VolumeManager",
121  "++ Detector element %s of type %s has no placement.",
122  de.name(), de.type().c_str());
123  }
125  for( const auto& pv : m_geo.g4Placements ) {
126  if( pv.second->IsParameterised() )
127  m_geo.g4Parameterised[pv.second] = pv.first;
128  if( pv.second->IsReplicated() )
129  m_geo.g4Replicated[pv.second] = pv.first;
130  }
131  m_entries.clear();
132  }
133 
135  void scanPhysicalVolume(const TGeoNode* node, PlacedVolume::VolIDs ids, SensitiveDetector& sd, Chain& chain) {
136  PlacedVolume pv = node;
137  Volume vol = pv.volume();
138  PlacedVolume::VolIDs pv_ids = pv.volIDs();
139 
140  chain.emplace_back(node);
141  ids.PlacedVolume::VolIDs::Base::insert(ids.end(), pv_ids.begin(), pv_ids.end());
142  if( vol.isSensitive() ) {
143  sd = vol.sensitiveDetector();
144  if( sd.readout().isValid() ) {
145  add_entry(sd, node, ids, chain);
146  }
147  else {
148  printout(WARNING, "Geant4VolumeManager",
149  "populate: Strange constellation volume %s is sensitive, but has no readout! sd:%p", pv.volume().name(),
150  sd.ptr());
151  }
152  }
153  for( Int_t idau = 0, ndau = node->GetNdaughters(); idau < ndau; ++idau ) {
154  TGeoNode* daughter = node->GetDaughter(idau);
155  PlacedVolume placement(daughter);
156  if( placement.data() ) {
157  scanPhysicalVolume(daughter, ids, sd, chain);
158  }
159  }
160  chain.pop_back();
161  }
162 
163  void add_entry(SensitiveDetector sd, const TGeoNode* n, const PlacedVolume::VolIDs& ids, const Chain& nodes) {
164  Chain control;
165  Volume vol;
166  Readout rdout = sd.readout();
167  IDDescriptor iddesc = rdout.idSpec();
168  VolumeID code = iddesc.encode(ids);
169  PrintLevel print_level = m_debug ? ALWAYS : m_geo.printLevel;
170  PrintLevel print_action = print_level;
171  PrintLevel print_chain = print_level;
172  PrintLevel print_res = print_level;
173  bool print_nodes = false;
175  Registries::const_iterator i = m_entries.find(code);
176 
177  printout(print_action,"Geant4VolumeManager","+++ Add path:%s vid:%016X",
178  detail::tools::placementPath(nodes, false).c_str(), code);
179 
180  if( i == m_entries.end() ) {
181  path.reserve(nodes.size());
182  for( Chain::const_reverse_iterator k = nodes.rbegin(), kend=nodes.rend(); k != kend; ++k ) {
183  const TGeoNode* node = *(k);
184  auto g4pit = m_geo.g4Placements.find(node);
185  if( g4pit != m_geo.g4Placements.end() ) {
186  G4VPhysicalVolume* phys = g4pit->second;
187  if( phys->IsParameterised() ) {
188  PlacedVolume pv(n);
189  PlacedVolumeExtension* ext = pv.data();
190  if( nullptr == ext->params->field ) {
191  ext->params->field = iddesc.field(ext->volIDs.at(0).first);
192  }
193  }
194  path.emplace_back(phys);
195  printout(print_chain, "Geant4VolumeManager",
196  "+++ Chain: Node OK: %s [%s]", node->GetName(), phys->GetName().c_str());
197  continue;
198  }
199  control.insert(control.begin(),node);
200  vol = Volume(node->GetVolume());
201  auto iVolImp = m_geo.g4VolumeImprints.find(vol);
202  if ( iVolImp != m_geo.g4VolumeImprints.end() ) {
203  for(const auto& imp : iVolImp->second ) {
204  const auto& c = imp.first;
205  if ( c.size() <= control.size() && control == c ) {
206  path.emplace_back(imp.second);
207  printout(print_chain, "Geant4VolumeManager", "+++ Chain: Node OK: %s %s -> %s",
208  node->GetName(), detail::tools::placementPath(c,false).c_str(),
209  imp.second->GetName().c_str());
210  control.clear();
211  break;
212  }
213  }
214  }
215  }
216  if ( control.empty() ) {
217  printout(print_res, "Geant4VolumeManager", "+++ Volume IDs:%s",
218  detail::tools::toString(rdout.idSpec(),ids,code).c_str());
219  path.erase(path.begin()+path.size()-1);
220  printout(print_res, "Geant4VolumeManager", "+++ Map %016X to Geant4 Path:%s",
221  (void*)code, Geant4TouchableHandler::placementPath(path).c_str());
222  auto hash = detail::hash64(&path[0], path.size()*sizeof(path[0]));
223  bool missing_hash_path = m_geo.g4Paths.find(hash) == m_geo.g4Paths.end();
224 #ifdef VOLMGR_HAVE_DEBUG_INFO
225  {
226  bool missing_real_path = m_geo.g4DebugInfo->g4Paths.find(path) == m_geo.g4DebugInfo->g4Paths.end();
227  if ( missing_real_path != missing_hash_path ) {
228  if ( !path.empty() )
229  printout(ERROR,"Geant4VolumeManager"," New G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str());
230  if ( !nodes.empty() )
231  printout(ERROR,"Geant4VolumeManager"," TGeo path: %s", detail::tools::placementPath(nodes,false).c_str());
232  printout(ERROR,"Geant4VolumeManager", " Offend.VolIDs: %s", detail::tools::toString(rdout.idSpec(),ids,code).c_str());
233  }
234  if ( missing_real_path ) {
236  opt.flags.parametrised = path.front()->IsParameterised() ? 1 : 0;
237  opt.flags.replicated = path.front()->IsReplicated() ? 1 : 0;
238  m_geo.g4DebugInfo->g4Paths[path] = { code, opt.value };
239  }
240  }
241 #endif
242  if ( missing_hash_path ) {
244  opt.flags.parametrised = path.front()->IsParameterised() ? 1 : 0;
245  opt.flags.replicated = path.front()->IsReplicated() ? 1 : 0;
246  m_geo.g4Paths[hash] = { code, opt.value };
247  m_entries.emplace(code);
248  return;
249  }
251  if ( !path.empty() && (path.front()->IsParameterised() || path.front()->IsReplicated()) ) {
252  return;
253  }
254  printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Geant4 path!!!! %s %s",
255  " [THIS SHOULD NEVER HAPPEN]", Geant4TouchableHandler::placementPath(path).c_str());
256  goto Err;
257  }
258  printout(INFO, "Geant4VolumeManager", "Control block has still %d entries:%s",
259  int(control.size()), detail::tools::placementPath(control,true).c_str());
260  print_nodes = true;
261  goto Err;
262  }
263  else {
265  if ( !path.empty() && (path.front()->IsParameterised() || path.front()->IsReplicated()) ) {
266  return;
267  }
268  }
269  printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Volume entry: 0x%X"
270  " [THIS SHOULD NEVER HAPPEN]", code);
271 
272  Err:
273  if ( i != m_entries.end() )
274  printout( ERROR,"Geant4VolumeManager"," Known G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str() );
275  if ( !path.empty() )
276  printout( ERROR,"Geant4VolumeManager"," New G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str() );
277  if ( !nodes.empty() ) {
278  printout( ERROR,"Geant4VolumeManager"," TGeo path: %s", detail::tools::placementPath(nodes,false).c_str() );
279  if( print_nodes ) {
280  std::string node_path;
281  for( std::size_t in=0; in<nodes.size(); ++in ) {
282  PlacedVolume pv(nodes[in]);
283  node_path += "/";
284  node_path += pv.name();
285  printout( ALWAYS,"Geant4VolumeManager", " TGeo Node[%ld]: %s [%p] Volids: '%s'",
286  in, node_path.c_str(), (void*)nodes[in], pv.volIDs().str().c_str() );
287  }
288  }
289  }
290  printout( ERROR,"Geant4VolumeManager", " Offend.VolIDs: %s", detail::tools::toString(rdout.idSpec(),ids,code).c_str() );
291  throw std::runtime_error("Failed to populate Geant4 volume manager!");
292  }
293  };
294 }
295 
299  if( info && info->valid ) {
300  if( !info->has_volmgr ) {
301  Populator p(description, *info, debug);
302  p.populate(description.world());
303  info->has_volmgr = true;
304  }
305  return;
306  }
307  except("Geant4VolumeManager", "Attempt populate from invalid Geant4 geometry info [Invalid-Info]");
308 }
309 
311 std::vector<const G4VPhysicalVolume*>
312 Geant4VolumeManager::placementPath(const G4VTouchable* touchable, bool exception) const {
313  Geant4TouchableHandler handler(touchable);
314  return handler.placementPath(exception);
315 }
316 
319  if( !isValid() ) {
320  except("Geant4VolumeManager", "Attempt to use invalid Geant4 volume manager [Invalid-Handle]");
321  }
322  else if( !ptr()->valid ) {
323  except("Geant4VolumeManager", "Attempt to use invalid Geant4 geometry info [Invalid-Info]");
324  }
325  return true;
326 }
327 
328 namespace {
329  std::string debug_status(const Geant4VolumeManager* mgr) {
330  char text[256];
331  auto* p = mgr->ptr();
332  if ( p ) {
333  ::snprintf(text, sizeof(text), "==> #path entries: %ld valid: %s has_volmgr: %s",
334  p->g4Paths.size(), yes_no(p->valid), yes_no(p->has_volmgr));
335  return { text };
336  }
337  return { "Invalid handle to Geant4GeometryInfo" };
338  }
339 }
340 
342 VolumeID Geant4VolumeManager::volumeID(const G4VTouchable* touchable) const {
343  Geant4TouchableHandler handler(touchable);
344  std::vector<const G4VPhysicalVolume*> path = handler.placementPath();
345  if( !isValid() ) {
346  printout(INFO, "Geant4VolumeManager", "+++ INVALID Geant4VolumeManager handle.");
347  return NonExisting;
348  }
349  else if( !ptr()->valid ) {
350  printout(INFO, "Geant4VolumeManager", "+++ INVALID Geant4VolumeManager [Not initialized]");
351  return NonExisting;
352  }
353  else if( path.empty() ) {
354  printout(INFO, "Geant4VolumeManager", "+++ EMPTY volume Geant4 Path: %s",
356  return NonExisting;
357  }
358  else {
359  uint64_t hash = detail::hash64(&path[0], sizeof(path[0])*path.size());
360  auto i = ptr()->g4Paths.find(hash);
361  if( i != ptr()->g4Paths.end() ) {
362  const auto& e = (*i).second;
363  VolumeID volid = e.volumeID;
365  if( e.flags == 0 ) {
366  return volid;
367  }
368  const auto& paramterised = ptr()->g4Parameterised;
369  const auto& replicated = ptr()->g4Replicated;
371  for( std::size_t j=0; j < path.size(); ++j ) {
372  const auto* phys = path[j];
373  if( phys->IsParameterised() ) {
374  int copy_no = touchable->GetCopyNumber(j);
375  const auto it = paramterised.find(phys);
376  if( it != paramterised.end() ) {
377  //printout(INFO,"Geant4VolumeManager",
378  // "Copy number: %ld <--> %ld", copy_no, long(phys->GetCopyNo()));
379  const auto* field = (*it).second.data()->params->field;
380  volid |= IDDescriptor::encode(field, copy_no);
381  continue;
382  }
383  except("Geant4VolumeManager",
384  "Error Geant4VolumeManager::volumeID(const G4VTouchable* touchable)");
385  }
386  else if( phys->IsReplicated() ) {
387  int copy_no = touchable->GetCopyNumber(j);
388  const auto it = replicated.find(phys);
389  if( it != replicated.end() ) {
390  const auto* field = (*it).second.data()->params->field;
391  volid |= IDDescriptor::encode(field, copy_no);
392  continue;
393  }
394  except("Geant4VolumeManager",
395  "Error Geant4VolumeManager::volumeID(const G4VTouchable* touchable)");
396  }
397  }
398  return volid;
399  }
400  if( !path[0] ) {
401  printout(INFO, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' [invalid path] %s",
402  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
403  return InvalidPath;
404  }
405  else if( !path[0]->GetLogicalVolume()->GetSensitiveDetector() ) {
406  printout(DEBUG, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' [insensitive] %s",
407  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
408  return Insensitive;
409  }
410  printout(INFO, "Geant4VolumeManager",
411  "+++ Bad Geant4 volume path: \'%s\' [missing entry] %s",
412  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
413  return NonExisting;
414  }
415  printout(INFO, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' %s",
416  Geant4TouchableHandler::placementPath(path).c_str(), yes_no(path.empty()));
417  return NonExisting;
418 }
419 
421 void Geant4VolumeManager::volumeDescriptor(const std::vector<const G4VPhysicalVolume*>& path,
422  VolIDDescriptor& vol_desc) const
423 {
424  vol_desc.second.clear();
425  vol_desc.first = NonExisting;
426  if( !path.empty() && checkValidity() ) {
427  auto hash = detail::hash64(&path[0], sizeof(path[0])*path.size());
428  auto i = ptr()->g4Paths.find(hash);
429  if( i != ptr()->g4Paths.end() ) {
430  VolumeID vid = (*i).second.volumeID;
431  G4LogicalVolume* lvol = path[0]->GetLogicalVolume();
432  if( lvol->GetSensitiveDetector() ) {
433  const auto* node = path[0];
434  const auto& pm = ptr()->g4Placements;
435  for( const auto& ipm : pm ) {
436  if ( ipm.second == node ) {
437  PlacedVolume pv = ipm.first;
439  IDDescriptor dsc = sd.readout().idSpec();
440  vol_desc.first = vid;
441  dsc.decodeFields(vid, vol_desc.second);
442  return;
443  }
444  }
445  }
446  vol_desc.first = Insensitive;
447  return;
448  }
449  if( !path[0] )
450  vol_desc.first = InvalidPath;
451  else if( !path[0]->GetLogicalVolume()->GetSensitiveDetector() )
452  vol_desc.first = Insensitive;
453  else
454  vol_desc.first = NonExisting;
455  }
456 }
457 
459 void Geant4VolumeManager::volumeDescriptor(const G4VTouchable* touchable,
460  VolIDDescriptor& vol_desc) const {
461  volumeDescriptor(placementPath(touchable), vol_desc);
462 }
dd4hep::IDDescriptor::decodeFields
void decodeFields(VolumeID vid, std::vector< std::pair< const BitFieldElement *, VolumeID > > &fields) const
Decode volume IDs and return filled descriptor with all fields.
Definition: IDDescriptor.cpp:164
dd4hep::DetElement::children
const Children & children() const
Access to the list of children.
Definition: DetElement.cpp:207
dd4hep::sim::Geant4VolumeManager::Geant4VolumeManager
Geant4VolumeManager()=default
Default constructor.
dd4hep::sim::Geant4GeometryInfo::PlacementFlags
Definition: Geant4GeometryInfo.h:93
dd4hep::sim::Geant4TouchableHandler
Helper class to ease the extraction of information from a G4Touchable object.
Definition: Geant4TouchableHandler.h:44
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags::parametrised
unsigned parametrised
Definition: Geant4GeometryInfo.h:96
dd4hep::Detector::world
virtual DetElement world() const =0
Return reference to the top-most (world) detector element.
Volumes.h
Geant4Mapping.h
dd4hep::SensitiveDetector
Handle class to hold the information of a sensitive detector.
Definition: DetElement.h:43
dd4hep::PlacedVolumeExtension
Implementation class extending the ROOT placed volume.
Definition: Volumes.h:80
dd4hep::IDDescriptor::field
const BitFieldElement * field(const std::string &field_name) const
Get the field descriptor of one field by name.
Definition: IDDescriptor.cpp:96
dd4hep::info
std::size_t info(const std::string &src, const std::string &msg)
Definition: RootDictionary.h:65
dd4hep::exception
void exception(const std::string &src, const std::string &msg)
Definition: RootDictionary.h:69
dd4hep::DetElement::type
std::string type() const
Access detector type (structure, tracker, calorimeter, etc.).
Definition: DetElement.cpp:97
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:164
Geant4VolumeManager.h
dd4hep::DetElement::placement
PlacedVolume placement() const
Access to the physical volume of this detector element.
Definition: DetElement.cpp:321
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::flags
struct dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags flags
VolumeManagerInterna.h
dd4hep::detail::tools::placementPath
std::string placementPath(DetElement element)
Assemble the placement path from a given detector element to the world volume.
Definition: DetectorTools.cpp:283
dd4hep::debug
std::size_t debug(const std::string &src, const std::string &msg)
Definition: RootDictionary.h:64
dd4hep::sim::Geant4TouchableHandler::Geant4PlacementPath
std::vector< const G4VPhysicalVolume * > Geant4PlacementPath
Definition: Geant4TouchableHandler.h:47
dd4hep::IDDescriptor
Class implementing the ID encoding of the detector response.
Definition: IDDescriptor.h:36
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:126
dd4hep::Handle
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
Definition: Handle.h:82
dd4hep::PlacedVolumeExtension::volIDs
VolIDs volIDs
ID container.
Definition: Volumes.h:128
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::sim::Geant4GeometryInfo::g4Paths
std::map< uint64_t, Placement > g4Paths
Definition: Geant4GeometryInfo.h:134
dd4hep::sim::Geant4VolumeManager::InvalidPath
static const VolumeID InvalidPath
Definition: Geant4VolumeManager.h:69
dd4hep::sim::Geant4GeometryInfo::printLevel
PrintLevel printLevel
Definition: Geant4GeometryInfo.h:139
VolumeManager.h
dd4hep::sim::Geant4VolumeManager::Insensitive
static const VolumeID Insensitive
Definition: Geant4VolumeManager.h:70
dd4hep::sim::Geant4GeometryInfo::g4Parameterised
Geant4GeometryMaps::G4PlacementMap g4Parameterised
Definition: Geant4GeometryInfo.h:118
dd4hep::sim::Geant4VolumeManager::volumeID
VolumeID volumeID(const G4VTouchable *touchable) const
Access CELLID by Geant4 touchable object.
Definition: Geant4VolumeManager.cpp:342
Geant4AssemblyVolume.h
VolIDDescriptor
std::pair< VolumeID, std::vector< std::pair< const BitFieldElement *, VolumeID > > > VolIDDescriptor
Definition: Geant4VolumeManager.cpp:58
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:187
dd4hep::PlacedVolumeExtension::VolIDs
Volume ID container.
Definition: Volumes.h:89
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:371
dd4hep::sim::Geant4VolumeManager::NonExisting
static const VolumeID NonExisting
Definition: Geant4VolumeManager.h:71
dd4hep::sim::Geant4GeometryInfo::g4Placements
Geant4GeometryMaps::PlacementMap g4Placements
Definition: Geant4GeometryInfo.h:115
dd4hep::IDDescriptor::encode
static VolumeID encode(const Field *fld, VolumeID value)
Encode partial volume identifiers to a volumeID.
Definition: IDDescriptor.cpp:148
DetectorTools.h
Geant4TouchableHandler.h
dd4hep::sim::Geant4GeometryInfo::g4DebugInfo
DebugInfo * g4DebugInfo
Definition: Geant4GeometryInfo.h:109
dd4hep::sim::Geant4VolumeManager
The Geant4VolumeManager to facilitate optimized lookups of cell IDs from touchables.
Definition: Geant4VolumeManager.h:47
dd4hep::sim::Geant4VolumeManager::placementPath
std::vector< const G4VPhysicalVolume * > placementPath(const G4VTouchable *touchable, bool exception=true) const
Helper: Generate placement path from touchable object.
Definition: Geant4VolumeManager.cpp:312
dd4hep::sim::Geant4GeometryInfo::g4VolumeImprints
Geant4GeometryMaps::VolumeImprintMap g4VolumeImprints
Definition: Geant4GeometryInfo.h:117
dd4hep::sim::IDDescriptor
IDDescriptor IDDescriptor
Definition: LCIOConversions.cpp:69
dd4hep::sim::Geant4GeometryInfo::g4Replicated
Geant4GeometryMaps::G4PlacementMap g4Replicated
Definition: Geant4GeometryInfo.h:119
VolumeID
dd4hep::DDSegmentation::VolumeID VolumeID
Definition: SegmentationDictionary.h:50
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags::replicated
unsigned replicated
Definition: Geant4GeometryInfo.h:97
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: EDM4hepFileReader.cpp:46
dd4hep::DetElement::Children
std::map< std::string, DetElement > Children
Definition: DetElement.h:205
dd4hep::sim::Geant4TouchableHandler::placementPath
static std::string placementPath(const Geant4PlacementPath &path, bool reverse=true)
Assemble Geant4 volume path.
Definition: Geant4TouchableHandler.cpp:58
dd4hep::sim::Geant4GeometryInfo
Concreate class holding the relation information between geant4 objects and dd4hep objects.
Definition: Geant4GeometryInfo.h:91
dd4hep::Handle::ptr
T * ptr() const
Access to the held object.
Definition: Handle.h:151
DetElement.h
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::PlacedVolumeExtension::VolIDs::str
std::string str() const
String representation for debugging.
Definition: Volumes.cpp:436
dd4hep::SensitiveDetector::readout
Readout readout() const
Access readout structure of the sensitive detector.
Definition: DetElement.cpp:420
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::value
int value
Definition: Geant4GeometryInfo.h:94
dd4hep::detail::tools::toString
std::string toString(const PlacedVolume::VolIDs &ids)
Convert VolumeID to string.
Definition: DetectorTools.cpp:385
dd4hep::PlacedVolume::volume
Volume volume() const
Logical volume of this placement.
Definition: Volumes.cpp:468
dd4hep::PlacedVolume::data
Object * data() const
Check if placement is properly instrumented.
Definition: Volumes.cpp:447
dd4hep::sim::hash
unsigned int hash(unsigned int initialSeed, unsigned int eventNumber, unsigned int runNumber)
calculate hash from initialSeed, eventID and runID
Definition: Geant4EventSeed.h:201
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::PlacedVolumeExtension::Parameterisation::field
const detail::BitFieldElement * field
Bitfield from sensitive detector to encode the volume ID on the fly.
Definition: Volumes.h:266
dd4hep::Readout
Handle to the implementation of the readout structure of a subdetector.
Definition: Readout.h:38
dd4hep::Readout::idSpec
IDDescriptor idSpec() const
Access IDDescription structure.
Definition: Readout.cpp:112
dd4hep::PlacedVolume::volIDs
const PlacedVolumeExtension::VolIDs & volIDs() const
Access to the volume IDs.
Definition: Volumes.cpp:496
valid
unsigned char valid
Definition: AlignmentsCalculator.cpp:69
dd4hep::sim::Geant4VolumeManager::volumeDescriptor
void volumeDescriptor(const std::vector< const G4VPhysicalVolume * > &path, std::pair< VolumeID, std::vector< std::pair< const BitFieldElement *, VolumeID > > > &volume_desc) const
Access fully decoded volume fields by placement path.
dd4hep::PlacedVolumeExtension::params
Parameterisation * params
Reference to the parameterised transformation.
Definition: Volumes.h:126
Printout.h
dd4hep::sim::Geant4VolumeManager::checkValidity
bool checkValidity() const
Check the validity of the information before accessing it.
Definition: Geant4VolumeManager.cpp:318
dd4hep::Volume::sensitiveDetector
Handle< NamedObject > sensitiveDetector() const
Access to the handle to the sensitive detector.
Definition: Volumes.cpp:1316