Geant4  10.01.p03
G4VPhysicalVolume.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: G4VPhysicalVolume.cc 83991 2014-09-26 09:22:26Z gcosmo $
28 //
29 //
30 // class G4VPhysicalVolume Implementation
31 //
32 // --------------------------------------------------------------------
33 
34 #include "G4VPhysicalVolume.hh"
35 
36 #include "G4PhysicalVolumeStore.hh"
37 #include "G4LogicalVolume.hh"
38 
39 // This static member is thread local. For each thread, it points to the
40 // array of G4PVData instances.
41 //
42 template <class G4PVData> G4ThreadLocal
44 
45 // This new field helps to use the class G4PVManager
46 //
48 
49 // This method is similar to the constructor. It is used by each worker
50 // thread to achieve the same effect as that of the master thread exept
51 // to register the new created instance. This method is invoked explicitly.
52 // It does not create a new G4VPhysicalVolume instance.
53 // It only assign the value for the fields encapsulated by the class G4PVData.
54 //
56 InitialiseWorker( G4VPhysicalVolume* /*pMasterObject*/,
57  G4RotationMatrix *pRot,
58  const G4ThreeVector &tlate)
59 {
61 
62  this->SetRotation( pRot ); // G4MT_rot = pRot;
63  this->SetTranslation( tlate ); // G4MT_trans = tlate;
64  // G4PhysicalVolumeStore::Register(this);
65 }
66 
67 // This method is similar to the destructor. It is used by each worker
68 // thread to achieve the partial effect as that of the master thread.
69 // For G4VPhysicalVolume instances, nothing more to do here.
70 //
72 {
73 }
74 
75 // Returns the private data instance manager.
76 //
78 {
79  return subInstanceManager;
80 }
81 
82 // Constructor: init parameters and register in Store
83 //
85  const G4ThreeVector &tlate,
86  const G4String& pName,
87  G4LogicalVolume* pLogical,
89  : flogical(pLogical),
90  fname(pName), flmother(0)
91 {
93 
94  this->SetRotation( pRot ); // G4MT_rot = pRot;
95  this->SetTranslation( tlate ); // G4MT_trans = tlate;
97 }
98 
99 // Fake default constructor - sets only member data and allocates memory
100 // for usage restricted to object persistency.
101 //
103  : flogical(0), fname(""), flmother(0)
104 {
105  // Register to store
106  //
108 
110 }
111 
112 // Destructor - remove from Store
113 //
115 {
117 }
118 
120 {
121  return 1;
122 }
123 
125 {
126  static G4RotationMatrix aRotM;
127  static G4RotationMatrix IdentityRM;
128 
129  G4RotationMatrix* retval = &IdentityRM;
130 
131  // Insure against frot being a null pointer
132  if(this->GetRotation())
133  {
134  aRotM = GetRotation()->inverse();
135  retval= &aRotM;
136  }
137  return retval;
138 }
139 
140 // Only implemented for placed and parameterised volumes.
141 // Not required for replicas.
142 //
144 {
145  return false;
146 }
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
static void Register(G4VPhysicalVolume *pSolid)
#define G4ThreadLocal
Definition: tls.hh:89
G4int CreateSubInstance()
int G4int
Definition: G4Types.hh:78
static G4GEOM_DLL G4PVManager subInstanceManager
static void DeRegister(G4VPhysicalVolume *pSolid)
void SetRotation(G4RotationMatrix *)
void InitialiseWorker(G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
void TerminateWorker(G4VPhysicalVolume *pMasterObject)
static const G4PVManager & GetSubInstanceManager()
bool G4bool
Definition: G4Types.hh:79
void SlaveCopySubInstanceArray()
void SetTranslation(const G4ThreeVector &v)
const G4RotationMatrix * GetRotation() const
virtual G4int GetMultiplicity() const
G4RotationMatrix * GetObjectRotation() const
double G4double
Definition: G4Types.hh:76
virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)