OMSim
Geant4 for IceCube optical module studies
OMSimDetectorComponent.hh
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "OMSimInputData.hh"
10 
11 #include <G4Transform3D.hh>
12 #include <G4VisAttributes.hh>
13 #include <G4SubtractionSolid.hh>
14 #include <G4PVPlacement.hh>
15 
26 {
27 public:
29  virtual void construction() = 0;
30 
32  bool m_checkOverlaps = false;
33 
40  struct Component
41  {
42  G4VSolid *VSolid;
43  G4LogicalVolume *VLogical;
44  G4ThreeVector Position;
45  G4RotationMatrix Rotation;
46  G4String Name;
47  };
48 
49  std::vector<G4ThreeVector> m_placedPositions;
50  std::vector<G4RotationMatrix> m_placedOrientations;
51  std::vector<G4Transform3D> m_placedTranslations;
52  std::map<G4String, Component> m_components;
53  std::map<G4String, G4PVPlacement *> m_lastPhysicals;
54 
55  void appendComponent(G4VSolid *pSolid, G4LogicalVolume *pLogical, G4ThreeVector pVector, G4RotationMatrix pRotation, G4String pName);
56  G4bool checkIfExists(G4String pName);
57 
58  Component getComponent(G4String pName);
59  G4Transform3D getNewPosition(G4ThreeVector pPosition, G4RotationMatrix pRotation, G4ThreeVector pObjectPosition, G4RotationMatrix pObjectRotation);
60 
61  void integrateDetectorComponent(OMSimDetectorComponent *pToIntegrate, G4ThreeVector pPosition, G4RotationMatrix pRotation, G4String pNameExtension);
62  void deleteComponent(G4String pName);
63 
64  void placeIt(G4ThreeVector pPosition, G4RotationMatrix pRotation, G4LogicalVolume *&pMother, G4String pNameExtension = "");
65  void placeIt(G4Transform3D pTrans, G4LogicalVolume *&pMother, G4String pNameExtension = "");
66 
67  G4SubtractionSolid *substractToVolume(G4VSolid *pInputVolume, G4ThreeVector pSubstractionPos, G4RotationMatrix pSubstractionRot, G4String pNewVolumeName);
68  G4SubtractionSolid *substractToVolume(G4VSolid *pInputVolume, G4Transform3D pTrans, G4String pNewVolumeName);
69 
70 protected:
71  // Use static const members for G4VisAttributes
72  static const G4VisAttributes m_glassVis;
73  static const G4VisAttributes m_gelVis;
74  static const G4VisAttributes m_steelVis;
75  static const G4VisAttributes m_aluVis;
76  static const G4VisAttributes m_whiteVis;
77  static const G4VisAttributes m_absorberSemiTransparentVis;
78  static const G4VisAttributes m_absorberVis;
79  static const G4VisAttributes m_boardVis;
80  static const G4VisAttributes m_blueVis;
81  static const G4VisAttributes m_airVis;
82  static const G4VisAttributes m_airVis2;
83  static const G4VisAttributes m_redVis;
84  static const G4VisAttributes m_blackVis;
85  static const G4VisAttributes m_LEDvis;
86  static const G4VisAttributes m_photocathodeVis;
87  static const G4VisAttributes m_invisibleVis;
88 };
89 
Definition of ParameterTable and OMSimInputData.
Abstract base class used for constructing detector components.
Definition: OMSimDetectorComponent.hh:26
std::vector< G4RotationMatrix > m_placedOrientations
store the orientations each time the components are placed
Definition: OMSimDetectorComponent.hh:50
std::vector< G4ThreeVector > m_placedPositions
store the positions each time the components are placed
Definition: OMSimDetectorComponent.hh:49
OMSimInputData * m_data
Instance of OMSimInputdata, which should be started only once.
Definition: OMSimDetectorComponent.hh:31
std::map< G4String, Component > m_components
dictionary with each component
Definition: OMSimDetectorComponent.hh:52
void integrateDetectorComponent(OMSimDetectorComponent *pToIntegrate, G4ThreeVector pPosition, G4RotationMatrix pRotation, G4String pNameExtension)
Integrates the components of another OMSimDetectorComponent instance.
Definition: OMSimDetectorComponent.cc:161
G4SubtractionSolid * substractToVolume(G4VSolid *pInputVolume, G4ThreeVector pSubstractionPos, G4RotationMatrix pSubstractionRot, G4String pNewVolumeName)
Subtracts components from a given solid volume using position and rotation.
Definition: OMSimDetectorComponent.cc:180
G4bool checkIfExists(G4String pName)
Check if a component with a certain name exists in the Components map.
Definition: OMSimDetectorComponent.cc:52
virtual void construction()=0
Abstract method you have to define in order to make a derived class from OMSimDetectorComponent.
void deleteComponent(G4String pName)
Deletes a specified component from the Components map.
Definition: OMSimDetectorComponent.cc:65
G4Transform3D getNewPosition(G4ThreeVector pPosition, G4RotationMatrix pRotation, G4ThreeVector pObjectPosition, G4RotationMatrix pObjectRotation)
Computes a new position for a sub-component, based on a given global position and rotation.
Definition: OMSimDetectorComponent.cc:104
void placeIt(G4ThreeVector pPosition, G4RotationMatrix pRotation, G4LogicalVolume *&pMother, G4String pNameExtension="")
Placement of the DetectorComponent. Each Component is placed in the same mother.
Definition: OMSimDetectorComponent.cc:116
void appendComponent(G4VSolid *pSolid, G4LogicalVolume *pLogical, G4ThreeVector pVector, G4RotationMatrix pRotation, G4String pName)
Append component to Components vector.
Definition: OMSimDetectorComponent.cc:31
std::map< G4String, G4PVPlacement * > m_lastPhysicals
dictionary with the (last) G4PVPlacement of each component mComponents produced after calling placeIt
Definition: OMSimDetectorComponent.hh:53
std::vector< G4Transform3D > m_placedTranslations
store the translation each time the components are placed
Definition: OMSimDetectorComponent.hh:51
Component getComponent(G4String pName)
Retrieves a specified component from the Components map.
Definition: OMSimDetectorComponent.cc:82
Manages the input data, including parsing and storing material properties.
Definition: OMSimInputData.hh:189
This struct represents a single detector component within an OMSimDetectorComponent instance.
Definition: OMSimDetectorComponent.hh:41
G4RotationMatrix Rotation
A G4RotationMatrix object representing the rotation of the component with respect to its initial orie...
Definition: OMSimDetectorComponent.hh:45
G4LogicalVolume * VLogical
A pointer to a Geant4 G4LogicalVolume object that contains the material properties,...
Definition: OMSimDetectorComponent.hh:43
G4String Name
A G4String object representing the unique name of the component.
Definition: OMSimDetectorComponent.hh:46
G4ThreeVector Position
A G4ThreeVector object representing the position of the component with respect to the origin of its c...
Definition: OMSimDetectorComponent.hh:44
G4VSolid * VSolid
A pointer to a Geant4 G4VSolid object that represents the physical volume of the component.
Definition: OMSimDetectorComponent.hh:42