G4AdjointSteppingAction Class Reference

#include <G4AdjointSteppingAction.hh>

Inheritance diagram for G4AdjointSteppingAction:

G4UserSteppingAction

Public Member Functions

 G4AdjointSteppingAction ()
 ~G4AdjointSteppingAction ()
void UserSteppingAction (const G4Step *)
void SetExtSourceEMax (G4double Emax)
void SetStartEvent (G4bool aBool)
G4bool GetDidAdjParticleReachTheExtSource ()
G4ThreeVector GetLastMomentum ()
G4ThreeVector GetLastPosition ()
G4double GetLastEkin ()
G4double GetLastWeight ()
void SetPrimWeight (G4double weight)
G4ParticleDefinition * GetLastPartDef ()
void SetUserAdjointSteppingAction (G4UserSteppingAction *anAction)

Detailed Description

Definition at line 69 of file G4AdjointSteppingAction.hh.


Constructor & Destructor Documentation

G4AdjointSteppingAction::G4AdjointSteppingAction (  ) 

Definition at line 43 of file G4AdjointSteppingAction.cc.

References G4AdjointCrossSurfChecker::GetInstance().

00044   : ext_sourceEMax(0.), start_event(false),
00045     did_adj_part_reach_ext_source(false), last_ekin(0.), last_weight(0.),
00046     prim_weight(0.), last_part_def(0), theUserAdjointSteppingAction(0)
00047 { 
00048   theG4AdjointCrossSurfChecker = G4AdjointCrossSurfChecker::GetInstance();
00049 }

G4AdjointSteppingAction::~G4AdjointSteppingAction (  ) 

Definition at line 52 of file G4AdjointSteppingAction.cc.

00053 {;}


Member Function Documentation

G4bool G4AdjointSteppingAction::GetDidAdjParticleReachTheExtSource (  )  [inline]

Definition at line 79 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::GetDidAdjParticleReachTheExtSource().

00079 {return did_adj_part_reach_ext_source;}

G4double G4AdjointSteppingAction::GetLastEkin (  )  [inline]

Definition at line 82 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::RegisterAtEndOfAdjointTrack().

00082 {return last_ekin;}

G4ThreeVector G4AdjointSteppingAction::GetLastMomentum (  )  [inline]

Definition at line 80 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::RegisterAtEndOfAdjointTrack().

00080 {return last_momentum;}

G4ParticleDefinition* G4AdjointSteppingAction::GetLastPartDef (  )  [inline]

Definition at line 85 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::RegisterAtEndOfAdjointTrack().

00085 {return last_part_def;}

G4ThreeVector G4AdjointSteppingAction::GetLastPosition (  )  [inline]

Definition at line 81 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::RegisterAtEndOfAdjointTrack().

00081 {return last_pos;}

G4double G4AdjointSteppingAction::GetLastWeight (  )  [inline]

Definition at line 83 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::RegisterAtEndOfAdjointTrack().

00083 {return last_weight;}

void G4AdjointSteppingAction::SetExtSourceEMax ( G4double  Emax  )  [inline]

Definition at line 77 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::SetExtSourceEmax().

00077 {ext_sourceEMax=Emax;} 

void G4AdjointSteppingAction::SetPrimWeight ( G4double  weight  )  [inline]

Definition at line 84 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::RegisterAdjointPrimaryWeight().

00084 {prim_weight=weight;} 

void G4AdjointSteppingAction::SetStartEvent ( G4bool  aBool  )  [inline]

Definition at line 78 of file G4AdjointSteppingAction.hh.

00078 {start_event =aBool;}

void G4AdjointSteppingAction::SetUserAdjointSteppingAction ( G4UserSteppingAction *  anAction  )  [inline]

Definition at line 86 of file G4AdjointSteppingAction.hh.

Referenced by G4AdjointSimManager::SetAdjointSteppingAction().

00086 {theUserAdjointSteppingAction = anAction;}

void G4AdjointSteppingAction::UserSteppingAction ( const G4Step *   )  [virtual]

Reimplemented from G4UserSteppingAction.

Definition at line 57 of file G4AdjointSteppingAction.cc.

References G4AdjointCrossSurfChecker::CrossingOneOfTheRegisteredSurface(), fStopAndKill, fWorldBoundary, G4ParticleDefinition::GetBaryonNumber(), G4Track::GetDefinition(), G4Track::GetKineticEnergy(), G4Track::GetMomentum(), G4ParticleDefinition::GetParticleType(), G4Track::GetWeight(), G4Track::SetTrackStatus(), and G4UserSteppingAction::UserSteppingAction().

00058 {
00059   //Apply first the user adjoint stepping action
00060   //---------------------------
00061   if (theUserAdjointSteppingAction) theUserAdjointSteppingAction->UserSteppingAction(aStep);
00062 
00063   G4Track* aTrack =aStep->GetTrack();
00064   G4double nb_nuc=1.;
00065   G4ParticleDefinition* thePartDef = aTrack->GetDefinition();
00066  
00067   if (thePartDef->GetParticleType() == "adjoint_nucleus"){
00068         nb_nuc=double(thePartDef->GetBaryonNumber());
00069   }
00070   //Kill conditions for adjoint particles reaching the maximum energy
00071   //-----------------------------------------------------------------
00072   if(aTrack->GetKineticEnergy() >= ext_sourceEMax*nb_nuc){
00073         aTrack->SetTrackStatus(fStopAndKill);
00074         did_adj_part_reach_ext_source=false;
00075         return;
00076   }
00077 
00078   G4double weight_factor = aTrack->GetWeight()/prim_weight;
00079 
00080   if ( (weight_factor>0 && weight_factor<=0) || weight_factor<= 1e-290 || weight_factor>1.e200)
00081   {
00082         //std::cout<<"Weight_factor problem! Value = "<<weight_factor<<std::endl;
00083         aTrack->SetTrackStatus(fStopAndKill);
00084         did_adj_part_reach_ext_source=false;
00085         return; 
00086   }
00087   
00088   
00089   //Kill conditions for surface crossing
00090   //--------------------------------------
00091   
00092   G4String surface_name;
00093   G4double cos_to_surface;
00094   G4bool GoingIn;
00095   G4ThreeVector crossing_pos;
00096   if (theG4AdjointCrossSurfChecker->CrossingOneOfTheRegisteredSurface(aStep, surface_name, crossing_pos, cos_to_surface, GoingIn) ){
00097         
00098         //G4cout<<"Test_step11"<<std::endl;
00099         //G4cout<<surface_name<<std::endl;
00100         if (surface_name == "ExternalSource") {
00101                 //Registering still needed
00102                 did_adj_part_reach_ext_source=true;
00103                 aTrack->SetTrackStatus(fStopAndKill);
00104                 //now register the adjoint particles reaching the external surface
00105                 last_momentum =aTrack->GetMomentum();
00106                 last_ekin=aTrack->GetKineticEnergy();
00107                 last_weight = aTrack->GetWeight();
00108                 last_part_def = aTrack->GetDefinition();
00109                 last_pos = crossing_pos;
00110                 return;
00111         }       
00112         else if (surface_name == "AdjointSource" && GoingIn) {
00113                 did_adj_part_reach_ext_source=false;
00114                 aTrack->SetTrackStatus(fStopAndKill);
00115                 return;
00116         }  
00117   }
00118   //Check for reaching out of world
00119   if (aStep->GetPostStepPoint()->GetStepStatus() == fWorldBoundary) {
00120           did_adj_part_reach_ext_source=true;
00121           last_momentum =aTrack->GetMomentum();
00122           last_ekin=aTrack->GetKineticEnergy();
00123           last_weight = aTrack->GetWeight();
00124           last_part_def = aTrack->GetDefinition();
00125           last_pos = crossing_pos;
00126                 return;
00127 
00128   }
00129   
00130 }


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