Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PVDivisionFactory.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4PVDivisionFactory Implementation file
27//
28// Author: Ivana Hrivnacova, 04.05.2004 ([email protected])
29// --------------------------------------------------------------------
30
32#include "G4PVDivision.hh"
34
35//_____________________________________________________________________________
36
38{
39 // Protected singleton constructor.
40 // ---
41}
42
43//_____________________________________________________________________________
44
46
47//_____________________________________________________________________________
48
50{
51 if (fgInstance == nullptr)
52 {
54 }
55 return dynamic_cast<G4PVDivisionFactory*>(fgInstance);
56}
57
58//_____________________________________________________________________________
59
62 G4LogicalVolume* pLogical,
63 G4LogicalVolume* pMotherLogical,
64 const EAxis pAxis,
65 const G4int nReplicas,
66 const G4double width,
67 const G4double offset )
68{
69 // Create division - with number of divisions and width
70 // ---
71
72 return new G4PVDivision(pName, pLogical, pMotherLogical,
73 pAxis, nReplicas, width, offset);
74}
75
76//_____________________________________________________________________________
77
80 G4LogicalVolume* pLogical,
81 G4LogicalVolume* pMotherLogical,
82 const EAxis pAxis,
83 const G4int nReplicas,
84 const G4double offset )
85{
86 // Create division - with number of divisions
87 // ---
88
89 return new G4PVDivision(pName, pLogical, pMotherLogical,
90 pAxis, nReplicas, offset);
91}
92
93//_____________________________________________________________________________
94
97 G4LogicalVolume* pLogical,
98 G4LogicalVolume* pMotherLogical,
99 const EAxis pAxis,
100 const G4double width,
101 const G4double offset )
102{
103 // Create division - with width
104 // ---
105
106 return new G4PVDivision(pName, pLogical, pMotherLogical,
107 pAxis, width, offset);
108}
109
110//_____________________________________________________________________________
111
114 G4LogicalVolume* pLogical,
115 G4LogicalVolume* pMotherLogical,
116 const G4VPVParameterisation* param)
117{
118 // Create division - with parameterisation
119 // ---
120
121 // Get parameterisation data
122 //
123 const auto divParam = dynamic_cast<const G4VDivisionParameterisation*>(param);
124
125 if (divParam == nullptr)
126 {
127 G4Exception("G4PVDivisionFactory::CreatePVDivision()",
128 "GeomDiv0001", FatalException,
129 "Unexpected parameterisation type!");
130 return nullptr;
131 }
132 else
133 {
134 EAxis axis = divParam->GetAxis();
135 G4int nofDivisions = divParam->GetNoDiv();
136 G4double width = divParam->GetWidth();
137 G4double offset = divParam->GetOffset();
138
139 return new G4PVDivision(pName, pLogical, pMotherLogical,
140 axis, nofDivisions, width, offset);
141 }
142}
143
144//_____________________________________________________________________________
145
147{
148 // Returns true if pv is division
149 // ---
150
151 return dynamic_cast<const G4PVDivision*>(pv) != nullptr;
152}
153
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
G4bool IsPVDivision(const G4VPhysicalVolume *pv) const override
static G4PVDivisionFactory * GetInstance()
G4VPhysicalVolume * CreatePVDivision(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset) override
~G4PVDivisionFactory() override
static G4ThreadLocal G4VPVDivisionFactory * fgInstance
EAxis
Definition geomdefs.hh:54