G4ReflectionFactory Class Reference

#include <G4ReflectionFactory.hh>


Public Member Functions

virtual ~G4ReflectionFactory ()
G4PhysicalVolumesPair Place (const G4Transform3D &transform3D, const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, G4bool isMany, G4int copyNo, G4bool surfCheck=false)
G4PhysicalVolumesPair Replicate (const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofReplicas, G4double width, G4double offset=0)
G4PhysicalVolumesPair Divide (const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofDivisions, G4double width, G4double offset)
G4PhysicalVolumesPair Divide (const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofDivisions, G4double offset)
G4PhysicalVolumesPair Divide (const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4double width, G4double offset)
void SetVerboseLevel (G4int verboseLevel)
G4int GetVerboseLevel () const
void SetVolumesNameExtension (const G4String &nameExtension)
const G4StringGetVolumesNameExtension () const
void SetScalePrecision (G4double scaleValue)
G4double GetScalePrecision () const
G4LogicalVolumeGetConstituentLV (G4LogicalVolume *reflLV) const
G4LogicalVolumeGetReflectedLV (G4LogicalVolume *lv) const
G4bool IsConstituent (G4LogicalVolume *lv) const
G4bool IsReflected (G4LogicalVolume *lv) const
const G4ReflectedVolumesMapGetReflectedVolumesMap () const
void Reset ()

Static Public Member Functions

static G4ReflectionFactoryInstance ()

Protected Member Functions

 G4ReflectionFactory ()
 G4ReflectionFactory (const G4ReflectionFactory &)
G4ReflectionFactoryoperator= (const G4ReflectionFactory &)


Detailed Description

Definition at line 84 of file G4ReflectionFactory.hh.


Constructor & Destructor Documentation

G4ReflectionFactory::~G4ReflectionFactory (  )  [virtual]

Definition at line 97 of file G4ReflectionFactory.cc.

00098 {
00099   delete fInstance;
00100 }

G4ReflectionFactory::G4ReflectionFactory (  )  [protected]

Definition at line 83 of file G4ReflectionFactory.cc.

References G4GeometryTolerance::GetInstance(), and G4GeometryTolerance::GetSurfaceTolerance().

Referenced by Instance().

00084   : fVerboseLevel(0),
00085     fNameExtension(fDefaultNameExtension)    
00086 {
00087   // Protected singleton constructor.
00088   // ---
00089 
00090   fScalePrecision = 10.
00091                   * G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
00092   fInstance = this;
00093 }

G4ReflectionFactory::G4ReflectionFactory ( const G4ReflectionFactory  )  [protected]


Member Function Documentation

G4PhysicalVolumesPair G4ReflectionFactory::Divide ( const G4String name,
G4LogicalVolume LV,
G4LogicalVolume motherLV,
EAxis  axis,
G4double  width,
G4double  offset 
)

Definition at line 326 of file G4ReflectionFactory.cc.

References G4VPVDivisionFactory::CreatePVDivision(), G4cout, G4endl, G4LogicalVolume::GetName(), and GetReflectedLV().

00332 {
00333   // Creates division in the given mother.
00334   // The result is a pair of physical volumes;
00335   // the second physical volume is a division in a reflected mother
00336   // or 0 if mother LV was not reflected.
00337   // ---
00338 
00339   if (fVerboseLevel>0)
00340   {
00341     G4cout << "Divide " << name << " lv " << LV << " " 
00342            << LV->GetName() << G4endl;
00343   }  
00344 
00345   G4VPVDivisionFactory* divisionFactory = GetPVDivisionFactory();
00346 
00347   G4VPhysicalVolume* pv1 = divisionFactory
00348     -> CreatePVDivision(name, LV, motherLV, axis, width, offset);
00349  
00350   G4VPhysicalVolume* pv2 = 0;
00351   if (G4LogicalVolume* reflMotherLV = GetReflectedLV(motherLV))
00352   {
00353     // if mother was reflected
00354     // reflect the LV and replicate it in reflected mother
00355     
00356     pv2 = divisionFactory->CreatePVDivision(name, ReflectLV(LV), reflMotherLV, 
00357                                             axis, width, offset); 
00358   }
00359     
00360   return G4PhysicalVolumesPair(pv1, pv2);            
00361 }         

G4PhysicalVolumesPair G4ReflectionFactory::Divide ( const G4String name,
G4LogicalVolume LV,
G4LogicalVolume motherLV,
EAxis  axis,
G4int  nofDivisions,
G4double  offset 
)

Definition at line 285 of file G4ReflectionFactory.cc.

References G4VPVDivisionFactory::CreatePVDivision(), G4cout, G4endl, G4LogicalVolume::GetName(), and GetReflectedLV().

00291 {
00292   // Creates division in the given mother.
00293   // The result is a pair of physical volumes;
00294   // the second physical volume is a division in a reflected mother
00295   // or 0 if mother LV was not reflected.
00296   // ---
00297 
00298   if (fVerboseLevel>0)
00299   {
00300     G4cout << "Divide " << name << " lv " << LV << " " 
00301            << LV->GetName() << G4endl;
00302   }  
00303 
00304   G4VPVDivisionFactory* divisionFactory = GetPVDivisionFactory();
00305 
00306   G4VPhysicalVolume* pv1 = divisionFactory
00307       ->CreatePVDivision(name, LV, motherLV, axis, nofDivisions, offset);
00308  
00309   G4VPhysicalVolume* pv2 = 0;
00310   if (G4LogicalVolume* reflMotherLV = GetReflectedLV(motherLV))
00311   {
00312     // if mother was reflected
00313     // reflect the LV and replicate it in reflected mother
00314     
00315     pv2 = divisionFactory->CreatePVDivision(name, ReflectLV(LV), reflMotherLV, 
00316                                             axis, nofDivisions, offset); 
00317   }
00318     
00319   return G4PhysicalVolumesPair(pv1, pv2);            
00320 }         

G4PhysicalVolumesPair G4ReflectionFactory::Divide ( const G4String name,
G4LogicalVolume LV,
G4LogicalVolume motherLV,
EAxis  axis,
G4int  nofDivisions,
G4double  width,
G4double  offset 
)

Definition at line 243 of file G4ReflectionFactory.cc.

References G4VPVDivisionFactory::CreatePVDivision(), G4cout, G4endl, G4LogicalVolume::GetName(), and GetReflectedLV().

Referenced by G4GDMLReadStructure::DivisionvolRead().

00250 {
00251   // Creates division in the given mother.
00252   // The result is a pair of physical volumes;
00253   // the second physical volume is a division in a reflected mother
00254   // or 0 if mother LV was not reflected.
00255   // ---
00256 
00257   if (fVerboseLevel>0)
00258   {
00259     G4cout << "Divide " << name << " lv " << LV << " " 
00260            << LV->GetName() << G4endl;
00261   }  
00262 
00263   G4VPVDivisionFactory* divisionFactory = GetPVDivisionFactory();
00264 
00265   G4VPhysicalVolume* pv1 = divisionFactory
00266       ->CreatePVDivision(name, LV, motherLV, axis, nofDivisions, width, offset);
00267  
00268   G4VPhysicalVolume* pv2 = 0;
00269   if (G4LogicalVolume* reflMotherLV = GetReflectedLV(motherLV))
00270   {
00271     // if mother was reflected
00272     // reflect the LV and replicate it in reflected mother
00273     
00274     pv2 = divisionFactory->CreatePVDivision(name, ReflectLV(LV), reflMotherLV, 
00275                                             axis, nofDivisions, width, offset); 
00276   }
00277     
00278   return G4PhysicalVolumesPair(pv1, pv2);            
00279 }         

G4LogicalVolume * G4ReflectionFactory::GetConstituentLV ( G4LogicalVolume reflLV  )  const

Definition at line 685 of file G4ReflectionFactory.cc.

00686 {              
00687   // Returns the consituent volume of the given reflected volume,
00688   // 0 if the given reflected volume was not found.
00689   // ---
00690 
00691   LogicalVolumesMapIterator it = fReflectedLVMap.find(reflLV);
00692 
00693   if (it == fReflectedLVMap.end()) return 0;
00694 
00695   return (*it).second;
00696 }        

G4LogicalVolume * G4ReflectionFactory::GetReflectedLV ( G4LogicalVolume lv  )  const

Definition at line 701 of file G4ReflectionFactory.cc.

Referenced by Divide(), Place(), and Replicate().

00702 {              
00703   // Returns the reflected volume of the given consituent volume,
00704   // 0 if the given volume was not reflected.
00705   // ---
00706 
00707   LogicalVolumesMapIterator it = fConstituentLVMap.find(lv);
00708 
00709   if (it == fConstituentLVMap.end()) return 0;
00710 
00711   return (*it).second;
00712 }        

const G4ReflectedVolumesMap & G4ReflectionFactory::GetReflectedVolumesMap (  )  const

Definition at line 752 of file G4ReflectionFactory.cc.

00753 {
00754   return fReflectedLVMap;
00755 }

G4double G4ReflectionFactory::GetScalePrecision (  )  const

Definition at line 843 of file G4ReflectionFactory.cc.

00844 {
00845   return fScalePrecision;
00846 }

G4int G4ReflectionFactory::GetVerboseLevel (  )  const

Definition at line 857 of file G4ReflectionFactory.cc.

00858 {
00859   return fVerboseLevel;
00860 }

const G4String & G4ReflectionFactory::GetVolumesNameExtension (  )  const

Definition at line 871 of file G4ReflectionFactory.cc.

00872 {
00873   return fNameExtension;
00874 }

G4ReflectionFactory * G4ReflectionFactory::Instance (  )  [static]

Definition at line 71 of file G4ReflectionFactory.cc.

References G4ReflectionFactory().

Referenced by G4tgbVolume::ConstructG4PhysVol(), G3Division::CreatePVReplica(), G4GDMLReadStructure::DivisionvolRead(), G4tgbGeometryDumper::DumpPhysVol(), G4tgbGeometryDumper::DumpPVPlacement(), G3toG4BuildPVTree(), G4tgbVolumeMgr::G4tgbVolumeMgr(), G4GDMLReadStructure::PhysvolRead(), and G4GDMLReadStructure::ReplicaRead().

00072 {
00073   // Static singleton access method.
00074   // ---
00075 
00076   if (!fInstance) { fInstance = new G4ReflectionFactory(); }
00077 
00078   return fInstance;
00079 }  

G4bool G4ReflectionFactory::IsConstituent ( G4LogicalVolume lv  )  const

Definition at line 716 of file G4ReflectionFactory.cc.

00717 {
00718   // Returns true if the given volume has been already reflected
00719   // (is in the map of constituent volumes).
00720   // ---
00721 
00722   return (fConstituentLVMap.find(lv) != fConstituentLVMap.end());
00723 }  

G4bool G4ReflectionFactory::IsReflected ( G4LogicalVolume lv  )  const

Definition at line 727 of file G4ReflectionFactory.cc.

Referenced by G4tgbGeometryDumper::DumpPhysVol(), and G4tgbGeometryDumper::DumpPVPlacement().

00728 {
00729   // Returns true if the given volume is a reflected volume
00730   // (is in the map reflected  volumes).
00731   // ---
00732 
00733   return (fReflectedLVMap.find(lv) != fReflectedLVMap.end());
00734 }  

G4ReflectionFactory& G4ReflectionFactory::operator= ( const G4ReflectionFactory  )  [protected]

G4PhysicalVolumesPair G4ReflectionFactory::Place ( const G4Transform3D transform3D,
const G4String name,
G4LogicalVolume LV,
G4LogicalVolume motherLV,
G4bool  isMany,
G4int  copyNo,
G4bool  surfCheck = false 
)

Definition at line 109 of file G4ReflectionFactory.cc.

References G4cout, G4endl, G4LogicalVolume::GetName(), and GetReflectedLV().

Referenced by G4tgbVolume::ConstructG4PhysVol(), G3Division::CreatePVReplica(), G3toG4BuildPVTree(), and G4GDMLReadStructure::PhysvolRead().

00116 {
00117   // Evaluates the passed transformation; if it contains reflection
00118   // it performs its decomposition, creates new reflected solid and
00119   // logical volume (or retrieves them from a map if the reflected
00120   // objects were already created), transforms the daughters (if present)
00121   // and place it in the given mother.
00122   // The result is a pair of physical volumes;
00123   // the second physical volume is a placement in a reflected mother
00124   // - or 0 if mother LV was not reflected.
00125   // ---
00126 
00127   if (fVerboseLevel>0)
00128   {
00129     G4cout << "Place " << name << " lv " << LV << " "
00130            << LV->GetName() << G4endl;
00131   }  
00132 
00133   // decompose transformation
00134   G4Scale3D     scale;
00135   G4Rotate3D    rotation;
00136   G4Translate3D translation;
00137 
00138   transform3D.getDecomposition(scale, rotation, translation);
00139   G4Transform3D pureTransform3D = translation * rotation;
00140   
00141   //PrintTransform(transform3D);
00142   //PrintTransform(pureTransform3D);
00143 
00144   // check that scale correspond to fScale
00145   //
00146   CheckScale(scale);
00147   
00148   //
00149   // reflection IS NOT present in transform3D 
00150   //
00151 
00152   if (! IsReflection(scale))
00153   {
00154     if (fVerboseLevel>0)
00155       G4cout << "Scale positive" << G4endl;
00156 
00157     G4VPhysicalVolume* pv1
00158       =  new G4PVPlacement(pureTransform3D, LV, name,
00159                            motherLV, isMany, copyNo, surfCheck);
00160  
00161     G4VPhysicalVolume* pv2 = 0;
00162     if (G4LogicalVolume* reflMotherLV = GetReflectedLV(motherLV))
00163     {
00164       // if mother was reflected
00165       // reflect this LV and place it in reflected mother
00166       
00167       pv2 = new G4PVPlacement(fScale * (pureTransform3D * fScale.inverse()),
00168                               ReflectLV(LV, surfCheck), name, reflMotherLV,
00169                               isMany, copyNo, surfCheck);
00170     }
00171     
00172     return G4PhysicalVolumesPair(pv1, pv2);            
00173   }         
00174            
00175   //
00176   //  reflection IS present in transform3D
00177   //
00178 
00179   if (fVerboseLevel>0)
00180     G4cout << "scale negative" << G4endl;
00181 
00182   G4VPhysicalVolume* pv1
00183     = new G4PVPlacement(pureTransform3D, ReflectLV(LV, surfCheck), name,
00184                         motherLV, isMany, copyNo, surfCheck);
00185 
00186   G4VPhysicalVolume* pv2 = 0;
00187   if (G4LogicalVolume* reflMotherLV = GetReflectedLV(motherLV))
00188   {
00189 
00190     // if mother was reflected
00191     // place the refLV consituent in reflected mother
00192 
00193     pv2 =  new G4PVPlacement(fScale * (pureTransform3D * fScale.inverse()),
00194                              LV, name, reflMotherLV, isMany, copyNo, surfCheck);
00195   }
00196 
00197   return G4PhysicalVolumesPair(pv1, pv2);  
00198 }           

G4PhysicalVolumesPair G4ReflectionFactory::Replicate ( const G4String name,
G4LogicalVolume LV,
G4LogicalVolume motherLV,
EAxis  axis,
G4int  nofReplicas,
G4double  width,
G4double  offset = 0 
)

Definition at line 204 of file G4ReflectionFactory.cc.

References G4cout, G4endl, G4LogicalVolume::GetName(), and GetReflectedLV().

Referenced by G3Division::CreatePVReplica(), and G4GDMLReadStructure::ReplicaRead().

00211 {
00212   // Creates replica in given mother.
00213   // The result is a pair of physical volumes;
00214   // the second physical volume is a replica in a reflected mother
00215   // - or 0 if mother LV was not reflected.
00216   // ---
00217 
00218   if (fVerboseLevel>0)
00219   {
00220     G4cout << "Replicate " << name << " lv " << LV << " " 
00221            << LV->GetName() << G4endl;
00222   }  
00223 
00224   G4VPhysicalVolume* pv1
00225     = new G4PVReplica(name, LV, motherLV, axis, nofReplicas, width, offset);
00226  
00227   G4VPhysicalVolume* pv2 = 0;
00228   if (G4LogicalVolume* reflMotherLV = GetReflectedLV(motherLV))
00229   {
00230     // if mother was reflected
00231     // reflect the LV and replicate it in reflected mother
00232     
00233     pv2 = new G4PVReplica(name, ReflectLV(LV), reflMotherLV, 
00234                           axis, nofReplicas, width, offset); 
00235   }
00236     
00237   return G4PhysicalVolumesPair(pv1, pv2);            
00238 }         

void G4ReflectionFactory::Reset (  ) 

Definition at line 760 of file G4ReflectionFactory.cc.

00761 {
00762   fConstituentLVMap.~map();
00763   fReflectedLVMap.~map();
00764 }

void G4ReflectionFactory::SetScalePrecision ( G4double  scaleValue  ) 

Definition at line 836 of file G4ReflectionFactory.cc.

Referenced by G4tgbVolumeMgr::G4tgbVolumeMgr().

00837 {
00838   fScalePrecision = scaleValue;
00839 }

void G4ReflectionFactory::SetVerboseLevel ( G4int  verboseLevel  ) 

Definition at line 850 of file G4ReflectionFactory.cc.

00851 {
00852   fVerboseLevel = verboseLevel;
00853 }

void G4ReflectionFactory::SetVolumesNameExtension ( const G4String nameExtension  ) 

Definition at line 864 of file G4ReflectionFactory.cc.

00865 {
00866   fNameExtension = nameExtension;
00867 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:16 2013 for Geant4 by  doxygen 1.4.7