Geant4  10.02.p03
G4AssemblyVolume Class Reference

#include <G4AssemblyVolume.hh>

Collaboration diagram for G4AssemblyVolume:

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 ()
 
unsigned int TotalImprintedVolumes () 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 ()
 

Private Member Functions

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

Private Attributes

std::vector< G4AssemblyTripletfTriplets
 
std::vector< G4VPhysicalVolume * > fPVStore
 
unsigned int fImprintsCounter
 
unsigned int fAssemblyID
 

Static Private Attributes

static G4ThreadLocal unsigned int fsInstanceCounter = 0
 

Detailed Description

Definition at line 60 of file G4AssemblyVolume.hh.

Constructor & Destructor Documentation

◆ G4AssemblyVolume() [1/2]

G4AssemblyVolume::G4AssemblyVolume ( )

Definition at line 48 of file G4AssemblyVolume.cc.

49  : fAssemblyID( 0 )
50 {
53  SetImprintsCount( 0 );
54 }
void SetImprintsCount(unsigned int value)
void SetAssemblyID(unsigned int value)
unsigned int fAssemblyID
unsigned int GetInstanceCount() const
Here is the call graph for this function:

◆ G4AssemblyVolume() [2/2]

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

Definition at line 58 of file G4AssemblyVolume.cc.

61  : fAssemblyID( 0 )
62 {
65  SetImprintsCount( 0 );
66  AddPlacedVolume(volume, translation, rotation);
67 }
void SetImprintsCount(unsigned int value)
void SetAssemblyID(unsigned int value)
unsigned int fAssemblyID
void AddPlacedVolume(G4LogicalVolume *pPlacedVolume, G4ThreeVector &translation, G4RotationMatrix *rotation)
unsigned int GetInstanceCount() const
Here is the call graph for this function:

◆ ~G4AssemblyVolume()

G4AssemblyVolume::~G4AssemblyVolume ( )

Definition at line 71 of file G4AssemblyVolume.cc.

72 {
73  unsigned int howmany = fTriplets.size();
74  if( howmany != 0 )
75  {
76  for( unsigned int i = 0; i < howmany; i++ )
77  {
78  G4RotationMatrix* pRotToClean = fTriplets[i].GetRotation();
79  if( pRotToClean != 0 )
80  {
81  delete pRotToClean;
82  }
83  }
84  }
85  fTriplets.clear();
86 
87  howmany = fPVStore.size();
88  if( howmany != 0 )
89  {
90  for( unsigned int j = 0; j < howmany; j++ )
91  {
92  delete fPVStore[j];
93  }
94  }
95  fPVStore.clear();
97 }
std::vector< G4AssemblyTriplet > fTriplets
std::vector< G4VPhysicalVolume * > fPVStore
Here is the call graph for this function:

Member Function Documentation

◆ AddPlacedAssembly() [1/2]

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

Definition at line 161 of file G4AssemblyVolume.cc.

163 {
164  // Decompose transformation
165  //
167  G4Rotate3D rotation;
168  G4Translate3D translation;
169  transformation.getDecomposition(scale, rotation, translation);
170 
171  G4ThreeVector v = translation.getTranslation();
173  *r = rotation.getRotation();
174 
175  G4bool isReflection = false;
176  if (scale(0,0)*scale(1,1)*scale(2,2) < 0.) { isReflection = true; }
177 
178  G4AssemblyTriplet toAdd( pAssembly, v, r, isReflection );
179  fTriplets.push_back( toAdd );
180 }
std::vector< G4AssemblyTriplet > fTriplets
CLHEP::Hep3Vector getTranslation() const
CLHEP::HepRotation G4RotationMatrix
void getDecomposition(Scale3D &scale, Rotate3D &rotation, Translate3D &translation) const
Definition: Transform3D.cc:174
bool G4bool
Definition: G4Types.hh:79
Double_t scale
CLHEP::HepRotation getRotation() const
Here is the call graph for this function:

◆ AddPlacedAssembly() [2/2]

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

Definition at line 146 of file G4AssemblyVolume.cc.

149 {
150  G4RotationMatrix* toStore = new G4RotationMatrix;
151 
152  if( pRotation != 0 ) { *toStore = *pRotation; }
153 
154  G4AssemblyTriplet toAdd( pAssembly, translation, toStore );
155  fTriplets.push_back( toAdd );
156 }
std::vector< G4AssemblyTriplet > fTriplets
CLHEP::HepRotation G4RotationMatrix

◆ AddPlacedVolume() [1/2]

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

Definition at line 109 of file G4AssemblyVolume.cc.

112 {
113  G4RotationMatrix* toStore = new G4RotationMatrix;
114 
115  if( pRotation != 0 ) { *toStore = *pRotation; }
116 
117  G4AssemblyTriplet toAdd( pVolume, translation, toStore );
118  fTriplets.push_back( toAdd );
119 }
std::vector< G4AssemblyTriplet > fTriplets
CLHEP::HepRotation G4RotationMatrix
Here is the caller graph for this function:

◆ AddPlacedVolume() [2/2]

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

Definition at line 123 of file G4AssemblyVolume.cc.

125 {
126  // Decompose transformation
128  G4Rotate3D rotation;
129  G4Translate3D translation;
130  transformation.getDecomposition(scale, rotation, translation);
131 
132  G4ThreeVector v = translation.getTranslation();
134  *r = rotation.getRotation();
135 
136  G4bool isReflection = false;
137  if (scale(0,0)*scale(1,1)*scale(2,2) < 0.) { isReflection = true; }
138 
139  G4AssemblyTriplet toAdd( pVolume, v, r, isReflection );
140  fTriplets.push_back( toAdd );
141 }
std::vector< G4AssemblyTriplet > fTriplets
CLHEP::Hep3Vector getTranslation() const
CLHEP::HepRotation G4RotationMatrix
void getDecomposition(Scale3D &scale, Rotate3D &rotation, Translate3D &translation) const
Definition: Transform3D.cc:174
bool G4bool
Definition: G4Types.hh:79
Double_t scale
CLHEP::HepRotation getRotation() const
Here is the call graph for this function:

◆ GetAssemblyID()

unsigned int G4AssemblyVolume::GetAssemblyID ( ) const
Here is the caller graph for this function:

◆ GetImprintsCount()

unsigned int G4AssemblyVolume::GetImprintsCount ( ) const
Here is the caller graph for this function:

◆ GetInstanceCount()

unsigned int G4AssemblyVolume::GetInstanceCount ( ) const

Definition at line 351 of file G4AssemblyVolume.cc.

352 {
354 }
static G4ThreadLocal unsigned int fsInstanceCounter
Here is the caller graph for this function:

◆ GetVolumesIterator()

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

◆ ImprintsCountMinus()

void G4AssemblyVolume::ImprintsCountMinus ( )
protected

◆ ImprintsCountPlus()

void G4AssemblyVolume::ImprintsCountPlus ( )
protected
Here is the caller graph for this function:

◆ InstanceCountMinus()

void G4AssemblyVolume::InstanceCountMinus ( )
protected

Definition at line 366 of file G4AssemblyVolume.cc.

367 {
369 }
static G4ThreadLocal unsigned int fsInstanceCounter
Here is the caller graph for this function:

◆ InstanceCountPlus()

void G4AssemblyVolume::InstanceCountPlus ( )
protected

Definition at line 361 of file G4AssemblyVolume.cc.

362 {
364 }
static G4ThreadLocal unsigned int fsInstanceCounter
Here is the caller graph for this function:

◆ MakeImprint() [1/3]

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

Definition at line 310 of file G4AssemblyVolume.cc.

315 {
316  // If needed user can specify explicitely the base count from which to start
317  // off for the generation of phys. vol. copy numbers.
318  // The old behaviour is preserved when copyNumBase == 0, e.g. the generated
319  // copy numbers start from the count equal to current number of daughter
320  // volumes before an imprint is made
321 
322  // Compose transformation
323  //
324  if( pRotationInMother == 0 )
325  {
326  // Make it by default an indentity matrix
327  //
328  pRotationInMother =
330  }
331 
332  G4Transform3D transform( *pRotationInMother,
333  translationInMother );
334  MakeImprint(this, pMotherLV, transform, copyNumBase, surfCheck);
335 }
void MakeImprint(G4LogicalVolume *pMotherLV, G4ThreeVector &translationInMother, G4RotationMatrix *pRotationInMother, G4int copyNumBase=0, G4bool surfCheck=false)
static DLL_API const HepRotation IDENTITY
Definition: Rotation.h:369
Here is the caller graph for this function:

◆ MakeImprint() [2/3]

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

Definition at line 337 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 a imprint is made
347 
348  MakeImprint(this, pMotherLV, transformation, copyNumBase, surfCheck);
349 }
void MakeImprint(G4LogicalVolume *pMotherLV, G4ThreeVector &translationInMother, G4RotationMatrix *pRotationInMother, G4int copyNumBase=0, G4bool surfCheck=false)
Here is the call graph for this function:

◆ MakeImprint() [3/3]

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

Definition at line 220 of file G4AssemblyVolume.cc.

225 {
226  unsigned int numberOfDaughters;
227 
228  if( copyNumBase == 0 )
229  {
230  numberOfDaughters = pMotherLV->GetNoDaughters();
231  }
232  else
233  {
234  numberOfDaughters = copyNumBase;
235  }
236 
237  // We start from the first available index
238  //
239  numberOfDaughters++;
240 
242 
243  std::vector<G4AssemblyTriplet> triplets = pAssembly->fTriplets;
244 
245  for( unsigned int i = 0; i < triplets.size(); i++ )
246  {
247  G4Transform3D Ta( *(triplets[i].GetRotation()),
248  triplets[i].GetTranslation() );
249  if ( triplets[i].IsReflection() ) { Ta = Ta * G4ReflectZ3D(); }
250 
251  G4Transform3D Tfinal = transformation * Ta;
252 
253  if ( triplets[i].GetVolume() )
254  {
255  // Generate the unique name for the next PV instance
256  // The name has format:
257  //
258  // av_WWW_impr_XXX_YYY_ZZZ
259  // where the fields mean:
260  // WWW - assembly volume instance number
261  // XXX - assembly volume imprint number
262  // YYY - the name of a log. volume we want to make a placement of
263  // ZZZ - the log. volume index inside the assembly volume
264  //
265  std::stringstream pvName;
266  pvName << "av_"
267  << GetAssemblyID()
268  << "_impr_"
269  << GetImprintsCount()
270  << "_"
271  << triplets[i].GetVolume()->GetName().c_str()
272  << "_pv_"
273  << i
274  << std::ends;
275 
276  // Generate a new physical volume instance inside a mother
277  // (as we allow 3D transformation use G4ReflectionFactory to
278  // take into account eventual reflection)
279  //
280  G4PhysicalVolumesPair pvPlaced
282  pvName.str().c_str(),
283  triplets[i].GetVolume(),
284  pMotherLV,
285  false,
286  numberOfDaughters + i,
287  surfCheck );
288 
289  // Register the physical volume created by us so we can delete it later
290  //
291  fPVStore.push_back( pvPlaced.first );
292  if ( pvPlaced.second ) { fPVStore.push_back( pvPlaced.second ); }
293  }
294  else if ( triplets[i].GetAssembly() )
295  {
296  // Place volumes in this assembly with composed transformation
297  //
298  MakeImprint( triplets[i].GetAssembly(), pMotherLV,
299  Tfinal, i*100+copyNumBase, surfCheck );
300  }
301  else
302  {
303  G4Exception("G4AssemblyVolume::MakeImprint(..)",
304  "GeomVol0003", FatalException,
305  "Triplet has no volume and no assembly");
306  }
307  }
308 }
unsigned int GetImprintsCount() const
std::vector< G4AssemblyTriplet > fTriplets
void MakeImprint(G4LogicalVolume *pMotherLV, G4ThreeVector &translationInMother, G4RotationMatrix *pRotationInMother, G4int copyNumBase=0, G4bool surfCheck=false)
G4int GetNoDaughters() const
std::vector< G4VPhysicalVolume * > fPVStore
static G4ReflectionFactory * Instance()
G4PhysicalVolumesPair Place(const G4Transform3D &transform3D, const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, G4bool isMany, G4int copyNo, G4bool surfCheck=false)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
HepGeom::ReflectZ3D G4ReflectZ3D
unsigned int GetAssemblyID() const
std::pair< G4VPhysicalVolume *, G4VPhysicalVolume * > G4PhysicalVolumesPair
void ImprintsCountPlus()
Here is the call graph for this function:

◆ SetAssemblyID()

void G4AssemblyVolume::SetAssemblyID ( unsigned int  value)
protected
Here is the caller graph for this function:

◆ SetImprintsCount()

void G4AssemblyVolume::SetImprintsCount ( unsigned int  value)
protected
Here is the caller graph for this function:

◆ SetInstanceCount()

void G4AssemblyVolume::SetInstanceCount ( unsigned int  value)
protected

Definition at line 356 of file G4AssemblyVolume.cc.

357 {
359 }
static G4ThreadLocal unsigned int fsInstanceCounter

◆ TotalImprintedVolumes()

unsigned int G4AssemblyVolume::TotalImprintedVolumes ( ) const
inline

Member Data Documentation

◆ fAssemblyID

unsigned int G4AssemblyVolume::fAssemblyID
private

Definition at line 217 of file G4AssemblyVolume.hh.

◆ fImprintsCounter

unsigned int G4AssemblyVolume::fImprintsCounter
private

Definition at line 209 of file G4AssemblyVolume.hh.

◆ fPVStore

std::vector<G4VPhysicalVolume*> G4AssemblyVolume::fPVStore
private

Definition at line 198 of file G4AssemblyVolume.hh.

◆ fsInstanceCounter

G4ThreadLocal unsigned int G4AssemblyVolume::fsInstanceCounter = 0
staticprivate

Definition at line 213 of file G4AssemblyVolume.hh.

◆ fTriplets

std::vector<G4AssemblyTriplet> G4AssemblyVolume::fTriplets
private

Definition at line 193 of file G4AssemblyVolume.hh.


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