G4Root Version 6.6
Loading...
Searching...
No Matches
TG4RootDetectorConstruction.h
Go to the documentation of this file.
1// @(#)root/g4root:$Id$
2// Author: Andrei Gheata 07/08/06
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
17
18#ifndef ROOT_TG4RootDetectorConstruction
19#define ROOT_TG4RootDetectorConstruction
20
21#include "G4RotationMatrix.hh"
22#include "G4VUserDetectorConstruction.hh"
23
24#include "TGeoManager.h"
25#include "TGeoNode.h"
26
27#include <unordered_map>
28
29class TObjArray;
30class TGeoManager;
31class TGeoMaterial;
32class TGeoShape;
33class TGeoVolume;
34class TGeoMatrix;
35
36class G4FieldManager;
37class G4VSolid;
38class G4LogicalVolume;
39class G4VPhysicalVolume;
40class G4Material;
41class G4Element;
43
56
58{
59
60 private:
62 typedef std::unordered_map<const TGeoMaterial*, G4Material*> G4MaterialMap_t;
64 typedef G4MaterialMap_t::const_iterator G4MaterialIt_t;
66 typedef G4MaterialMap_t::value_type G4MaterialVal_t;
68
70 typedef std::unordered_map<const TGeoVolume*, G4LogicalVolume*> G4VolumeMap_t;
72 typedef G4VolumeMap_t::const_iterator G4VolumeIt_t;
74 typedef G4VolumeMap_t::value_type G4VolumeVal_t;
76
78 typedef std::unordered_map<const G4LogicalVolume*, TGeoVolume*> VolumeMap_t;
80 typedef VolumeMap_t::const_iterator VolumeIt_t;
82 typedef VolumeMap_t::value_type VolumeVal_t;
84
86 typedef std::unordered_map<const TGeoNode*, G4VPhysicalVolume*>
89 typedef G4PVolumeMap_t::const_iterator G4PVolumeIt_t;
91 typedef G4PVolumeMap_t::value_type G4PVolumeVal_t;
93
95 typedef std::unordered_map<const G4VPhysicalVolume*, TGeoNode*> PVolumeMap_t;
97 typedef PVolumeMap_t::const_iterator PVolumeIt_t;
99 typedef PVolumeMap_t::value_type PVolumeVal_t;
101
102 protected:
104 TGeoManager* fGeometry;
105 G4VPhysicalVolume* fTopPV;
107 // Geometry creators
109 void CreateG4Materials();
110 void CreateG4Elements();
112 // Converters TGeo->G4 for basic types
113 G4VSolid* CreateG4Solid(TGeoShape* shape);
114 G4LogicalVolume* CreateG4LogicalVolume(TGeoVolume* vol);
115 G4VPhysicalVolume* CreateG4PhysicalVolume(TGeoNode* node);
116 G4Material* CreateG4Material(const TGeoMaterial* mat);
117 G4RotationMatrix* CreateG4Rotation(const TGeoMatrix* matrix);
118 G4Element* CreateG4Element(TGeoElement* elem);
119
120 public:
122 TG4RootDetectorConstruction(TGeoManager* geom);
124
125 virtual G4VPhysicalVolume* Construct();
126 virtual void ConstructSDandField();
127
128 // Getters
130 TGeoManager* GetGeometryManager() const { return fGeometry; }
132 G4VPhysicalVolume* GetTopPV() const { return fTopPV; }
133 G4Material* GetG4Material(const TGeoMaterial* mat) const;
134 G4LogicalVolume* GetG4Volume(const TGeoVolume* vol) const;
135 TGeoVolume* GetVolume(const G4LogicalVolume* g4vol) const;
136 G4VPhysicalVolume* GetG4VPhysicalVolume(const TGeoNode* node) const;
137 TGeoNode* GetNode(const G4VPhysicalVolume* g4vol) const;
141 Bool_t IsConstructed() const { return fIsConstructed; }
142
144
145 // ClassDef(TG4RootDetectorConstruction,0) // Class creating a G4 gometry
146 // based on ROOT geometry
147};
148
154
Builder creating a pseudo G4 geometry starting from a TGeo geometry.
PVolumeMap_t::const_iterator PVolumeIt_t
the constant iterator for the map from G4VPhysicalVolume to TGeoNode
PVolumeMap_t fPVolumeMap
map of TGeo volumes
TVirtualUserPostDetConstruction * fSDInit
Sensitive detector hook.
G4VPhysicalVolume * GetG4VPhysicalVolume(const TGeoNode *node) const
G4VPhysicalVolume * CreateG4PhysicalVolume(TGeoNode *node)
std::unordered_map< const G4LogicalVolume *, TGeoVolume * > VolumeMap_t
the map from G4LogicalVolume to TGeoVolume
TGeoManager * GetGeometryManager() const
Return TGeo geometry manager.
G4PVolumeMap_t fG4PVolumeMap
map of G4 physical volumes
G4MaterialMap_t::const_iterator G4MaterialIt_t
the constant iterator for the map from TGeoMaterial to G4Material
G4RotationMatrix * CreateG4Rotation(const TGeoMatrix *matrix)
VolumeMap_t fVolumeMap
map of TGeo volumes
G4MaterialMap_t::value_type G4MaterialVal_t
the value type for the map from TGeoMaterial to G4Material
TGeoNode * GetNode(const G4VPhysicalVolume *g4vol) const
G4PVolumeMap_t::const_iterator G4PVolumeIt_t
the constant iterator for the map from TGeoNode to G4VPhysicalVolume
G4MaterialMap_t fG4MaterialMap
map of G4 materials
std::unordered_map< const TGeoNode *, G4VPhysicalVolume * > G4PVolumeMap_t
the map from TGeoNode to G4VPhysicalVolume
G4Material * CreateG4Material(const TGeoMaterial *mat)
std::unordered_map< const TGeoMaterial *, G4Material * > G4MaterialMap_t
the map from TGeoMaterial to G4Material
TVirtualUserPostDetConstruction * GetSDInit() const
Return the sensitive detector hook.
void Initialize(TVirtualUserPostDetConstruction *sdinit=0)
G4VPhysicalVolume * fTopPV
World G4 physical volume.
PVolumeMap_t::value_type PVolumeVal_t
the value type for the map from G4VPhysicalVolume to TGeoNode
Bool_t fIsConstructed
flag Construct() called
VolumeMap_t::value_type VolumeVal_t
the value type for the map from G4LogicalVolume to TGeoVolume
virtual G4VPhysicalVolume * Construct()
std::unordered_map< const TGeoVolume *, G4LogicalVolume * > G4VolumeMap_t
the map from TGeoVolume to G4LogicalVolume
G4LogicalVolume * GetG4Volume(const TGeoVolume *vol) const
G4VSolid * CreateG4Solid(TGeoShape *shape)
Bool_t IsConstructed() const
Return the flag Construct() called.
G4Material * GetG4Material(const TGeoMaterial *mat) const
G4VolumeMap_t fG4VolumeMap
map of G4 volumes
std::unordered_map< const G4VPhysicalVolume *, TGeoNode * > PVolumeMap_t
the map from G4VPhysicalVolume to TGeoNode
G4VPhysicalVolume * GetTopPV() const
Return the World G4 physical volume.
G4VolumeMap_t::const_iterator G4VolumeIt_t
the constant iterator for the map from TGeoVolume to G4LogicalVolume
TGeoVolume * GetVolume(const G4LogicalVolume *g4vol) const
G4PVolumeMap_t::value_type G4PVolumeVal_t
the value type for the map from TGeoNode to G4VPhysicalVolume
VolumeMap_t::const_iterator VolumeIt_t
the constant iterator for the map from G4LogicalVolume to TGeoVolume
G4Element * CreateG4Element(TGeoElement *elem)
G4VolumeMap_t::value_type G4VolumeVal_t
the value type for the map from TGeoVolume to G4LogicalVolume
G4LogicalVolume * CreateG4LogicalVolume(TGeoVolume *vol)
TGeoManager * fGeometry
TGeo geometry manager.
Abstract class for defining links to G4 geometry.
virtual void Initialize(TG4RootDetectorConstruction *dc)=0
Initialize.