Geant4 10.7.0
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 45 of file G4AssemblyVolume.cc.

46{
51 if (aStore->GetAssembly(fAssemblyID,false))
52 {
53 std::ostringstream message;
54 message << "The assembly has NOT been registered !" << G4endl
55 << " Assembly " << fAssemblyID
56 << " already existing in store !" << G4endl;
57 G4Exception("G4AssemblyVolume::G4AssemblyVolume()", "GeomVol1001",
58 JustWarning, message);
59 }
60 else
61 {
62 aStore->Register(this);
63 }
64}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define G4endl
Definition: G4ios.hh:57
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 68 of file G4AssemblyVolume.cc.

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

◆ ~G4AssemblyVolume()

G4AssemblyVolume::~G4AssemblyVolume ( )

Definition at line 94 of file G4AssemblyVolume.cc.

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

Member Function Documentation

◆ AddPlacedAssembly() [1/2]

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

Definition at line 165 of file G4AssemblyVolume.cc.

168{
169 G4RotationMatrix* toStore = new G4RotationMatrix;
170
171 if( pRotation != nullptr ) { *toStore = *pRotation; }
172
173 G4AssemblyTriplet toAdd( pAssembly, translation, toStore );
174 fTriplets.push_back( toAdd );
175}
CLHEP::HepRotation G4RotationMatrix

◆ AddPlacedAssembly() [2/2]

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

Definition at line 180 of file G4AssemblyVolume.cc.

182{
183 // Decompose transformation
184 //
185 G4Scale3D scale;
186 G4Rotate3D rotation;
187 G4Translate3D translation;
188 transformation.getDecomposition(scale, rotation, translation);
189
190 G4ThreeVector v = translation.getTranslation();
192 *r = rotation.getRotation();
193
194 G4bool isReflection = false;
195 if (scale(0,0)*scale(1,1)*scale(2,2) < 0.) { isReflection = true; }
196
197 G4AssemblyTriplet toAdd( pAssembly, v, r, isReflection );
198 fTriplets.push_back( toAdd );
199}
bool G4bool
Definition: G4Types.hh:86
CLHEP::HepRotation getRotation() const
void getDecomposition(Scale3D &scale, Rotate3D &rotation, Translate3D &translation) const
Definition: Transform3D.cc:173
CLHEP::Hep3Vector getTranslation() const

Referenced by G4GDMLReadStructure::PhysvolRead().

◆ AddPlacedVolume() [1/2]

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

Definition at line 128 of file G4AssemblyVolume.cc.

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

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

◆ AddPlacedVolume() [2/2]

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

Definition at line 142 of file G4AssemblyVolume.cc.

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

◆ 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 377 of file G4AssemblyVolume.cc.

378{
379 return G4AssemblyVolume::fsInstanceCounter;
380}

Referenced by 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 392 of file G4AssemblyVolume.cc.

393{
394 G4AssemblyVolume::fsInstanceCounter--;
395}

Referenced by ~G4AssemblyVolume().

◆ InstanceCountPlus()

void G4AssemblyVolume::InstanceCountPlus ( )
protected

Definition at line 387 of file G4AssemblyVolume.cc.

388{
389 G4AssemblyVolume::fsInstanceCounter++;
390}

Referenced by G4AssemblyVolume().

◆ MakeImprint() [1/2]

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

Definition at line 336 of file G4AssemblyVolume.cc.

341{
342 // If needed user can specify explicitely the base count from which to start
343 // off for the generation of phys. vol. copy numbers.
344 // The old behaviour is preserved when copyNumBase == 0, e.g. the generated
345 // copy numbers start from the count equal to current number of daughter
346 // volumes before an imprint is made
347
348 // Compose transformation
349 //
350 if( pRotationInMother == nullptr )
351 {
352 // Make it by default an indentity matrix
353 //
354 pRotationInMother =
356 }
357
358 G4Transform3D transform( *pRotationInMother,
359 translationInMother );
360 MakeImprint(this, pMotherLV, transform, copyNumBase, surfCheck);
361}
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(), and G4GDMLReadStructure::PhysvolRead().

◆ MakeImprint() [2/2]

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

Definition at line 363 of file G4AssemblyVolume.cc.

367{
368 // If needed user can specify explicitely the base count from which to start
369 // off for the generation of phys. vol. copy numbers.
370 // The old behaviour is preserved when copyNumBase == 0, e.g. the generated
371 // copy numbers start from the count equal to current number of daughter
372 // volumes before a imprint is made
373
374 MakeImprint(this, pMotherLV, transformation, copyNumBase, surfCheck);
375}

◆ SetAssemblyID()

void G4AssemblyVolume::SetAssemblyID ( unsigned int  value)
inlineprotected

Referenced by G4AssemblyVolume().

◆ SetImprintsCount()

void G4AssemblyVolume::SetImprintsCount ( unsigned int  value)
inlineprotected

Referenced by G4AssemblyVolume().

◆ SetInstanceCount()

void G4AssemblyVolume::SetInstanceCount ( unsigned int  value)
inlineprotected

Definition at line 382 of file G4AssemblyVolume.cc.

383{
384 G4AssemblyVolume::fsInstanceCounter = value;
385}

◆ 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: