G4ParallelWorldProcess Class Reference

#include <G4ParallelWorldProcess.hh>

Inheritance diagram for G4ParallelWorldProcess:

G4VProcess

Public Member Functions

 G4ParallelWorldProcess (const G4String &processName="ParaWorld", G4ProcessType theType=fParameterisation)
virtual ~G4ParallelWorldProcess ()
void SetParallelWorld (G4String parallelWorldName)
void SetParallelWorld (G4VPhysicalVolume *parallelWorld)
void StartTracking (G4Track *)
G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *)
G4VParticleChangeAtRestDoIt (const G4Track &, const G4Step &)
G4double AlongStepGetPhysicalInteractionLength (const G4Track &, G4double, G4double, G4double &, G4GPILSelection *)
G4VParticleChangeAlongStepDoIt (const G4Track &, const G4Step &)
G4double PostStepGetPhysicalInteractionLength (const G4Track &, G4double, G4ForceCondition *)
G4VParticleChangePostStepDoIt (const G4Track &, const G4Step &)
void SetLayeredMaterialFlag (G4bool flg=true)
G4bool GetLayeredMaterialFlag () const
G4bool IsAtRestRequired (G4ParticleDefinition *)

Static Public Member Functions

static const G4StepGetHyperStep ()
static G4int GetHypNavigatorID ()

Detailed Description

Definition at line 73 of file G4ParallelWorldProcess.hh.


Constructor & Destructor Documentation

G4ParallelWorldProcess::G4ParallelWorldProcess ( const G4String processName = "ParaWorld",
G4ProcessType  theType = fParameterisation 
)

Definition at line 61 of file G4ParallelWorldProcess.cc.

References G4cout, G4endl, G4PathFinder::GetInstance(), G4TransportationManager::GetNavigatorForTracking(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4VProcess::GetProcessName(), G4TransportationManager::GetTransportationManager(), G4VProcess::pParticleChange, G4Navigator::SetPushVerbosity(), and G4VProcess::verboseLevel.

00062 :G4VProcess(processName,theType), fGhostNavigator(0), fNavigatorID(-1),
00063  fFieldTrack('0'),layeredMaterialFlag(false)
00064 {
00065   if(!fpHyperStep) fpHyperStep = new G4Step();
00066   iParallelWorld = ++nParallelWorlds;
00067 
00068   pParticleChange = &aDummyParticleChange;
00069 
00070   fGhostStep = new G4Step();
00071   fGhostPreStepPoint = fGhostStep->GetPreStepPoint();
00072   fGhostPostStepPoint = fGhostStep->GetPostStepPoint();
00073 
00074   fTransportationManager = G4TransportationManager::GetTransportationManager();
00075   fTransportationManager->GetNavigatorForTracking()->SetPushVerbosity(false);
00076   fPathFinder = G4PathFinder::GetInstance();
00077 
00078   if (verboseLevel>0)
00079   {
00080     G4cout << GetProcessName() << " is created " << G4endl;
00081   }
00082 }

G4ParallelWorldProcess::~G4ParallelWorldProcess (  )  [virtual]

Definition at line 84 of file G4ParallelWorldProcess.cc.

00085 {
00086   delete fGhostStep;
00087   nParallelWorlds--;
00088   if(nParallelWorlds==0)
00089   {
00090     delete fpHyperStep;
00091     fpHyperStep = 0;
00092   }
00093 }


Member Function Documentation

G4VParticleChange * G4ParallelWorldProcess::AlongStepDoIt ( const G4Track ,
const G4Step  
) [virtual]

Implements G4VProcess.

Definition at line 314 of file G4ParallelWorldProcess.cc.

References G4VParticleChange::Initialize(), and G4VProcess::pParticleChange.

00316 {
00317   pParticleChange->Initialize(track);
00318   return pParticleChange; 
00319 }

G4double G4ParallelWorldProcess::AlongStepGetPhysicalInteractionLength ( const G4Track ,
G4double  ,
G4double  ,
G4double ,
G4GPILSelection  
) [virtual]

Implements G4VProcess.

Definition at line 259 of file G4ParallelWorldProcess.cc.

References CandidateForSelection, G4Navigator::ComputeSafety(), G4PathFinder::ComputeStep(), DBL_MAX, G4Track::GetCurrentStepNumber(), G4Track::GetVolume(), kDoNot, kSharedOther, kSharedTransport, kUndefLimited, kUnique, NotCandidateForSelection, and G4FieldTrackUpdator::Update().

00262 {
00263   static G4FieldTrack endTrack('0');
00264   //static ELimited eLimited;
00265   ELimited eLimited;
00266   ELimited eLim = kUndefLimited;
00267   
00268   *selection = NotCandidateForSelection;
00269   G4double returnedStep = DBL_MAX;
00270 
00271   if (previousStepSize > 0.)
00272   { fGhostSafety -= previousStepSize; }
00273   if (fGhostSafety < 0.) fGhostSafety = 0.0;
00274       
00275   if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
00276   {
00277     // I have no chance to limit
00278     returnedStep = currentMinimumStep;
00279     fOnBoundary = false;
00280     proposedSafety = fGhostSafety - currentMinimumStep;
00281     eLim = kDoNot;
00282   }
00283   else 
00284   {
00285     G4FieldTrackUpdator::Update(&fFieldTrack,&track);
00286     returnedStep
00287       = fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
00288                      track.GetCurrentStepNumber(),fGhostSafety,eLimited,
00289                      endTrack,track.GetVolume());
00290     if(eLimited == kDoNot)
00291     {
00292       fOnBoundary = false;
00293       fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
00294     }
00295     else
00296     {
00297       fOnBoundary = true;
00298     }
00299     proposedSafety = fGhostSafety;
00300     if(eLimited == kUnique || eLimited == kSharedOther) {
00301        *selection = CandidateForSelection;
00302     }
00303     else if (eLimited == kSharedTransport) { 
00304        returnedStep *= (1.0 + 1.0e-9);  
00305     }
00306     eLim = eLimited;
00307   }
00308 
00309   if(iParallelWorld==nParallelWorlds) fNavIDHyp = 0;
00310   if(eLim == kUnique || eLim == kSharedOther) fNavIDHyp = fNavigatorID;
00311   return returnedStep;
00312 }

G4VParticleChange * G4ParallelWorldProcess::AtRestDoIt ( const G4Track ,
const G4Step  
) [virtual]

Implements G4VProcess.

Definition at line 165 of file G4ParallelWorldProcess.cc.

References G4StepPoint::GetTouchableHandle(), G4VSensitiveDetector::Hit(), G4VParticleChange::Initialize(), G4VProcess::pParticleChange, G4StepPoint::SetSensitiveDetector(), and G4StepPoint::SetTouchableHandle().

00168 { 
00169 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00170 // At Rest must be registered ONLY for the particle which has other At Rest
00171 // process(es).
00172 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00173   fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
00174   G4VSensitiveDetector* aSD = 0;
00175   if(fOldGhostTouchable->GetVolume())
00176   { aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector(); }
00177   fOnBoundary = false;
00178   if(aSD)
00179   {
00180     CopyStep(step);
00181     fGhostPreStepPoint->SetSensitiveDetector(aSD);
00182 
00183     fNewGhostTouchable = fOldGhostTouchable;
00184   
00185     fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
00186     fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
00187     if(fNewGhostTouchable->GetVolume())
00188     {
00189       fGhostPostStepPoint->SetSensitiveDetector(
00190         fNewGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
00191     }
00192     else
00193     { fGhostPostStepPoint->SetSensitiveDetector(0); }
00194 
00195     aSD->Hit(fGhostStep);
00196   }
00197 
00198   pParticleChange->Initialize(track);
00199   return pParticleChange;
00200 }

G4double G4ParallelWorldProcess::AtRestGetPhysicalInteractionLength ( const G4Track ,
G4ForceCondition  
) [virtual]

Implements G4VProcess.

Definition at line 153 of file G4ParallelWorldProcess.cc.

References DBL_MAX, and Forced.

00156 {
00157 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00158 // At Rest must be registered ONLY for the particle which has other At Rest
00159 // process(es).
00160 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00161   *condition = Forced;
00162   return DBL_MAX;
00163 }

const G4Step * G4ParallelWorldProcess::GetHyperStep (  )  [static]

Definition at line 55 of file G4ParallelWorldProcess.cc.

00056 { return fpHyperStep; }

G4int G4ParallelWorldProcess::GetHypNavigatorID (  )  [static]

Definition at line 57 of file G4ParallelWorldProcess.cc.

00058 { return fNavIDHyp; }

G4bool G4ParallelWorldProcess::GetLayeredMaterialFlag (  )  const [inline]

Definition at line 127 of file G4ParallelWorldProcess.hh.

00128   { return layeredMaterialFlag; }

G4bool G4ParallelWorldProcess::IsAtRestRequired ( G4ParticleDefinition  ) 

Definition at line 400 of file G4ParallelWorldProcess.cc.

References G4ParticleDefinition::GetParticleName(), and G4ParticleDefinition::GetPDGEncoding().

00401 {
00402   G4int pdgCode = partDef->GetPDGEncoding();
00403   if(pdgCode==0)
00404   {
00405     G4String partName = partDef->GetParticleName();
00406     if(partName=="opticalphoton") return false;
00407     if(partName=="geantino") return false;
00408     if(partName=="chargedgeantino") return false;
00409   }
00410   else
00411   {
00412     if(pdgCode==22) return false; // gamma
00413     if(pdgCode==11) return false; // electron
00414     if(pdgCode==2212) return false; // proton
00415     if(pdgCode==-12) return false; // anti_nu_e
00416     if(pdgCode==12) return false; // nu_e
00417     if(pdgCode==-14) return false; // anti_nu_mu
00418     if(pdgCode==14) return false; // nu_mu
00419     if(pdgCode==-16) return false; // anti_nu_tau
00420     if(pdgCode==16) return false; // nu_tau
00421   }
00422   return true;
00423 }

G4VParticleChange * G4ParallelWorldProcess::PostStepDoIt ( const G4Track ,
const G4Step  
) [virtual]

Implements G4VProcess.

Definition at line 212 of file G4ParallelWorldProcess.cc.

References G4PathFinder::CreateTouchableHandle(), G4StepPoint::GetSensitiveDetector(), G4Track::GetStep(), G4StepPoint::GetTouchableHandle(), G4VSensitiveDetector::Hit(), G4VParticleChange::Initialize(), G4VProcess::pParticleChange, G4StepPoint::SetSensitiveDetector(), and G4StepPoint::SetTouchableHandle().

00215 { 
00216   fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
00217   G4VSensitiveDetector* aSD = 0;
00218   if(fOldGhostTouchable->GetVolume())
00219   { aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector(); }
00220   CopyStep(step);
00221   fGhostPreStepPoint->SetSensitiveDetector(aSD);
00222 
00223   if(fOnBoundary)
00224   {
00225     fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
00226   }
00227   else
00228   {
00229     fNewGhostTouchable = fOldGhostTouchable;
00230   }
00231     
00232   fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
00233   fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
00234 
00235   if(fNewGhostTouchable->GetVolume())
00236   {
00237     fGhostPostStepPoint->SetSensitiveDetector(
00238       fNewGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
00239   }
00240   else
00241   { fGhostPostStepPoint->SetSensitiveDetector(0); }
00242 
00243   G4VSensitiveDetector* sd = fGhostPreStepPoint->GetSensitiveDetector();
00244   if(sd)
00245   {
00246     sd->Hit(fGhostStep);
00247   }
00248 
00249   pParticleChange->Initialize(track); 
00250   if(layeredMaterialFlag)
00251   {
00252     G4StepPoint* realWorldPostStepPoint =
00253      ((G4Step*)(track.GetStep()))->GetPostStepPoint();
00254     SwitchMaterial(realWorldPostStepPoint);
00255   }
00256   return pParticleChange;
00257 }

G4double G4ParallelWorldProcess::PostStepGetPhysicalInteractionLength ( const G4Track ,
G4double  ,
G4ForceCondition  
) [virtual]

Implements G4VProcess.

Definition at line 203 of file G4ParallelWorldProcess.cc.

References DBL_MAX, and StronglyForced.

00207 {
00208   *condition = StronglyForced;
00209   return DBL_MAX;
00210 }

void G4ParallelWorldProcess::SetLayeredMaterialFlag ( G4bool  flg = true  )  [inline]

Definition at line 125 of file G4ParallelWorldProcess.hh.

00126   { layeredMaterialFlag = flg; }

void G4ParallelWorldProcess::SetParallelWorld ( G4VPhysicalVolume parallelWorld  ) 

Definition at line 105 of file G4ParallelWorldProcess.cc.

References G4VPhysicalVolume::GetName(), G4TransportationManager::GetNavigator(), and G4Navigator::SetPushVerbosity().

00106 {
00107   fGhostWorldName = parallelWorld->GetName();
00108   fGhostWorld = parallelWorld;
00109   fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
00110   fGhostNavigator->SetPushVerbosity(false);
00111 }

void G4ParallelWorldProcess::SetParallelWorld ( G4String  parallelWorldName  ) 

Definition at line 96 of file G4ParallelWorldProcess.cc.

References G4TransportationManager::GetNavigator(), G4TransportationManager::GetParallelWorld(), and G4Navigator::SetPushVerbosity().

00097 {
00098   fGhostWorldName = parallelWorldName;
00099   fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
00100   fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
00101   fGhostNavigator->SetPushVerbosity(false);
00102 }

void G4ParallelWorldProcess::StartTracking ( G4Track  )  [virtual]

Reimplemented from G4VProcess.

Definition at line 113 of file G4ParallelWorldProcess.cc.

References G4TransportationManager::ActivateNavigator(), G4PathFinder::CreateTouchableHandle(), FatalException, fUndefined, G4Exception(), G4Track::GetMomentumDirection(), G4Track::GetPosition(), G4Step::GetPostStepPoint(), G4Step::GetPreStepPoint(), G4Track::GetStep(), G4PathFinder::PrepareNewTrack(), G4StepPoint::SetStepStatus(), and G4StepPoint::SetTouchableHandle().

00114 {
00115   if(fGhostNavigator)
00116   { fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
00117   else
00118   {
00119     G4Exception("G4ParallelWorldProcess::StartTracking",
00120        "ProcParaWorld000",FatalException,
00121        "G4ParallelWorldProcess is used for tracking without having a parallel world assigned");
00122   }
00123   fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
00124 
00125   fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
00126   fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
00127   fNewGhostTouchable = fOldGhostTouchable;
00128   fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
00129 
00130   fGhostSafety = -1.;
00131   fOnBoundary = false;
00132   fGhostPreStepPoint->SetStepStatus(fUndefined);
00133   fGhostPostStepPoint->SetStepStatus(fUndefined);
00134 
00135 //  G4VPhysicalVolume* thePhys = fNewGhostTouchable->GetVolume();
00136 //  if(thePhys)
00137 //  {
00138 //    G4Material* ghostMaterial = thePhys->GetLogicalVolume()->GetMaterial();
00139 //    if(ghostMaterial)
00140 //    { G4cout << " --- Material : " << ghostMaterial->GetName() << G4endl; }
00141 //  }
00142 
00143   *(fpHyperStep->GetPostStepPoint()) = *(trk->GetStep()->GetPostStepPoint());
00144   if(layeredMaterialFlag)
00145   {
00146     G4StepPoint* realWorldPostStepPoint = trk->GetStep()->GetPostStepPoint();
00147     SwitchMaterial(realWorldPostStepPoint);
00148   }
00149   *(fpHyperStep->GetPreStepPoint()) = *(fpHyperStep->GetPostStepPoint());
00150 }


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