DD4hep  1.32.1
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;
80 
82  Populator(const Detector& description, Geant4GeometryInfo& g)
83  : m_detDesc(description), m_geo(g)
84  {
85 #ifdef VOLMGR_HAVE_DEBUG_INFO
86  if ( nullptr == g.g4DebugInfo ) {
87  g.g4DebugInfo = new Geant4GeometryInfo::DebugInfo();
88  }
89 #endif
90  }
92  ~Populator() {
93 #ifdef VOLMGR_HAVE_DEBUG_INFO
94  if ( g.g4DebugInfo ) {
95  delete g.g4DebugInfo;
96  g.g4DebugInfo = nullptr;
97  }
98 #endif
99  }
100 
101 
103  void populate(DetElement e) {
104  const DetElement::Children& c = e.children();
105  m_entries.clear();
106  for( const auto& i : c ) {
107  DetElement de = i.second;
108  PlacedVolume pv = de.placement();
109  if( pv.isValid() ) {
110  Chain chain;
113  m_entries.clear();
114  chain.emplace_back(m_detDesc.world().placement().ptr());
115  scanPhysicalVolume(pv.ptr(), std::move(ids), sd, chain);
116  continue;
117  }
118  printout(WARNING, "Geant4VolumeManager",
119  "++ Detector element %s of type %s has no placement.",
120  de.name(), de.type().c_str());
121  }
123  for( const auto& pv : m_geo.g4Placements ) {
124  if( pv.second->IsParameterised() )
125  m_geo.g4Parameterised[pv.second] = pv.first;
126  if( pv.second->IsReplicated() )
127  m_geo.g4Replicated[pv.second] = pv.first;
128  }
129  m_entries.clear();
130  }
131 
133  void scanPhysicalVolume(const TGeoNode* node, PlacedVolume::VolIDs ids, SensitiveDetector& sd, Chain& chain) {
134  PlacedVolume pv = node;
135  Volume vol = pv.volume();
136  PlacedVolume::VolIDs pv_ids = pv.volIDs();
137 
138  chain.emplace_back(node);
139  ids.PlacedVolume::VolIDs::Base::insert(ids.end(), pv_ids.begin(), pv_ids.end());
140  if( vol.isSensitive() ) {
141  sd = vol.sensitiveDetector();
142  if( sd.readout().isValid() ) {
143  add_entry(sd, node, ids, chain);
144  }
145  else {
146  printout(WARNING, "Geant4VolumeManager",
147  "populate: Strange constellation volume %s is sensitive, but has no readout! sd:%p", pv.volume().name(),
148  sd.ptr());
149  }
150  }
151  for( Int_t idau = 0, ndau = node->GetNdaughters(); idau < ndau; ++idau ) {
152  TGeoNode* daughter = node->GetDaughter(idau);
153  PlacedVolume placement(daughter);
154  if( placement.data() ) {
155  scanPhysicalVolume(daughter, ids, sd, chain);
156  }
157  }
158  chain.pop_back();
159  }
160 
161  void add_entry(SensitiveDetector sd, const TGeoNode* n, const PlacedVolume::VolIDs& ids, const Chain& nodes) {
162  Chain control;
163  Volume vol;
164  Readout rdout = sd.readout();
165  IDDescriptor iddesc = rdout.idSpec();
166  VolumeID code = iddesc.encode(ids);
167  PrintLevel print_level = m_geo.printLevel;
168  PrintLevel print_action = print_level;
169  PrintLevel print_chain = print_level;
170  PrintLevel print_res = print_level;
172  Registries::const_iterator i = m_entries.find(code);
173 
174  printout(print_action,"Geant4VolumeManager","+++ Add path:%s vid:%016X",
175  detail::tools::placementPath(nodes, false).c_str(), code);
176 
177  if( i == m_entries.end() ) {
178  path.reserve(nodes.size());
179  for( Chain::const_reverse_iterator k = nodes.rbegin(), kend=nodes.rend(); k != kend; ++k ) {
180  const TGeoNode* node = *(k);
181  auto g4pit = m_geo.g4Placements.find(node);
182  if( g4pit != m_geo.g4Placements.end() ) {
183  G4VPhysicalVolume* phys = g4pit->second;
184  if( phys->IsParameterised() ) {
185  PlacedVolume pv(n);
186  PlacedVolumeExtension* ext = pv.data();
187  if( nullptr == ext->params->field ) {
188  ext->params->field = iddesc.field(ext->volIDs.at(0).first);
189  }
190  }
191  path.emplace_back(phys);
192  printout(print_chain, "Geant4VolumeManager",
193  "+++ Chain: Node OK: %s [%s]", node->GetName(), phys->GetName().c_str());
194  continue;
195  }
196  control.insert(control.begin(),node);
197  vol = Volume(node->GetVolume());
198  auto iVolImp = m_geo.g4VolumeImprints.find(vol);
199  if ( iVolImp != m_geo.g4VolumeImprints.end() ) {
200  for(const auto& imp : iVolImp->second ) {
201  const auto& c = imp.first;
202  if ( c.size() <= control.size() && control == c ) {
203  path.emplace_back(imp.second);
204  printout(print_chain, "Geant4VolumeManager", "+++ Chain: Node OK: %s %s -> %s",
205  node->GetName(), detail::tools::placementPath(c,false).c_str(),
206  imp.second->GetName().c_str());
207  control.clear();
208  break;
209  }
210  }
211  }
212  }
213  if ( control.empty() ) {
214  printout(print_res, "Geant4VolumeManager", "+++ Volume IDs:%s",
215  detail::tools::toString(rdout.idSpec(),ids,code).c_str());
216  path.erase(path.begin()+path.size()-1);
217  printout(print_res, "Geant4VolumeManager", "+++ Map %016X to Geant4 Path:%s",
218  (void*)code, Geant4TouchableHandler::placementPath(path).c_str());
219  auto hash = detail::hash64(&path[0], path.size()*sizeof(path[0]));
220  bool missing_hash_path = m_geo.g4Paths.find(hash) == m_geo.g4Paths.end();
221 #ifdef VOLMGR_HAVE_DEBUG_INFO
222  {
223  bool missing_real_path = m_geo.g4DebugInfo->g4Paths.find(path) == m_geo.g4DebugInfo->g4Paths.end();
224  if ( missing_real_path != missing_hash_path ) {
225  if ( !path.empty() )
226  printout(ERROR,"Geant4VolumeManager"," New G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str());
227  if ( !nodes.empty() )
228  printout(ERROR,"Geant4VolumeManager"," TGeo path: %s", detail::tools::placementPath(nodes,false).c_str());
229  printout(ERROR,"Geant4VolumeManager", " Offend.VolIDs: %s", detail::tools::toString(rdout.idSpec(),ids,code).c_str());
230  }
231  if ( missing_real_path ) {
233  opt.flags.parametrised = path.front()->IsParameterised() ? 1 : 0;
234  opt.flags.replicated = path.front()->IsReplicated() ? 1 : 0;
235  m_geo.g4DebugInfo->g4Paths[path] = { code, opt.value };
236  }
237  }
238 #endif
239  if ( missing_hash_path ) {
241  opt.flags.parametrised = path.front()->IsParameterised() ? 1 : 0;
242  opt.flags.replicated = path.front()->IsReplicated() ? 1 : 0;
243  m_geo.g4Paths[hash] = { code, opt.value };
244  m_entries.emplace(code);
245  return;
246  }
248  if ( !path.empty() && (path.front()->IsParameterised() || path.front()->IsReplicated()) ) {
249  return;
250  }
251  printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Geant4 path!!!! %s %s",
252  " [THIS SHOULD NEVER HAPPEN]", Geant4TouchableHandler::placementPath(path).c_str());
253  goto Err;
254  }
255  printout(INFO, "Geant4VolumeManager", "Control block has still %d entries:%s",
256  int(control.size()), detail::tools::placementPath(control,true).c_str());
257  goto Err;
258  }
259  else {
261  if ( !path.empty() && (path.front()->IsParameterised() || path.front()->IsReplicated()) ) {
262  return;
263  }
264  }
265  printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Volume entry: 0x%X"
266  " [THIS SHOULD NEVER HAPPEN]", code);
267 
268  Err:
269  if ( i != m_entries.end() )
270  printout(ERROR,"Geant4VolumeManager"," Known G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str());
271  if ( !path.empty() )
272  printout(ERROR,"Geant4VolumeManager"," New G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str());
273  if ( !nodes.empty() )
274  printout(ERROR,"Geant4VolumeManager"," TGeo path: %s", detail::tools::placementPath(nodes,false).c_str());
275  printout(ERROR,"Geant4VolumeManager", " Offend.VolIDs: %s", detail::tools::toString(rdout.idSpec(),ids,code).c_str());
276  throw std::runtime_error("Failed to populate Geant4 volume manager!");
277  }
278  };
279 }
280 
284  if( info && info->valid ) {
285  if( !info->has_volmgr ) {
286  Populator p(description, *info);
287  p.populate(description.world());
288  info->has_volmgr = true;
289  }
290  return;
291  }
292  except("Geant4VolumeManager", "Attempt populate from invalid Geant4 geometry info [Invalid-Info]");
293 }
294 
296 std::vector<const G4VPhysicalVolume*>
297 Geant4VolumeManager::placementPath(const G4VTouchable* touchable, bool exception) const {
298  Geant4TouchableHandler handler(touchable);
299  return handler.placementPath(exception);
300 }
301 
304  if( !isValid() ) {
305  except("Geant4VolumeManager", "Attempt to use invalid Geant4 volume manager [Invalid-Handle]");
306  }
307  else if( !ptr()->valid ) {
308  except("Geant4VolumeManager", "Attempt to use invalid Geant4 geometry info [Invalid-Info]");
309  }
310  return true;
311 }
312 
313 namespace {
314  std::string debug_status(const Geant4VolumeManager* mgr) {
315  char text[256];
316  auto* p = mgr->ptr();
317  if ( p ) {
318  ::snprintf(text, sizeof(text), "==> #path entries: %ld valid: %s has_volmgr: %s",
319  p->g4Paths.size(), yes_no(p->valid), yes_no(p->has_volmgr));
320  return { text };
321  }
322  return { "Invalid handle to Geant4GeometryInfo" };
323  }
324 }
325 
327 VolumeID Geant4VolumeManager::volumeID(const G4VTouchable* touchable) const {
328  Geant4TouchableHandler handler(touchable);
329  std::vector<const G4VPhysicalVolume*> path = handler.placementPath();
330  if( !isValid() ) {
331  printout(INFO, "Geant4VolumeManager", "+++ INVALID Geant4VolumeManager handle.");
332  return NonExisting;
333  }
334  else if( !ptr()->valid ) {
335  printout(INFO, "Geant4VolumeManager", "+++ INVALID Geant4VolumeManager [Not initialized]");
336  return NonExisting;
337  }
338  else if( path.empty() ) {
339  printout(INFO, "Geant4VolumeManager", "+++ EMPTY volume Geant4 Path: %s",
341  return NonExisting;
342  }
343  else {
344  uint64_t hash = detail::hash64(&path[0], sizeof(path[0])*path.size());
345  auto i = ptr()->g4Paths.find(hash);
346  if( i != ptr()->g4Paths.end() ) {
347  const auto& e = (*i).second;
348  VolumeID volid = e.volumeID;
350  if( e.flags == 0 ) {
351  return volid;
352  }
353  const auto& paramterised = ptr()->g4Parameterised;
354  const auto& replicated = ptr()->g4Replicated;
356  for( std::size_t j=0; j < path.size(); ++j ) {
357  const auto* phys = path[j];
358  if( phys->IsParameterised() ) {
359  int copy_no = touchable->GetCopyNumber(j);
360  const auto it = paramterised.find(phys);
361  if( it != paramterised.end() ) {
362  //printout(INFO,"Geant4VolumeManager",
363  // "Copy number: %ld <--> %ld", copy_no, long(phys->GetCopyNo()));
364  const auto* field = (*it).second.data()->params->field;
365  volid |= IDDescriptor::encode(field, copy_no);
366  continue;
367  }
368  except("Geant4VolumeManager",
369  "Error Geant4VolumeManager::volumeID(const G4VTouchable* touchable)");
370  }
371  else if( phys->IsReplicated() ) {
372  int copy_no = touchable->GetCopyNumber(j);
373  const auto it = replicated.find(phys);
374  if( it != replicated.end() ) {
375  const auto* field = (*it).second.data()->params->field;
376  volid |= IDDescriptor::encode(field, copy_no);
377  continue;
378  }
379  except("Geant4VolumeManager",
380  "Error Geant4VolumeManager::volumeID(const G4VTouchable* touchable)");
381  }
382  }
383  return volid;
384  }
385  if( !path[0] ) {
386  printout(INFO, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' [invalid path] %s",
387  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
388  return InvalidPath;
389  }
390  else if( !path[0]->GetLogicalVolume()->GetSensitiveDetector() ) {
391  printout(INFO, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' [insensitive] %s",
392  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
393  return Insensitive;
394  }
395  printout(INFO, "Geant4VolumeManager",
396  "+++ Bad Geant4 volume path: \'%s\' [missing entry] %s",
397  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
398  return NonExisting;
399  }
400  printout(INFO, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' %s",
401  Geant4TouchableHandler::placementPath(path).c_str(), yes_no(path.empty()));
402  return NonExisting;
403 }
404 
406 void Geant4VolumeManager::volumeDescriptor(const std::vector<const G4VPhysicalVolume*>& path,
407  VolIDDescriptor& vol_desc) const
408 {
409  vol_desc.second.clear();
410  vol_desc.first = NonExisting;
411  if( !path.empty() && checkValidity() ) {
412  auto hash = detail::hash64(&path[0], sizeof(path[0])*path.size());
413  auto i = ptr()->g4Paths.find(hash);
414  if( i != ptr()->g4Paths.end() ) {
415  VolumeID vid = (*i).second.volumeID;
416  G4LogicalVolume* lvol = path[0]->GetLogicalVolume();
417  if( lvol->GetSensitiveDetector() ) {
418  const auto* node = path[0];
419  const auto& pm = ptr()->g4Placements;
420  for( const auto& ipm : pm ) {
421  if ( ipm.second == node ) {
422  PlacedVolume pv = ipm.first;
424  IDDescriptor dsc = sd.readout().idSpec();
425  vol_desc.first = vid;
426  dsc.decodeFields(vid, vol_desc.second);
427  return;
428  }
429  }
430  }
431  vol_desc.first = Insensitive;
432  return;
433  }
434  if( !path[0] )
435  vol_desc.first = InvalidPath;
436  else if( !path[0]->GetLogicalVolume()->GetSensitiveDetector() )
437  vol_desc.first = Insensitive;
438  else
439  vol_desc.first = NonExisting;
440  }
441 }
442 
444 void Geant4VolumeManager::volumeDescriptor(const G4VTouchable* touchable,
445  VolIDDescriptor& vol_desc) const {
446  volumeDescriptor(placementPath(touchable), vol_desc);
447 }
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:277
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:327
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:297
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:41
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::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:379
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:303
dd4hep::Volume::sensitiveDetector
Handle< NamedObject > sensitiveDetector() const
Access to the handle to the sensitive detector.
Definition: Volumes.cpp:1316