DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4DetectorConstruction.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 
14 #ifndef DDG4_GEANT4DETECTORCONSTRUCTION_H
15 #define DDG4_GEANT4DETECTORCONSTRUCTION_H
16 
17 // Framework include files
18 #include <DD4hep/DetElement.h>
19 #include <DDG4/Geant4Action.h>
20 
21 // Forward declarations
24 class G4VPhysicalVolume;
25 class G4LogicalVolume;
26 class G4UserLimits;
27 class G4Material;
28 class G4Element;
29 class G4VSolid;
30 class G4Region;
31 
33 namespace dd4hep {
34 
35  // Forward declarations
36  class Detector;
37 
39  namespace sim {
40 
41  // Forward declarations
42  class Geant4Kernel;
43  class Geant4GeometryInfo;
44  class Geant4AssemblyVolume;
45  class Geant4DetectorConstruction;
46  class Geant4DetectorConstructionContext;
47  class Geant4DetectorConstructionSequence;
48 
50 
62  public:
64 #ifdef __CINT__
66 #else
68 #endif
69  G4VPhysicalVolume* world { nullptr };
77  : description(l), world(0), geometry(0), detector(d) { }
81  void setSensitiveDetector(G4LogicalVolume* vol, G4VSensitiveDetector* sd);
82  };
83 
85 
103  public:
105  Geant4DetectorConstruction(Geant4Context* context, const std::string& nam);
107  virtual ~Geant4DetectorConstruction();
115  virtual G4VSensitiveDetector* createSensitiveDetector(const std::string& type,
116  const std::string& name);
117  };
118 
120 
136  protected:
139 
140  public:
142  Geant4DetectorConstructionSequence(Geant4Context* context, const std::string& nam);
146  virtual void updateContext(Geant4Context* ctxt) override;
148  void adopt(Geant4DetectorConstruction* action);
150  Geant4DetectorConstruction* get(const std::string& nam) const;
157 
158 #if !defined(__CINT__)
159 
160 
162  const std::map<Material, G4Material*>& materials() const;
164  const std::map<Atom, G4Element*>& elements() const;
166  const std::map<const TGeoShape*, G4VSolid*>& shapes() const;
168  const std::map<Volume, G4LogicalVolume*>& volumes() const;
170  const std::map<PlacedVolume, G4VPhysicalVolume*>& placements() const;
172  const std::map<PlacedVolume, Geant4AssemblyVolume*>& assemblies() const;
173 
175  const std::map<LimitSet, G4UserLimits*>& limits() const;
177  const std::map<Region, G4Region*>& regions() const;
178 #endif
179 
181  };
182 
183  } // End namespace sim
184 } // End namespace dd4hep
185 
186 #endif // DDG4_GEANT4DETECTORCONSTRUCTION_H
dd4hep::sim::Geant4DetectorConstructionContext::Geant4DetectorConstructionContext
Geant4DetectorConstructionContext(Detector &l, G4VUserDetectorConstruction *d)
Initializing Constructor.
Definition: Geant4DetectorConstruction.h:76
dd4hep::sim::Geant4DetectorConstructionSequence::constructField
virtual void constructField(Geant4DetectorConstructionContext *ctxt)
Electromagnetic field construction callback. Called at "ConstructSDandField()".
Definition: Geant4DetectorConstruction.cpp:128
dd4hep::sim::Geant4DetectorConstruction::constructSensitives
virtual void constructSensitives(Geant4DetectorConstructionContext *ctxt)
Sensitive detector construction callback. Called at "ConstructSDandField()".
Definition: Geant4DetectorConstruction.cpp:78
dd4hep::sim::Geant4DetectorConstruction::createSensitiveDetector
virtual G4VSensitiveDetector * createSensitiveDetector(const std::string &type, const std::string &name)
Create Geant4 sensitive detector object using the factory mechanism.
Definition: Geant4DetectorConstruction.cpp:45
dd4hep::sim::Geant4DetectorConstructionSequence::~Geant4DetectorConstructionSequence
virtual ~Geant4DetectorConstructionSequence()
Default destructor.
Definition: Geant4DetectorConstruction.cpp:90
dd4hep::sim::Geant4DetectorConstructionSequence::shapes
const std::map< const TGeoShape *, G4VSolid * > & shapes() const
Access to the converted shapes.
Definition: Geant4DetectorConstruction.cpp:154
dd4hep::sim::Geant4DetectorConstructionSequence::updateContext
virtual void updateContext(Geant4Context *ctxt) override
Set or update client context.
Definition: Geant4DetectorConstruction.cpp:96
dd4hep::sim::Geant4DetectorConstruction::Geant4DetectorConstruction
Geant4DetectorConstruction(Geant4Context *context, const std::string &nam)
Standard Constructor.
Definition: Geant4DetectorConstruction.cpp:34
G4UserLimits
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:23
dd4hep::sim::Geant4DetectorConstructionContext::~Geant4DetectorConstructionContext
~Geant4DetectorConstructionContext()
Default destructor.
Definition: Geant4DetectorConstruction.h:79
dd4hep::sim::Geant4DetectorConstructionContext::world
G4VPhysicalVolume * world
Reference to the world after construction.
Definition: Geant4DetectorConstruction.h:70
dd4hep::sim::Geant4DetectorConstructionContext
Geant4 detector construction context definition.
Definition: Geant4DetectorConstruction.h:61
dd4hep::sim::Geant4DetectorConstructionContext::description
Detector & description
Reference to geometry object.
Definition: Geant4DetectorConstruction.h:67
dd4hep::sim::Geant4DetectorConstructionSequence::constructGeo
virtual void constructGeo(Geant4DetectorConstructionContext *ctxt)
Geometry construction callback. Called at "Construct()".
Definition: Geant4DetectorConstruction.cpp:123
G4VSensitiveDetector
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:59
dd4hep::sim::Geant4DetectorConstructionSequence::elements
const std::map< Atom, G4Element * > & elements() const
Access to the converted elements.
Definition: Geant4DetectorConstruction.cpp:192
dd4hep::sim::Geant4DetectorConstructionSequence::adopt
void adopt(Geant4DetectorConstruction *action)
Add an actor responding to all callbacks. Sequence takes ownership.
Definition: Geant4DetectorConstruction.cpp:102
dd4hep::sim::Geant4DetectorConstructionSequence::constructSensitives
virtual void constructSensitives(Geant4DetectorConstructionContext *ctxt)
Sensitive detector construction callback. Called at "ConstructSDandField()".
Definition: Geant4DetectorConstruction.cpp:133
dd4hep::sim::Geant4DetectorConstructionSequence::limits
const std::map< LimitSet, G4UserLimits * > & limits() const
Access to the converted limit sets.
Definition: Geant4DetectorConstruction.cpp:162
dd4hep::sim::Geant4Action
Default base class for all Geant 4 actions and derivates thereof.
Definition: Geant4Action.h:113
dd4hep::sim::Geant4Action::name
const std::string & name() const
Access name of the action.
Definition: Geant4Action.h:280
dd4hep::sim::Geant4DetectorConstructionSequence
Concrete basic implementation of the Geant4 detector construction sequencer.
Definition: Geant4DetectorConstruction.h:135
dd4hep::sim::Geant4DetectorConstructionSequence::m_actors
Actors< Geant4DetectorConstruction > m_actors
The list of action objects to be called.
Definition: Geant4DetectorConstruction.h:138
dd4hep::sim::Geant4DetectorConstructionContext::detector
G4VUserDetectorConstruction * detector
G4 User detector initializer.
Definition: Geant4DetectorConstruction.h:74
dd4hep::sim::Geant4DetectorConstruction::~Geant4DetectorConstruction
virtual ~Geant4DetectorConstruction()
Default destructor.
Definition: Geant4DetectorConstruction.cpp:40
dd4hep::sim::Geant4DetectorConstructionSequence::get
Geant4DetectorConstruction * get(const std::string &nam) const
Access an actor by name.
Definition: Geant4DetectorConstruction.cpp:112
dd4hep::sim::Geant4GeometryInfo
Concreate class holding the relation information between geant4 objects and dd4hep objects.
Definition: Geant4GeometryInfo.h:93
DetElement.h
dd4hep::sim::Geant4DetectorConstruction::constructGeo
virtual void constructGeo(Geant4DetectorConstructionContext *ctxt)
Geometry construction callback. Called at "Construct()".
Definition: Geant4DetectorConstruction.cpp:70
dd4hep::sim::Geant4DetectorConstructionContext::setSensitiveDetector
void setSensitiveDetector(G4LogicalVolume *vol, G4VSensitiveDetector *sd)
Helper: Assign sensitive detector to logical volume.
Definition: Geant4DetectorConstruction.cpp:27
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4DetectorConstructionSequence::materials
const std::map< Material, G4Material * > & materials() const
Access to the converted materials.
Definition: Geant4DetectorConstruction.cpp:185
dd4hep::sim::Geant4DetectorConstruction::constructField
virtual void constructField(Geant4DetectorConstructionContext *ctxt)
Electromagnetic field construction callback. Called at "ConstructSDandField()".
Definition: Geant4DetectorConstruction.cpp:74
G4VUserDetectorConstruction
Class of the Geant4 toolkit. See http://www-geant4.kek.jp/Reference.
Definition: Geant4Classes.h:67
dd4hep::sim::Geant4DetectorConstructionSequence::volumes
const std::map< Volume, G4LogicalVolume * > & volumes() const
Access to the converted volumes.
Definition: Geant4DetectorConstruction.cpp:147
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::sim::Geant4Action::Actors
Actor class to manipulate action groups.
Definition: Geant4Action.h:168
dd4hep::sim::Geant4DetectorConstructionSequence::placements
const std::map< PlacedVolume, G4VPhysicalVolume * > & placements() const
Access to the converted placements.
Definition: Geant4DetectorConstruction.cpp:178
dd4hep::sim::Geant4DetectorConstructionContext::geometry
Geant4GeometryInfo * geometry
The cached geometry information.
Definition: Geant4DetectorConstruction.h:72
dd4hep::sim::Geant4DetectorConstruction
Basic implementation of the Geant4 detector construction action.
Definition: Geant4DetectorConstruction.h:102
dd4hep::sim::Geant4DetectorConstructionSequence::Geant4DetectorConstructionSequence
Geant4DetectorConstructionSequence(Geant4Context *context, const std::string &nam)
Standard Constructor.
Definition: Geant4DetectorConstruction.cpp:82
dd4hep::sim::Geant4DetectorConstructionSequence::regions
const std::map< Region, G4Region * > & regions() const
Access to the converted regions.
Definition: Geant4DetectorConstruction.cpp:139
Geant4Action.h
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201
dd4hep::sim::Geant4Action::context
Geant4Context * context() const
Access the context.
Definition: Geant4Action.h:270
dd4hep::sim::Geant4DetectorConstructionSequence::assemblies
const std::map< PlacedVolume, Geant4AssemblyVolume * > & assemblies() const
Access to the converted assemblys.
Definition: Geant4DetectorConstruction.cpp:170