OMSim
Geant4 for IceCube optical module studies
OMSimDetectorComponent Class Referenceabstract

Abstract base class used for constructing detector components. More...

Inheritance diagram for OMSimDetectorComponent:
[legend]
Collaboration diagram for OMSimDetectorComponent:
[legend]

Detailed Description

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. More...
 
G4bool checkIfExists (G4String pName)
 Check if a component with a certain name exists in the Components map. More...
 
Component getComponent (G4String pName)
 Retrieves a specified component from the Components map. More...
 
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. More...
 
void integrateDetectorComponent (OMSimDetectorComponent *pToIntegrate, G4ThreeVector pPosition, G4RotationMatrix pRotation, G4String pNameExtension)
 Integrates the components of another OMSimDetectorComponent instance. More...
 
void deleteComponent (G4String pName)
 Deletes a specified component from the Components map. More...
 
void placeIt (G4ThreeVector pPosition, G4RotationMatrix pRotation, G4LogicalVolume *&pMother, G4String pNameExtension="")
 Placement of the DetectorComponent. Each Component is placed in the same mother. More...
 
void placeIt (G4Transform3D pTrans, G4LogicalVolume *&pMother, G4String pNameExtension="")
 Places the components in a specified mother volume using a provided transformation. More...
 
G4SubtractionSolid * substractToVolume (G4VSolid *pInputVolume, G4ThreeVector pSubstractionPos, G4RotationMatrix pSubstractionRot, G4String pNewVolumeName)
 Subtracts components from a given solid volume using position and rotation. More...
 
G4SubtractionSolid * substractToVolume (G4VSolid *pInputVolume, G4Transform3D pTrans, G4String pNewVolumeName)
 Subtracts components from a given solid volume. More...
 

Public Attributes

OMSimInputDatam_data
 Instance of OMSimInputdata, which should be started only once.
 
bool m_checkOverlaps = false
 
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, Componentm_components
 dictionary with each component
 
std::map< G4String, G4PVPlacement * > m_lastPhysicals
 dictionary with the (last) G4PVPlacement of each component mComponents produced after calling placeIt
 

Static Protected Attributes

static const G4VisAttributes m_glassVis = G4VisAttributes(G4Colour(0.7, 0.7, 0.8, 0.25))
 
static const G4VisAttributes m_gelVis = G4VisAttributes(G4Colour(0.45, 0.5, 0.35, 0.2))
 
static const G4VisAttributes m_steelVis = G4VisAttributes(G4Colour(0.6, 0.6, 0.7, 1.0))
 
static const G4VisAttributes m_aluVis = G4VisAttributes(G4Colour(0.8, 0.8, 0.9, 1.0))
 
static const G4VisAttributes m_whiteVis = G4VisAttributes(G4Colour(1, 1, 1, 1.0))
 
static const G4VisAttributes m_absorberSemiTransparentVis = G4VisAttributes(G4Colour(0.2, 0.2, 0.2, 0.5))
 
static const G4VisAttributes m_absorberVis = G4VisAttributes(G4Colour(0.2, 0.2, 0.2, 1.0))
 
static const G4VisAttributes m_boardVis = G4VisAttributes(G4Colour(0, 1, 0, 1))
 
static const G4VisAttributes m_blueVis = G4VisAttributes(G4Colour(0, 0, 1, 1))
 
static const G4VisAttributes m_airVis = G4VisAttributes(G4Colour(0.7, 0.7, 0.8, 0.2))
 
static const G4VisAttributes m_airVis2 = G4VisAttributes(G4Colour(0.0, 0, 1., 0.5))
 
static const G4VisAttributes m_redVis = G4VisAttributes(G4Colour(1.0, 0.0, 0.0, 1))
 
static const G4VisAttributes m_blackVis = G4VisAttributes(G4Colour(0.0, 0.0, 0.0, 1.0))
 
static const G4VisAttributes m_LEDvis = G4VisAttributes(G4Colour(0.2, 0.6, 0.8, 0.5))
 
static const G4VisAttributes m_photocathodeVis = G4VisAttributes(G4Colour(1.0, 1.0, 0.0, 0.1))
 
static const G4VisAttributes m_invisibleVis = G4VisAttributes::GetInvisible()
 

Member Function Documentation

◆ appendComponent()

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.

Parameters
p_solidA pointer to a G4VSolid object representing the solid volume of the component.
p_logicalA pointer to a G4LogicalVolume object representing the logical volume of the component.
p_vectorA G4ThreeVector object representing the position of the component with respect to the origin.
p_rotationA G4RotationMatrix object representing the rotation of the component with respect to the origin.
p_nameA G4String object representing the unique name of the component.

◆ checkIfExists()

G4bool OMSimDetectorComponent::checkIfExists ( G4String  p_name)
Parameters
p_nameA G4String object representing the unique name of the component to check.
Returns
G4bool True if the component exists in the map, false otherwise.

◆ deleteComponent()

void OMSimDetectorComponent::deleteComponent ( G4String  p_name)
Parameters
p_nameA G4String representing the name of the component to delete. The component must exist in the 'Components' map.

◆ getComponent()

OMSimDetectorComponent::Component OMSimDetectorComponent::getComponent ( G4String  p_name)
Parameters
p_nameA G4String name of the component to fetch. The component must exist in the 'Components' map.
Returns
OMSimDetectorComponent::Component structure containing the solid volume, logical volume, position, rotation, and name of component.

◆ getNewPosition()

G4Transform3D OMSimDetectorComponent::getNewPosition ( G4ThreeVector  p_position,
G4RotationMatrix  p_rotation,
G4ThreeVector  pObjectPosition,
G4RotationMatrix  pObjectRotation 
)
Parameters
p_positionThe initial position (a G4ThreeVector) of the sub-component
p_rotationThe initial orientation (a G4RotationMatrix) of the sub-component
pObjectPositionThe position (a G4ThreeVector) of the object with respect to the original position
pObjectRotationThe orientation (a G4RotationMatrix) of the object with respect to the original orientation
Returns
G4Transform3D representing the new position and orientation of the component

◆ integrateDetectorComponent()

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.

Parameters
p_toIntegrateThe OMSimDetectorComponent instance whose components are to be integrated.
p_positionThe G4ThreeVector representing the position where the new OMSimDetectorComponent instance will be integrated.
p_rotationThe G4RotationMatrix representing the rotation of the new OMSimDetectorComponent instance.
p_nameExtensionA G4String used to extend the original name of the component.

◆ placeIt() [1/2]

void OMSimDetectorComponent::placeIt ( G4ThreeVector  p_position,
G4RotationMatrix  p_rotation,
G4LogicalVolume *&  p_mother,
G4String  p_nameExtension = "" 
)
Parameters
p_positionG4ThreeVector with position of the components (as in G4PVPlacement()).
p_rotationG4RotationMatrix with rotation of the components (as in G4PVPlacement()).
p_motherG4LogicalVolume where the components is going to be placed (as in G4PVPlacement()).
p_nameExtensionG4String name of the physical volume. You should not have two physicals with the same name.

◆ placeIt() [2/2]

void OMSimDetectorComponent::placeIt ( G4Transform3D  p_trans,
G4LogicalVolume *&  p_mother,
G4String  p_nameExtension = "" 
)
Parameters
p_transThe G4Transform3D object representing the transformation to be applied to the components.
p_motherG4LogicalVolume where the components is going to be placed (as in G4PVPlacement()).
p_nameExtensionG4String name of the physical volume. You should not have two physicals with the same name.

◆ substractToVolume() [1/2]

G4SubtractionSolid * OMSimDetectorComponent::substractToVolume ( G4VSolid *  p_inputVolume,
G4ThreeVector  p_substractionPos,
G4RotationMatrix  p_substractionRot,
G4String  p_newVolumeName 
)
Parameters
p_inputVolumeThe G4VSolid volume that components will be subtracted from.
p_substractionPosThe G4ThreeVector representing the position that will be used in the transformation of each component before it is subtracted from p_inputVolume.
p_substractionRotThe G4RotationMatrix representing the rotation that will be used in the transformation of each component before it is subtracted from p_inputVolume.
p_newVolumeNameThe G4String name for the new volume that results from the subtraction.
Returns
Returns a G4SubtractionSolid which is the result of subtracting the OMSimDetectorComponent's components from p_inputVolume.

◆ substractToVolume() [2/2]

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.

Parameters
p_inputVolumeThe G4VSolid volume that components will be subtracted from.
p_transThe G4Transform3D representing the transformation that will be applied to each component before it is subtracted from p_inputVolume.
p_newVolumeNameThe G4String name for the new volume that results from the subtraction.
Returns
Returns a G4SubtractionSolid which is the result of subtracting the OMSimDetectorComponent's components from p_inputVolume.

The documentation for this class was generated from the following files: