![]() |
OMSim
Geant4 for IceCube optical module studies
|
Abstract base class used for constructing detector components. More...
This class serves as a base class for constructing and manipulating detector components in OMSim. It provides a set of helper functions for creating and arranging components within a detector, as well as methods for altering the geometry, such as subtracting one component from another. The class maintains an internal list of components, allowing for operations to be performed on all components simultaneously. The placeIt
methods allow for the placement of components within a specified logical volume, either via individual positioning and rotation parameters, or via a Geant4 transformation. Furthermore, components from one OMSimDetectorComponent
instance can be integrated into another, with user-specified position, rotation, and name extension. This makes it possible to build complex geometrical structures in a modular fashion in cases where a single mother volume cannot be used.
Classes | |
struct | Component |
This struct represents a single detector component within an OMSimDetectorComponent instance. More... | |
Public Member Functions | |
virtual void | construction ()=0 |
Abstract method you have to define in order to make a derived class from OMSimDetectorComponent. | |
void | appendComponent (G4VSolid *pSolid, G4LogicalVolume *pLogical, G4ThreeVector pVector, G4RotationMatrix pRotation, G4String pName) |
Append component to Components vector. | |
G4bool | checkIfExists (G4String pName) |
Check if a component with a certain name exists in the Components map. | |
Component | getComponent (G4String pName) |
Retrieves a specified component from the Components map. | |
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. | |
void | integrateDetectorComponent (OMSimDetectorComponent *pToIntegrate, G4ThreeVector pPosition, G4RotationMatrix pRotation, G4String pNameExtension) |
Integrates the components of another OMSimDetectorComponent instance. | |
void | deleteComponent (G4String pName) |
Deletes a specified component from the Components map. | |
void | placeIt (G4ThreeVector pPosition, G4RotationMatrix pRotation, G4LogicalVolume *&pMother, G4String pNameExtension="") |
Placement of the DetectorComponent. Each Component is placed in the same mother. | |
void | placeIt (G4Transform3D pTrans, G4LogicalVolume *&pMother, G4String pNameExtension="") |
Places the components in a specified mother volume using a provided transformation. | |
G4SubtractionSolid * | substractToVolume (G4VSolid *pInputVolume, G4ThreeVector pSubstractionPos, G4RotationMatrix pSubstractionRot, G4String pNewVolumeName) |
Subtracts components from a given solid volume using position and rotation. | |
G4SubtractionSolid * | substractToVolume (G4VSolid *pInputVolume, G4Transform3D pTrans, G4String pNewVolumeName) |
Subtracts components from a given solid volume. | |
Public Attributes | |
OMSimInputData * | m_data |
Instance of OMSimInputdata, which should be started only once. | |
bool | m_checkOverlaps = true |
std::vector< G4ThreeVector > | m_placedPositions |
store the positions each time the components are placed | |
std::vector< G4RotationMatrix > | m_placedOrientations |
store the orientations each time the components are placed | |
std::vector< G4Transform3D > | m_placedTranslations |
store the translation each time the components are placed | |
std::map< G4String, Component > | m_components |
dictionary with each component | |
std::map< G4String, G4PVPlacement * > | m_lastPhysicals |
dictionary with the (last) G4PVPlacement of each component mComponents produced after calling placeIt | |
void OMSimDetectorComponent::appendComponent | ( | G4VSolid * | p_solid, |
G4LogicalVolume * | p_logical, | ||
G4ThreeVector | p_vector, | ||
G4RotationMatrix | p_rotation, | ||
G4String | p_name | ||
) |
This function is used to add a new component to the 'Components' vector. Each component contains the solid volume, logical volume, position, rotation, and a unique name. It checks first if a component with the same name already exists. If it does, a warning message is generated and the name of the new component is appended with a unique suffix to avoid conflicts. The new component is then added to the 'Components' vector.
p_solid | A pointer to a G4VSolid object representing the solid volume of the component. |
p_logical | A pointer to a G4LogicalVolume object representing the logical volume of the component. |
p_vector | A G4ThreeVector object representing the position of the component with respect to the origin. |
p_rotation | A G4RotationMatrix object representing the rotation of the component with respect to the origin. |
p_name | A G4String object representing the unique name of the component. |
G4bool OMSimDetectorComponent::checkIfExists | ( | G4String | p_name | ) |
p_name | A G4String object representing the unique name of the component to check. |
|
pure virtual |
Implemented in DEGG, DEggHarness, LOM16, LOM18, mDOM, mDOMFlasher, mDOMHarness, DOM, and OMSimPMTConstruction.
void OMSimDetectorComponent::deleteComponent | ( | G4String | p_name | ) |
p_name | A G4String representing the name of the component to delete. The component must exist in the 'Components' map. |
OMSimDetectorComponent::Component OMSimDetectorComponent::getComponent | ( | G4String | p_name | ) |
p_name | A G4String name of the component to fetch. The component must exist in the 'Components' map. |
G4Transform3D OMSimDetectorComponent::getNewPosition | ( | G4ThreeVector | p_position, |
G4RotationMatrix | p_rotation, | ||
G4ThreeVector | pObjectPosition, | ||
G4RotationMatrix | pObjectRotation | ||
) |
p_position | The initial position (a G4ThreeVector) of the sub-component |
p_rotation | The initial orientation (a G4RotationMatrix) of the sub-component |
pObjectPosition | The position (a G4ThreeVector) of the object with respect to the original position |
pObjectRotation | The orientation (a G4RotationMatrix) of the object with respect to the original orientation |
void OMSimDetectorComponent::integrateDetectorComponent | ( | OMSimDetectorComponent * | p_toIntegrate, |
G4ThreeVector | p_position, | ||
G4RotationMatrix | p_rotation, | ||
G4String | p_nameExtension | ||
) |
This function is used to incorporate the components of another instance of OMSimDetectorComponent into the current instance. The provided position and rotation parameters are used to transform the components from the input OMSimDetectorComponent instance before integrating. Each transformed component from the input instance is then appended to the current instance using the appendComponent() function. A name extension is applied to the original component names for distinction after integration.
p_toIntegrate | The OMSimDetectorComponent instance whose components are to be integrated. |
p_position | The G4ThreeVector representing the position where the new OMSimDetectorComponent instance will be integrated. |
p_rotation | The G4RotationMatrix representing the rotation of the new OMSimDetectorComponent instance. |
p_nameExtension | A G4String used to extend the original name of the component. |
void OMSimDetectorComponent::placeIt | ( | G4ThreeVector | p_position, |
G4RotationMatrix | p_rotation, | ||
G4LogicalVolume *& | p_mother, | ||
G4String | p_nameExtension = "" |
||
) |
p_position | G4ThreeVector with position of the components (as in G4PVPlacement()). |
p_rotation | G4RotationMatrix with rotation of the components (as in G4PVPlacement()). |
p_mother | G4LogicalVolume where the components is going to be placed (as in G4PVPlacement()). |
p_nameExtension | G4String name of the physical volume. You should not have two physicals with the same name. |
void OMSimDetectorComponent::placeIt | ( | G4Transform3D | p_trans, |
G4LogicalVolume *& | p_mother, | ||
G4String | p_nameExtension = "" |
||
) |
p_trans | The G4Transform3D object representing the transformation to be applied to the components. |
p_mother | G4LogicalVolume where the components is going to be placed (as in G4PVPlacement()). |
p_nameExtension | G4String name of the physical volume. You should not have two physicals with the same name. |
G4SubtractionSolid * OMSimDetectorComponent::substractToVolume | ( | G4VSolid * | p_inputVolume, |
G4ThreeVector | p_substractionPos, | ||
G4RotationMatrix | p_substractionRot, | ||
G4String | p_newVolumeName | ||
) |
p_inputVolume | The G4VSolid volume that components will be subtracted from. |
p_substractionPos | The G4ThreeVector representing the position that will be used in the transformation of each component before it is subtracted from p_inputVolume. |
p_substractionRot | The G4RotationMatrix representing the rotation that will be used in the transformation of each component before it is subtracted from p_inputVolume. |
p_newVolumeName | The G4String name for the new volume that results from the subtraction. |
G4SubtractionSolid * OMSimDetectorComponent::substractToVolume | ( | G4VSolid * | p_inputVolume, |
G4Transform3D | p_trans, | ||
G4String | p_newVolumeName | ||
) |
This function enables you to subtract the shape defined by components of the OMSimDetectorComponent instance from a specified input volume. This can be useful for modeling complex geometries where a solid needs to have some parts "cut out" from it. The method goes through each component of the OMSimDetectorComponent, computes the transformation needed, and subtracts it from the input volume. The resulting subtracted solid is returned.
p_inputVolume | The G4VSolid volume that components will be subtracted from. |
p_trans | The G4Transform3D representing the transformation that will be applied to each component before it is subtracted from p_inputVolume. |
p_newVolumeName | The G4String name for the new volume that results from the subtraction. |