DD4hep  1.32.1
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 #include <utility>
25 #include <vector>
26 
27 // Geant4 forward declarations
28 class G4VPhysicalVolume;
29 
30 
32 namespace dd4hep {
33 
35  namespace sim {
36 
37  // Forward declarations
38  class Geant4VolumeManager;
39  class Geant4GeometryInfo;
40 
42 
47  class Geant4VolumeManager : public Handle<Geant4GeometryInfo> {
48  protected:
50  bool checkValidity() const;
51  protected:
52  friend class Geant4Mapping;
53 
55  Geant4VolumeManager() = default;
58  : Handle<Geant4GeometryInfo>(e) { }
62  template <typename Q> Geant4VolumeManager(const Handle<Q>& e)
64  }
67 
68  public:
69  static const VolumeID InvalidPath = VolumeID(-1LL);
70  static const VolumeID Insensitive = VolumeID(-2LL);
71  static const VolumeID NonExisting = 0ULL;
72 
75 
77  std::vector<const G4VPhysicalVolume*>
78  placementPath(const G4VTouchable* touchable, bool exception = true) const;
80  VolumeID volumeID(const G4VTouchable* touchable) const;
82  void volumeDescriptor(const std::vector<const G4VPhysicalVolume*>& path,
83  std::pair<VolumeID,std::vector<std::pair<const BitFieldElement*, VolumeID> > >& volume_desc) const;
85  void volumeDescriptor(const G4VTouchable* touchable,
86  std::pair<VolumeID,std::vector<std::pair<const BitFieldElement*, VolumeID> > >& volume_desc) const;
87  };
88  } // End namespace sim
89 } // End namespace dd4hep
90 #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:69
dd4hep::sim::Geant4VolumeManager::Insensitive
static const VolumeID Insensitive
Definition: Geant4VolumeManager.h:70
dd4hep::sim::Geant4VolumeManager::volumeID
VolumeID volumeID(const G4VTouchable *touchable) const
Access CELLID by Geant4 touchable object.
Definition: Geant4VolumeManager.cpp:327
dd4hep::sim::Geant4VolumeManager::operator=
Geant4VolumeManager & operator=(const Geant4VolumeManager &c)=default
Assignment operator.
dd4hep::sim::Geant4VolumeManager::NonExisting
static const VolumeID NonExisting
Definition: Geant4VolumeManager.h:71
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: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::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: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: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
Access fully 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:303