Geant4  9.6.p02
 All Classes 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 69784 2013-05-15 09:16:06Z 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  static G4PVDivisionFactory * theFactory = new G4PVDivisionFactory;
58  if (!fgInstance)
59  {
60  fgInstance = theFactory;
61  }
62  return theFactory;
63 }
64 
65 //_____________________________________________________________________________
66 
69  G4LogicalVolume* pLogical,
70  G4LogicalVolume* pMotherLogical,
71  const EAxis pAxis,
72  const G4int nReplicas,
73  const G4double width,
74  const G4double offset )
75 {
76  // Create division - with number of divisions and width
77  // ---
78 
79  return new G4PVDivision(pName, pLogical, pMotherLogical,
80  pAxis, nReplicas, width, offset);
81 }
82 
83 //_____________________________________________________________________________
84 
87  G4LogicalVolume* pLogical,
88  G4LogicalVolume* pMotherLogical,
89  const EAxis pAxis,
90  const G4int nReplicas,
91  const G4double offset )
92 {
93  // Create division - with number of divisions
94  // ---
95 
96  return new G4PVDivision(pName, pLogical, pMotherLogical,
97  pAxis, nReplicas, offset);
98 }
99 
100 //_____________________________________________________________________________
101 
104  G4LogicalVolume* pLogical,
105  G4LogicalVolume* pMotherLogical,
106  const EAxis pAxis,
107  const G4double width,
108  const G4double offset )
109 {
110  // Create division - with width
111  // ---
112 
113  return new G4PVDivision(pName, pLogical, pMotherLogical,
114  pAxis, width, offset);
115 }
116 
117 //_____________________________________________________________________________
118 
121  G4LogicalVolume* pLogical,
122  G4LogicalVolume* pMotherLogical,
123  const G4VPVParameterisation* param)
124 {
125  // Create division - with parameterisation
126  // ---
127 
128  // Get parameterisation data
129  //
130  const G4VDivisionParameterisation* divParam
131  = dynamic_cast<const G4VDivisionParameterisation*>(param);
132 
133  if (!divParam)
134  {
135  G4Exception("G4PVDivisionFactory::CreatePVDivision()",
136  "GeomDiv0001", FatalException,
137  "Unexpected parameterisation type!");
138  return 0;
139  }
140  else
141  {
142  EAxis axis = divParam->GetAxis();
143  G4int nofDivisions = divParam->GetNoDiv();
144  G4double width = divParam->GetWidth();
145  G4double offset = divParam->GetOffset();
146 
147  return new G4PVDivision(pName, pLogical, pMotherLogical,
148  axis, nofDivisions, width, offset);
149  }
150 }
151 
152 //_____________________________________________________________________________
153 
155 {
156  // Returns true if pv is division
157  // ---
158 
159  if (dynamic_cast<const G4PVDivision*>(pv))
160  return true;
161  else
162  return false;
163 }
164