64 G4AdjointSimManager::G4AdjointSimManager()
69 theAdjointRunAction = 0;
72 theAdjointEventAction = 0;
73 theAdjointTrackingAction = 0;
80 user_action_already_defined=
false;
81 use_user_StackingAction =
false;
83 fUserTrackingAction= 0;
85 fUserSteppingAction= 0;
86 fUserPrimaryGeneratorAction= 0;
88 fUserStackingAction= 0;
90 adjoint_sim_mode =
false;
96 welcome_message =
true;
104 G4AdjointSimManager::~G4AdjointSimManager()
106 if (theAdjointRunAction)
delete theAdjointRunAction;
107 if (theAdjointPrimaryGeneratorAction)
delete theAdjointPrimaryGeneratorAction;
108 if (theAdjointSteppingAction)
delete theAdjointSteppingAction;
109 if (theAdjointEventAction)
delete theAdjointEventAction;
110 if (theAdjointTrackingAction)
delete theAdjointTrackingAction;
111 if (theAdjointStackingAction)
delete theAdjointStackingAction;
112 if (theMessenger)
delete theMessenger;
125 if (welcome_message) {
126 G4cout<<
"****************************************************************"<<std::endl;
127 G4cout<<
"*** Geant4 Reverse/Adjoint Monte Carlo mode ***"<<std::endl;
128 G4cout<<
"*** Author: L.Desorgher ***"<<std::endl;
129 G4cout<<
"*** Company: SpaceIT GmbH, Bern, Switzerland ***"<<std::endl;
130 G4cout<<
"*** Sponsored by: ESA/ESTEC contract contract 21435/08/NL/AT ***"<<std::endl;
131 G4cout<<
"****************************************************************"<<std::endl;
132 welcome_message=
false;
137 SetAdjointPrimaryRunAndStackingActions();
138 SetRestOfAdjointActions();
144 adjoint_sim_mode=
true;
146 ID_of_last_particle_that_reach_the_ext_source=0;
151 nb_evt_of_last_run =nb_evt;
156 ResetRestOfUserActions();
157 ResetUserPrimaryRunAndStackingActions();
158 adjoint_sim_mode=
false;
184 void G4AdjointSimManager::SetRestOfAdjointActions()
188 if (!user_action_already_defined) DefineUserActions();
199 void G4AdjointSimManager::SetAdjointPrimaryRunAndStackingActions()
203 if (!user_action_already_defined) DefineUserActions();
209 theRunManager->
SetUserAction(theAdjointPrimaryGeneratorAction);
216 void G4AdjointSimManager::ResetRestOfUserActions()
230 void G4AdjointSimManager::ResetUserPrimaryRunAndStackingActions()
241 void G4AdjointSimManager::DefineUserActions()
250 user_action_already_defined=
true;
256 adjoint_tracking_mode = aBool;
258 if (adjoint_tracking_mode) {
259 SetRestOfAdjointActions();
266 ResetRestOfUserActions();
293 last_direction /=last_direction.
mag();
294 last_cos_th = last_direction.
z();
299 last_fwd_part_name.
remove(0,4);
304 last_fwd_part_index=-1;
306 while(i<aList.size() && last_fwd_part_index<0) {
307 if (aList[i]->GetParticleName() == last_fwd_part_name) last_fwd_part_index=i;
311 last_ekin = theAdjointSteppingAction->
GetLastEkin();
312 last_ekin_nuc = last_ekin;
315 last_ekin_nuc /=nb_nuc;
345 ID_of_last_particle_that_reach_the_ext_source++;
382 area_of_the_adjoint_source=area;
393 area_of_the_adjoint_source=area;
402 area_of_the_adjoint_source=area;
412 theAdjointPrimaryGeneratorAction->
SetEmin(Emin);
418 theAdjointPrimaryGeneratorAction->
SetEmax(Emax);
443 theAdjointPrimaryGeneratorAction->
SetPrimaryIon(adjointIon, fwdIon);
455 theAdjointPrimaryWeight = aWeight;
463 theAdjointEventAction = anAction;
481 theAdjointTrackingAction=anAction;
487 theAdjointRunAction=anAction;