EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eASTVDetectorComponent.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eASTVDetectorComponent.hh
1 // ********************************************************************
2 //
3 // eASTVDetectorComponent.hh
4 // Header file of the abstract base class of eAST detector component
5 //
6 // History
7 // May 8th, 2021 : first implementation
8 //
9 // ********************************************************************
10 
11 #ifndef eASTVDetectorComponent_H
12 #define eASTVDetectorComponent_H 1
13 
14 class G4VPhysicalVolume;
15 class G4LogicalVolume;
16 class G4Region;
19 
20 class G4UserRunAction;
21 class G4UserEventAction;
22 class G4UserStackingAction;
23 class G4UserTrackingAction;
24 class G4UserSteppingAction;
25 
26 #include "globals.hh"
27 #include "G4ThreeVector.hh"
28 #include "G4RotationMatrix.hh"
29 
31 {
32  public:
33  eASTVDetectorComponent(G4String compName, G4int vl = 0);
34  virtual ~eASTVDetectorComponent();
35 
36  public:
37  // invoked only in the master thread
38  virtual void SetUp() = 0;
39  virtual void Construct(G4VPhysicalVolume*) = 0;
40  virtual void ConstructActionForMaster()
41  {;}
42 
43  // invoked in the worker threads (not in master)
44  virtual void ConstructSD()
45  {;}
46  virtual void ConstructActions()
47  {;}
48 
49  protected:
50  // Utility method to locate the component
51  void Locate(G4LogicalVolume* compLogVol, G4VPhysicalVolume* worldPhys);
53  G4String LocateDataFile( const G4String fn ) const;
54 
55  protected:
56  // Utility methods to register component-specific
57  // user action classes. These methods should be used
58  // in ConstructActions() and ConstructActionForMaster()
59  // methods.
60  void RegisterUserAction(G4UserRunAction*);
61  void RegisterUserAction(G4UserEventAction*);
62  void RegisterUserAction(G4UserStackingAction*);
63  void RegisterUserAction(G4UserTrackingAction*);
64  void RegisterUserAction(G4UserSteppingAction*);
65 
66  protected:
67  // Utility method to define a material to a logical
68  // volume. The input file is an ASCII file, and
69  // each line of the file should have the name of
70  // a logical volume and its material name.
71  // Material name must be a name that appears in
72  // G4NistManager.
73  void ReadMaterialFile(G4String);
74 
75  protected:
76  G4String componentName;
77  G4String commandDir;
78  G4int verboseLevel;
79  G4VPhysicalVolume* pEnvelopePhys = nullptr;
80  G4Region* pRegion = nullptr;
81 
82  public:
83  void SetUpBase(G4int vl = 0);
84 
85  public:
86  virtual G4VPhysicalVolume* GetEnvelope()
87  { return pEnvelopePhys; }
88  virtual G4Region* GetRegion()
89  { return pRegion; }
90 
91  private:
94 
95  private:
96  G4ThreeVector fPosition;
97  G4RotationMatrix fRotation;
98 
99  public:
100  void SetLocation(G4ThreeVector pos)
101  { fPosition = pos; }
102  void SetRotation(G4String ax,G4double ang)
103  {
104  if(ax=="x") fRotation.rotateX(ang);
105  if(ax=="y") fRotation.rotateY(ang);
106  if(ax=="z") fRotation.rotateZ(ang);
107  }
108  G4ThreeVector GetLocation()
109  { return fPosition; }
110  G4RotationMatrix GetRotation()
111  { return fRotation; }
112 
113  private:
114  G4bool CheckRegion();
115 };
116 
117 #endif
118