EDepSimUserDetectorConstruction.hh
Go to the documentation of this file.
1 #ifndef EDepSim_UserDetectorConstruction_h
2 #define EDepSim_UserDetectorConstruction_h 1
3 
4 #include "globals.hh"
5 #include "G4VUserDetectorConstruction.hh"
6 
7 class G4Element;
8 class G4Material;
9 class G4VPhysicalVolume;
10 class G4GDMLParser;
11 namespace EDepSim {class Builder;}
12 namespace EDepSim {class UserDetectorConstruction;}
13 
15 #include "EDepSimBuilder.hh"
16 
17 namespace EDepSim {class UserDetectorConstruction;}
18 
19 /// Construct the EDepSim detector geometry. This handles two methods of
20 /// construction. In the first, the geometry is read from a GDML file which
21 /// is expected to contain the SensDet, EField and BField auxiliary types for
22 /// logical volumes that are sensitive, have an electric field, and have a
23 /// magnetic field (respectively). The alternative is to define a builder
24 class EDepSim::UserDetectorConstruction : public G4VUserDetectorConstruction {
25 public:
27  virtual ~UserDetectorConstruction();
28 
29  /// The required method to construct the detector and define the world
30  /// volume.
31  virtual G4VPhysicalVolume* Construct();
32 
33  /// The method to setup the sensitive detectors and fields. In a multi
34  /// thread application, this is called per thread.
35  virtual void ConstructSDandField();
36 
37  /// Return the detector construction messenger
39  return fDetectorMessenger;
40  };
41 
42  /// Update the geometry information to match stuff read from the macro
43  /// file.
44  void UpdateGeometry();
45 
46  /// Set ValidateGeomtry to true
48 
49  /// Set the GDML parser that this class should use.
50  void SetGDMLParser(G4GDMLParser* parser) {fGDMLParser = parser;}
51 
52  /// Get the GDML parser that this class is using.
53  G4GDMLParser* GetGDMLParser() {return fGDMLParser;}
54 
55  /// Exclude a logical volume from being a sensitive detector (e.g. the
56  /// Rock around the detector). This is used to override a gdml geometry.
58  fExcludeAsSensitiveDetector.push_back(exclude);
59  }
60 
61 protected:
62 
63  /// Define the materials used in the detector.
64  void DefineMaterials(void);
65 
66  /// Define the natural isotope abundance.
67  G4Element* DefineElement(G4String name, G4String symbol, G4double z);
68 
69  /// This really constructs the detector, but doesn't define
70  /// materials before it's constructed. This is called by Construct()
71  G4VPhysicalVolume* ConstructDetector();
72 
73  /// A messenger to for the DetectorConstruction object.
75 
76  /// A constructor to create the world.
78 
79  /// A GDML Parser if one has been defined.
80  G4GDMLParser* fGDMLParser;
81 
82  /// The constructed world volume.
83  G4VPhysicalVolume* fPhysicalWorld;
84 
85 private:
86 
87  /// The default material.
88  G4Material* fDefaultMaterial;
89 
90  /// Apply Validation
92 
93  /// Vector of logical volumes to exclude being sensitive detectors.
94  std::vector<std::string> fExcludeAsSensitiveDetector;
95 };
96 
97 #endif
static QCString name
Definition: declinfo.cpp:673
G4GDMLParser * GetGDMLParser()
Get the GDML parser that this class is using.
std::string string
Definition: nybbler.cc:12
virtual EDepSim::DetectorMessenger * GetMessenger(void)
Return the detector construction messenger.
EDepSim::Builder * fWorldBuilder
A constructor to create the world.
Construct a module from components.
Definition: TG4HitSegment.h:10
G4Element * DefineElement(G4String name, G4String symbol, G4double z)
Define the natural isotope abundance.
G4VPhysicalVolume * fPhysicalWorld
The constructed world volume.
EDepSim::DetectorMessenger * fDetectorMessenger
A messenger to for the DetectorConstruction object.
void DefineMaterials(void)
Define the materials used in the detector.
void SetGDMLParser(G4GDMLParser *parser)
Set the GDML parser that this class should use.
G4GDMLParser * fGDMLParser
A GDML Parser if one has been defined.
void ValidateGeometry()
Set ValidateGeomtry to true.
std::vector< std::string > fExcludeAsSensitiveDetector
Vector of logical volumes to exclude being sensitive detectors.
G4Material * fDefaultMaterial
The default material.