Geant4-11
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// class G4VPhysicalVolume Implementation
27//
28// 15.01.13, G.Cosmo, A.Dotti: Modified for thread-safety for MT
29// 28.08.96, P.Kent: Replaced transform by rotmat + vector
30// 25.07.96, P.Kent: Modified interface for new `Replica' capable geometry
31// 24.07.95, P.Kent: First non-stub version
32// --------------------------------------------------------------------
33
34#include "G4VPhysicalVolume.hh"
35
37#include "G4LogicalVolume.hh"
38
39// This new field helps to use the class G4PVManager
40//
42
43// These macros change the references to fields that are now encapsulated
44// in the class G4PVData.
45//
46#define G4MT_rot ((subInstanceManager.offset[instanceID]).frot)
47#define G4MT_tx ((subInstanceManager.offset[instanceID]).tx)
48#define G4MT_ty ((subInstanceManager.offset[instanceID]).ty)
49#define G4MT_tz ((subInstanceManager.offset[instanceID]).tz)
50#define G4MT_pvdata (subInstanceManager.offset[instanceID])
51
52// Constructor: init parameters and register in Store
53//
55 const G4ThreeVector& tlate,
56 const G4String& pName,
57 G4LogicalVolume* pLogical,
59 : flogical(pLogical), fname(pName)
60{
62
63 this->SetRotation( pRot ); // G4MT_rot = pRot;
64 this->SetTranslation( tlate ); // G4MT_trans = tlate;
65
66 // Initialize 'Shadow' data structure - for use by object persistency
67 pvdata = new G4PVData();
68 pvdata->frot = pRot;
69 pvdata->tx = tlate.x();
70 pvdata->ty = tlate.y();
71 pvdata->tz = tlate.z();
72
74}
75
76// Fake default constructor - sets only member data and allocates memory
77// for usage restricted to object persistency.
78//
80 : fname("")
81{
82 // Register to store
83 //
85
87}
88
89// Destructor - remove from Store
90//
92{
93 delete pvdata;
95}
96
97// Set volume name and notify store of the change
98//
100{
101 fname = pName;
103}
104
105// This method is similar to the constructor. It is used by each worker
106// thread to achieve the same effect as that of the master thread exept
107// to register the new created instance. This method is invoked explicitly.
108// It does not create a new G4VPhysicalVolume instance.
109// It only assign the value for the fields encapsulated by the class G4PVData.
110//
112InitialiseWorker( G4VPhysicalVolume* /*pMasterObject*/,
113 G4RotationMatrix *pRot,
114 const G4ThreeVector &tlate)
115{
117
118 this->SetRotation( pRot ); // G4MT_rot = pRot;
119 this->SetTranslation( tlate ); // G4MT_trans = tlate;
120 // G4PhysicalVolumeStore::Register(this);
121}
122
123// Release memory allocated for offset
124//
126{
128}
129
130// This method is similar to the destructor. It is used by each worker
131// thread to achieve the partial effect as that of the master thread.
132// For G4VPhysicalVolume instances, nothing more to do here.
133//
135{
136}
137
138// Returns the private data instance manager.
139//
141{
142 return subInstanceManager;
143}
144
146{
147 return 1;
148}
149
151{
153}
154
156{
157 G4MT_tx=vec.x(); G4MT_ty=vec.y(); G4MT_tz=vec.z();
158}
159
161{
162 return G4MT_rot;
163}
164
166{
167 return G4MT_rot;
168}
169
171{
172 G4MT_rot = pRot;
173}
174
176{
177 static G4RotationMatrix aRotM;
178 static G4RotationMatrix IdentityRM;
179
180 G4RotationMatrix* retval = &IdentityRM;
181
182 // Insure against frot being a null pointer
183 if(this->GetRotation())
184 {
185 aRotM = GetRotation()->inverse();
186 retval= &aRotM;
187 }
188 return retval;
189}
190
192{
193 G4RotationMatrix aRotM; // Initialised to identity
194
195 // Insure against G4MT_rot being a null pointer
196 if(G4MT_rot)
197 {
198 aRotM = G4MT_rot->inverse();
199 }
200 return aRotM;
201}
202
204{
206}
207
209{
210 return G4MT_rot;
211}
212
214{
216}
217
218// Only implemented for placed and parameterised volumes.
219// Not required for replicas.
220//
222{
223 return false;
224}
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4MT_ty
#define G4MT_tz
#define G4MT_tx
#define G4MT_rot
double z() const
double x() const
double y() const
HepRotation inverse() const
G4int CreateSubInstance()
void SlaveCopySubInstanceArray()
G4RotationMatrix * frot
static G4PhysicalVolumeStore * GetInstance()
static void Register(G4VPhysicalVolume *pSolid)
static void DeRegister(G4VPhysicalVolume *pSolid)
static G4GEOM_DLL G4PVManager subInstanceManager
const G4RotationMatrix * GetRotation() const
G4RotationMatrix * GetObjectRotation() const
const G4ThreeVector GetTranslation() const
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
G4ThreeVector GetFrameTranslation() const
virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
G4RotationMatrix GetObjectRotationValue() const
virtual G4int GetMultiplicity() const
const G4RotationMatrix * GetFrameRotation() const
void TerminateWorker(G4VPhysicalVolume *pMasterObject)
virtual ~G4VPhysicalVolume()
void SetTranslation(const G4ThreeVector &v)
void SetRotation(G4RotationMatrix *)
G4ThreeVector GetObjectTranslation() const
static const G4PVManager & GetSubInstanceManager()
void SetName(const G4String &pName)
void InitialiseWorker(G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
string fname
Definition: test.py:308