Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 76245 2013-11-08 11:14:32Z gcosmo $
27 //
28 /////////////////////////////////////////////////////////////////////////////
29 // Class Name: G4AdjointCrossSurfChecker
30 // Author: L. Desorgher
31 // Organisation: SpaceIT GmbH
32 // Contract: ESA contract 21435/08/NL/AT
33 // Customer: ESA/ESTEC
34 /////////////////////////////////////////////////////////////////////////////
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 
64 ////////////////////////////////////////////////////////////////////////////////
65 //
66 G4ThreadLocal G4AdjointSimManager* G4AdjointSimManager::instance = 0;
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 //
70 G4AdjointSimManager::G4AdjointSimManager():
71  fUserRunAction(0), fUserEventAction(0),fUserPrimaryGeneratorAction(0),
72  fUserTrackingAction(0), fUserSteppingAction(0), fUserStackingAction(0),
73  theAdjointRunAction(0), theAdjointEventAction(0)
74 {
75  //instance =this;
76  G4cout<<"G4AdjointSimManager::G4AdjointSimManager() Here"<<std::endl;
77  //Create adjoint actions;
78  //----------------------
79  theAdjointPrimaryGeneratorAction = new G4AdjointPrimaryGeneratorAction();
80  theAdjointSteppingAction = new G4AdjointSteppingAction();
81  theAdjointStackingAction = new G4AdjointStackingAction();
82  theAdjointTrackingAction = new G4AdjointTrackingAction(theAdjointSteppingAction);
83 
84  //Create messenger
85  //----------------
86  theMessenger = new G4AdjointSimMessenger(this);
87 
88  user_action_already_defined=false;
89  use_user_StackingAction = false;
90 
91  adjoint_sim_mode = false;
92 
93  normalisation_mode=3;
94 
95  nb_nuc=1.;
96 
97  welcome_message =true;
98 
99  //Define user action and set this class instance as RunAction
100  //----------------
101  DefineUserActions();
102  G4RunManager* theRunManager = G4RunManager::GetRunManager();
103  theRunManager->SetUserAction(this);
104 /*
105 #ifdef G4MULTITHREADED
106 
107  if (theRunManager->GetRunManagerType() == G4RunManager::workerRM){
108  G4cout<<"Here"<<std::endl;
109  //G4MTAdjointSimManager::GetInstance()->RegisterLocalManager(this);
110  G4cout<<"Here1"<<std::endl;
111  }
112 #endif
113 */
114 }
115 ////////////////////////////////////////////////////////////////////////////////
116 //
117 G4AdjointSimManager::~G4AdjointSimManager()
118 {
119  if (theAdjointRunAction) delete theAdjointRunAction;
120  if (theAdjointPrimaryGeneratorAction) delete theAdjointPrimaryGeneratorAction;
121  if (theAdjointSteppingAction) delete theAdjointSteppingAction;
122  if (theAdjointEventAction) delete theAdjointEventAction;
123  if (theAdjointTrackingAction) delete theAdjointTrackingAction;
124  if (theAdjointStackingAction) delete theAdjointStackingAction;
125  if (theMessenger) delete theMessenger;
126 }
127 ////////////////////////////////////////////////////////////////////////////////
128 //
130 {
131  if (instance == 0) instance = new G4AdjointSimManager;
132  return instance;
133 }
134 ////////////////////////////////////////////////////////////////////////////////
135 //
137 { if (G4RunManager::GetRunManager()->GetRunManagerType() != G4RunManager::sequentialRM) return; //only for sequential mode
138  if (welcome_message) {
139  G4cout<<"****************************************************************"<<std::endl;
140  G4cout<<"*** Geant4 Reverse/Adjoint Monte Carlo mode ***"<<std::endl;
141  G4cout<<"*** Author: L.Desorgher ***"<<std::endl;
142  G4cout<<"*** Company: SpaceIT GmbH, Bern, Switzerland ***"<<std::endl;
143  G4cout<<"*** Sponsored by: ESA/ESTEC contract contract 21435/08/NL/AT ***"<<std::endl;
144  G4cout<<"****************************************************************"<<std::endl;
145  welcome_message=false;
146  }
147 
148  //Switch to adjoint simulation mode
149  //---------------------------------------------------------
151 
152  //Make the run
153  //------------
154 
155  nb_evt_of_last_run =nb_evt;
156  G4RunManager::GetRunManager()->BeamOn(nb_evt*theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes());
157  //G4RunManager::GetRunManager()->BeamOn(theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes()*2*nb_evt);
158 
159  //Back to Fwd Simulation Mode
160  //--------------------------------
162 
163  /*
164  //Register the weight vector
165  //--------------------------
166  std::ofstream FileOutputElectronWeight("ElectronWeight.txt", std::ios::out);
167  FileOutputElectronWeight<<std::setiosflags(std::ios::scientific);
168  FileOutputElectronWeight<<std::setprecision(6);
169  G4bool aBool = electron_last_weight_vector->Store(FileOutputElectronWeight, true);
170  FileOutputElectronWeight.close();
171 
172  std::ofstream FileOutputProtonWeight("ProtonWeight.txt", std::ios::out);
173  FileOutputProtonWeight<<std::setiosflags(std::ios::scientific);
174  FileOutputProtonWeight<<std::setprecision(6);
175  aBool = proton_last_weight_vector->Store(FileOutputProtonWeight, true);
176  FileOutputProtonWeight.close();
177 
178  std::ofstream FileOutputGammaWeight("GammaWeight.txt", std::ios::out);
179  FileOutputGammaWeight<<std::setiosflags(std::ios::scientific);
180  FileOutputGammaWeight<<std::setprecision(6);
181  aBool = gamma_last_weight_vector->Store(FileOutputGammaWeight, true);
182  FileOutputGammaWeight.close();
183  */
184 }
185 ////////////////////////////////////////////////////////////////////////////////
186 //
187 void G4AdjointSimManager::SetRestOfAdjointActions()
188 {
189  G4RunManager* theRunManager = G4RunManager::GetRunManager();
190 
191  if (!user_action_already_defined) DefineUserActions();
192 
193  //Replace the user action by the adjoint actions
194  //-------------------------------------------------
195 
196  theRunManager->SetUserAction(theAdjointEventAction);
197  theRunManager->SetUserAction(theAdjointSteppingAction);
198  theRunManager->SetUserAction(theAdjointTrackingAction);
199 
200 }
201 ////////////////////////////////////////////////////////////////////////////////
202 //
204 { //Replace the user defined actions by the adjoint actions
205  //---------------------------------------------------------
206  SetAdjointActions();
207 
208  //Update the list of primaries
209  //-----------------------------
210  theAdjointPrimaryGeneratorAction->UpdateListOfPrimaryParticles();
211  adjoint_sim_mode=true;
212  ID_of_last_particle_that_reach_the_ext_source=0;
213 }
214 ////////////////////////////////////////////////////////////////////////////////
215 //
217 { //Restore the user defined actions
218  //--------------------------------
219  ResetUserActions();
220  adjoint_sim_mode=false;
221 }
222 
223 ////////////////////////////////////////////////////////////////////////////////
224 //
225 void G4AdjointSimManager::SetAdjointActions()
226 {
227  G4RunManager* theRunManager = G4RunManager::GetRunManager();
228 
229  if (!user_action_already_defined) DefineUserActions();
230 
231  //Replace the user action by the adjoint actions
232  //-------------------------------------------------
233 
234  theRunManager->SetUserAction(theAdjointPrimaryGeneratorAction);
235  theRunManager->SetUserAction(theAdjointStackingAction);
236  if (use_user_StackingAction) theAdjointStackingAction->SetUserFwdStackingAction(fUserStackingAction);
237  else theAdjointStackingAction->SetUserFwdStackingAction(0);
238  if (theAdjointEventAction) theRunManager->SetUserAction(theAdjointEventAction);
239  theRunManager->SetUserAction(theAdjointSteppingAction);
240  theRunManager->SetUserAction(theAdjointTrackingAction);
241 }
242 ////////////////////////////////////////////////////////////////////////////////
243 //
244 void G4AdjointSimManager::SetAdjointPrimaryRunAndStackingActions()
245 {
246  G4RunManager* theRunManager = G4RunManager::GetRunManager();
247 
248  if (!user_action_already_defined) DefineUserActions();
249 
250  //Replace the user action by the adjoint actions
251  //-------------------------------------------------
252 
253  theRunManager->SetUserAction(theAdjointRunAction);
254  theRunManager->SetUserAction(theAdjointPrimaryGeneratorAction);
255  theRunManager->SetUserAction(theAdjointStackingAction);
256  if (use_user_StackingAction) theAdjointStackingAction->SetUserFwdStackingAction(fUserStackingAction);
257  else theAdjointStackingAction->SetUserFwdStackingAction(0);
258 }
259 ////////////////////////////////////////////////////////////////////////////////
260 //
261 void G4AdjointSimManager::ResetUserActions()
262 {
263  G4RunManager* theRunManager = G4RunManager::GetRunManager();
264 
265  //Restore the user defined actions
266  //-------------------------------
267 
268  theRunManager->SetUserAction(fUserEventAction);
269  theRunManager->SetUserAction(fUserSteppingAction);
270  theRunManager->SetUserAction(fUserTrackingAction);
271  theRunManager->SetUserAction(fUserPrimaryGeneratorAction);
272  theRunManager->SetUserAction(fUserStackingAction);
273 }
274 ////////////////////////////////////////////////////////////////////////////////
275 //
276 void G4AdjointSimManager::ResetRestOfUserActions()
277 {
278  G4RunManager* theRunManager = G4RunManager::GetRunManager();
279 
280  //Restore the user defined actions
281  //-------------------------------
282 
283  theRunManager->SetUserAction(fUserEventAction);
284  theRunManager->SetUserAction(fUserSteppingAction);
285  theRunManager->SetUserAction(fUserTrackingAction);
286 }
287 
288 ////////////////////////////////////////////////////////////////////////////////
289 //
290 void G4AdjointSimManager::ResetUserPrimaryRunAndStackingActions()
291 {
292  G4RunManager* theRunManager = G4RunManager::GetRunManager();
293  //Restore the user defined actions
294  //-------------------------------
295  theRunManager->SetUserAction(fUserRunAction);
296  theRunManager->SetUserAction(fUserPrimaryGeneratorAction);
297  theRunManager->SetUserAction(fUserStackingAction);
298 }
299 ////////////////////////////////////////////////////////////////////////////////
300 //
301 void G4AdjointSimManager::DefineUserActions()
302 {
303  G4RunManager* theRunManager = G4RunManager::GetRunManager();
304  fUserTrackingAction= const_cast<G4UserTrackingAction* >( theRunManager->GetUserTrackingAction() );
305  fUserEventAction= const_cast<G4UserEventAction* >( theRunManager->GetUserEventAction() );
306  fUserSteppingAction= const_cast<G4UserSteppingAction* >( theRunManager->GetUserSteppingAction() );
307  theAdjointSteppingAction->SetUserForwardSteppingAction(fUserSteppingAction);
308  fUserPrimaryGeneratorAction= const_cast<G4VUserPrimaryGeneratorAction* >( theRunManager->GetUserPrimaryGeneratorAction() );
309  fUserRunAction= const_cast<G4UserRunAction*>( theRunManager->GetUserRunAction() );
310  fUserStackingAction= const_cast<G4UserStackingAction* >( theRunManager->GetUserStackingAction() );
311  user_action_already_defined=true;
312 }
313 ///////////////////////////////////////////////////////////////////////////////
314 //
316 {
317  adjoint_tracking_mode = aBool;
318 
319  if (adjoint_tracking_mode) {
320  SetRestOfAdjointActions();
321  theAdjointStackingAction->SetAdjointMode(true);
322  theAdjointStackingAction->SetKillTracks(false);
323 
324  }
325  else {
326 
327  ResetRestOfUserActions();
328  theAdjointStackingAction->SetAdjointMode(false);
330  theAdjointStackingAction->SetKillTracks(false);
332  }
333  else theAdjointStackingAction->SetKillTracks(true);
334  }
335 }
336 ///////////////////////////////////////////////////////////////////////////////
337 //
339 {
340  return theAdjointSteppingAction->GetDidAdjParticleReachTheExtSource();
341 }
342 ///////////////////////////////////////////////////////////////////////////////
343 //
344 std::vector<G4ParticleDefinition*> G4AdjointSimManager::GetListOfPrimaryFwdParticles()
345 {
346  return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
347 }
348 ///////////////////////////////////////////////////////////////////////////////
349 //
351 {
352  return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles().size();
353 }
354 
355 ///////////////////////////////////////////////////////////////////////////////
356 //
358  return theAdjointTrackingAction->GetPositionAtEndOfLastAdjointTrack();
359 }
360 
361 ///////////////////////////////////////////////////////////////////////////////
362 //
364  return theAdjointTrackingAction->GetDirectionAtEndOfLastAdjointTrack();
365 }
366 //////////////////////////////////////////////////////////////////////////////
367 //
369  return theAdjointTrackingAction->GetEkinAtEndOfLastAdjointTrack();
370 }
371 ///////////////////////////////////////////////////////////////////////////////
372 //
374  return theAdjointTrackingAction->GetEkinNucAtEndOfLastAdjointTrack();
375 }
376 ///////////////////////////////////////////////////////////////////////////////
377 //
379  return theAdjointTrackingAction->GetWeightAtEndOfLastAdjointTrack();
380 }
381 ///////////////////////////////////////////////////////////////////////////////
382 //
384  return theAdjointTrackingAction->GetCosthAtEndOfLastAdjointTrack();
385 }
386 ///////////////////////////////////////////////////////////////////////////////
387 //
389 {return theAdjointTrackingAction->GetFwdParticleNameAtEndOfLastAdjointTrack();
390 }
391 ///////////////////////////////////////////////////////////////////////////////
392 //
394  return theAdjointTrackingAction->GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack();
395 }
396 
397 ///////////////////////////////////////////////////////////////////////////////
398 //
400 {
401  last_pos = theAdjointSteppingAction->GetLastPosition();
402  last_direction = theAdjointSteppingAction->GetLastMomentum();
403  last_direction /=last_direction.mag();
404  last_cos_th = last_direction.z();
405  G4ParticleDefinition* aPartDef= theAdjointSteppingAction->GetLastPartDef();
406 
407  last_fwd_part_name= aPartDef->GetParticleName();
408 
409  last_fwd_part_name.remove(0,4);
410 
411  last_fwd_part_PDGEncoding=G4ParticleTable::GetParticleTable()->FindParticle(last_fwd_part_name)->GetPDGEncoding();
412 
413  std::vector<G4ParticleDefinition*> aList = theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
414  last_fwd_part_index=-1;
415  size_t i=0;
416  while(i<aList.size() && last_fwd_part_index<0) {
417  if (aList[i]->GetParticleName() == last_fwd_part_name) last_fwd_part_index=i;
418  i++;
419  }
420 
421  last_ekin = theAdjointSteppingAction->GetLastEkin();
422  last_ekin_nuc = last_ekin;
423  if (aPartDef->GetParticleType() == "adjoint_nucleus") {
424  nb_nuc=double(aPartDef->GetBaryonNumber());
425  last_ekin_nuc /=nb_nuc;
426  }
427 
428  last_weight = theAdjointSteppingAction->GetLastWeight();
429 
430  /* G4PhysicsLogVector* theWeightVector=0;
431  if (last_fwd_part_name =="e-") theWeightVector=electron_last_weight_vector;
432  else if (last_fwd_part_name =="gamma") theWeightVector=gamma_last_weight_vector;
433  else if (last_fwd_part_name =="proton") theWeightVector=proton_last_weight_vector;
434 
435  if (theWeightVector){
436 
437  size_t ind = size_t(std::log10(last_weight/theAdjointPrimaryWeight)*10. + 200);
438  G4double low_val =theWeightVector->GetLowEdgeEnergy(ind);
439  G4bool aBool = true;
440  G4double bin_weight = theWeightVector->GetValue(low_val, aBool)+1.;
441  theWeightVector->PutValue(ind, bin_weight);
442  }
443  */
444  /*if ((last_weight/theAdjointPrimaryWeight)>1.) last_weight*=1000. ;
445  else if ( (last_weight/theAdjointPrimaryWeight)>0.1) last_weight*=100. ;
446  else if ( (last_weight/theAdjointPrimaryWeight)>0.01) last_weight*=10. ;*/
447 
448 
449  //G4cout <<"Last Weight "<<last_weight<<'\t'<<theAdjointPrimaryWeight<<'\t'<<last_weight/theAdjointPrimaryWeight<<std::endl;
450  /*if (last_weight/theAdjointPrimaryWeight >10.) {
451  G4cout<<"Warning a weight increase by a factor : "<<last_weight/theAdjointPrimaryWeight<<std::endl;
452  }
453  */
454 
455  ID_of_last_particle_that_reach_the_ext_source++;
456 }
457 ///////////////////////////////////////////////////////////////////////////////
458 //
460 {
461  G4double area;
462  return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("ExternalSource", radius, pos, area);
463 }
464 ///////////////////////////////////////////////////////////////////////////////
465 //
467 {
468  G4double area;
469  G4ThreeVector center;
470  return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "ExternalSource", radius, volume_name,center, area);
471 }
472 ///////////////////////////////////////////////////////////////////////////////
473 //
475 {
476  G4double area;
477  return G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "ExternalSource", volume_name,area);
478 }
479 ///////////////////////////////////////////////////////////////////////////////
480 //
482 {
483  theAdjointSteppingAction->SetExtSourceEMax(Emax);
484 }
485 ///////////////////////////////////////////////////////////////////////////////
486 //
488 {
489  G4double area;
490  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("AdjointSource", radius, pos, area);
491  theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, pos);
492  area_of_the_adjoint_source=area;
493  return aBool;
494 }
495 ///////////////////////////////////////////////////////////////////////////////
496 //
498 {
499  G4double area;
500  G4ThreeVector center;
501  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "AdjointSource", radius, volume_name,center, area);
502  theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, center);
503  area_of_the_adjoint_source=area;
504  return aBool;
505 }
506 ///////////////////////////////////////////////////////////////////////////////
507 //
509 {
510  G4double area;
511  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "AdjointSource", volume_name,area);
512  area_of_the_adjoint_source=area;
513  if (aBool) {
514  theAdjointPrimaryGeneratorAction->SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(volume_name);
515  }
516  return aBool;
517 }
518 ///////////////////////////////////////////////////////////////////////////////
519 //
521 {
522  theAdjointPrimaryGeneratorAction->SetEmin(Emin);
523 }
524 ///////////////////////////////////////////////////////////////////////////////
525 //
527 {
528  theAdjointPrimaryGeneratorAction->SetEmax(Emax);
529 }
530 ///////////////////////////////////////////////////////////////////////////////
531 //
533 {
534  theAdjointPrimaryGeneratorAction->ConsiderParticleAsPrimary(particle_name);
535 }
536 ///////////////////////////////////////////////////////////////////////////////
537 //
539 {
540  theAdjointPrimaryGeneratorAction->NeglectParticleAsPrimary(particle_name);
541 }
542 ///////////////////////////////////////////////////////////////////////////////
543 //
544 /*void G4AdjointSimManager::SetPrimaryIon(G4int Z, G4int A)
545 {
546  theAdjointPrimaryGeneratorAction->SetPrimaryIon(Z, A);
547 }
548 */
549 ///////////////////////////////////////////////////////////////////////////////
550 //
552 {
553  theAdjointPrimaryGeneratorAction->SetPrimaryIon(adjointIon, fwdIon);
554 }
555 ///////////////////////////////////////////////////////////////////////////////
556 //
558 {
559  return theAdjointPrimaryGeneratorAction->GetPrimaryIonName();
560 }
561 ///////////////////////////////////////////////////////////////////////////////
562 //
564 {
565  theAdjointPrimaryWeight = aWeight;
566  theAdjointSteppingAction->SetPrimWeight(aWeight);
567 }
568 
569 ///////////////////////////////////////////////////////////////////////////////
570 //
572 {
573  theAdjointEventAction = anAction;
574 }
575 ///////////////////////////////////////////////////////////////////////////////
576 //
578 {
579  theAdjointSteppingAction->SetUserAdjointSteppingAction(anAction);
580 }
581 ///////////////////////////////////////////////////////////////////////////////
582 //
584 {
585  theAdjointStackingAction->SetUserAdjointStackingAction(anAction);
586 }
587 
588 ///////////////////////////////////////////////////////////////////////////////
589 //
591 {
592  theAdjointRunAction=anAction;
593 }
594 ///////////////////////////////////////////////////////////////////////////////
595 //
596 ///////////////////////////////////////////////////////////////////////////////
597 //
599 {
600 G4cout<<"G4AdjointSimManager::BeginOfRunAction"<<std::endl;
601 
602  if (!adjoint_sim_mode){
603  if(fUserRunAction) fUserRunAction->BeginOfRunAction(aRun);
604  }
605  else {
606  if (theAdjointRunAction) theAdjointRunAction->BeginOfRunAction(aRun);
607  }
608 }
609 ///////////////////////////////////////////////////////////////////////////////
610 //
612 {if (!adjoint_sim_mode){
613  if(fUserRunAction) fUserRunAction->EndOfRunAction(aRun);
614  }
615  else if (theAdjointRunAction) theAdjointRunAction->EndOfRunAction(aRun);
616 /*
617 #ifdef G4MULTITHREADED
618  if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::workerRM){
619  if (adjoint_sim_mode) BackToFwdSimulationMode();
620  }
621 #endif
622 */
623 
624 }
static G4AdjointSimManager * GetInstance()
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4bool AddaSphericalSurface(const G4String &SurfaceName, G4double radius, G4ThreeVector pos, G4double &area)
G4bool GetDidAdjParticleReachTheExtSource()
void SetAdjointSourceEmax(G4double Emax)
G4String & remove(str_size)
void SetAdjointStackingAction(G4UserStackingAction *anAction)
virtual void EndOfRunAction(const G4Run *aRun)
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack()
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
G4bool DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack()
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()
void SetUserAdjointStackingAction(G4UserStackingAction *anAction)
G4bool DefineSphericalAdjointSource(G4double radius, G4ThreeVector pos)
#define G4ThreadLocal
Definition: tls.hh:52
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)
G4double GetEkinAtEndOfLastAdjointTrack()
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
Definition: G4Run.hh:46
const G4UserEventAction * GetUserEventAction() const
void RunAdjointSimulation(G4int nb_evt)
G4double GetCosthAtEndOfLastAdjointTrack()
const G4UserTrackingAction * GetUserTrackingAction() const
const G4String & GetParticleType() const
void SetUserForwardSteppingAction(G4UserSteppingAction *anAction)
G4bool DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
const G4String & GetPrimaryIonName()
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack()
G4bool DefineSphericalExtSource(G4double radius, G4ThreeVector pos)
static G4AdjointCrossSurfChecker * GetInstance()
void SetPrimWeight(G4double weight)
G4ParticleDefinition * GetLastPartDef()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
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()
G4double GetEkinNucAtEndOfLastAdjointTrack()
std::vector< G4ParticleDefinition * > GetListOfPrimaryFwdParticles()
void NeglectParticleAsPrimary(const G4String &particle_name)
void ConsiderParticleAsPrimary(const G4String &particle_name)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
G4double GetWeightAtEndOfLastAdjointTrack()
virtual void BeginOfRunAction(const G4Run *aRun)
void RegisterAdjointPrimaryWeight(G4double aWeight)
G4bool DefineExtSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
void SetUserAdjointSteppingAction(G4UserSteppingAction *anAction)
const G4UserRunAction * GetUserRunAction() const
void SetUserFwdStackingAction(G4UserStackingAction *anAction)
double G4double
Definition: G4Types.hh:76
G4ThreeVector GetPositionAtEndOfLastAdjointTrack()
void SetExtSourceEmax(G4double Emax)
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
double mag() const
G4ThreeVector GetPositionAtEndOfLastAdjointTrack()
void SetAdjointSteppingAction(G4UserSteppingAction *anAction)
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack()
void NeglectParticleAsPrimary(const G4String &particle_name)
std::vector< G4ParticleDefinition * > GetListOfPrimaryFwdParticles()
virtual void SetUserAction(G4UserRunAction *userAction)