DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4GeometryInfo.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_GEANT4GEOMETRYINFO_H
14 #define DDG4_GEANT4GEOMETRYINFO_H
15 
16 // Framework include files
17 #include <DD4hep/Objects.h>
18 #include <DD4hep/Printout.h>
19 #include <DD4hep/GeoHandler.h>
20 #include <DD4hep/PropertyTable.h>
21 #include <DDG4/Geant4Primitives.h>
22 
23 // C/C++ include files
24 #include <map>
25 #include <vector>
26 
27 // Forward declarations (TGeo)
28 class TGeoElement;
29 class TGeoMedium;
30 class TGeoVolume;
31 class TGeoShape;
32 class TGeoNode;
33 // Forward declarations (Geant4)
34 class G4Isotope;
35 class G4Element;
36 class G4Material;
37 class G4VSolid;
38 class G4LogicalVolume;
39 class G4Region;
40 class G4UserLimits;
41 class G4VisAttributes;
42 class G4VPhysicalVolume;
43 class G4OpticalSurface;
44 class G4LogicalSkinSurface;
45 class G4LogicalBorderSurface;
46 class G4AssemblyVolume;
48 class G4PhysicsOrderedFreeVector;
49 
51 namespace dd4hep {
52 
54  namespace sim {
55 
56  // Forward declarations
57  class Geant4Mapping;
58  class Geant4AssemblyVolume;
59 
61 
66  namespace Geant4GeometryMaps {
67  //typedef std::vector<const G4VPhysicalVolume*> Geant4PlacementPath;
68  typedef std::map<Atom, G4Element*> ElementMap;
69  typedef std::map<const TGeoIsotope*, G4Isotope*> IsotopeMap;
70  typedef std::map<Material, G4Material*> MaterialMap;
71  //typedef std::map<LimitSet, G4UserLimits*> LimitMap;
72  typedef std::map<PlacedVolume, G4VPhysicalVolume*> PlacementMap;
73  //typedef std::map<Region, G4Region*> RegionMap;
74  typedef std::map<Volume, G4LogicalVolume*> VolumeMap;
75  typedef std::map<PlacedVolume, Geant4AssemblyVolume*> AssemblyMap;
76 
77  typedef std::vector<const TGeoNode*> VolumeChain;
78  typedef std::pair<VolumeChain,const G4VPhysicalVolume*> ImprintEntry;
79  typedef std::vector<ImprintEntry> Imprints;
80  typedef std::map<Volume,Imprints> VolumeImprintMap;
81  typedef std::map<const TGeoShape*, G4VSolid*> SolidMap;
82  //typedef std::map<VisAttr, G4VisAttributes*> VisMap;
83  //typedef std::map<Geant4PlacementPath, VolumeID> Geant4PathMap;
84  typedef std::map<const G4VPhysicalVolume*, PlacedVolume> G4PlacementMap;
85  }
86 
88 
94  public:
95  struct Placement {
97  int flags;
98  };
100  int value;
101  struct _flags {
102  unsigned parametrised:1;
103  unsigned replicated:1;
106  } flags;
107  PlacementFlags() { this->value = 0; }
108  PlacementFlags(int v) { this->value = v; }
109  };
110  typedef std::vector<const G4VPhysicalVolume*> Geant4PlacementPath;
111  TGeoManager* manager = 0;
122  struct PropertyVector {
123  std::vector<double> bins;
124  std::vector<double> values;
125  std::string name, title;
126  PropertyVector() = default;
127  ~PropertyVector() = default;
128  };
129  std::map<PropertyTable, PropertyVector*> g4OpticalProperties;
130  std::map<OpticalSurface, G4OpticalSurface*> g4OpticalSurfaces;
131  std::map<SkinSurface, G4LogicalSkinSurface*> g4SkinSurfaces;
132  std::map<BorderSurface, G4LogicalBorderSurface*> g4BorderSurfaces;
133  std::map<Region, G4Region*> g4Regions;
134  std::map<VisAttr, G4VisAttributes*> g4Vis;
135  std::map<LimitSet, G4UserLimits*> g4Limits;
136  std::map<Geant4PlacementPath, Placement> g4Paths;
137  std::map<SensitiveDetector,std::set<const TGeoVolume*> > sensitives;
138  std::map<Region, std::set<const TGeoVolume*> > regions;
139  std::map<LimitSet, std::set<const TGeoVolume*> > limits;
140  G4VPhysicalVolume* m_world;
141  PrintLevel printLevel;
142  bool valid;
143  private:
144  friend class Geant4Mapping;
148  virtual ~Geant4GeometryInfo();
149  public:
151  G4VPhysicalVolume* world() const;
153  void setWorld(const TGeoNode* node);
155  static std::string placementPath(const Geant4PlacementPath& path, bool reverse=true);
156  };
157 
158  } // End namespace sim
159 } // End namespace dd4hep
160 #endif // DDG4_GEANT4GEOMETRYINFO_H
dd4hep::sim::Geant4GeometryInfo::PropertyVector::~PropertyVector
~PropertyVector()=default
dd4hep::sim::Geant4GeometryInfo::placementPath
static std::string placementPath(const Geant4PlacementPath &path, bool reverse=true)
Assemble Geant4 volume path.
Definition: Geant4GeometryInfo.cpp:24
dd4hep::sim::Geant4GeometryInfo::sensitives
std::map< SensitiveDetector, std::set< const TGeoVolume * > > sensitives
Definition: Geant4GeometryInfo.h:137
dd4hep::sim::Geant4GeometryInfo::PlacementFlags
Definition: Geant4GeometryInfo.h:99
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags::parametrised
unsigned parametrised
Definition: Geant4GeometryInfo.h:102
dd4hep::sim::Geant4GeometryInfo::Placement::volumeID
VolumeID volumeID
Definition: Geant4GeometryInfo.h:96
Objects.h
Geant4Primitives.h
dd4hep::sim::Geant4GeometryInfo::g4OpticalSurfaces
std::map< OpticalSurface, G4OpticalSurface * > g4OpticalSurfaces
Definition: Geant4GeometryInfo.h:130
dd4hep::sim::Geant4GeometryInfo::g4AssemblyVolumes
Geant4GeometryMaps::AssemblyMap g4AssemblyVolumes
Definition: Geant4GeometryInfo.h:118
v
View * v
Definition: MultiView.cpp:28
dd4hep::sim::Geant4GeometryInfo::g4Regions
std::map< Region, G4Region * > g4Regions
Definition: Geant4GeometryInfo.h:133
dd4hep::sim::Geant4GeometryMaps::AssemblyMap
std::map< PlacedVolume, Geant4AssemblyVolume * > AssemblyMap
Definition: Geant4GeometryInfo.h:75
dd4hep::detail::GeoHandlerTypes::GeometryInfo
Data container to store information obtained during the geometry scan.
Definition: GeoHandler.h:60
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::flags
struct dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags flags
dd4hep::sim::Geant4GeometryInfo::g4Materials
Geant4GeometryMaps::MaterialMap g4Materials
Definition: Geant4GeometryInfo.h:114
dd4hep::sim::Geant4GeometryInfo::g4Vis
std::map< VisAttr, G4VisAttributes * > g4Vis
Definition: Geant4GeometryInfo.h:134
dd4hep::sim::Geant4GeometryMaps::IsotopeMap
std::map< const TGeoIsotope *, G4Isotope * > IsotopeMap
Definition: Geant4GeometryInfo.h:69
dd4hep::sim::Geant4GeometryInfo::Placement
Definition: Geant4GeometryInfo.h:95
dd4hep::sim::Geant4GeometryInfo::PropertyVector::bins
std::vector< double > bins
Definition: Geant4GeometryInfo.h:123
dd4hep::sim::Geant4GeometryInfo::manager
TGeoManager * manager
Definition: Geant4GeometryInfo.h:111
dd4hep::sim::Geant4GeometryInfo::Geant4GeometryInfo
Geant4GeometryInfo()
Default constructor.
Definition: Geant4GeometryInfo.cpp:40
dd4hep::sim::Geant4GeometryInfo::setWorld
void setWorld(const TGeoNode *node)
Set the world volume.
Definition: Geant4GeometryInfo.cpp:59
dd4hep::sim::Geant4GeometryInfo::printLevel
PrintLevel printLevel
Definition: Geant4GeometryInfo.h:141
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags
Definition: Geant4GeometryInfo.h:101
G4UserLimits
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:23
dd4hep::sim::Geant4GeometryInfo::~Geant4GeometryInfo
virtual ~Geant4GeometryInfo()
Default destructor.
Definition: Geant4GeometryInfo.cpp:45
dd4hep::sim::Geant4GeometryInfo::g4Parameterised
Geant4GeometryMaps::G4PlacementMap g4Parameterised
Definition: Geant4GeometryInfo.h:120
dd4hep::sim::Geant4GeometryInfo::PropertyVector::title
std::string title
Definition: Geant4GeometryInfo.h:125
dd4hep::sim::Geant4GeometryInfo::limits
std::map< LimitSet, std::set< const TGeoVolume * > > limits
Definition: Geant4GeometryInfo.h:139
dd4hep::sim::Geant4Mapping
Geometry mapping from dd4hep to Geant 4.
Definition: Geant4Mapping.h:35
dd4hep::sim::Geant4GeometryInfo::PropertyVector::values
std::vector< double > values
Definition: Geant4GeometryInfo.h:124
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags::path_has_parametrised
unsigned path_has_parametrised
Definition: Geant4GeometryInfo.h:104
G4VSensitiveDetector
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:59
dd4hep::sim::Geant4GeometryInfo::PropertyVector::name
std::string name
Definition: Geant4GeometryInfo.h:125
dd4hep::sim::Geant4GeometryInfo::g4Placements
Geant4GeometryMaps::PlacementMap g4Placements
Definition: Geant4GeometryInfo.h:117
TNamed
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:37
dd4hep::sim::Geant4GeometryInfo::g4Isotopes
Geant4GeometryMaps::IsotopeMap g4Isotopes
Definition: Geant4GeometryInfo.h:112
dd4hep::sim::Geant4GeometryInfo::g4BorderSurfaces
std::map< BorderSurface, G4LogicalBorderSurface * > g4BorderSurfaces
Definition: Geant4GeometryInfo.h:132
dd4hep::sim::Geant4GeometryInfo::g4VolumeImprints
Geant4GeometryMaps::VolumeImprintMap g4VolumeImprints
Definition: Geant4GeometryInfo.h:119
dd4hep::sim::Geant4GeometryMaps::G4PlacementMap
std::map< const G4VPhysicalVolume *, PlacedVolume > G4PlacementMap
Definition: Geant4GeometryInfo.h:84
dd4hep::sim::Geant4GeometryInfo::m_world
G4VPhysicalVolume * m_world
Definition: Geant4GeometryInfo.h:140
dd4hep::sim::Geant4GeometryInfo::g4Replicated
Geant4GeometryMaps::G4PlacementMap g4Replicated
Definition: Geant4GeometryInfo.h:121
dd4hep::sim::Geant4GeometryMaps::MaterialMap
std::map< Material, G4Material * > MaterialMap
Definition: Geant4GeometryInfo.h:70
dd4hep::sim::Geant4GeometryMaps::ElementMap
std::map< Atom, G4Element * > ElementMap
Definition: Geant4GeometryInfo.h:68
dd4hep::sim::Geant4GeometryMaps::ImprintEntry
std::pair< VolumeChain, const G4VPhysicalVolume * > ImprintEntry
Definition: Geant4GeometryInfo.h:78
dd4hep::sim::Geant4GeometryInfo::g4Limits
std::map< LimitSet, G4UserLimits * > g4Limits
Definition: Geant4GeometryInfo.h:135
dd4hep::sim::Geant4GeometryInfo::g4Solids
Geant4GeometryMaps::SolidMap g4Solids
Definition: Geant4GeometryInfo.h:115
dd4hep::sim::Geant4GeometryInfo::PropertyVector::PropertyVector
PropertyVector()=default
G4AssemblyVolume
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:7
dd4hep::sim::Geant4GeometryInfo::valid
bool valid
Definition: Geant4GeometryInfo.h:142
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags::path_has_replicated
unsigned path_has_replicated
Definition: Geant4GeometryInfo.h:105
VolumeID
dd4hep::DDSegmentation::VolumeID VolumeID
Definition: SegmentationDictionary.h:50
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::_flags::replicated
unsigned replicated
Definition: Geant4GeometryInfo.h:103
dd4hep::sim::Geant4GeometryMaps::Imprints
std::vector< ImprintEntry > Imprints
Definition: Geant4GeometryInfo.h:79
dd4hep::sim::Geant4GeometryInfo
Concreate class holding the relation information between geant4 objects and dd4hep objects.
Definition: Geant4GeometryInfo.h:93
dd4hep::sim::Geant4GeometryInfo::Placement::flags
int flags
Definition: Geant4GeometryInfo.h:97
PropertyTable.h
dd4hep::sim::Geant4GeometryInfo::g4Paths
std::map< Geant4PlacementPath, Placement > g4Paths
Definition: Geant4GeometryInfo.h:136
dd4hep::sim::Geant4GeometryInfo::Geant4PlacementPath
std::vector< const G4VPhysicalVolume * > Geant4PlacementPath
Definition: Geant4GeometryInfo.h:110
dd4hep::sim::Geant4GeometryMaps::VolumeImprintMap
std::map< Volume, Imprints > VolumeImprintMap
Definition: Geant4GeometryInfo.h:80
dd4hep::sim::Geant4GeometryMaps::VolumeChain
std::vector< const TGeoNode * > VolumeChain
Definition: Geant4GeometryInfo.h:77
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::PlacementFlags
PlacementFlags()
Definition: Geant4GeometryInfo.h:107
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::value
int value
Definition: Geant4GeometryInfo.h:100
dd4hep::sim::Geant4GeometryInfo::PlacementFlags::PlacementFlags
PlacementFlags(int v)
Definition: Geant4GeometryInfo.h:108
dd4hep::sim::Geant4GeometryInfo::regions
std::map< Region, std::set< const TGeoVolume * > > regions
Definition: Geant4GeometryInfo.h:138
dd4hep::sim::Geant4GeometryInfo::g4Elements
Geant4GeometryMaps::ElementMap g4Elements
Definition: Geant4GeometryInfo.h:113
dd4hep::sim::Geant4GeometryInfo::world
G4VPhysicalVolume * world() const
The world placement.
Definition: Geant4GeometryInfo.cpp:52
dd4hep::sim::Geant4GeometryInfo::g4SkinSurfaces
std::map< SkinSurface, G4LogicalSkinSurface * > g4SkinSurfaces
Definition: Geant4GeometryInfo.h:131
Printout.h
dd4hep::sim::Geant4GeometryInfo::PropertyVector
Definition: Geant4GeometryInfo.h:122
dd4hep::sim::Geant4GeometryMaps::VolumeMap
std::map< Volume, G4LogicalVolume * > VolumeMap
Definition: Geant4GeometryInfo.h:74
dd4hep::sim::Geant4GeometryMaps::SolidMap
std::map< const TGeoShape *, G4VSolid * > SolidMap
Definition: Geant4GeometryInfo.h:81
dd4hep::sim::Geant4GeometryInfo::g4OpticalProperties
std::map< PropertyTable, PropertyVector * > g4OpticalProperties
Definition: Geant4GeometryInfo.h:129
dd4hep::sim::Geant4GeometryInfo::g4Volumes
Geant4GeometryMaps::VolumeMap g4Volumes
Definition: Geant4GeometryInfo.h:116
dd4hep::sim::Geant4GeometryMaps::PlacementMap
std::map< PlacedVolume, G4VPhysicalVolume * > PlacementMap
Definition: Geant4GeometryInfo.h:72
GeoHandler.h