Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
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// G4AdjointCrossSurfChecker implementation
27//
28// --------------------------------------------------------------------
29// Class Name: G4AdjointCrossSurfChecker
30// Author: L. Desorgher, 2007-2009
31// Organisation: SpaceIT GmbH
32// Contract: ESA contract 21435/08/NL/AT
33// Customer: ESA/ESTEC
34// --------------------------------------------------------------------
35
37#include "G4Run.hh"
38#include "G4RunManager.hh"
39
40#include "G4UserEventAction.hh"
41#include "G4UserRunAction.hh"
46
51
53
55
56#include "G4ParticleTable.hh"
57#include "G4PhysicsLogVector.hh"
58
59// --------------------------------------------------------------------
60//
61G4ThreadLocal G4AdjointSimManager* G4AdjointSimManager::instance = nullptr;
62
63// --------------------------------------------------------------------
64//
65G4AdjointSimManager::G4AdjointSimManager()
66{
67 // Create adjoint actions;
68 //----------------------
69 theAdjointPrimaryGeneratorAction = new G4AdjointPrimaryGeneratorAction();
70 theAdjointSteppingAction = new G4AdjointSteppingAction();
71 theAdjointTrackingAction =
72 new G4AdjointTrackingAction(theAdjointSteppingAction);
73 theAdjointStackingAction =
74 new G4AdjointStackingAction(theAdjointTrackingAction);
75 theAdjointTrackingAction->SetListOfPrimaryFwdParticles(
76 theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles());
77
78 // Create messenger
79 //----------------
80 theMessenger = new G4AdjointSimMessenger(this);
81
82 // Define user action and set this class instance as RunAction
83 //----------------
84 // DefineUserActions();
85 // G4RunManager* theRunManager = G4RunManager::GetRunManager();
86
87 // theRunManager->G4RunManager::SetUserAction(this);
88}
89
90// --------------------------------------------------------------------
91//
92G4AdjointSimManager::~G4AdjointSimManager()
93{
94 delete theAdjointRunAction;
95 delete theAdjointPrimaryGeneratorAction;
96 delete theAdjointSteppingAction;
97 delete theAdjointEventAction;
98 delete theAdjointTrackingAction;
99 delete theAdjointStackingAction;
100 delete theMessenger;
101}
102
103// --------------------------------------------------------------------
104//
106{
107 if(instance == nullptr)
108 instance = new G4AdjointSimManager;
109 return instance;
110}
111
112// --------------------------------------------------------------------
113//
115{
116 if(G4RunManager::GetRunManager()->GetRunManagerType() !=
118 return; // only for sequential mode
119 if(welcome_message)
120 {
121 G4cout << "****************************************************************"
122 << std::endl;
123 G4cout << "*** Geant4 Reverse/Adjoint Monte Carlo mode ***"
124 << std::endl;
125 G4cout << "*** Author: L.Desorgher ***"
126 << std::endl;
127 G4cout << "*** Company: SpaceIT GmbH, Bern, Switzerland ***"
128 << std::endl;
129 G4cout << "*** Sponsored by: ESA/ESTEC contract contract 21435/08/NL/AT ***"
130 << std::endl;
131 G4cout << "****************************************************************"
132 << std::endl;
133 welcome_message = false;
134 }
135
136 // Switch to adjoint simulation mode
137 //---------------------------------------------------------
139
140 // Make the run
141 //------------
142 nb_evt_of_last_run = nb_evt;
144 ->BeamOn( G4int(nb_evt*theAdjointPrimaryGeneratorAction
145 ->GetNbOfAdjointPrimaryTypes()) );
146
147 // Back to Fwd Simulation Mode
148 //--------------------------------
150
151 /*
152 //Register the weight vector
153 //--------------------------
154 std::ofstream FileOutputElectronWeight("ElectronWeight.txt", std::ios::out);
155 FileOutputElectronWeight<<std::setiosflags(std::ios::scientific);
156 FileOutputElectronWeight<<std::setprecision(6);
157 G4bool aBool = electron_last_weight_vector->Store(FileOutputElectronWeight,
158 true); FileOutputElectronWeight.close();
159
160 std::ofstream FileOutputProtonWeight("ProtonWeight.txt", std::ios::out);
161 FileOutputProtonWeight<<std::setiosflags(std::ios::scientific);
162 FileOutputProtonWeight<<std::setprecision(6);
163 aBool = proton_last_weight_vector->Store(FileOutputProtonWeight, true);
164 FileOutputProtonWeight.close();
165
166 std::ofstream FileOutputGammaWeight("GammaWeight.txt", std::ios::out);
167 FileOutputGammaWeight<<std::setiosflags(std::ios::scientific);
168 FileOutputGammaWeight<<std::setprecision(6);
169 aBool = gamma_last_weight_vector->Store(FileOutputGammaWeight, true);
170 FileOutputGammaWeight.close();
171 */
172}
173
174// --------------------------------------------------------------------
175//
176void G4AdjointSimManager::SetRestOfAdjointActions()
177{
178 G4RunManager* theRunManager = G4RunManager::GetRunManager();
179
180 if(!user_action_already_defined)
181 DefineUserActions();
182
183 // Replace the user action by the adjoint actions
184 //-------------------------------------------------
185
186 theRunManager->G4RunManager::SetUserAction(theAdjointEventAction);
187 theRunManager->G4RunManager::SetUserAction(theAdjointSteppingAction);
188 theRunManager->G4RunManager::SetUserAction(theAdjointTrackingAction);
189}
190
191// --------------------------------------------------------------------
192//
194{
195 // Replace the user defined actions by the adjoint actions
196 //---------------------------------------------------------
197 SetAdjointActions();
198
199 // Update the list of primaries
200 //-----------------------------
201 theAdjointPrimaryGeneratorAction->UpdateListOfPrimaryParticles();
202 adjoint_sim_mode = true;
203 ID_of_last_particle_that_reach_the_ext_source = 0;
204}
205
206// --------------------------------------------------------------------
207//
209{
210 // Restore the user defined actions
211 //--------------------------------
212 ResetUserActions();
213 adjoint_sim_mode = false;
214}
215
216// --------------------------------------------------------------------
217//
218void G4AdjointSimManager::SetAdjointActions()
219{
220 G4RunManager* theRunManager = G4RunManager::GetRunManager();
221
222 if(!user_action_already_defined)
223 DefineUserActions();
224
225 // Replace the user action by the adjoint actions
226 //-------------------------------------------------
227 theRunManager->G4RunManager::SetUserAction(this);
228 theRunManager->G4RunManager::SetUserAction(theAdjointPrimaryGeneratorAction);
229 theRunManager->G4RunManager::SetUserAction(theAdjointStackingAction);
230 if(use_user_StackingAction)
231 theAdjointStackingAction->SetUserFwdStackingAction(fUserStackingAction);
232 else
233 theAdjointStackingAction->SetUserFwdStackingAction(0);
234 theRunManager->G4RunManager::SetUserAction(theAdjointEventAction);
235 theRunManager->G4RunManager::SetUserAction(theAdjointSteppingAction);
236 theRunManager->G4RunManager::SetUserAction(theAdjointTrackingAction);
237 if(use_user_TrackingAction)
238 theAdjointTrackingAction->SetUserForwardTrackingAction(fUserTrackingAction);
239 else
240 theAdjointTrackingAction->SetUserForwardTrackingAction(0);
241}
242
243// --------------------------------------------------------------------
244//
245void G4AdjointSimManager::SetAdjointPrimaryRunAndStackingActions()
246{
247 G4RunManager* theRunManager = G4RunManager::GetRunManager();
248
249 if(!user_action_already_defined)
250 DefineUserActions();
251
252 // Replace the user action by the adjoint actions
253 //-------------------------------------------------
254
255 theRunManager->G4RunManager::SetUserAction(theAdjointRunAction);
256 theRunManager->G4RunManager::SetUserAction(theAdjointPrimaryGeneratorAction);
257 theRunManager->G4RunManager::SetUserAction(theAdjointStackingAction);
258 if(use_user_StackingAction)
259 theAdjointStackingAction->SetUserFwdStackingAction(fUserStackingAction);
260 else
261 theAdjointStackingAction->SetUserFwdStackingAction(nullptr);
262}
263
264// --------------------------------------------------------------------
265//
266void G4AdjointSimManager::ResetUserActions()
267{
268 G4RunManager* theRunManager = G4RunManager::GetRunManager();
269
270 // Restore the user defined actions
271 //-------------------------------
272 theRunManager->G4RunManager::SetUserAction(fUserRunAction);
273 theRunManager->G4RunManager::SetUserAction(fUserEventAction);
274 theRunManager->G4RunManager::SetUserAction(fUserSteppingAction);
275 theRunManager->G4RunManager::SetUserAction(fUserTrackingAction);
276 theRunManager->G4RunManager::SetUserAction(fUserPrimaryGeneratorAction);
277 theRunManager->G4RunManager::SetUserAction(fUserStackingAction);
278}
279
280// --------------------------------------------------------------------
281//
282void G4AdjointSimManager::ResetRestOfUserActions()
283{
284 G4RunManager* theRunManager = G4RunManager::GetRunManager();
285
286 // Restore the user defined actions
287 //-------------------------------
288
289 theRunManager->G4RunManager::SetUserAction(fUserEventAction);
290 theRunManager->G4RunManager::SetUserAction(fUserSteppingAction);
291 theRunManager->G4RunManager::SetUserAction(fUserTrackingAction);
292}
293
294// --------------------------------------------------------------------
295//
296void G4AdjointSimManager::ResetUserPrimaryRunAndStackingActions()
297{
298 G4RunManager* theRunManager = G4RunManager::GetRunManager();
299 // Restore the user defined actions
300 //-------------------------------
301 theRunManager->G4RunManager::SetUserAction(fUserRunAction);
302 theRunManager->G4RunManager::SetUserAction(fUserPrimaryGeneratorAction);
303 theRunManager->G4RunManager::SetUserAction(fUserStackingAction);
304}
305
306// --------------------------------------------------------------------
307//
308void G4AdjointSimManager::DefineUserActions()
309{
310 G4RunManager* theRunManager = G4RunManager::GetRunManager();
311 fUserTrackingAction =
312 const_cast<G4UserTrackingAction*>(theRunManager->GetUserTrackingAction());
313 fUserEventAction =
314 const_cast<G4UserEventAction*>(theRunManager->GetUserEventAction());
315 fUserSteppingAction =
316 const_cast<G4UserSteppingAction*>(theRunManager->GetUserSteppingAction());
317 theAdjointSteppingAction->SetUserForwardSteppingAction(fUserSteppingAction);
318 fUserPrimaryGeneratorAction = const_cast<G4VUserPrimaryGeneratorAction*>(
319 theRunManager->GetUserPrimaryGeneratorAction());
320 fUserRunAction =
321 const_cast<G4UserRunAction*>(theRunManager->GetUserRunAction());
322 fUserStackingAction =
323 const_cast<G4UserStackingAction*>(theRunManager->GetUserStackingAction());
324 user_action_already_defined = true;
325}
326
327// --------------------------------------------------------------------
328//
330{
331 return theAdjointTrackingAction->GetIsAdjointTrackingMode();
332}
333
334// --------------------------------------------------------------------
335//
337 G4bool aBool) // could be removed
338{
339 adjoint_tracking_mode = aBool;
340
341 if(adjoint_tracking_mode)
342 {
343 SetRestOfAdjointActions();
344 theAdjointStackingAction->SetAdjointMode(true);
345 theAdjointStackingAction->SetKillTracks(false);
346 }
347 else
348 {
349 ResetRestOfUserActions();
350 theAdjointStackingAction->SetAdjointMode(false);
352 {
353 theAdjointStackingAction->SetKillTracks(false);
355 }
356 else
357 theAdjointStackingAction->SetKillTracks(true);
358 }
359}
360
361// --------------------------------------------------------------------
362//
364{
366}
367
368// --------------------------------------------------------------------
369//
370std::vector<G4ParticleDefinition*>*
372{
373 return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
374}
375
376// --------------------------------------------------------------------
377//
379{
380 return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles()
381 ->size();
382}
383
384// --------------------------------------------------------------------
385//
388{
389 return theAdjointTrackingAction->GetPositionAtEndOfLastAdjointTrack(i);
390}
391
392// --------------------------------------------------------------------
393//
396{
397 return theAdjointTrackingAction->GetDirectionAtEndOfLastAdjointTrack(i);
398}
399
400// --------------------------------------------------------------------
401//
404{
405 return theAdjointTrackingAction->GetEkinAtEndOfLastAdjointTrack(i);
406}
407
408// --------------------------------------------------------------------
409//
412{
413 return theAdjointTrackingAction->GetEkinNucAtEndOfLastAdjointTrack(i);
414}
415
416// --------------------------------------------------------------------
417//
420{
421 return theAdjointTrackingAction->GetWeightAtEndOfLastAdjointTrack(i);
422}
423
424// --------------------------------------------------------------------
425//
428{
429 return theAdjointTrackingAction->GetCosthAtEndOfLastAdjointTrack(i);
430}
431
432// --------------------------------------------------------------------
433//
435{
436 return theAdjointTrackingAction->GetFwdParticleNameAtEndOfLastAdjointTrack();
437}
438
439// --------------------------------------------------------------------
440//
443{
444 return theAdjointTrackingAction
446}
447
448// --------------------------------------------------------------------
449//
452{
453 return theAdjointTrackingAction->GetLastFwdParticleIndex(i);
454}
455
456// --------------------------------------------------------------------
457//
460{
461 return theAdjointTrackingAction
463}
464
465// --------------------------------------------------------------------
466//
468{
469 theAdjointTrackingAction->ClearEndOfAdjointTrackInfoVectors();
470}
471
472// --------------------------------------------------------------------
473//
475{
476 last_pos = theAdjointSteppingAction->GetLastPosition();
477 last_direction = theAdjointSteppingAction->GetLastMomentum();
478 last_direction /= last_direction.mag();
479 last_cos_th = last_direction.z();
480 G4ParticleDefinition* aPartDef = theAdjointSteppingAction->GetLastPartDef();
481
482 last_fwd_part_name = aPartDef->GetParticleName();
483
484 last_fwd_part_name.erase(0, 4);
485
486 last_fwd_part_PDGEncoding = G4ParticleTable::GetParticleTable()
487 ->FindParticle(last_fwd_part_name)
488 ->GetPDGEncoding();
489
490 std::vector<G4ParticleDefinition*>* aList =
491 theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
492 last_fwd_part_index = -1;
493 G4int i = 0;
494 while(i < (G4int)aList->size() && last_fwd_part_index < 0)
495 {
496 if((*aList)[i]->GetParticleName() == last_fwd_part_name)
497 last_fwd_part_index = i;
498 ++i;
499 }
500
501 last_ekin = theAdjointSteppingAction->GetLastEkin();
502 last_ekin_nuc = last_ekin;
503 if(aPartDef->GetParticleType() == "adjoint_nucleus")
504 {
505 nb_nuc = double(aPartDef->GetBaryonNumber());
506 last_ekin_nuc /= nb_nuc;
507 }
508
509 last_weight = theAdjointSteppingAction->GetLastWeight();
510
511 last_pos_vec.push_back(last_pos);
512 last_direction_vec.push_back(last_direction);
513 last_ekin_vec.push_back(last_ekin);
514 last_ekin_nuc_vec.push_back(last_ekin_nuc);
515 last_cos_th_vec.push_back(last_cos_th);
516 last_weight_vec.push_back(last_weight);
517 last_fwd_part_PDGEncoding_vec.push_back(last_fwd_part_PDGEncoding);
518 last_fwd_part_index_vec.push_back(last_fwd_part_index);
519 ID_of_last_particle_that_reach_the_ext_source++;
520 ID_of_last_particle_that_reach_the_ext_source_vec.push_back(
521 ID_of_last_particle_that_reach_the_ext_source);
522}
523
524// --------------------------------------------------------------------
525//
527 G4ThreeVector pos)
528{
529 G4double area;
531 "ExternalSource", radius, pos, area);
532}
533
534// --------------------------------------------------------------------
535//
536G4bool
538 G4double radius, const G4String& volume_name)
539{
540 G4double area;
541 G4ThreeVector center;
544 "ExternalSource", radius, volume_name, center, area);
545}
546
547// --------------------------------------------------------------------
548//
550 const G4String& volume_name)
551{
552 G4double area;
554 "ExternalSource", volume_name, area);
555}
556
557// --------------------------------------------------------------------
558//
560{
561 theAdjointSteppingAction->SetExtSourceEMax(Emax);
562}
563
564// --------------------------------------------------------------------
565//
567 G4ThreeVector pos)
568{
569 G4double area;
571 "AdjointSource", radius, pos, area);
572 theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius,
573 pos);
574 area_of_the_adjoint_source = area;
575 return aBool;
576}
577
578// --------------------------------------------------------------------
579//
580G4bool
582 G4double radius, const G4String& volume_name)
583{
584 G4double area;
585 G4ThreeVector center;
588 "AdjointSource", radius, volume_name, center, area);
589 theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius,
590 center);
591 area_of_the_adjoint_source = area;
592 return aBool;
593}
594
595// --------------------------------------------------------------------
596//
598 const G4String& volume_name)
599{
600 G4double area;
601 G4bool aBool =
603 "AdjointSource", volume_name, area);
604 area_of_the_adjoint_source = area;
605 if(aBool)
606 {
607 theAdjointPrimaryGeneratorAction
609 }
610 return aBool;
611}
612
613// --------------------------------------------------------------------
614//
616{
617 theAdjointPrimaryGeneratorAction->SetEmin(Emin);
618}
619
620// --------------------------------------------------------------------
621//
623{
624 theAdjointPrimaryGeneratorAction->SetEmax(Emax);
625}
626
627// --------------------------------------------------------------------
628//
630 const G4String& particle_name)
631{
632 theAdjointPrimaryGeneratorAction->ConsiderParticleAsPrimary(particle_name);
633}
634
635// --------------------------------------------------------------------
636//
638 const G4String& particle_name)
639{
640 theAdjointPrimaryGeneratorAction->NeglectParticleAsPrimary(particle_name);
641}
642
643// --------------------------------------------------------------------
644//
646 G4ParticleDefinition* fwdIon)
647{
648 theAdjointPrimaryGeneratorAction->SetPrimaryIon(adjointIon, fwdIon);
649}
650
651// --------------------------------------------------------------------
652//
654{
655 return theAdjointPrimaryGeneratorAction->GetPrimaryIonName();
656}
657
658// --------------------------------------------------------------------
659//
661{
662 theAdjointPrimaryWeight = aWeight;
663 theAdjointSteppingAction->SetPrimWeight(aWeight);
664}
665
666// --------------------------------------------------------------------
667//
669{
670 theAdjointEventAction = anAction;
671}
672
673// --------------------------------------------------------------------
674//
676 G4UserSteppingAction* anAction)
677{
678 theAdjointSteppingAction->SetUserAdjointSteppingAction(anAction);
679}
680
681// --------------------------------------------------------------------
682//
684 G4UserStackingAction* anAction)
685{
686 theAdjointStackingAction->SetUserAdjointStackingAction(anAction);
687}
688
689
690// --------------------------------------------------------------------
691//
693{
694 theAdjointRunAction = anAction;
695}
696
697// --------------------------------------------------------------------
698//
700{
701 theAdjointPrimaryGeneratorAction->SetNbPrimaryFwdGammasPerEvent(nb);
702}
703
704// --------------------------------------------------------------------
705//
707{
708 theAdjointPrimaryGeneratorAction->SetNbAdjointPrimaryGammasPerEvent(nb);
709}
710
711// --------------------------------------------------------------------
712//
714{
715 theAdjointPrimaryGeneratorAction->SetNbAdjointPrimaryElectronsPerEvent(nb);
716}
717
718// --------------------------------------------------------------------
719//
721{
722 /*
723 if (!adjoint_sim_mode){
724 if(fUserRunAction) fUserRunAction->BeginOfRunAction(aRun);
725 }
726 else {
727 if (theAdjointRunAction) theAdjointRunAction->BeginOfRunAction(aRun);
728 }
729 */
730 fUserRunAction->BeginOfRunAction(aRun);
731}
732
733// --------------------------------------------------------------------
734//
736{
737 if(!adjoint_sim_mode)
738 {
739 if(fUserRunAction)
740 fUserRunAction->EndOfRunAction(aRun);
741 }
742 else if(theAdjointRunAction)
743 theAdjointRunAction->EndOfRunAction(aRun);
744 /*
745 #ifdef G4MULTITHREADED
746 if (G4RunManager::GetRunManager()->GetRunManagerType() ==
747 G4RunManager::workerRM)
748 {
749 if (adjoint_sim_mode) BackToFwdSimulationMode();
750 }
751 #endif
752 */
753}
754
755// --------------------------------------------------------------------
756//
758{
759 return theAdjointPrimaryGeneratorAction->GetLastGeneratedFwdPrimaryParticle();
760}
761
762// --------------------------------------------------------------------
763//
765{
766 theAdjointSteppingAction->ResetDidOneAdjPartReachExtSourceDuringEvent();
767}
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
double z() const
double mag() const
G4bool AddaSphericalSurface(const G4String &SurfaceName, G4double radius, G4ThreeVector pos, G4double &area)
G4bool AddanExtSurfaceOfAvolume(const G4String &SurfaceName, const G4String &volume_name, G4double &area)
static G4AdjointCrossSurfChecker * GetInstance()
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String &SurfaceName, G4double radius, const G4String &volume_name, G4ThreeVector &center, G4double &area)
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()
void ConsiderParticleAsPrimary(const G4String &particle_name)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
G4ParticleDefinition * GetLastGeneratedFwdPrimaryParticle()
void NeglectParticleAsPrimary(const G4String &particle_name)
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
void SetAdjointStackingAction(G4UserStackingAction *anAction)
G4bool DefineAdjointSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
const G4String & GetPrimaryIonName()
G4bool DefineExtSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
G4double GetEkinAtEndOfLastAdjointTrack(std::size_t i=0)
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(std::size_t i=0)
G4bool GetDidAdjParticleReachTheExtSource()
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()
void RunAdjointSimulation(G4int nb_evt)
G4double GetCosthAtEndOfLastAdjointTrack(std::size_t i=0)
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()
G4bool DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
void SetNbAdjointPrimaryGammasPerEvent(G4int)
void SetAdjointTrackingMode(G4bool aBool)
void ConsiderParticleAsPrimary(const G4String &particle_name)
std::size_t GetNbOfPrimaryFwdParticles()
void SetAdjointRunAction(G4UserRunAction *anAction)
void SetExtSourceEmax(G4double Emax)
virtual void BeginOfRunAction(const G4Run *aRun)
void SetAdjointSourceEmax(G4double Emax)
void RegisterAdjointPrimaryWeight(G4double aWeight)
void SetAdjointSourceEmin(G4double Emin)
virtual void EndOfRunAction(const G4Run *aRun)
G4double GetWeightAtEndOfLastAdjointTrack(std::size_t i=0)
void ResetDidOneAdjPartReachExtSourceDuringEvent()
void SetAdjointEventAction(G4UserEventAction *anAction)
void NeglectParticleAsPrimary(const G4String &particle_name)
G4bool DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
void SetNbAdjointPrimaryElectronsPerEvent(G4int)
static G4AdjointSimManager * GetInstance()
G4int GetFwdParticleIndexAtEndOfLastAdjointTrack(std::size_t i=0)
G4double GetEkinNucAtEndOfLastAdjointTrack(std::size_t i=0)
void SetNbOfPrimaryFwdGammasPerEvent(G4int)
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(std::size_t i=0)
G4ParticleDefinition * GetLastGeneratedFwdPrimaryParticle()
void SetAdjointSteppingAction(G4UserSteppingAction *anAction)
G4bool DefineSphericalExtSource(G4double radius, G4ThreeVector pos)
G4ThreeVector GetPositionAtEndOfLastAdjointTrack(std::size_t i=0)
std::size_t GetNbOfAdointTracksReachingTheExternalSurface()
G4bool DefineSphericalAdjointSource(G4double radius, G4ThreeVector pos)
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
void SetUserFwdStackingAction(G4UserStackingAction *anAction)
void SetUserAdjointStackingAction(G4UserStackingAction *anAction)
G4ParticleDefinition * GetLastPartDef()
void SetUserForwardSteppingAction(G4UserSteppingAction *anAction)
void SetExtSourceEMax(G4double Emax)
void SetUserAdjointSteppingAction(G4UserSteppingAction *anAction)
void SetPrimWeight(G4double weight)
G4double GetEkinAtEndOfLastAdjointTrack(std::size_t i=0)
void SetListOfPrimaryFwdParticles(std::vector< G4ParticleDefinition * > *aListOfParticles)
G4double GetEkinNucAtEndOfLastAdjointTrack(std::size_t i=0)
G4ThreeVector GetPositionAtEndOfLastAdjointTrack(std::size_t i=0)
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(std::size_t i=0)
G4double GetWeightAtEndOfLastAdjointTrack(std::size_t i=0)
std::size_t GetNbOfAdointTracksReachingTheExternalSurface()
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(std::size_t i=0)
G4int GetLastFwdParticleIndex(std::size_t i=0)
G4double GetCosthAtEndOfLastAdjointTrack(std::size_t i=0)
void SetUserForwardTrackingAction(G4UserTrackingAction *anAction)
const G4String & GetParticleType() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
const G4UserTrackingAction * GetUserTrackingAction() const
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
const G4UserEventAction * GetUserEventAction() const
static G4RunManager * GetRunManager()
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)
const G4UserStackingAction * GetUserStackingAction() const
const G4UserSteppingAction * GetUserSteppingAction() const
const G4UserRunAction * GetUserRunAction() const
Definition: G4Run.hh:49
virtual void EndOfRunAction(const G4Run *aRun)
virtual void BeginOfRunAction(const G4Run *aRun)
#define G4ThreadLocal
Definition: tls.hh:77