Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4AdjointSimManager.cc
Go to the documentation of this file.
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: G4AdjointSimManager.cc 102566 2017-02-09 08:35:24Z gcosmo $
27 //
29 // Class Name: G4AdjointCrossSurfChecker
30 // Author: L. Desorgher
31 // Organisation: SpaceIT GmbH
32 // Contract: ESA contract 21435/08/NL/AT
33 // Customer: ESA/ESTEC
35 
36 #include "G4AdjointSimManager.hh"
37 #include "G4Run.hh"
38 #include "G4RunManager.hh"
39 
40 #include "G4UserEventAction.hh"
42 #include "G4UserTrackingAction.hh"
43 #include "G4UserSteppingAction.hh"
44 #include "G4UserStackingAction.hh"
45 #include "G4UserRunAction.hh"
46 
51 
52 #include "G4AdjointSimMessenger.hh"
53 
55 
56 #include "G4ParticleTable.hh"
57 #include "G4PhysicsLogVector.hh"
58 /*
59 #ifdef G4MULTITHREADED
60 #include "G4MTAdjointSimManager.hh"
61 #endif
62 */
63 
65 //
66 G4ThreadLocal G4AdjointSimManager* G4AdjointSimManager::instance = 0;
67 
69 //
70 G4AdjointSimManager::G4AdjointSimManager():
71  fUserRunAction(0), fUserEventAction(0),fUserPrimaryGeneratorAction(0),
72  fUserTrackingAction(0), fUserSteppingAction(0), fUserStackingAction(0),
73  theAdjointRunAction(0), theAdjointEventAction(0),
74  adjoint_tracking_mode(false),last_ekin(0),last_ekin_nuc(0),
75  last_cos_th(0),last_fwd_part_PDGEncoding(0),last_fwd_part_index(0),
76  last_weight(0), ID_of_last_particle_that_reach_the_ext_source(0),
77  nb_evt_of_last_run(0),area_of_the_adjoint_source(0),theAdjointPrimaryWeight(0)
78 {
79  //Create adjoint actions;
80  //----------------------
81  theAdjointPrimaryGeneratorAction = new G4AdjointPrimaryGeneratorAction();
82  theAdjointSteppingAction = new G4AdjointSteppingAction();
83  theAdjointTrackingAction = new G4AdjointTrackingAction(theAdjointSteppingAction);
84  theAdjointStackingAction = new G4AdjointStackingAction(theAdjointTrackingAction);
85  theAdjointTrackingAction->SetListOfPrimaryFwdParticles(
86  theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles());
87  //Create messenger
88  //----------------
89  theMessenger = new G4AdjointSimMessenger(this);
90 
91  user_action_already_defined=false;
92  use_user_StackingAction = false;
93  use_user_TrackingAction =true;
94 
95  adjoint_sim_mode = false;
96 
97  normalisation_mode=3;
98 
99  nb_nuc=1.;
100 
101  welcome_message =true;
102 
103  //Define user action and set this class instance as RunAction
104  //----------------
105  //DefineUserActions();
106  //G4RunManager* theRunManager = G4RunManager::GetRunManager();
107 
108  //theRunManager->G4RunManager::SetUserAction(this);
109 /*
110 #ifdef G4MULTITHREADED
111 
112  if (theRunManager->GetRunManagerType() == G4RunManager::workerRM){
113  G4cout<<"Here"<<std::endl;
114  //G4MTAdjointSimManager::GetInstance()->RegisterLocalManager(this);
115  G4cout<<"Here1"<<std::endl;
116  }
117 #endif
118 */
119 }
121 //
122 G4AdjointSimManager::~G4AdjointSimManager()
123 {
124  if (theAdjointRunAction) delete theAdjointRunAction;
125  if (theAdjointPrimaryGeneratorAction) delete theAdjointPrimaryGeneratorAction;
126  if (theAdjointSteppingAction) delete theAdjointSteppingAction;
127  if (theAdjointEventAction) delete theAdjointEventAction;
128  if (theAdjointTrackingAction) delete theAdjointTrackingAction;
129  if (theAdjointStackingAction) delete theAdjointStackingAction;
130  if (theMessenger) delete theMessenger;
131 }
133 //
135 {
136  if (instance == 0) instance = new G4AdjointSimManager;
137  return instance;
138 }
140 //
142 { if (G4RunManager::GetRunManager()->GetRunManagerType() != G4RunManager::sequentialRM) return; //only for sequential mode
143  if (welcome_message) {
144  G4cout<<"****************************************************************"<<std::endl;
145  G4cout<<"*** Geant4 Reverse/Adjoint Monte Carlo mode ***"<<std::endl;
146  G4cout<<"*** Author: L.Desorgher ***"<<std::endl;
147  G4cout<<"*** Company: SpaceIT GmbH, Bern, Switzerland ***"<<std::endl;
148  G4cout<<"*** Sponsored by: ESA/ESTEC contract contract 21435/08/NL/AT ***"<<std::endl;
149  G4cout<<"****************************************************************"<<std::endl;
150  welcome_message=false;
151  }
152 
153  //Switch to adjoint simulation mode
154  //---------------------------------------------------------
156 
157  //Make the run
158  //------------
159 
160  nb_evt_of_last_run =nb_evt;
161  G4RunManager::GetRunManager()->BeamOn(nb_evt*theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes());
162  //G4RunManager::GetRunManager()->BeamOn(theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes()*2*nb_evt);
163 
164  //Back to Fwd Simulation Mode
165  //--------------------------------
167 
168  /*
169  //Register the weight vector
170  //--------------------------
171  std::ofstream FileOutputElectronWeight("ElectronWeight.txt", std::ios::out);
172  FileOutputElectronWeight<<std::setiosflags(std::ios::scientific);
173  FileOutputElectronWeight<<std::setprecision(6);
174  G4bool aBool = electron_last_weight_vector->Store(FileOutputElectronWeight, true);
175  FileOutputElectronWeight.close();
176 
177  std::ofstream FileOutputProtonWeight("ProtonWeight.txt", std::ios::out);
178  FileOutputProtonWeight<<std::setiosflags(std::ios::scientific);
179  FileOutputProtonWeight<<std::setprecision(6);
180  aBool = proton_last_weight_vector->Store(FileOutputProtonWeight, true);
181  FileOutputProtonWeight.close();
182 
183  std::ofstream FileOutputGammaWeight("GammaWeight.txt", std::ios::out);
184  FileOutputGammaWeight<<std::setiosflags(std::ios::scientific);
185  FileOutputGammaWeight<<std::setprecision(6);
186  aBool = gamma_last_weight_vector->Store(FileOutputGammaWeight, true);
187  FileOutputGammaWeight.close();
188  */
189 }
191 //
192 void G4AdjointSimManager::SetRestOfAdjointActions()
193 {
194  G4RunManager* theRunManager = G4RunManager::GetRunManager();
195 
196  if (!user_action_already_defined) DefineUserActions();
197 
198  //Replace the user action by the adjoint actions
199  //-------------------------------------------------
200 
201  theRunManager->G4RunManager::SetUserAction(theAdjointEventAction);
202  theRunManager->G4RunManager::SetUserAction(theAdjointSteppingAction);
203  theRunManager->G4RunManager::SetUserAction(theAdjointTrackingAction);
204 
205 }
207 //
209 { //Replace the user defined actions by the adjoint actions
210  //---------------------------------------------------------
211  SetAdjointActions();
212 
213  //Update the list of primaries
214  //-----------------------------
215  theAdjointPrimaryGeneratorAction->UpdateListOfPrimaryParticles();
216  adjoint_sim_mode=true;
217  ID_of_last_particle_that_reach_the_ext_source=0;
218 }
220 //
222 { //Restore the user defined actions
223  //--------------------------------
224  ResetUserActions();
225  adjoint_sim_mode=false;
226 }
227 
229 //
230 void G4AdjointSimManager::SetAdjointActions()
231 {
232  G4RunManager* theRunManager = G4RunManager::GetRunManager();
233 
234  if (!user_action_already_defined) DefineUserActions();
235 
236 
237  //Replace the user action by the adjoint actions
238  //-------------------------------------------------
239  theRunManager->G4RunManager::SetUserAction(this);
240  theRunManager->G4RunManager::SetUserAction(theAdjointPrimaryGeneratorAction);
241  theRunManager->G4RunManager::SetUserAction(theAdjointStackingAction);
242  if (use_user_StackingAction) theAdjointStackingAction->SetUserFwdStackingAction(fUserStackingAction);
243  else theAdjointStackingAction->SetUserFwdStackingAction(0);
244  theRunManager->G4RunManager::SetUserAction(theAdjointEventAction);
245  theRunManager->G4RunManager::SetUserAction(theAdjointSteppingAction);
246  theRunManager->G4RunManager::SetUserAction(theAdjointTrackingAction);
247  if (use_user_TrackingAction) theAdjointTrackingAction->SetUserForwardTrackingAction(fUserTrackingAction);
248  else theAdjointTrackingAction->SetUserForwardTrackingAction(0);
249 }
251 //
252 void G4AdjointSimManager::SetAdjointPrimaryRunAndStackingActions()
253 {
254  G4RunManager* theRunManager = G4RunManager::GetRunManager();
255 
256  if (!user_action_already_defined) DefineUserActions();
257 
258  //Replace the user action by the adjoint actions
259  //-------------------------------------------------
260 
261  theRunManager->G4RunManager::SetUserAction(theAdjointRunAction);
262  theRunManager->G4RunManager::SetUserAction(theAdjointPrimaryGeneratorAction);
263  theRunManager->G4RunManager::SetUserAction(theAdjointStackingAction);
264  if (use_user_StackingAction) theAdjointStackingAction->SetUserFwdStackingAction(fUserStackingAction);
265  else theAdjointStackingAction->SetUserFwdStackingAction(0);
266 }
268 //
269 void G4AdjointSimManager::ResetUserActions()
270 {
271  G4RunManager* theRunManager = G4RunManager::GetRunManager();
272 
273  //Restore the user defined actions
274  //-------------------------------
275  theRunManager->G4RunManager::SetUserAction(fUserRunAction);
276  theRunManager->G4RunManager::SetUserAction(fUserEventAction);
277  theRunManager->G4RunManager::SetUserAction(fUserSteppingAction);
278  theRunManager->G4RunManager::SetUserAction(fUserTrackingAction);
279  theRunManager->G4RunManager::SetUserAction(fUserPrimaryGeneratorAction);
280  theRunManager->G4RunManager::SetUserAction(fUserStackingAction);
281 }
283 //
284 void G4AdjointSimManager::ResetRestOfUserActions()
285 {
286  G4RunManager* theRunManager = G4RunManager::GetRunManager();
287 
288  //Restore the user defined actions
289  //-------------------------------
290 
291  theRunManager->G4RunManager::SetUserAction(fUserEventAction);
292  theRunManager->G4RunManager::SetUserAction(fUserSteppingAction);
293  theRunManager->G4RunManager::SetUserAction(fUserTrackingAction);
294 }
295 
297 //
298 void G4AdjointSimManager::ResetUserPrimaryRunAndStackingActions()
299 {
300  G4RunManager* theRunManager = G4RunManager::GetRunManager();
301  //Restore the user defined actions
302  //-------------------------------
303  theRunManager->G4RunManager::SetUserAction(fUserRunAction);
304  theRunManager->G4RunManager::SetUserAction(fUserPrimaryGeneratorAction);
305  theRunManager->G4RunManager::SetUserAction(fUserStackingAction);
306 }
308 //
309 void G4AdjointSimManager::DefineUserActions()
310 {
311  G4RunManager* theRunManager = G4RunManager::GetRunManager();
312  fUserTrackingAction= const_cast<G4UserTrackingAction* >( theRunManager->GetUserTrackingAction() );
313  fUserEventAction= const_cast<G4UserEventAction* >( theRunManager->GetUserEventAction() );
314  fUserSteppingAction= const_cast<G4UserSteppingAction* >( theRunManager->GetUserSteppingAction() );
315  theAdjointSteppingAction->SetUserForwardSteppingAction(fUserSteppingAction);
316  fUserPrimaryGeneratorAction= const_cast<G4VUserPrimaryGeneratorAction* >( theRunManager->GetUserPrimaryGeneratorAction() );
317  fUserRunAction= const_cast<G4UserRunAction*>( theRunManager->GetUserRunAction() );
318  fUserStackingAction= const_cast<G4UserStackingAction* >( theRunManager->GetUserStackingAction() );
319  user_action_already_defined=true;
320 }
322 //
324  return theAdjointTrackingAction->GetIsAdjointTrackingMode();
325 }
327 //
329 {
330  adjoint_tracking_mode = aBool;
331 
332  if (adjoint_tracking_mode) {
333  SetRestOfAdjointActions();
334  theAdjointStackingAction->SetAdjointMode(true);
335  theAdjointStackingAction->SetKillTracks(false);
336 
337  }
338  else {
339 
340  ResetRestOfUserActions();
341  theAdjointStackingAction->SetAdjointMode(false);
343  theAdjointStackingAction->SetKillTracks(false);
345  }
346  else theAdjointStackingAction->SetKillTracks(true);
347  }
348 }
350 //
352 {
354 }
355 
357 //
358 std::vector<G4ParticleDefinition*>* G4AdjointSimManager::GetListOfPrimaryFwdParticles()
359 {
360  return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
361 }
363 //
365 {
366  return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles()->size();
367 }
368 
370 //
372  return theAdjointTrackingAction->GetPositionAtEndOfLastAdjointTrack(i);
373 }
374 
376 //
378  return theAdjointTrackingAction->GetDirectionAtEndOfLastAdjointTrack(i);
379 }
381 //
383  return theAdjointTrackingAction->GetEkinAtEndOfLastAdjointTrack(i);
384 }
386 //
388  return theAdjointTrackingAction->GetEkinNucAtEndOfLastAdjointTrack(i);
389 }
391 //
393  return theAdjointTrackingAction->GetWeightAtEndOfLastAdjointTrack(i);
394 }
396 //
398  return theAdjointTrackingAction->GetCosthAtEndOfLastAdjointTrack(i);
399 }
401 //
403 {return theAdjointTrackingAction->GetFwdParticleNameAtEndOfLastAdjointTrack();
404 }
406 //
408  return theAdjointTrackingAction->GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(i);
409 }
410 
412 //
414 {return theAdjointTrackingAction->GetLastFwdParticleIndex(i);
415 }
417 //
419 {
420  return theAdjointTrackingAction->GetNbOfAdointTracksReachingTheExternalSurface();
421 }
423 //
425 {theAdjointTrackingAction->ClearEndOfAdjointTrackInfoVectors();
426 }
427 
429 //
431 {
432  last_pos = theAdjointSteppingAction->GetLastPosition();
433  last_direction = theAdjointSteppingAction->GetLastMomentum();
434  last_direction /=last_direction.mag();
435  last_cos_th = last_direction.z();
436  G4ParticleDefinition* aPartDef= theAdjointSteppingAction->GetLastPartDef();
437 
438  last_fwd_part_name= aPartDef->GetParticleName();
439 
440  last_fwd_part_name.remove(0,4);
441 
442  last_fwd_part_PDGEncoding=G4ParticleTable::GetParticleTable()->FindParticle(last_fwd_part_name)->GetPDGEncoding();
443 
444  std::vector<G4ParticleDefinition*>* aList = theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
445  last_fwd_part_index=-1;
446  size_t i=0;
447  while(i<aList->size() && last_fwd_part_index<0) {
448  if ((*aList)[i]->GetParticleName() == last_fwd_part_name) last_fwd_part_index=i;
449  i++;
450  }
451 
452  last_ekin = theAdjointSteppingAction->GetLastEkin();
453  last_ekin_nuc = last_ekin;
454  if (aPartDef->GetParticleType() == "adjoint_nucleus") {
455  nb_nuc=double(aPartDef->GetBaryonNumber());
456  last_ekin_nuc /=nb_nuc;
457  }
458 
459  last_weight = theAdjointSteppingAction->GetLastWeight();
460 
461 
462 
463  last_pos_vec.push_back(last_pos);
464  last_direction_vec.push_back(last_direction);
465  last_ekin_vec.push_back(last_ekin);
466  last_ekin_nuc_vec.push_back(last_ekin_nuc);
467  last_cos_th_vec.push_back(last_cos_th);
468  last_weight_vec.push_back(last_weight);
469  last_fwd_part_PDGEncoding_vec.push_back(last_fwd_part_PDGEncoding);
470  last_fwd_part_index_vec.push_back(last_fwd_part_index);
471  ID_of_last_particle_that_reach_the_ext_source++;
472  ID_of_last_particle_that_reach_the_ext_source_vec.push_back(ID_of_last_particle_that_reach_the_ext_source);
473 
474 
475 
476 
477 
478 
479  /* G4PhysicsLogVector* theWeightVector=0;
480  if (last_fwd_part_name =="e-") theWeightVector=electron_last_weight_vector;
481  else if (last_fwd_part_name =="gamma") theWeightVector=gamma_last_weight_vector;
482  else if (last_fwd_part_name =="proton") theWeightVector=proton_last_weight_vector;
483 
484  if (theWeightVector){
485 
486  size_t ind = size_t(std::log10(last_weight/theAdjointPrimaryWeight)*10. + 200);
487  G4double low_val =theWeightVector->GetLowEdgeEnergy(ind);
488  G4bool aBool = true;
489  G4double bin_weight = theWeightVector->GetValue(low_val, aBool)+1.;
490  theWeightVector->PutValue(ind, bin_weight);
491  }
492  */
493  /*if ((last_weight/theAdjointPrimaryWeight)>1.) last_weight*=1000. ;
494  else if ( (last_weight/theAdjointPrimaryWeight)>0.1) last_weight*=100. ;
495  else if ( (last_weight/theAdjointPrimaryWeight)>0.01) last_weight*=10. ;*/
496 
497 
498  //G4cout <<"Last Weight "<<last_weight<<'\t'<<theAdjointPrimaryWeight<<'\t'<<last_weight/theAdjointPrimaryWeight<<std::endl;
499  /*if (last_weight/theAdjointPrimaryWeight >10.) {
500  G4cout<<"Warning a weight increase by a factor : "<<last_weight/theAdjointPrimaryWeight<<std::endl;
501  }
502  */
503 
504 
505 }
507 //
509 {
510  G4double area;
511  return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("ExternalSource", radius, pos, area);
512 }
514 //
516 {
517  G4double area;
518  G4ThreeVector center;
519  return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "ExternalSource", radius, volume_name,center, area);
520 }
522 //
524 {
525  G4double area;
526  return G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "ExternalSource", volume_name,area);
527 }
529 //
531 {
532  theAdjointSteppingAction->SetExtSourceEMax(Emax);
533 }
535 //
537 {
538  G4double area;
539  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("AdjointSource", radius, pos, area);
540  theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, pos);
541  area_of_the_adjoint_source=area;
542  return aBool;
543 }
545 //
547 {
548  G4double area;
549  G4ThreeVector center;
550  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "AdjointSource", radius, volume_name,center, area);
551  theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, center);
552  area_of_the_adjoint_source=area;
553  return aBool;
554 }
556 //
558 {
559  G4double area;
560  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "AdjointSource", volume_name,area);
561  area_of_the_adjoint_source=area;
562  if (aBool) {
563  theAdjointPrimaryGeneratorAction->SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(volume_name);
564  }
565  return aBool;
566 }
568 //
570 {
571  theAdjointPrimaryGeneratorAction->SetEmin(Emin);
572 }
574 //
576 {
577  theAdjointPrimaryGeneratorAction->SetEmax(Emax);
578 }
580 //
582 {
583  theAdjointPrimaryGeneratorAction->ConsiderParticleAsPrimary(particle_name);
584 }
586 //
588 {
589  theAdjointPrimaryGeneratorAction->NeglectParticleAsPrimary(particle_name);
590 }
592 //
593 /*void G4AdjointSimManager::SetPrimaryIon(G4int Z, G4int A)
594 {
595  theAdjointPrimaryGeneratorAction->SetPrimaryIon(Z, A);
596 }
597 */
599 //
601 {
602  theAdjointPrimaryGeneratorAction->SetPrimaryIon(adjointIon, fwdIon);
603 }
605 //
607 {
608  return theAdjointPrimaryGeneratorAction->GetPrimaryIonName();
609 }
611 //
613 {
614  theAdjointPrimaryWeight = aWeight;
615  theAdjointSteppingAction->SetPrimWeight(aWeight);
616 }
617 
619 //
621 {
622  theAdjointEventAction = anAction;
623 }
625 //
627 {
628  theAdjointSteppingAction->SetUserAdjointSteppingAction(anAction);
629 }
631 //
633 {
634  theAdjointStackingAction->SetUserAdjointStackingAction(anAction);
635 }
636 
638 //
640 {
641  theAdjointRunAction=anAction;
642 }
644 //
646 {
647  theAdjointPrimaryGeneratorAction->SetNbPrimaryFwdGammasPerEvent(nb);
648 }
650 //
652 {
653  theAdjointPrimaryGeneratorAction->SetNbAdjointPrimaryGammasPerEvent(nb);
654 }
656 //
658 {
659  theAdjointPrimaryGeneratorAction->SetNbAdjointPrimaryElectronsPerEvent(nb);
660 }
662 //
664 {
665 /*
666  if (!adjoint_sim_mode){
667  if(fUserRunAction) fUserRunAction->BeginOfRunAction(aRun);
668  }
669  else {
670  if (theAdjointRunAction) theAdjointRunAction->BeginOfRunAction(aRun);
671  }
672  */
673 fUserRunAction->BeginOfRunAction(aRun);
674 }
676 //
678 {if (!adjoint_sim_mode){
679  if(fUserRunAction) fUserRunAction->EndOfRunAction(aRun);
680  }
681  else if (theAdjointRunAction) theAdjointRunAction->EndOfRunAction(aRun);
682 /*
683 #ifdef G4MULTITHREADED
684  if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::workerRM){
685  if (adjoint_sim_mode) BackToFwdSimulationMode();
686  }
687 #endif
688 */
689 
690 }
692 //
694  return theAdjointPrimaryGeneratorAction->GetLastGeneratedFwdPrimaryParticle();
695 }
697 //
699 {theAdjointSteppingAction->ResetDidOneAdjPartReachExtSourceDuringEvent();
700 }
701 
702 
static G4AdjointSimManager * GetInstance()
G4int GetLastFwdParticleIndex(size_t i=0)
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
G4double GetCosthAtEndOfLastAdjointTrack(size_t i=0)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4int GetFwdParticleIndexAtEndOfLastAdjointTrack(size_t i=0)
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()
G4bool AddaSphericalSurface(const G4String &SurfaceName, G4double radius, G4ThreeVector pos, G4double &area)
G4bool GetDidAdjParticleReachTheExtSource()
void SetAdjointSourceEmax(G4double Emax)
G4double GetEkinNucAtEndOfLastAdjointTrack(size_t i=0)
G4String & remove(str_size)
void SetAdjointStackingAction(G4UserStackingAction *anAction)
G4ThreeVector GetPositionAtEndOfLastAdjointTrack(size_t i=0)
virtual void EndOfRunAction(const G4Run *aRun)
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(size_t i=0)
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
G4bool DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()
void SetUserAdjointStackingAction(G4UserStackingAction *anAction)
G4bool DefineSphericalAdjointSource(G4double radius, G4ThreeVector pos)
G4ParticleDefinition * GetLastGeneratedFwdPrimaryParticle()
#define G4ThreadLocal
Definition: tls.hh:89
G4double GetCosthAtEndOfLastAdjointTrack(size_t i=0)
int G4int
Definition: G4Types.hh:78
const G4UserSteppingAction * GetUserSteppingAction() const
const G4String & GetParticleName() const
double z() const
virtual void EndOfRunAction(const G4Run *aRun)
void SetAdjointSourceEmin(G4double Emin)
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String &SurfaceName, G4double radius, const G4String &volume_name, G4ThreeVector &center, G4double &area)
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
void ConsiderParticleAsPrimary(const G4String &particle_name)
G4GLOB_DLL std::ostream G4cout
void SetAdjointTrackingMode(G4bool aBool)
const G4UserStackingAction * GetUserStackingAction() const
virtual void BeginOfRunAction(const G4Run *aRun)
G4bool DefineAdjointSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
bool G4bool
Definition: G4Types.hh:79
void SetNbOfPrimaryFwdGammasPerEvent(G4int)
G4double GetEkinNucAtEndOfLastAdjointTrack(size_t i=0)
Definition: G4Run.hh:46
const G4UserEventAction * GetUserEventAction() const
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(size_t i=0)
void RunAdjointSimulation(G4int nb_evt)
const G4UserTrackingAction * GetUserTrackingAction() const
const G4String & GetParticleType() const
size_t GetNbOfAdointTracksReachingTheExternalSurface()
void SetUserForwardSteppingAction(G4UserSteppingAction *anAction)
G4double GetWeightAtEndOfLastAdjointTrack(size_t i=0)
G4bool DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
const G4String & GetPrimaryIonName()
G4bool DefineSphericalExtSource(G4double radius, G4ThreeVector pos)
static G4AdjointCrossSurfChecker * GetInstance()
void SetPrimWeight(G4double weight)
G4ParticleDefinition * GetLastPartDef()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
G4double GetEkinAtEndOfLastAdjointTrack(size_t i=0)
void SetExtSourceEMax(G4double Emax)
void SetAdjointRunAction(G4UserRunAction *anAction)
G4bool AddanExtSurfaceOfAvolume(const G4String &SurfaceName, const G4String &volume_name, G4double &area)
void SetAdjointEventAction(G4UserEventAction *anAction)
static G4ParticleTable * GetParticleTable()
G4ThreeVector GetPositionAtEndOfLastAdjointTrack(size_t i=0)
void NeglectParticleAsPrimary(const G4String &particle_name)
void ConsiderParticleAsPrimary(const G4String &particle_name)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()
virtual void BeginOfRunAction(const G4Run *aRun)
static const G4double Emin
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(size_t i=0)
void RegisterAdjointPrimaryWeight(G4double aWeight)
G4bool DefineExtSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
static const G4double Emax
void SetNbAdjointPrimaryElectronsPerEvent(G4int)
void SetNbAdjointPrimaryGammasPerEvent(G4int)
void SetUserAdjointSteppingAction(G4UserSteppingAction *anAction)
G4ParticleDefinition * GetLastGeneratedFwdPrimaryParticle()
const G4UserRunAction * GetUserRunAction() const
void SetUserFwdStackingAction(G4UserStackingAction *anAction)
double G4double
Definition: G4Types.hh:76
void SetUserForwardTrackingAction(G4UserTrackingAction *anAction)
void SetExtSourceEmax(G4double Emax)
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(size_t i=0)
double mag() const
void SetAdjointSteppingAction(G4UserSteppingAction *anAction)
G4double GetEkinAtEndOfLastAdjointTrack(size_t i=0)
G4double GetWeightAtEndOfLastAdjointTrack(size_t i=0)
static const G4double pos
size_t GetNbOfAdointTracksReachingTheExternalSurface()
void NeglectParticleAsPrimary(const G4String &particle_name)
void ResetDidOneAdjPartReachExtSourceDuringEvent()