Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4AdjointTrackingAction Class Reference

#include <G4AdjointTrackingAction.hh>

Inheritance diagram for G4AdjointTrackingAction:
Collaboration diagram for G4AdjointTrackingAction:

Public Member Functions

 G4AdjointTrackingAction (G4AdjointSteppingAction *anAction)
 
virtual ~G4AdjointTrackingAction ()
 
virtual void PreUserTrackingAction (const G4Track *)
 
virtual void PostUserTrackingAction (const G4Track *)
 
void RegisterAtEndOfAdjointTrack ()
 
void ClearEndOfAdjointTrackInfoVectors ()
 
void SetUserForwardTrackingAction (G4UserTrackingAction *anAction)
 
G4ThreeVector GetPositionAtEndOfLastAdjointTrack (size_t i=0)
 
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack (size_t i=0)
 
G4double GetEkinAtEndOfLastAdjointTrack (size_t i=0)
 
G4double GetEkinNucAtEndOfLastAdjointTrack (size_t i=0)
 
G4double GetWeightAtEndOfLastAdjointTrack (size_t i=0)
 
G4double GetCosthAtEndOfLastAdjointTrack (size_t i=0)
 
const G4StringGetFwdParticleNameAtEndOfLastAdjointTrack ()
 
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack (size_t i=0)
 
G4bool GetIsAdjointTrackingMode ()
 
G4int GetLastFwdParticleIndex (size_t i=0)
 
size_t GetNbOfAdointTracksReachingTheExternalSurface ()
 
void SetListOfPrimaryFwdParticles (std::vector< G4ParticleDefinition * > *aListOfParticles)
 
- Public Member Functions inherited from G4UserTrackingAction
 G4UserTrackingAction ()
 
virtual ~G4UserTrackingAction ()
 
virtual void SetTrackingManagerPointer (G4TrackingManager *pValue)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserTrackingAction
G4TrackingManagerfpTrackingManager
 

Detailed Description

Definition at line 52 of file G4AdjointTrackingAction.hh.

Constructor & Destructor Documentation

G4AdjointTrackingAction::G4AdjointTrackingAction ( G4AdjointSteppingAction anAction)

Definition at line 43 of file G4AdjointTrackingAction.cc.

45  :theAdjointSteppingAction(anAction),theUserFwdTrackingAction(0)
46 {;}
G4AdjointTrackingAction::~G4AdjointTrackingAction ( )
virtual

Definition at line 48 of file G4AdjointTrackingAction.cc.

50 {;}

Member Function Documentation

void G4AdjointTrackingAction::ClearEndOfAdjointTrackInfoVectors ( )

Definition at line 119 of file G4AdjointTrackingAction.cc.

120  { last_pos_vec.clear();
121  last_direction_vec.clear();
122  last_ekin_vec.clear();
123  last_ekin_nuc_vec.clear();
124  last_cos_th_vec.clear();
125  last_weight_vec.clear();
126  last_fwd_part_PDGEncoding_vec.clear();
127  last_fwd_part_index_vec.clear();
128  }

Here is the caller graph for this function:

G4double G4AdjointTrackingAction::GetCosthAtEndOfLastAdjointTrack ( size_t  i = 0)
inline

Definition at line 78 of file G4AdjointTrackingAction.hh.

78 {return last_cos_th_vec[i];}

Here is the caller graph for this function:

G4ThreeVector G4AdjointTrackingAction::GetDirectionAtEndOfLastAdjointTrack ( size_t  i = 0)
inline

Definition at line 74 of file G4AdjointTrackingAction.hh.

74 { return last_direction_vec[i];}

Here is the caller graph for this function:

G4double G4AdjointTrackingAction::GetEkinAtEndOfLastAdjointTrack ( size_t  i = 0)
inline

Definition at line 75 of file G4AdjointTrackingAction.hh.

75 { return last_ekin_vec[i];}

Here is the caller graph for this function:

G4double G4AdjointTrackingAction::GetEkinNucAtEndOfLastAdjointTrack ( size_t  i = 0)
inline

Definition at line 76 of file G4AdjointTrackingAction.hh.

76 { return last_ekin_nuc_vec[i];}

Here is the caller graph for this function:

const G4String& G4AdjointTrackingAction::GetFwdParticleNameAtEndOfLastAdjointTrack ( )
inline

Definition at line 79 of file G4AdjointTrackingAction.hh.

79 {return last_fwd_part_name;}

Here is the caller graph for this function:

G4int G4AdjointTrackingAction::GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack ( size_t  i = 0)
inline

Definition at line 80 of file G4AdjointTrackingAction.hh.

80 {return last_fwd_part_PDGEncoding_vec[i];}

Here is the caller graph for this function:

G4bool G4AdjointTrackingAction::GetIsAdjointTrackingMode ( )
inline

Definition at line 81 of file G4AdjointTrackingAction.hh.

81 {return is_adjoint_tracking_mode;}

Here is the caller graph for this function:

G4int G4AdjointTrackingAction::GetLastFwdParticleIndex ( size_t  i = 0)
inline

Definition at line 82 of file G4AdjointTrackingAction.hh.

82  {
83  return last_fwd_part_index_vec[i];};

Here is the caller graph for this function:

size_t G4AdjointTrackingAction::GetNbOfAdointTracksReachingTheExternalSurface ( )
inline

Definition at line 84 of file G4AdjointTrackingAction.hh.

84 {return last_pos_vec.size();}

Here is the caller graph for this function:

G4ThreeVector G4AdjointTrackingAction::GetPositionAtEndOfLastAdjointTrack ( size_t  i = 0)
inline

Definition at line 73 of file G4AdjointTrackingAction.hh.

73 { return last_pos_vec[i];}

Here is the caller graph for this function:

G4double G4AdjointTrackingAction::GetWeightAtEndOfLastAdjointTrack ( size_t  i = 0)
inline

Definition at line 77 of file G4AdjointTrackingAction.hh.

77 {return last_weight_vec[i];}

Here is the caller graph for this function:

void G4AdjointTrackingAction::PostUserTrackingAction ( const G4Track aTrack)
virtual

Reimplemented from G4UserTrackingAction.

Definition at line 67 of file G4AdjointTrackingAction.cc.

68 {
69 
70  //important to have it here !
71  last_weight = theAdjointSteppingAction->GetLastWeight();
72  last_ekin = theAdjointSteppingAction->GetLastEkin();
73 
74 
75  if(!is_adjoint_tracking_mode){
76  if (theUserFwdTrackingAction)
77  theUserFwdTrackingAction->PostUserTrackingAction(aTrack);
78  }
79  else if (theAdjointSteppingAction->GetDidAdjParticleReachTheExtSource()){
80  last_pos = theAdjointSteppingAction->GetLastPosition();
81  last_direction = theAdjointSteppingAction->GetLastMomentum();
82  last_direction /=last_direction.mag();
83  last_cos_th = last_direction.z();
84  G4ParticleDefinition* aPartDef= theAdjointSteppingAction->GetLastPartDef();
85  last_fwd_part_name= aPartDef->GetParticleName();
86  last_fwd_part_name.remove(0,4);
87  last_fwd_part_PDGEncoding=G4ParticleTable::GetParticleTable()
88  ->FindParticle(last_fwd_part_name)->GetPDGEncoding();
89  last_ekin = theAdjointSteppingAction->GetLastEkin();
90  last_ekin_nuc = last_ekin;
91  if (aPartDef->GetParticleType() == "adjoint_nucleus") {
92  G4double nb_nuc=double(aPartDef->GetBaryonNumber());
93  last_ekin_nuc /=nb_nuc;
94  }
95 
96  last_fwd_part_index=-1;
97  size_t i=0;
98  while(i< pListOfPrimaryFwdParticles->size() && last_fwd_part_index<0) {
99  if ((*pListOfPrimaryFwdParticles)[i]->GetParticleName() == last_fwd_part_name)
100  last_fwd_part_index=i;
101  i++;
102  }
103  //Fill the vectors
104  last_pos_vec.push_back(last_pos);
105  last_direction_vec.push_back(last_direction);
106  last_ekin_vec.push_back(last_ekin);
107  last_ekin_nuc_vec.push_back(last_ekin_nuc);
108  last_cos_th_vec.push_back(last_cos_th);
109  last_weight_vec.push_back(last_weight);
110  //G4cout<<"Last weight "<<last_weight<<std::endl;
111  last_fwd_part_PDGEncoding_vec.push_back(last_fwd_part_PDGEncoding);
112  last_fwd_part_index_vec.push_back(last_fwd_part_index);
113  }
114  else {
115 
116  }
117 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4String & remove(str_size)
const G4String & GetParticleName() const
double z() const
const G4String & GetParticleType() const
G4ParticleDefinition * GetLastPartDef()
static G4ParticleTable * GetParticleTable()
virtual void PostUserTrackingAction(const G4Track *)
double G4double
Definition: G4Types.hh:76
double mag() const

Here is the call graph for this function:

void G4AdjointTrackingAction::PreUserTrackingAction ( const G4Track aTrack)
virtual

Reimplemented from G4UserTrackingAction.

Definition at line 52 of file G4AdjointTrackingAction.cc.

53 {
54  G4String partType = aTrack->GetParticleDefinition()->GetParticleType();
55  if (partType.contains(G4String("adjoint"))){
56  is_adjoint_tracking_mode =true;
57  theAdjointSteppingAction->SetPrimWeight(aTrack->GetWeight());
58  }
59  else {
60  is_adjoint_tracking_mode =false;
61  if (theUserFwdTrackingAction)
62  theUserFwdTrackingAction->PreUserTrackingAction(aTrack);
63  }
64  theAdjointSteppingAction->SetAdjointTrackingMode(is_adjoint_tracking_mode);
65 }
void SetAdjointTrackingMode(G4bool aBool)
const G4ParticleDefinition * GetParticleDefinition() const
const G4String & GetParticleType() const
void SetPrimWeight(G4double weight)
G4bool contains(const std::string &) const
G4double GetWeight() const
virtual void PreUserTrackingAction(const G4Track *)

Here is the call graph for this function:

void G4AdjointTrackingAction::RegisterAtEndOfAdjointTrack ( )
void G4AdjointTrackingAction::SetListOfPrimaryFwdParticles ( std::vector< G4ParticleDefinition * > *  aListOfParticles)
inline

Definition at line 85 of file G4AdjointTrackingAction.hh.

86  {pListOfPrimaryFwdParticles=aListOfParticles;}
void G4AdjointTrackingAction::SetUserForwardTrackingAction ( G4UserTrackingAction anAction)
inline

Definition at line 71 of file G4AdjointTrackingAction.hh.

71  {
72  theUserFwdTrackingAction = anAction;}

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