Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4PVDivisionFactory Implementation file << 27 // 23 // 28 // Author: Ivana Hrivnacova, 04.05.2004 (Ivan << 24 // $Id: G4PVDivisionFactory.cc,v 1.1 2004/05/13 14:56:31 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-patch-01 $ >> 26 // >> 27 // class G4PVDivisionFactory Implementation file >> 28 // >> 29 // Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch) 29 // ------------------------------------------- 30 // -------------------------------------------------------------------- 30 31 31 #include "G4PVDivisionFactory.hh" 32 #include "G4PVDivisionFactory.hh" 32 #include "G4PVDivision.hh" 33 #include "G4PVDivision.hh" 33 #include "G4VDivisionParameterisation.hh" 34 #include "G4VDivisionParameterisation.hh" 34 35 35 //____________________________________________ 36 //_____________________________________________________________________________ 36 37 >> 38 G4PVDivisionFactory::G4PVDivisionFactory() >> 39 : G4VPVDivisionFactory() >> 40 { >> 41 // Protected singleton constructor. >> 42 // --- >> 43 } >> 44 >> 45 //_____________________________________________________________________________ >> 46 >> 47 G4PVDivisionFactory::~G4PVDivisionFactory() >> 48 { >> 49 } >> 50 >> 51 //_____________________________________________________________________________ >> 52 37 G4PVDivisionFactory* G4PVDivisionFactory::GetI 53 G4PVDivisionFactory* G4PVDivisionFactory::GetInstance() 38 { 54 { 39 if (fgInstance == nullptr) << 55 static G4PVDivisionFactory theFactory; >> 56 if (!fgInstance) 40 { 57 { 41 fgInstance = new G4PVDivisionFactory; << 58 fgInstance = &theFactory; 42 } 59 } 43 return dynamic_cast<G4PVDivisionFactory*>(fg << 60 return &theFactory; 44 } 61 } 45 62 46 //____________________________________________ 63 //_____________________________________________________________________________ 47 64 48 G4VPhysicalVolume* 65 G4VPhysicalVolume* 49 G4PVDivisionFactory::CreatePVDivision(const G4 66 G4PVDivisionFactory::CreatePVDivision(const G4String& pName, 50 G4LogicalVolume* 67 G4LogicalVolume* pLogical, 51 G4LogicalVolume* 68 G4LogicalVolume* pMotherLogical, 52 const EAxis pAxis 69 const EAxis pAxis, 53 const G4int nRepl 70 const G4int nReplicas, 54 const G4double wi 71 const G4double width, 55 const G4double of 72 const G4double offset ) 56 { 73 { 57 // Create division - with number of division 74 // Create division - with number of divisions and width 58 // --- 75 // --- 59 76 60 return new G4PVDivision(pName, pLogical, pMo 77 return new G4PVDivision(pName, pLogical, pMotherLogical, 61 pAxis, nReplicas, wi 78 pAxis, nReplicas, width, offset); 62 } 79 } 63 80 64 //____________________________________________ 81 //_____________________________________________________________________________ 65 82 66 G4VPhysicalVolume* 83 G4VPhysicalVolume* 67 G4PVDivisionFactory::CreatePVDivision(const G4 84 G4PVDivisionFactory::CreatePVDivision(const G4String& pName, 68 G4LogicalVolume* 85 G4LogicalVolume* pLogical, 69 G4LogicalVolume* 86 G4LogicalVolume* pMotherLogical, 70 const EAxis pAxis 87 const EAxis pAxis, 71 const G4int nRepl 88 const G4int nReplicas, 72 const G4double of 89 const G4double offset ) 73 { 90 { 74 // Create division - with number of division 91 // Create division - with number of divisions 75 // --- 92 // --- 76 93 77 return new G4PVDivision(pName, pLogical, pMo 94 return new G4PVDivision(pName, pLogical, pMotherLogical, 78 pAxis, nReplicas, of 95 pAxis, nReplicas, offset); 79 } 96 } 80 97 81 //____________________________________________ 98 //_____________________________________________________________________________ 82 99 83 G4VPhysicalVolume* 100 G4VPhysicalVolume* 84 G4PVDivisionFactory::CreatePVDivision(const G4 101 G4PVDivisionFactory::CreatePVDivision(const G4String& pName, 85 G4LogicalVolume* 102 G4LogicalVolume* pLogical, 86 G4LogicalVolume* 103 G4LogicalVolume* pMotherLogical, 87 const EAxis pAxis 104 const EAxis pAxis, 88 const G4double wi 105 const G4double width, 89 const G4double of 106 const G4double offset ) 90 { 107 { 91 // Create division - with width 108 // Create division - with width 92 // --- 109 // --- 93 110 94 return new G4PVDivision(pName, pLogical, pMo 111 return new G4PVDivision(pName, pLogical, pMotherLogical, 95 pAxis, width, offset 112 pAxis, width, offset); 96 } 113 } 97 114 98 //____________________________________________ 115 //_____________________________________________________________________________ 99 116 100 G4VPhysicalVolume* 117 G4VPhysicalVolume* 101 G4PVDivisionFactory::CreatePVDivision(const G4 118 G4PVDivisionFactory::CreatePVDivision(const G4String& pName, 102 G4LogicalVolume* 119 G4LogicalVolume* pLogical, 103 G4LogicalVolume* 120 G4LogicalVolume* pMotherLogical, 104 const G4VPVParame 121 const G4VPVParameterisation* param) 105 { 122 { 106 // Create division - with parameterisation 123 // Create division - with parameterisation 107 // --- 124 // --- 108 125 109 // Get parameterisation data 126 // Get parameterisation data 110 // 127 // 111 const auto divParam = dynamic_cast<const G4V << 128 const G4VDivisionParameterisation* divParam >> 129 = dynamic_cast<const G4VDivisionParameterisation*>(param); 112 130 113 if (divParam == nullptr) << 131 if (!divParam) 114 { 132 { 115 G4Exception("G4PVDivisionFactory::CreatePV 133 G4Exception("G4PVDivisionFactory::CreatePVDivision()", 116 "GeomDiv0001", FatalException, << 134 "WrongType", FatalException, 117 "Unexpected parameterisation t << 135 "Unexpected parameterisation type !"); 118 return nullptr; << 119 } 136 } 120 else << 121 { << 122 EAxis axis = divParam->GetAxis(); << 123 G4int nofDivisions = divParam->GetNoDiv(); << 124 G4double width = divParam->GetWidth(); << 125 G4double offset = divParam->GetOffset(); << 126 137 127 return new G4PVDivision(pName, pLogical, p << 138 EAxis axis = divParam->GetAxis(); 128 axis, nofDivisions << 139 G4int nofDivisions = divParam->GetNoDiv(); 129 } << 140 G4double width = divParam->GetWidth(); >> 141 G4double offset = divParam->GetOffset(); >> 142 >> 143 return new G4PVDivision(pName, pLogical, pMotherLogical, >> 144 axis, nofDivisions, width, offset); 130 } 145 } 131 146 132 //____________________________________________ 147 //_____________________________________________________________________________ 133 148 134 G4bool G4PVDivisionFactory::IsPVDivision(const 149 G4bool G4PVDivisionFactory::IsPVDivision(const G4VPhysicalVolume* pv) const 135 { 150 { 136 // Returns true if pv is division 151 // Returns true if pv is division 137 // --- 152 // --- 138 153 139 return dynamic_cast<const G4PVDivision*>(pv) << 154 if (dynamic_cast<const G4PVDivision*>(pv)) >> 155 return true; >> 156 else >> 157 return false; 140 } 158 } 141 159 142 160