ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PVDivisionFactory.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4PVDivisionFactory.cc
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 (Ivana.Hrivnacova@cern.ch)
29 // --------------------------------------------------------------------
30 
31 #include "G4PVDivisionFactory.hh"
32 #include "G4PVDivision.hh"
34 
35 //_____________________________________________________________________________
36 
39 {
40  // Protected singleton constructor.
41  // ---
42 }
43 
44 //_____________________________________________________________________________
45 
47 {
48 }
49 
50 //_____________________________________________________________________________
51 
53 {
54  if (fgInstance == nullptr)
55  {
57  }
58  return dynamic_cast<G4PVDivisionFactory*>(fgInstance);
59 }
60 
61 //_____________________________________________________________________________
62 
65  G4LogicalVolume* pLogical,
66  G4LogicalVolume* pMotherLogical,
67  const EAxis pAxis,
68  const G4int nReplicas,
69  const G4double width,
70  const G4double offset )
71 {
72  // Create division - with number of divisions and width
73  // ---
74 
75  return new G4PVDivision(pName, pLogical, pMotherLogical,
76  pAxis, nReplicas, width, offset);
77 }
78 
79 //_____________________________________________________________________________
80 
83  G4LogicalVolume* pLogical,
84  G4LogicalVolume* pMotherLogical,
85  const EAxis pAxis,
86  const G4int nReplicas,
87  const G4double offset )
88 {
89  // Create division - with number of divisions
90  // ---
91 
92  return new G4PVDivision(pName, pLogical, pMotherLogical,
93  pAxis, nReplicas, offset);
94 }
95 
96 //_____________________________________________________________________________
97 
100  G4LogicalVolume* pLogical,
101  G4LogicalVolume* pMotherLogical,
102  const EAxis pAxis,
103  const G4double width,
104  const G4double offset )
105 {
106  // Create division - with width
107  // ---
108 
109  return new G4PVDivision(pName, pLogical, pMotherLogical,
110  pAxis, width, offset);
111 }
112 
113 //_____________________________________________________________________________
114 
117  G4LogicalVolume* pLogical,
118  G4LogicalVolume* pMotherLogical,
119  const G4VPVParameterisation* param)
120 {
121  // Create division - with parameterisation
122  // ---
123 
124  // Get parameterisation data
125  //
126  const G4VDivisionParameterisation* divParam
127  = dynamic_cast<const G4VDivisionParameterisation*>(param);
128 
129  if (divParam == nullptr)
130  {
131  G4Exception("G4PVDivisionFactory::CreatePVDivision()",
132  "GeomDiv0001", FatalException,
133  "Unexpected parameterisation type!");
134  return nullptr;
135  }
136  else
137  {
138  EAxis axis = divParam->GetAxis();
139  G4int nofDivisions = divParam->GetNoDiv();
140  G4double width = divParam->GetWidth();
141  G4double offset = divParam->GetOffset();
142 
143  return new G4PVDivision(pName, pLogical, pMotherLogical,
144  axis, nofDivisions, width, offset);
145  }
146 }
147 
148 //_____________________________________________________________________________
149 
151 {
152  // Returns true if pv is division
153  // ---
154 
155  return (dynamic_cast<const G4PVDivision*>(pv) != nullptr) ? true : false;
156 }
157