DD4hep  1.31.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 <sstream>
32 
33 //#define VOLMGR_HAVE_DEBUG_INFO 1
34 
35 #ifdef VOLMGR_HAVE_DEBUG_INFO
36 namespace dd4hep {
39  namespace sim {
40 
41  class Geant4GeometryInfo::DebugInfo {
42  public:
43  typedef std::vector<const G4VPhysicalVolume*> Geant4PlacementPath;
44  std::map<Geant4PlacementPath, Placement> g4Paths;
45  };
46  } // End namespace sim
47 } // End namespace dd4hep
48 #endif
49 
50 using namespace dd4hep::sim;
51 using namespace dd4hep;
52 
54 using VolIDDescriptor = std::pair<VolumeID,std::vector<std::pair<const BitFieldElement*, VolumeID> > >;
55 
56 namespace {
57 
59 
64  struct Populator {
65 
66  typedef std::vector<const TGeoNode*> Chain;
67  // typedef std::map<VolumeID,Geant4TouchableHandler::Geant4PlacementPath> Registries;
68  typedef std::set<VolumeID> Registries;
69 
71  const Detector& m_detDesc;
73  Registries m_entries;
75  Geant4GeometryInfo& m_geo;
76 
78  Populator(const Detector& description, Geant4GeometryInfo& g)
79  : m_detDesc(description), m_geo(g)
80  {
81 #ifdef VOLMGR_HAVE_DEBUG_INFO
82  if ( nullptr == g.g4DebugInfo ) {
83  g.g4DebugInfo = new Geant4GeometryInfo::DebugInfo();
84  }
85 #endif
86  }
88  ~Populator() {
89 #ifdef VOLMGR_HAVE_DEBUG_INFO
90  if ( g.g4DebugInfo ) {
91  delete g.g4DebugInfo;
92  g.g4DebugInfo = nullptr;
93  }
94 #endif
95  }
96 
97  typedef std::pair<VolumeID, VolumeID> Encoding;
99  static Encoding encoding(const IDDescriptor iddesc, const PlacedVolume::VolIDs& ids) {
100  VolumeID volume_id = 0, mask = 0;
101  for( const auto& id : ids ) {
102  const BitFieldElement* f = iddesc.field(id.first);
103  VolumeID msk = f->mask();
104  int off = f->offset();
105  VolumeID val = id.second; // Necessary to extend volume IDs > 32 bit
106  volume_id |= ((f->value(val << off) << off)&msk);
107  mask |= msk;
108  }
109  return std::make_pair(volume_id, mask);
110  }
111 
113  void populate(DetElement e) {
114  const DetElement::Children& c = e.children();
115  m_entries.clear();
116  for( const auto& i : c ) {
117  DetElement de = i.second;
118  PlacedVolume pv = de.placement();
119  if( pv.isValid() ) {
120  Chain chain;
123  m_entries.clear();
124  chain.emplace_back(m_detDesc.world().placement().ptr());
125  scanPhysicalVolume(pv.ptr(), std::move(ids), sd, chain);
126  continue;
127  }
128  printout(WARNING, "Geant4VolumeManager",
129  "++ Detector element %s of type %s has no placement.",
130  de.name(), de.type().c_str());
131  }
133  for( const auto& pv : m_geo.g4Placements ) {
134  if( pv.second->IsParameterised() )
135  m_geo.g4Parameterised[pv.second] = pv.first;
136  if( pv.second->IsReplicated() )
137  m_geo.g4Replicated[pv.second] = pv.first;
138  }
139  m_entries.clear();
140  }
141 
143  void scanPhysicalVolume(const TGeoNode* node, PlacedVolume::VolIDs ids, SensitiveDetector& sd, Chain& chain) {
144  PlacedVolume pv = node;
145  Volume vol = pv.volume();
146  PlacedVolume::VolIDs pv_ids = pv.volIDs();
147 
148  chain.emplace_back(node);
149  ids.PlacedVolume::VolIDs::Base::insert(ids.end(), pv_ids.begin(), pv_ids.end());
150  if( vol.isSensitive() ) {
151  sd = vol.sensitiveDetector();
152  if( sd.readout().isValid() ) {
153  add_entry(sd, node, ids, chain);
154  }
155  else {
156  printout(WARNING, "Geant4VolumeManager",
157  "populate: Strange constellation volume %s is sensitive, but has no readout! sd:%p", pv.volume().name(),
158  sd.ptr());
159  }
160  }
161  for( Int_t idau = 0, ndau = node->GetNdaughters(); idau < ndau; ++idau ) {
162  TGeoNode* daughter = node->GetDaughter(idau);
163  PlacedVolume placement(daughter);
164  if( placement.data() ) {
165  scanPhysicalVolume(daughter, ids, sd, chain);
166  }
167  }
168  chain.pop_back();
169  }
170 
171  void add_entry(SensitiveDetector sd, const TGeoNode* n, const PlacedVolume::VolIDs& ids, const Chain& nodes) {
172  Chain control;
173  Volume vol;
174  Readout rdout = sd.readout();
175  IDDescriptor iddesc = rdout.idSpec();
176  VolumeID code = iddesc.encode(ids);
177  PrintLevel print_level = m_geo.printLevel;
178  PrintLevel print_action = print_level;
179  PrintLevel print_chain = print_level;
180  PrintLevel print_res = print_level;
182  Registries::const_iterator i = m_entries.find(code);
183 
184  printout(print_action,"Geant4VolumeManager","+++ Add path:%s vid:%016X",
185  detail::tools::placementPath(nodes, false).c_str(), code);
186 
187  if( i == m_entries.end() ) {
188  path.reserve(nodes.size());
189  for( Chain::const_reverse_iterator k = nodes.rbegin(), kend=nodes.rend(); k != kend; ++k ) {
190  const TGeoNode* node = *(k);
191  auto g4pit = m_geo.g4Placements.find(node);
192  if( g4pit != m_geo.g4Placements.end() ) {
193  G4VPhysicalVolume* phys = g4pit->second;
194  if( phys->IsParameterised() ) {
195  PlacedVolume pv(n);
196  PlacedVolumeExtension* ext = pv.data();
197  if( nullptr == ext->params->field ) {
198  ext->params->field = iddesc.field(ext->volIDs.at(0).first);
199  }
200  }
201  path.emplace_back(phys);
202  printout(print_chain, "Geant4VolumeManager",
203  "+++ Chain: Node OK: %s [%s]", node->GetName(), phys->GetName().c_str());
204  continue;
205  }
206  control.insert(control.begin(),node);
207  vol = Volume(node->GetVolume());
208  auto iVolImp = m_geo.g4VolumeImprints.find(vol);
209  if ( iVolImp != m_geo.g4VolumeImprints.end() ) {
210  for(const auto& imp : iVolImp->second ) {
211  const auto& c = imp.first;
212  if ( c.size() <= control.size() && control == c ) {
213  path.emplace_back(imp.second);
214  printout(print_chain, "Geant4VolumeManager", "+++ Chain: Node OK: %s %s -> %s",
215  node->GetName(), detail::tools::placementPath(c,false).c_str(),
216  imp.second->GetName().c_str());
217  control.clear();
218  break;
219  }
220  }
221  }
222  }
223  if ( control.empty() ) {
224  printout(print_res, "Geant4VolumeManager", "+++ Volume IDs:%s",
225  detail::tools::toString(rdout.idSpec(),ids,code).c_str());
226  path.erase(path.begin()+path.size()-1);
227  printout(print_res, "Geant4VolumeManager", "+++ Map %016X to Geant4 Path:%s",
228  (void*)code, Geant4TouchableHandler::placementPath(path).c_str());
229  auto hash = detail::hash64(&path[0], path.size()*sizeof(path[0]));
230  bool missing_hash_path = m_geo.g4Paths.find(hash) == m_geo.g4Paths.end();
231 #ifdef VOLMGR_HAVE_DEBUG_INFO
232  {
233  bool missing_real_path = m_geo.g4DebugInfo->g4Paths.find(path) == m_geo.g4DebugInfo->g4Paths.end();
234  if ( missing_real_path != missing_hash_path ) {
235  if ( !path.empty() )
236  printout(ERROR,"Geant4VolumeManager"," New G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str());
237  if ( !nodes.empty() )
238  printout(ERROR,"Geant4VolumeManager"," TGeo path: %s", detail::tools::placementPath(nodes,false).c_str());
239  printout(ERROR,"Geant4VolumeManager", " Offend.VolIDs: %s", detail::tools::toString(rdout.idSpec(),ids,code).c_str());
240  }
241  if ( missing_real_path ) {
243  opt.flags.parametrised = path.front()->IsParameterised() ? 1 : 0;
244  opt.flags.replicated = path.front()->IsReplicated() ? 1 : 0;
245  m_geo.g4DebugInfo->g4Paths[path] = { code, opt.value };
246  }
247  }
248 #endif
249  if ( missing_hash_path ) {
251  opt.flags.parametrised = path.front()->IsParameterised() ? 1 : 0;
252  opt.flags.replicated = path.front()->IsReplicated() ? 1 : 0;
253  m_geo.g4Paths[hash] = { code, opt.value };
254  m_entries.emplace(code);
255  return;
256  }
258  if ( !path.empty() && (path.front()->IsParameterised() || path.front()->IsReplicated()) ) {
259  return;
260  }
261  printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Geant4 path!!!! %s %s",
262  " [THIS SHOULD NEVER HAPPEN]", Geant4TouchableHandler::placementPath(path).c_str());
263  goto Err;
264  }
265  printout(INFO, "Geant4VolumeManager", "Control block has still %d entries:%s",
266  int(control.size()), detail::tools::placementPath(control,true).c_str());
267  goto Err;
268  }
269  else {
271  if ( !path.empty() && (path.front()->IsParameterised() || path.front()->IsReplicated()) ) {
272  return;
273  }
274  }
275  printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Volume entry: 0x%X"
276  " [THIS SHOULD NEVER HAPPEN]", code);
277 
278  Err:
279  if ( i != m_entries.end() )
280  printout(ERROR,"Geant4VolumeManager"," Known G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str());
281  if ( !path.empty() )
282  printout(ERROR,"Geant4VolumeManager"," New G4 path: %s", Geant4TouchableHandler::placementPath(path).c_str());
283  if ( !nodes.empty() )
284  printout(ERROR,"Geant4VolumeManager"," TGeo path: %s", detail::tools::placementPath(nodes,false).c_str());
285  printout(ERROR,"Geant4VolumeManager", " Offend.VolIDs: %s", detail::tools::toString(rdout.idSpec(),ids,code).c_str());
286  throw std::runtime_error("Failed to populate Geant4 volume manager!");
287  }
288  };
289 }
290 
294  if( info && info->valid ) {
295  if( !info->has_volmgr ) {
296  Populator p(description, *info);
297  p.populate(description.world());
298  info->has_volmgr = true;
299  }
300  return;
301  }
302  except("Geant4VolumeManager", "Attempt populate from invalid Geant4 geometry info [Invalid-Info]");
303 }
304 
306 std::vector<const G4VPhysicalVolume*>
307 Geant4VolumeManager::placementPath(const G4VTouchable* touchable, bool exception) const {
308  Geant4TouchableHandler handler(touchable);
309  return handler.placementPath(exception);
310 }
311 
314  if( !isValid() ) {
315  except("Geant4VolumeManager", "Attempt to use invalid Geant4 volume manager [Invalid-Handle]");
316  }
317  else if( !ptr()->valid ) {
318  except("Geant4VolumeManager", "Attempt to use invalid Geant4 geometry info [Invalid-Info]");
319  }
320  return true;
321 }
322 
323 namespace {
324  std::string debug_status(const Geant4VolumeManager* mgr) {
325  char text[256];
326  auto* p = mgr->ptr();
327  if ( p ) {
328  ::snprintf(text, sizeof(text), "==> #path entries: %ld valid: %s has_volmgr: %s",
329  p->g4Paths.size(), yes_no(p->valid), yes_no(p->has_volmgr));
330  return { text };
331  }
332  return { "Invalid handle to Geant4GeometryInfo" };
333  }
334 }
335 
337 VolumeID Geant4VolumeManager::volumeID(const G4VTouchable* touchable) const {
338  Geant4TouchableHandler handler(touchable);
339  std::vector<const G4VPhysicalVolume*> path = handler.placementPath();
340  if( !isValid() ) {
341  printout(INFO, "Geant4VolumeManager", "+++ INVALID Geant4VolumeManager handle.");
342  return NonExisting;
343  }
344  else if( !ptr()->valid ) {
345  printout(INFO, "Geant4VolumeManager", "+++ INVALID Geant4VolumeManager [Not initialized]");
346  return NonExisting;
347  }
348  else if( path.empty() ) {
349  printout(INFO, "Geant4VolumeManager", "+++ EMPTY volume Geant4 Path: %s",
351  return NonExisting;
352  }
353  else {
354  uint64_t hash = detail::hash64(&path[0], sizeof(path[0])*path.size());
355  auto i = ptr()->g4Paths.find(hash);
356  if( i != ptr()->g4Paths.end() ) {
357  const auto& e = (*i).second;
358  VolumeID volid = e.volumeID;
360  if( e.flags == 0 ) {
361  return volid;
362  }
363  const auto& paramterised = ptr()->g4Parameterised;
364  const auto& replicated = ptr()->g4Replicated;
366  for( std::size_t j=0; j < path.size(); ++j ) {
367  const auto* phys = path[j];
368  if( phys->IsParameterised() ) {
369  int copy_no = touchable->GetCopyNumber(j);
370  const auto it = paramterised.find(phys);
371  if( it != paramterised.end() ) {
372  //printout(INFO,"Geant4VolumeManager",
373  // "Copy number: %ld <--> %ld", copy_no, long(phys->GetCopyNo()));
374  const auto* field = (*it).second.data()->params->field;
375  volid |= IDDescriptor::encode(field, copy_no);
376  continue;
377  }
378  except("Geant4VolumeManager",
379  "Error Geant4VolumeManager::volumeID(const G4VTouchable* touchable)");
380  }
381  else if( phys->IsReplicated() ) {
382  int copy_no = touchable->GetCopyNumber(j);
383  const auto it = replicated.find(phys);
384  if( it != replicated.end() ) {
385  const auto* field = (*it).second.data()->params->field;
386  volid |= IDDescriptor::encode(field, copy_no);
387  continue;
388  }
389  except("Geant4VolumeManager",
390  "Error Geant4VolumeManager::volumeID(const G4VTouchable* touchable)");
391  }
392  }
393  return volid;
394  }
395  if( !path[0] ) {
396  printout(INFO, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' [invalid path] %s",
397  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
398  return InvalidPath;
399  }
400  else if( !path[0]->GetLogicalVolume()->GetSensitiveDetector() ) {
401  printout(INFO, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' [insensitive] %s",
402  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
403  return Insensitive;
404  }
405  printout(INFO, "Geant4VolumeManager",
406  "+++ Bad Geant4 volume path: \'%s\' [missing entry] %s",
407  Geant4TouchableHandler::placementPath(path).c_str(), debug_status(this).c_str());
408  return NonExisting;
409  }
410  printout(INFO, "Geant4VolumeManager", "+++ Bad Geant4 volume path: \'%s\' %s",
411  Geant4TouchableHandler::placementPath(path).c_str(), yes_no(path.empty()));
412  return NonExisting;
413 }
414 
416 void Geant4VolumeManager::volumeDescriptor(const std::vector<const G4VPhysicalVolume*>& path,
417  VolIDDescriptor& vol_desc) const
418 {
419  vol_desc.second.clear();
420  vol_desc.first = NonExisting;
421  if( !path.empty() && checkValidity() ) {
422  auto hash = detail::hash64(&path[0], sizeof(path[0])*path.size());
423  auto i = ptr()->g4Paths.find(hash);
424  if( i != ptr()->g4Paths.end() ) {
425  VolumeID vid = (*i).second.volumeID;
426  G4LogicalVolume* lvol = path[0]->GetLogicalVolume();
427  if( lvol->GetSensitiveDetector() ) {
428  const auto* node = path[0];
429  const auto& pm = ptr()->g4Placements;
430  for( const auto& ipm : pm ) {
431  if ( ipm.second == node ) {
432  PlacedVolume pv = ipm.first;
434  IDDescriptor dsc = sd.readout().idSpec();
435  vol_desc.first = vid;
436  dsc.decodeFields(vid, vol_desc.second);
437  return;
438  }
439  }
440  }
441  vol_desc.first = Insensitive;
442  return;
443  }
444  if( !path[0] )
445  vol_desc.first = InvalidPath;
446  else if( !path[0]->GetLogicalVolume()->GetSensitiveDetector() )
447  vol_desc.first = Insensitive;
448  else
449  vol_desc.first = NonExisting;
450  }
451 }
452 
454 void Geant4VolumeManager::volumeDescriptor(const G4VTouchable* touchable,
455  VolIDDescriptor& vol_desc) const {
456  volumeDescriptor(placementPath(touchable), vol_desc);
457 }
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::DDSegmentation::BitFieldElement::offset
unsigned offset() const
Definition: BitFieldCoder.h:64
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.
dd4hep::DDSegmentation::BitFieldElement
Helper class for BitFieldCoder that corresponds to one field value.
Definition: BitFieldCoder.h:32
Volumes.h
Geant4Mapping.h
dd4hep::SensitiveDetector
Handle class to hold the information of a sensitive detector.
Definition: DetElement.h:44
dd4hep::PlacedVolumeExtension
Implementation class extending the ROOT placed volume.
Definition: Volumes.h:79
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:163
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:276
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:37
dd4hep::DDSegmentation::BitFieldElement::value
FieldID value(CellID bitfield) const
calculate this field's value given an external 64 bit bitmap
Definition: BitFieldCoder.cpp:55
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
dd4hep::Handle
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
Definition: Handle.h:84
dd4hep::PlacedVolumeExtension::volIDs
VolIDs volIDs
ID container.
Definition: Volumes.h:127
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:66
dd4hep::sim::Geant4GeometryInfo::printLevel
PrintLevel printLevel
Definition: Geant4GeometryInfo.h:139
VolumeManager.h
dd4hep::sim::Geant4VolumeManager::Insensitive
static const VolumeID Insensitive
Definition: Geant4VolumeManager.h:67
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:337
Geant4AssemblyVolume.h
VolIDDescriptor
std::pair< VolumeID, std::vector< std::pair< const BitFieldElement *, VolumeID > > > VolIDDescriptor
Definition: Geant4VolumeManager.cpp:54
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::PlacedVolumeExtension::VolIDs
Volume ID container.
Definition: Volumes.h:88
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:370
dd4hep::sim::Geant4VolumeManager::NonExisting
static const VolumeID NonExisting
Definition: Geant4VolumeManager.h:68
dd4hep::sim::Geant4GeometryInfo::g4Placements
Geant4GeometryMaps::PlacementMap g4Placements
Definition: Geant4GeometryInfo.h:115
dd4hep::DetElementVolumeIDs::Encoding
Encoding/mask for sensitive volumes.
Definition: DetElementVolumeIDs.cpp:45
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::DDSegmentation::BitFieldElement::mask
CellID mask() const
Definition: BitFieldCoder.h:73
dd4hep::sim::Geant4VolumeManager
The Geant4VolumeManager to facilitate optimized lookups of cell IDs from touchables.
Definition: Geant4VolumeManager.h:44
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:307
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:206
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:153
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:378
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:265
dd4hep::Readout
Handle to the implementation of the readout structure of a subdetector.
Definition: Readout.h:38
Encoding
DetElementVolumeIDs::Encoding Encoding
Definition: DetElementVolumeIDs.cpp:136
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
Accessfully decoded volume fields by placement path.
dd4hep::PlacedVolumeExtension::params
Parameterisation * params
Reference to the parameterised transformation.
Definition: Volumes.h:125
Printout.h
dd4hep::sim::Geant4VolumeManager::checkValidity
bool checkValidity() const
Check the validity of the information before accessing it.
Definition: Geant4VolumeManager.cpp:313
dd4hep::Volume::sensitiveDetector
Handle< NamedObject > sensitiveDetector() const
Access to the handle to the sensitive detector.
Definition: Volumes.cpp:1316