Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
27 // $Id: G4PVDivisionFactory.cc 68718 2013-04-05 09:16:24Z gcosmo $
28 //
29 // class G4PVDivisionFactory Implementation file
30 //
31 // Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch)
32 // --------------------------------------------------------------------
33 
34 #include "G4PVDivisionFactory.hh"
35 #include "G4PVDivision.hh"
37 
38 //_____________________________________________________________________________
39 
42 {
43  // Protected singleton constructor.
44  // ---
45 }
46 
47 //_____________________________________________________________________________
48 
50 {
51 }
52 
53 //_____________________________________________________________________________
54 
56 {
57  if (!fgInstance)
58  {
60  }
61  return dynamic_cast<G4PVDivisionFactory*>(fgInstance);
62 }
63 
64 //_____________________________________________________________________________
65 
68  G4LogicalVolume* pLogical,
69  G4LogicalVolume* pMotherLogical,
70  const EAxis pAxis,
71  const G4int nReplicas,
72  const G4double width,
73  const G4double offset )
74 {
75  // Create division - with number of divisions and width
76  // ---
77 
78  return new G4PVDivision(pName, pLogical, pMotherLogical,
79  pAxis, nReplicas, width, offset);
80 }
81 
82 //_____________________________________________________________________________
83 
86  G4LogicalVolume* pLogical,
87  G4LogicalVolume* pMotherLogical,
88  const EAxis pAxis,
89  const G4int nReplicas,
90  const G4double offset )
91 {
92  // Create division - with number of divisions
93  // ---
94 
95  return new G4PVDivision(pName, pLogical, pMotherLogical,
96  pAxis, nReplicas, offset);
97 }
98 
99 //_____________________________________________________________________________
100 
103  G4LogicalVolume* pLogical,
104  G4LogicalVolume* pMotherLogical,
105  const EAxis pAxis,
106  const G4double width,
107  const G4double offset )
108 {
109  // Create division - with width
110  // ---
111 
112  return new G4PVDivision(pName, pLogical, pMotherLogical,
113  pAxis, width, offset);
114 }
115 
116 //_____________________________________________________________________________
117 
120  G4LogicalVolume* pLogical,
121  G4LogicalVolume* pMotherLogical,
122  const G4VPVParameterisation* param)
123 {
124  // Create division - with parameterisation
125  // ---
126 
127  // Get parameterisation data
128  //
129  const G4VDivisionParameterisation* divParam
130  = dynamic_cast<const G4VDivisionParameterisation*>(param);
131 
132  if (!divParam)
133  {
134  G4Exception("G4PVDivisionFactory::CreatePVDivision()",
135  "GeomDiv0001", FatalException,
136  "Unexpected parameterisation type!");
137  return 0;
138  }
139  else
140  {
141  EAxis axis = divParam->GetAxis();
142  G4int nofDivisions = divParam->GetNoDiv();
143  G4double width = divParam->GetWidth();
144  G4double offset = divParam->GetOffset();
145 
146  return new G4PVDivision(pName, pLogical, pMotherLogical,
147  axis, nofDivisions, width, offset);
148  }
149 }
150 
151 //_____________________________________________________________________________
152 
154 {
155  // Returns true if pv is division
156  // ---
157 
158  if (dynamic_cast<const G4PVDivision*>(pv))
159  return true;
160  else
161  return false;
162 }
163 
#define width
G4double GetOffset() const
int G4int
Definition: G4Types.hh:78
static G4PVDivisionFactory * GetInstance()
static G4ThreadLocal G4VPVDivisionFactory * fgInstance
G4double GetWidth() const
bool G4bool
Definition: G4Types.hh:79
virtual G4VPhysicalVolume * CreatePVDivision(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4bool IsPVDivision(const G4VPhysicalVolume *pv) const
EAxis
Definition: geomdefs.hh:54
double G4double
Definition: G4Types.hh:76