DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
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 #include <G4VTouchable.hh>
22 // Geant4 forward declarations
23 class G4VPhysicalVolume;
24 
25 
27 namespace dd4hep {
28 
30  namespace sim {
31 
32  // Forward declarations
33  class Geant4VolumeManager;
34  class Geant4GeometryInfo;
35 
37 
42  class Geant4VolumeManager : public Handle<Geant4GeometryInfo> {
43  protected:
45  bool checkValidity() const;
46 
47  public:
48  static const VolumeID InvalidPath = VolumeID(-1LL);
49  static const VolumeID Insensitive = VolumeID(-2LL);
50  static const VolumeID NonExisting = 0ULL;
51 
55  Geant4VolumeManager() = default;
58  : Handle<Geant4GeometryInfo>(e) { }
62  template <typename Q> Geant4VolumeManager(const Handle<Q>& e)
64  }
67 
69  std::vector<const G4VPhysicalVolume*>
70  placementPath(const G4VTouchable* touchable, bool exception = true) const;
72  //VolumeID volumeID(const std::vector<const G4VPhysicalVolume*>& path) const;
74  VolumeID volumeID(const G4VTouchable* touchable) const;
76  void volumeDescriptor(const std::vector<const G4VPhysicalVolume*>& path,
77  std::pair<VolumeID,std::vector<std::pair<const BitFieldElement*, VolumeID> > >& volume_desc) const;
79  void volumeDescriptor(const G4VTouchable* touchable,
80  std::pair<VolumeID,std::vector<std::pair<const BitFieldElement*, VolumeID> > >& volume_desc) const;
81  };
82 
83  } // End namespace sim
84 } // End namespace dd4hep
85 #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:84
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:48
dd4hep::sim::Geant4VolumeManager::Insensitive
static const VolumeID Insensitive
Definition: Geant4VolumeManager.h:49
dd4hep::sim::Geant4VolumeManager::volumeID
VolumeID volumeID(const G4VTouchable *touchable) const
Access CELLID by placement path.
Definition: Geant4VolumeManager.cpp:268
dd4hep::sim::Geant4VolumeManager::operator=
Geant4VolumeManager & operator=(const Geant4VolumeManager &c)=default
Assignment operator.
dd4hep::sim::Geant4VolumeManager::NonExisting
static const VolumeID NonExisting
Definition: Geant4VolumeManager.h:50
dd4hep::sim::Geant4VolumeManager
The Geant4VolumeManager to facilitate optimized lookups of cell IDs from touchables.
Definition: Geant4VolumeManager.h:42
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:231
dd4hep::sim::Geant4VolumeManager::Geant4VolumeManager
Geant4VolumeManager(const Handle< Q > &e)
Constructor to be used when reading the already parsed object.
Definition: Geant4VolumeManager.h:62
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:93
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:57
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:237