Berkeley Nuclear Data Software
GeometryObject.h
Go to the documentation of this file.
1 //Constructed by Josh Brown.
2 //brown.ja@berkeley.edu
3 
4 #ifndef _GEOMETRY_OBJECT_H_
5 #define _GEOMETRY_OBJECT_H_
6 //project
7 #include "MaterialManager.h"
8 //geant
9 #include "G4ThreeVector.hh"
10 #include "G4LogicalVolume.hh"
11 #include "G4PVPlacement.hh"
12 #include "G4RotationMatrix.hh"
13 // #include "G4SystemOfUnits.hh"
14 //c++
15 #include <string>
16 #include <vector>
17 
18 namespace NSDG4
19 {
21 // through a messenger by defining an interface class
22 // inheriting from this class will allow simple construction
23 // see collimator sim for an example
25 {
26 public:
27  //default constructer set the center and rotation to 0
28  //the name to null and the material to galactic
31  virtual G4LogicalVolume* construct(G4LogicalVolume* a_mother,
32  MaterialManager* a_materials
33  ) = 0;
36  virtual void setProperty(std::string a_propertyName,
37  std::vector<double> a_values
38  );
39  //setters
40  virtual void setName(std::string a_name);
41  virtual void setMaterial(std::string a_material);
42  virtual void setCenter(G4ThreeVector a_center);
43  virtual void setRotMatrix(const G4RotationMatrix& a_rotation);
44 
45  //getters
46  virtual std::string getName() const;
47  virtual std::string getMaterial() const;
48  virtual G4ThreeVector getCenter() const;
49  virtual G4RotationMatrix getRotationMatrix() const;
51  G4LogicalVolume* getPrimaryLogicalVolume();
54  // with sensitive detectors
55  G4LogicalVolume* getLogicalVolume(std::string a_name);
56 
57  bool isConstructed();
58 protected:
60  std::string m_name;
62  std::string m_material;
64  G4ThreeVector m_center;
66  G4LogicalVolume* m_primaryLV;
67 
69  G4RotationMatrix m_rotMat;
70 
72  std::map<std::string , G4LogicalVolume* > m_lvs;
73 
75 
76 };
77 
78 
79 }
80 #endif
abstract base class of geometry objects allowing modifications
Definition: GeometryObject.h:25
bool m_constructed
Definition: GeometryObject.h:74
virtual void setName(std::string a_name)
Definition: GeometryObject.cpp:33
virtual std::string getMaterial() const
Definition: GeometryObject.cpp:49
virtual void setProperty(std::string a_propertyName, std::vector< double > a_values)
Definition: GeometryObject.cpp:20
GeometryObject()
Definition: GeometryObject.cpp:8
virtual G4RotationMatrix getRotationMatrix() const
Definition: GeometryObject.cpp:62
G4LogicalVolume * m_primaryLV
volume to associate SD to if it exists
Definition: GeometryObject.h:66
virtual std::string getName() const
Definition: GeometryObject.cpp:45
bool isConstructed()
Definition: GeometryObject.cpp:88
G4ThreeVector m_center
used to store the center position of the object
Definition: GeometryObject.h:64
std::map< std::string, G4LogicalVolume * > m_lvs
used to store logical volumes
Definition: GeometryObject.h:72
G4RotationMatrix m_rotMat
used to store ration information of the object
Definition: GeometryObject.h:69
virtual G4LogicalVolume * construct(G4LogicalVolume *a_mother, MaterialManager *a_materials)=0
must be implemented by the child class
std::string m_name
used to store a name of an object which can later be used for access
Definition: GeometryObject.h:60
virtual void setCenter(G4ThreeVector a_center)
Definition: GeometryObject.cpp:29
G4LogicalVolume * getLogicalVolume(std::string a_name)
Definition: GeometryObject.cpp:68
virtual void setRotMatrix(const G4RotationMatrix &a_rotation)
Definition: GeometryObject.cpp:41
std::string m_material
used to store the name of the construction material
Definition: GeometryObject.h:62
G4LogicalVolume * getPrimaryLogicalVolume()
!!BREAKS ENCAPSULATION!!!
Definition: GeometryObject.cpp:57
virtual G4ThreeVector getCenter() const
Definition: GeometryObject.cpp:53
virtual void setMaterial(std::string a_material)
Definition: GeometryObject.cpp:37
Definition: MaterialManager.h:15
Definition: AbsLYAna.h:7