Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AssemblyVolume Class Reference

#include <G4AssemblyVolume.hh>

Public Member Functions

 G4AssemblyVolume ()
 
 G4AssemblyVolume (G4LogicalVolume *volume, G4ThreeVector &translation, G4RotationMatrix *rotation)
 
 ~G4AssemblyVolume ()
 
void AddPlacedVolume (G4LogicalVolume *pPlacedVolume, G4ThreeVector &translation, G4RotationMatrix *rotation)
 
void AddPlacedVolume (G4LogicalVolume *pPlacedVolume, G4Transform3D &transformation)
 
void AddPlacedAssembly (G4AssemblyVolume *pAssembly, G4Transform3D &transformation)
 
void AddPlacedAssembly (G4AssemblyVolume *pAssembly, G4ThreeVector &translation, G4RotationMatrix *rotation)
 
void MakeImprint (G4LogicalVolume *pMotherLV, G4ThreeVector &translationInMother, G4RotationMatrix *pRotationInMother, G4int copyNumBase=0, G4bool surfCheck=false)
 
void MakeImprint (G4LogicalVolume *pMotherLV, G4Transform3D &transformation, G4int copyNumBase=0, G4bool surfCheck=false)
 
std::vector< G4VPhysicalVolume * >::iterator GetVolumesIterator ()
 
std::size_t TotalImprintedVolumes () const
 
G4Transform3DGetImprintTransformation (unsigned int imprintID)
 
std::vector< G4AssemblyTriplet >::iterator GetTripletsIterator ()
 
std::size_t TotalTriplets () const
 
unsigned int GetImprintsCount () const
 
unsigned int GetInstanceCount () const
 
unsigned int GetAssemblyID () const
 

Protected Member Functions

void SetInstanceCount (unsigned int value)
 
void SetAssemblyID (unsigned int value)
 
void InstanceCountPlus ()
 
void InstanceCountMinus ()
 
void SetImprintsCount (unsigned int value)
 
void ImprintsCountPlus ()
 
void ImprintsCountMinus ()
 

Detailed Description

Definition at line 53 of file G4AssemblyVolume.hh.

Constructor & Destructor Documentation

◆ G4AssemblyVolume() [1/2]

G4AssemblyVolume::G4AssemblyVolume ( )

Definition at line 47 of file G4AssemblyVolume.cc.

48{
53 if (aStore->GetAssembly(fAssemblyID,false) != nullptr)
54 {
55 std::ostringstream message;
56 message << "The assembly has NOT been registered !" << G4endl
57 << " Assembly " << fAssemblyID
58 << " already existing in store !" << G4endl;
59 G4Exception("G4AssemblyVolume::G4AssemblyVolume()", "GeomVol1001",
60 JustWarning, message);
61 }
62 else
63 {
64 aStore->Register(this);
65 }
66}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4endl
Definition G4ios.hh:67
static G4AssemblyStore * GetInstance()
G4AssemblyVolume * GetAssembly(unsigned int id, G4bool verbose=true) const
static void Register(G4AssemblyVolume *pAssembly)
void SetAssemblyID(unsigned int value)
void SetImprintsCount(unsigned int value)
unsigned int GetInstanceCount() const

◆ G4AssemblyVolume() [2/2]

G4AssemblyVolume::G4AssemblyVolume ( G4LogicalVolume * volume,
G4ThreeVector & translation,
G4RotationMatrix * rotation )

Definition at line 71 of file G4AssemblyVolume.cc.

74{
78 AddPlacedVolume(volume, translation, rotation);
80 if (aStore->GetAssembly(fAssemblyID,false) != nullptr)
81 {
82 std::ostringstream message;
83 message << "The assembly has NOT been registered !" << G4endl
84 << " Assembly " << fAssemblyID
85 << " already existing in store !" << G4endl;
86 G4Exception("G4Assembly::G4Assembly()", "GeomVol1001",
87 JustWarning, message);
88 }
89 else
90 {
91 aStore->Register(this);
92 }
93}
void AddPlacedVolume(G4LogicalVolume *pPlacedVolume, G4ThreeVector &translation, G4RotationMatrix *rotation)

◆ ~G4AssemblyVolume()

G4AssemblyVolume::~G4AssemblyVolume ( )

Definition at line 98 of file G4AssemblyVolume.cc.

99{
100 std::size_t howmany = fTriplets.size();
101 if( howmany != 0 )
102 {
103 for( std::size_t i = 0; i < howmany; ++i )
104 {
105 G4RotationMatrix* pRotToClean = fTriplets[i].GetRotation();
106 delete pRotToClean;
107 }
108 }
109 fTriplets.clear();
110
111 // No need to delete physical volumes, as these are deleted
112 // by physical-volumes store.
113 //
114 fPVStore.clear();
117}
static void DeRegister(G4AssemblyVolume *pAssembly)

Member Function Documentation

◆ AddPlacedAssembly() [1/2]

void G4AssemblyVolume::AddPlacedAssembly ( G4AssemblyVolume * pAssembly,
G4ThreeVector & translation,
G4RotationMatrix * rotation )

Definition at line 169 of file G4AssemblyVolume.cc.

172{
173 auto toStore = new G4RotationMatrix;
174
175 if( pRotation != nullptr ) { *toStore = *pRotation; }
176
177 G4AssemblyTriplet toAdd( pAssembly, translation, toStore );
178 fTriplets.push_back( toAdd );
179}
CLHEP::HepRotation G4RotationMatrix

◆ AddPlacedAssembly() [2/2]

void G4AssemblyVolume::AddPlacedAssembly ( G4AssemblyVolume * pAssembly,
G4Transform3D & transformation )

Definition at line 185 of file G4AssemblyVolume.cc.

187{
188 // Decompose transformation
189 //
190 G4Scale3D scale;
191 G4Rotate3D rotation;
192 G4Translate3D translation;
193 transformation.getDecomposition(scale, rotation, translation);
194
195 G4ThreeVector v = translation.getTranslation();
196 auto r = new G4RotationMatrix;
197 *r = rotation.getRotation();
198
199 G4bool isReflection = false;
200 if (scale(0,0)*scale(1,1)*scale(2,2) < 0.) { isReflection = true; }
201
202 G4AssemblyTriplet toAdd( pAssembly, v, r, isReflection );
203 fTriplets.push_back( toAdd );
204}
bool G4bool
Definition G4Types.hh:86
CLHEP::HepRotation getRotation() const
void getDecomposition(Scale3D &scale, Rotate3D &rotation, Translate3D &translation) const
CLHEP::Hep3Vector getTranslation() const

Referenced by G4GDMLReadStructure::PhysvolRead().

◆ AddPlacedVolume() [1/2]

void G4AssemblyVolume::AddPlacedVolume ( G4LogicalVolume * pPlacedVolume,
G4ThreeVector & translation,
G4RotationMatrix * rotation )

Definition at line 130 of file G4AssemblyVolume.cc.

133{
134 auto toStore = new G4RotationMatrix;
135
136 if( pRotation != nullptr ) { *toStore = *pRotation; }
137
138 G4AssemblyTriplet toAdd( pVolume, translation, toStore );
139 fTriplets.push_back( toAdd );
140}

Referenced by G4tgbVolume::ConstructG4PhysVol(), G4AssemblyVolume(), and G4GDMLReadStructure::PhysvolRead().

◆ AddPlacedVolume() [2/2]

void G4AssemblyVolume::AddPlacedVolume ( G4LogicalVolume * pPlacedVolume,
G4Transform3D & transformation )

Definition at line 145 of file G4AssemblyVolume.cc.

147{
148 // Decompose transformation
149 G4Scale3D scale;
150 G4Rotate3D rotation;
151 G4Translate3D translation;
152 transformation.getDecomposition(scale, rotation, translation);
153
154 G4ThreeVector v = translation.getTranslation();
155 auto r = new G4RotationMatrix;
156 *r = rotation.getRotation();
157
158 G4bool isReflection = false;
159 if (scale(0,0)*scale(1,1)*scale(2,2) < 0.) { isReflection = true; }
160
161 G4AssemblyTriplet toAdd( pVolume, v, r, isReflection );
162 fTriplets.push_back( toAdd );
163}

◆ GetAssemblyID()

unsigned int G4AssemblyVolume::GetAssemblyID ( ) const
inline

◆ GetImprintsCount()

unsigned int G4AssemblyVolume::GetImprintsCount ( ) const
inline

◆ GetImprintTransformation()

G4Transform3D & G4AssemblyVolume::GetImprintTransformation ( unsigned int imprintID)
inline

◆ GetInstanceCount()

unsigned int G4AssemblyVolume::GetInstanceCount ( ) const

Definition at line 386 of file G4AssemblyVolume.cc.

387{
388 return G4AssemblyVolume::fsInstanceCounter;
389}

Referenced by G4AssemblyVolume(), and G4AssemblyVolume().

◆ GetTripletsIterator()

std::vector< G4AssemblyTriplet >::iterator G4AssemblyVolume::GetTripletsIterator ( )
inline

◆ GetVolumesIterator()

std::vector< G4VPhysicalVolume * >::iterator G4AssemblyVolume::GetVolumesIterator ( )
inline

◆ ImprintsCountMinus()

void G4AssemblyVolume::ImprintsCountMinus ( )
inlineprotected

◆ ImprintsCountPlus()

void G4AssemblyVolume::ImprintsCountPlus ( )
inlineprotected

◆ InstanceCountMinus()

void G4AssemblyVolume::InstanceCountMinus ( )
protected

Definition at line 404 of file G4AssemblyVolume.cc.

405{
406 G4AssemblyVolume::fsInstanceCounter--;
407}

Referenced by ~G4AssemblyVolume().

◆ InstanceCountPlus()

void G4AssemblyVolume::InstanceCountPlus ( )
protected

Definition at line 398 of file G4AssemblyVolume.cc.

399{
400 G4AssemblyVolume::fsInstanceCounter++;
401}

Referenced by G4AssemblyVolume(), and G4AssemblyVolume().

◆ MakeImprint() [1/2]

void G4AssemblyVolume::MakeImprint ( G4LogicalVolume * pMotherLV,
G4ThreeVector & translationInMother,
G4RotationMatrix * pRotationInMother,
G4int copyNumBase = 0,
G4bool surfCheck = false )

Definition at line 343 of file G4AssemblyVolume.cc.

348{
349 // If needed user can specify explicitely the base count from which to start
350 // off for the generation of phys. vol. copy numbers.
351 // The old behaviour is preserved when copyNumBase == 0, e.g. the generated
352 // copy numbers start from the count equal to current number of daughter
353 // volumes before an imprint is made
354
355 // Compose transformation
356 //
357 if( pRotationInMother == nullptr )
358 {
359 // Make it by default an indentity matrix
360 //
361 pRotationInMother =
363 }
364
365 G4Transform3D transform( *pRotationInMother,
366 translationInMother );
367 MakeImprint(this, pMotherLV, transform, copyNumBase, surfCheck);
368}
static DLL_API const HepRotation IDENTITY
Definition Rotation.h:366
void MakeImprint(G4LogicalVolume *pMotherLV, G4ThreeVector &translationInMother, G4RotationMatrix *pRotationInMother, G4int copyNumBase=0, G4bool surfCheck=false)

Referenced by G4tgbVolume::ConstructG4PhysVol(), MakeImprint(), MakeImprint(), and G4GDMLReadStructure::PhysvolRead().

◆ MakeImprint() [2/2]

void G4AssemblyVolume::MakeImprint ( G4LogicalVolume * pMotherLV,
G4Transform3D & transformation,
G4int copyNumBase = 0,
G4bool surfCheck = false )

Definition at line 371 of file G4AssemblyVolume.cc.

375{
376 // If needed user can specify explicitely the base count from which to start
377 // off for the generation of phys. vol. copy numbers.
378 // The old behaviour is preserved when copyNumBase == 0, e.g. the generated
379 // copy numbers start from the count equal to current number of daughter
380 // volumes before a imprint is made
381
382 MakeImprint(this, pMotherLV, transformation, copyNumBase, surfCheck);
383}

◆ SetAssemblyID()

void G4AssemblyVolume::SetAssemblyID ( unsigned int value)
inlineprotected

◆ SetImprintsCount()

void G4AssemblyVolume::SetImprintsCount ( unsigned int value)
inlineprotected

◆ SetInstanceCount()

void G4AssemblyVolume::SetInstanceCount ( unsigned int value)
inlineprotected

Definition at line 392 of file G4AssemblyVolume.cc.

393{
394 G4AssemblyVolume::fsInstanceCounter = value;
395}

◆ TotalImprintedVolumes()

std::size_t G4AssemblyVolume::TotalImprintedVolumes ( ) const
inline

◆ TotalTriplets()

std::size_t G4AssemblyVolume::TotalTriplets ( ) const
inline

The documentation for this class was generated from the following files: