GEMC  1.8
Geant4 Monte-Carlo Framework
detector.h
Go to the documentation of this file.
1 
14 #ifndef detector_H
15 #define detector_H 1
16 
17 // %%%%%%%%%%
18 // G4 headers
19 // %%%%%%%%%%
20 #include "G4Colour.hh"
21 #include "G4FieldManager.hh"
22 #include "G4LogicalVolume.hh"
23 #include "G4Material.hh"
24 #include "G4PVPlacement.hh"
25 #include "G4ThreeVector.hh"
26 #include "G4VisAttributes.hh"
27 #include "G4VSensitiveDetector.hh"
28 #include "G4VSolid.hh"
29 
30 // %%%%%%%%%%%%
31 // gemc headers
32 // %%%%%%%%%%%%
33 #include "usage.h"
34 #include "identifier.h"
35 #include "run_conditions.h"
36 #include "string_utilities.h"
37 
38 
46 class detector
47 {
48 
49  public:
50  detector();
51  ~detector(){;}
52 
53  string name;
54  string mother;
55  string description;
56 
57  G4ThreeVector pos;
58  G4RotationMatrix rot;
59 
60  G4VisAttributes VAtts;
61 
62  string type;
63  vector<double> dimensions;
64 
65  string material;
66  string magfield;
67 
68  int ncopy;
69  bool pMany;
70 
71  int exist;
72  int visible;
73  int style;
74 
75  string sensitivity;
76  string hitType;
77  vector<identifier> identity;
78 
79  int scanned;
80 
81  private:
82  G4VSolid* SolidV;
83  G4LogicalVolume* LogicV;
84  G4VPhysicalVolume* PhysicalV;
85 
86  public:
87  int create_solid(gemc_opts, map<string, detector>*);
88  int create_logical_volume(map<string, G4Material*>*, gemc_opts);
89  int create_physical_volumes(gemc_opts, G4LogicalVolume*);
90  void setSensitivity(G4VSensitiveDetector *SD){LogicV->SetSensitiveDetector(SD);}
91 
92  G4VSolid *GetSolid() { return SolidV;}
93  G4LogicalVolume *GetLogical() { return LogicV;}
94  G4VPhysicalVolume *GetPhysical(){ return PhysicalV;}
95  void SetLogical(G4LogicalVolume *LV){LogicV = LV;}
96  void SetTranslation(G4ThreeVector TR){PhysicalV->SetTranslation(TR);}
97  void RemoveDaughter(G4VPhysicalVolume* PV){LogicV->RemoveDaughter(PV);}
98  void AssignMFM(G4FieldManager* MFM){LogicV->SetFieldManager(MFM, true);}
99 
100  void SetUserLimits(G4UserLimits* L) { LogicV->SetUserLimits(L);}
101 
102  friend ostream &operator<<(ostream &stream, detector);
103  bool operator== (const detector& D) const;
104 };
105 
106 
107 // All these functions defined here but maybe should be moved somewhere else for consistency.
108 map<string, detector> read_detector(gemc_opts, run_conditions);
109 
110 #endif
111 
int create_logical_volume(map< string, G4Material * > *, gemc_opts)
Creates the Logical Volume.
Definition: detector.cc:695
friend ostream & operator<<(ostream &stream, detector)
Overloaded "<<" for detector class. Dumps infos on screen.
Definition: detector.cc:934
G4LogicalVolume * GetLogical()
Returns Logical Volume pointer.
Definition: detector.h:93
string sensitivity
Defines the Sensitive Detector. possible choices: "no" "hits collection name".
Definition: detector.h:75
string mother
Mother Volume name.
Definition: detector.h:54
void AssignMFM(G4FieldManager *MFM)
Assigns Magnetic Field Manager to LogicV.
Definition: detector.h:98
G4ThreeVector pos
Position relative to the mother volume, as G4ThreeVector.
Definition: detector.h:57
bool operator==(const detector &D) const
Overloaded "==" operator for detector class.
Definition: detector.cc:974
int create_solid(gemc_opts, map< string, detector > *)
Creates the Solid. If it&#39;s a Copy Placement, retrieve and assigns LogicV.
Definition: detector.cc:46
G4VisAttributes VAtts
Visual Attributes: color, transparency, style (wireframe, solid), visibility.
Definition: detector.h:60
void SetTranslation(G4ThreeVector TR)
Sets Physical Volume Position.
Definition: detector.h:96
bool pMany
Needed by geant4 at G4PVPlacement time.
Definition: detector.h:69
map< string, detector > read_detector(gemc_opts, run_conditions)
Reads detector map from database.
int ncopy
copy number
Definition: detector.h:68
string name
Name of the volume. Since this is the key of the STL map, it has to be unique.
Definition: detector.h:53
string material
Volume Material name.
Definition: detector.h:65
detector()
Definition: detector.cc:39
void SetUserLimits(G4UserLimits *L)
Definition: detector.h:100
int visible
visibility of the detector: 0=invisible 1=visible
Definition: detector.h:72
int style
Visual style: 0=wireframe 1=solid.
Definition: detector.h:73
string hitType
Hit Process routine name. A Hit Process MPHBaseClass derived class must exists with this name...
Definition: detector.h:76
vector< identifier > identity
Vector of identifiers. Example: superlayer manual 1 type manual 2 segment manual 3 strip manual 4...
Definition: detector.h:77
string magfield
Magnetic Field. The string "no" means that the field is inherited from the mother volume...
Definition: detector.h:66
G4RotationMatrix rot
Rotation Matrix, defined by rotations along x,y,z axis relative to the mother volume.
Definition: detector.h:58
int exist
detector ON/OFF switch
Definition: detector.h:71
int create_physical_volumes(gemc_opts, G4LogicalVolume *)
Creates the Physical Volume.
Definition: detector.cc:757
G4VSolid * GetSolid()
Returns G4 Solid pointer.
Definition: detector.h:92
~detector()
Definition: detector.h:51
G4VPhysicalVolume * GetPhysical()
Returns Physical Volume pointer.
Definition: detector.h:94
void SetLogical(G4LogicalVolume *LV)
Sets Logical Volume pointer.
Definition: detector.h:95
string type
solid type. This follows the GEANT4 definitions
Definition: detector.h:62
vector< double > dimensions
vector of dimensions. Size, units depends on solid type
Definition: detector.h:63
int scanned
for use during construction
Definition: detector.h:79
void RemoveDaughter(G4VPhysicalVolume *PV)
Remove Physical Volumes from LogicV.
Definition: detector.h:97
void setSensitivity(G4VSensitiveDetector *SD)
Assign the sensitive detector to the Logical Volume.
Definition: detector.h:90
string description
Volume Description for documentation.
Definition: detector.h:55