DD4hep  1.31.0
Detector Description Toolkit for High Energy Physics
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Geant4VolumeManager.h
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 DDG4_GEANT4VOLUMEMANAGER_H
14 #define DDG4_GEANT4VOLUMEMANAGER_H
15 
16 // Framework include files
17 #include <DD4hep/Detector.h>
18 #include <DD4hep/IDDescriptor.h>
19 #include <DDG4/Geant4Primitives.h>
20 
21 // Geant4 include files
22 #include <G4VTouchable.hh>
23 
24 // Geant4 forward declarations
25 class G4VPhysicalVolume;
26 
27 
29 namespace dd4hep {
30 
32  namespace sim {
33 
34  // Forward declarations
35  class Geant4VolumeManager;
36  class Geant4GeometryInfo;
37 
39 
44  class Geant4VolumeManager : public Handle<Geant4GeometryInfo> {
45  protected:
47  bool checkValidity() const;
48  protected:
49  friend class Geant4Mapping;
50 
52  Geant4VolumeManager() = default;
55  : Handle<Geant4GeometryInfo>(e) { }
59  template <typename Q> Geant4VolumeManager(const Handle<Q>& e)
61  }
64 
65  public:
66  static const VolumeID InvalidPath = VolumeID(-1LL);
67  static const VolumeID Insensitive = VolumeID(-2LL);
68  static const VolumeID NonExisting = 0ULL;
69 
72 
74  std::vector<const G4VPhysicalVolume*>
75  placementPath(const G4VTouchable* touchable, bool exception = true) const;
77  VolumeID volumeID(const G4VTouchable* touchable) const;
79  void volumeDescriptor(const std::vector<const G4VPhysicalVolume*>& path,
80  std::pair<VolumeID,std::vector<std::pair<const BitFieldElement*, VolumeID> > >& volume_desc) const;
82  void volumeDescriptor(const G4VTouchable* touchable,
83  std::pair<VolumeID,std::vector<std::pair<const BitFieldElement*, VolumeID> > >& volume_desc) const;
84  };
85  } // End namespace sim
86 } // End namespace dd4hep
87 #endif // DDG4_GEANT4VOLUMEMANAGER_H
dd4hep::sim::Geant4VolumeManager::Geant4VolumeManager
Geant4VolumeManager()=default
Default constructor.
Geant4Primitives.h
Detector.h
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::Handle
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
Definition: Handle.h:82
dd4hep::sim::Geant4VolumeManager::Geant4VolumeManager
Geant4VolumeManager(const Geant4VolumeManager &e)=default
Constructor to be used when reading the already parsed object.
dd4hep::sim::Geant4VolumeManager::InvalidPath
static const VolumeID InvalidPath
Definition: Geant4VolumeManager.h:66
dd4hep::sim::Geant4VolumeManager::Insensitive
static const VolumeID Insensitive
Definition: Geant4VolumeManager.h:67
dd4hep::sim::Geant4VolumeManager::volumeID
VolumeID volumeID(const G4VTouchable *touchable) const
Access CELLID by Geant4 touchable object.
Definition: Geant4VolumeManager.cpp:337
dd4hep::sim::Geant4VolumeManager::operator=
Geant4VolumeManager & operator=(const Geant4VolumeManager &c)=default
Assignment operator.
dd4hep::sim::Geant4VolumeManager::NonExisting
static const VolumeID NonExisting
Definition: Geant4VolumeManager.h:68
dd4hep::sim::Geant4Mapping
Geometry mapping from dd4hep to Geant 4.
Definition: Geant4Mapping.h:35
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::Geant4VolumeManager::Geant4VolumeManager
Geant4VolumeManager(const Handle< Q > &e)
Constructor to be used when reading the already parsed object.
Definition: Geant4VolumeManager.h:59
VolumeID
dd4hep::DDSegmentation::VolumeID VolumeID
Definition: SegmentationDictionary.h:50
IDDescriptor.h
dd4hep::sim::Geant4GeometryInfo
Concreate class holding the relation information between geant4 objects and dd4hep objects.
Definition: Geant4GeometryInfo.h:91
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4VolumeManager::Geant4VolumeManager
Geant4VolumeManager(const Handle< Geant4GeometryInfo > &e)
Constructor to be used when reading the already parsed object.
Definition: Geant4VolumeManager.h:54
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
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::sim::Geant4VolumeManager::volumeDescriptor
void volumeDescriptor(const G4VTouchable *touchable, std::pair< VolumeID, std::vector< std::pair< const BitFieldElement *, VolumeID > > > &volume_desc) const
Access fully decoded volume fields by Geant4 touchable object.
dd4hep::sim::Geant4VolumeManager::checkValidity
bool checkValidity() const
Check the validity of the information before accessing it.
Definition: Geant4VolumeManager.cpp:313