G3Division Class Reference

#include <G3Division.hh>


Public Member Functions

 G3Division (G3DivType type, G3VolTableEntry *vte, G3VolTableEntry *mvte, G4int nofDivision, G4int iaxis, G4int nmed, G4double c0, G4double step)
 G3Division (G3VolTableEntry *vte, G3VolTableEntry *mvte, const G3Division &division)
virtual ~G3Division ()
void UpdateVTE ()
void CreatePVReplica ()


Detailed Description

Definition at line 55 of file G3Division.hh.


Constructor & Destructor Documentation

G3Division::G3Division ( G3DivType  type,
G3VolTableEntry vte,
G3VolTableEntry mvte,
G4int  nofDivision,
G4int  iaxis,
G4int  nmed,
G4double  c0,
G4double  step 
)

Definition at line 50 of file G3Division.cc.

References G3VolTableEntry::SetHasNegPars().

00053   : fType(type),
00054     fVTE(vte),
00055     fMVTE(mvte),
00056     fNofDivisions(nofDivisions),
00057     fIAxis(iaxis),
00058     fNmed(nmed),
00059     fC0(c0),
00060     fStep(step),
00061     fLowRange(0.),
00062     fHighRange(0.),
00063     fWidth(0.),
00064     fOffset(0.),
00065     fAxis(kXAxis)
00066 {
00067   fVTE->SetHasNegPars(true);
00068 }

G3Division::G3Division ( G3VolTableEntry vte,
G3VolTableEntry mvte,
const G3Division division 
)

Definition at line 70 of file G3Division.cc.

References fC0, fIAxis, fNmed, fNofDivisions, fStep, fType, kXAxis, and G3VolTableEntry::SetHasNegPars().

00072   : fVTE(vte),
00073     fMVTE(mvte)
00074 {
00075   // only "input" parameters are copied from division
00076   fType = division.fType;
00077   fNofDivisions = division.fNofDivisions;
00078   fIAxis = division.fIAxis;
00079   fNmed = division.fNmed;
00080   fC0 = division.fC0;
00081   fStep = division.fStep;
00082 
00083   // other parameters are set as in standard constructor
00084   fLowRange = 0.;
00085   fHighRange = 0.;
00086   fWidth = 0.;
00087   fOffset = 0.;
00088   fAxis = kXAxis;
00089   fVTE->SetHasNegPars(true);
00090 }

G3Division::~G3Division (  )  [virtual]

Definition at line 92 of file G3Division.cc.

00093 {}


Member Function Documentation

void G3Division::CreatePVReplica (  ) 

Definition at line 128 of file G3Division.cc.

References G4cout, G4endl, G3VolTableEntry::GetLV(), G4LogicalVolume::GetName(), G3VolTableEntry::GetName(), G3VolTableEntry::GetShape(), G4LogicalVolume::GetSolid(), G4ReflectionFactory::Instance(), G4ReflectionFactory::Place(), position, and G4ReflectionFactory::Replicate().

Referenced by G3toG4BuildPVTree().

00129 {
00130   G4String name = fVTE->GetName();
00131   G4LogicalVolume* lv =  fVTE->GetLV();
00132   G4LogicalVolume* mlv = fMVTE->GetLV();
00133   
00134   G4String shape = fMVTE->GetShape();
00135   if (shape == "PARA") {
00136     // The para volume cannot be replicated using G4PVReplica.
00137     // (Replicating a volume along a cartesian axis means "slicing" it
00138     // with slices -perpendicular- to that axis.)
00139     
00140     // position the replicated elements    
00141     for (G4int i=0; i<fNofDivisions; i++) {
00142        G4ThreeVector position = G4ThreeVector(); 
00143        position[fIAxis-1] = fLowRange + fWidth/2. + i*fWidth;
00144        if (position.y()!=0.) 
00145          position.setX(position.y()*((G4Para*)lv->GetSolid())->GetTanAlpha());
00146 
00147        #ifndef G3G4_NO_REFLECTION
00148        G4ReflectionFactory::Instance()
00149          ->Place(G4Translate3D(position), name, lv, mlv, 0, i);
00150 
00151        #else  
00152        new G4PVPlacement(0, position, lv, name, mlv, 0, i);
00153 
00154        #endif
00155     }
00156     
00157     // G4PVReplica cannot be created
00158     return;   
00159   }     
00160   
00161   #ifdef G3G4DEBUG
00162     G4cout << "Create G4PVReplica name " << name << " logical volume name " 
00163            << lv->GetName() << " mother logical volme name "
00164            << mlv->GetName() << " axis " << fAxis << " ndivisions " 
00165            << fNofDivisions << " width " << fWidth << " Offset "
00166            << fOffset << G4endl;
00167   #endif
00168 
00169   #ifndef G3G4_NO_REFLECTION
00170   G4ReflectionFactory::Instance()
00171     ->Replicate(name, lv, mlv, fAxis, fNofDivisions, fWidth, fOffset);
00172 
00173   #else    
00174   new G4PVReplica(name, lv, mlv, fAxis, fNofDivisions, fWidth, fOffset);
00175 
00176   #endif
00177 }

void G3Division::UpdateVTE (  ) 

Definition at line 97 of file G3Division.cc.

References G3VolTableEntry::AddDaughter(), G3VolTableEntry::AddMother(), G3VolTableEntry::GetNmed(), G3VolTableEntry::HasNegPars(), kDvn, kDvn2, kDvt, kDvt2, G3VolTableEntry::ReplaceDaughter(), and G3VolTableEntry::SetNmed().

Referenced by G4CloneDaughters(), G4CreateCloneVTEWithDivision(), and G4ProcessDaughters().

00098 {
00099   if (fVTE->HasNegPars() && !(fMVTE->HasNegPars())) {
00100 
00101     // set nmed from mother 
00102     if (fNmed == 0) fNmed = fMVTE->GetNmed();
00103     fVTE->SetNmed(fNmed);
00104    
00105     SetRangeAndAxis();
00106     
00107     // create envelope (if necessary)
00108     // and solid    
00109     G3VolTableEntry* envVTE = 0;
00110     if      (fType == kDvn)  envVTE = Dvn(); 
00111     else if (fType == kDvn2) envVTE = Dvn2(); 
00112     else if (fType == kDvt)  envVTE = Dvt(); 
00113     else if (fType == kDvt2) envVTE = Dvt2();
00114     
00115     if (envVTE) {
00116       // reset mother <-> daughter
00117       fMVTE->ReplaceDaughter(fVTE, envVTE);
00118       fVTE->ReplaceMother(fMVTE, envVTE);
00119       envVTE->AddDaughter(fVTE);
00120       envVTE->AddMother(fMVTE);
00121 
00122       // replace mother with envelope
00123       fMVTE = envVTE;
00124     }
00125   }  
00126 }


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