Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4AdjointSteppingAction.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4AdjointSteppingAction.cc 102436 2017-01-27 08:28:53Z gcosmo $
27 //
29 // Class Name: G4AdjointSteppingAction
30 // Author: L. Desorgher
31 // Organisation: SpaceIT GmbH
32 // Contract: ESA contract 21435/08/NL/AT
33 // Customer: ESA/ESTEC
35 
37 #include "G4Track.hh"
38 #include "G4PhysicalVolumeStore.hh"
39 #include "G4AffineTransform.hh"
42 //
43 
45  : ext_sourceEMax(0.), start_event(false),
46  did_adj_part_reach_ext_source(false), last_ekin(0.), last_weight(0.),
47  prim_weight(1.), last_part_def(0), theUserAdjointSteppingAction(0),
48  theUserFwdSteppingAction(0)
49 {
51 }
53 //
55 {;}
56 
58 //
60 {
61  G4Track* aTrack =aStep->GetTrack();
62  //G4cout<<"Ste weight "<<<<std:.endl;
63  //forward tracking mode
67  return;
68  }
71  return;
72  }
73  //Apply first the user adjoint stepping action
74  //---------------------------
77 
78 
79  G4double nb_nuc=1.;
80  G4ParticleDefinition* thePartDef = aTrack->GetDefinition();
81 
82  if (thePartDef->GetParticleType() == "adjoint_nucleus"){
83  nb_nuc=double(thePartDef->GetBaryonNumber());
84  }
85  //Kill conditions for adjoint particles reaching the maximum energy
86  //-----------------------------------------------------------------
87  if(aTrack->GetKineticEnergy() >= ext_sourceEMax*nb_nuc){
90  return;
91  }
92  //G4cout<<"Weight adjoint "<<aTrack->GetWeight()<<std::endl;
93  /*G4double weight_factor = aTrack->GetWeight()/prim_weight;
94  if ( (weight_factor>0 && weight_factor<=0) || weight_factor<= 1e-290 || weight_factor>1.e200)
95  {
96  //std::cout<<"Weight_factor problem! Value = "<<weight_factor<<std::endl;
97  aTrack->SetTrackStatus(fStopAndKill);
98  did_adj_part_reach_ext_source=false;
99  //G4cout<<thePartDef->GetParticleName()<<std::endl;
100  return;
101  }
102  */
103 
104 
105  //Kill conditions for surface crossing
106  //--------------------------------------
107 
108  G4String surface_name;
109  G4double cos_to_surface;
110  G4bool GoingIn;
111  G4ThreeVector crossing_pos;
112  if (theG4AdjointCrossSurfChecker->CrossingOneOfTheRegisteredSurface(aStep, surface_name, crossing_pos, cos_to_surface, GoingIn) ){
113 
114  //G4cout<<"Test_step11"<<std::endl;
115  if (surface_name == "ExternalSource") {
116  //Registering still needed
119  aTrack->SetTrackStatus(fStopAndKill);
120  //now register the adjoint particles reaching the external surface
121  last_momentum =aTrack->GetMomentum();
122  last_ekin=aTrack->GetKineticEnergy();
123  last_weight = aTrack->GetWeight();
124  last_part_def = aTrack->GetDefinition();
125  last_pos = crossing_pos;
126  return;
127  }
128  else if (surface_name == "AdjointSource" && GoingIn) {
130  aTrack->SetTrackStatus(fStopAndKill);
131  return;
132  }
133  }
134  //Check for reaching out of world
135  //G4cout<<aStep->GetPostStepPoint()->GetStepStatus()<<std::endl;
136  if (aStep->GetPostStepPoint()->GetStepStatus() == fWorldBoundary) {
139  last_momentum =aTrack->GetMomentum();
140  last_ekin=aTrack->GetKineticEnergy();
141  last_weight = aTrack->GetWeight();
142  last_part_def = aTrack->GetDefinition();
143  last_pos = crossing_pos;
144  return;
145  }
146 }
147 
G4double GetKineticEnergy() const
G4UserSteppingAction * theUserFwdSteppingAction
G4UserSteppingAction * theUserAdjointSteppingAction
G4ParticleDefinition * last_part_def
const G4String & GetParticleType() const
G4AdjointCrossSurfChecker * theG4AdjointCrossSurfChecker
static G4AdjointCrossSurfChecker * GetInstance()
G4ParticleDefinition * GetDefinition() const
G4double GetWeight() const
G4ThreeVector GetMomentum() const
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4StepStatus GetStepStatus() const
G4Track * GetTrack() const
Definition: G4Step.hh:76
G4StepPoint * GetPostStepPoint() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void UserSteppingAction(const G4Step *)
G4bool CrossingOneOfTheRegisteredSurface(const G4Step *aStep, G4String &surface_name, G4ThreeVector &crossing_pos, G4double &cos_to_surface, G4bool &GoingIn)
virtual void UserSteppingAction(const G4Step *)