Geant4-11
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes
G4AdjointSimManager Class Reference

#include <G4AdjointSimManager.hh>

Inheritance diagram for G4AdjointSimManager:
G4UserRunAction

Public Member Functions

void BackToFwdSimulationMode ()
 
virtual void BeginOfRunAction (const G4Run *aRun)
 
void ClearEndOfAdjointTrackInfoVectors ()
 
void ConsiderParticleAsPrimary (const G4String &particle_name)
 
G4bool DefineAdjointSourceOnTheExtSurfaceOfAVolume (const G4String &volume_name)
 
G4bool DefineExtSourceOnTheExtSurfaceOfAVolume (const G4String &volume_name)
 
G4bool DefineSphericalAdjointSource (G4double radius, G4ThreeVector pos)
 
G4bool DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume (G4double radius, const G4String &volume_name)
 
G4bool DefineSphericalExtSource (G4double radius, G4ThreeVector pos)
 
G4bool DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume (G4double radius, const G4String &volume_name)
 
virtual void EndOfRunAction (const G4Run *aRun)
 
virtual G4RunGenerateRun ()
 
G4bool GetAdjointSimMode ()
 
G4double GetAdjointSourceArea ()
 
G4bool GetAdjointTrackingMode ()
 
G4double GetCosthAtEndOfLastAdjointTrack (std::size_t i=0)
 
G4bool GetDidAdjParticleReachTheExtSource ()
 
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack (std::size_t i=0)
 
G4double GetEkinAtEndOfLastAdjointTrack (std::size_t i=0)
 
G4double GetEkinNucAtEndOfLastAdjointTrack (std::size_t i=0)
 
G4int GetFwdParticleIndexAtEndOfLastAdjointTrack (std::size_t i=0)
 
const G4StringGetFwdParticleNameAtEndOfLastAdjointTrack ()
 
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack (std::size_t i=0)
 
G4int GetIDOfLastAdjParticleReachingExtSource ()
 
G4ParticleDefinitionGetLastGeneratedFwdPrimaryParticle ()
 
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles ()
 
G4int GetNbEvtOfLastRun ()
 
std::size_t GetNbOfAdointTracksReachingTheExternalSurface ()
 
std::size_t GetNbOfPrimaryFwdParticles ()
 
G4int GetNormalisationMode ()
 
G4double GetNumberNucleonsInIon ()
 
G4ThreeVector GetPositionAtEndOfLastAdjointTrack (std::size_t i=0)
 
const G4StringGetPrimaryIonName ()
 
G4double GetWeightAtEndOfLastAdjointTrack (std::size_t i=0)
 
G4bool IsMaster () const
 
void NeglectParticleAsPrimary (const G4String &particle_name)
 
void RegisterAdjointPrimaryWeight (G4double aWeight)
 
void RegisterAtEndOfAdjointTrack ()
 
void ResetDidOneAdjPartReachExtSourceDuringEvent ()
 
void RunAdjointSimulation (G4int nb_evt)
 
void SetAdjointEventAction (G4UserEventAction *anAction)
 
void SetAdjointRunAction (G4UserRunAction *anAction)
 
void SetAdjointSourceEmax (G4double Emax)
 
void SetAdjointSourceEmin (G4double Emin)
 
void SetAdjointStackingAction (G4UserStackingAction *anAction)
 
void SetAdjointSteppingAction (G4UserSteppingAction *anAction)
 
void SetAdjointTrackingMode (G4bool aBool)
 
void SetExtSourceEmax (G4double Emax)
 
virtual void SetMaster (G4bool val=true)
 
void SetNbAdjointPrimaryElectronsPerEvent (G4int)
 
void SetNbAdjointPrimaryGammasPerEvent (G4int)
 
void SetNbOfPrimaryFwdGammasPerEvent (G4int)
 
void SetNormalisationMode (G4int n)
 
void SetPrimaryIon (G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
 
void SwitchToAdjointSimulationMode ()
 
void UseUserStackingActionInFwdTrackingPhase (G4bool aBool)
 
void UseUserTrackingActionInFwdTrackingPhase (G4bool aBool)
 

Static Public Member Functions

static G4AdjointSimManagerGetInstance ()
 

Protected Attributes

G4bool isMaster = true
 

Private Member Functions

void DefineUserActions ()
 
 G4AdjointSimManager ()
 
void ResetRestOfUserActions ()
 
void ResetUserActions ()
 
void ResetUserPrimaryRunAndStackingActions ()
 
void SetAdjointActions ()
 
void SetAdjointPrimaryRunAndStackingActions ()
 
void SetRestOfAdjointActions ()
 
 ~G4AdjointSimManager ()
 

Private Attributes

G4bool adjoint_sim_mode = false
 
G4bool adjoint_tracking_mode = false
 
G4double area_of_the_adjoint_source = 0.0
 
G4UserEventActionfUserEventAction = nullptr
 
G4VUserPrimaryGeneratorActionfUserPrimaryGeneratorAction = nullptr
 
G4UserRunActionfUserRunAction = nullptr
 
G4UserStackingActionfUserStackingAction = nullptr
 
G4UserSteppingActionfUserSteppingAction = nullptr
 
G4UserTrackingActionfUserTrackingAction = nullptr
 
G4int ID_of_last_particle_that_reach_the_ext_source = 0
 
std::vector< G4intID_of_last_particle_that_reach_the_ext_source_vec
 
G4double last_cos_th = 0.0
 
std::vector< G4doublelast_cos_th_vec
 
G4ThreeVector last_direction
 
std::vector< G4ThreeVectorlast_direction_vec
 
G4double last_ekin = 0.0
 
G4double last_ekin_nuc = 0.0
 
std::vector< G4doublelast_ekin_nuc_vec
 
std::vector< G4doublelast_ekin_vec
 
G4int last_fwd_part_index = 0
 
std::vector< G4intlast_fwd_part_index_vec
 
G4String last_fwd_part_name
 
G4int last_fwd_part_PDGEncoding = 0
 
std::vector< G4intlast_fwd_part_PDGEncoding_vec
 
G4ThreeVector last_pos
 
std::vector< G4ThreeVectorlast_pos_vec
 
G4double last_weight = 0.0
 
std::vector< G4doublelast_weight_vec
 
G4int nb_evt_of_last_run = 0
 
G4double nb_nuc = 1.0
 
G4int normalisation_mode = 3
 
G4UserEventActiontheAdjointEventAction = nullptr
 
G4AdjointPrimaryGeneratorActiontheAdjointPrimaryGeneratorAction = nullptr
 
G4double theAdjointPrimaryWeight = 0.0
 
G4UserRunActiontheAdjointRunAction = nullptr
 
G4AdjointStackingActiontheAdjointStackingAction = nullptr
 
G4AdjointSteppingActiontheAdjointSteppingAction = nullptr
 
G4AdjointTrackingActiontheAdjointTrackingAction = nullptr
 
G4AdjointSimMessengertheMessenger = nullptr
 
G4bool use_user_StackingAction = false
 
G4bool use_user_TrackingAction = false
 
G4bool user_action_already_defined = false
 
G4bool welcome_message = true
 

Static Private Attributes

static G4ThreadLocal G4AdjointSimManagerinstance = nullptr
 

Detailed Description

Definition at line 162 of file G4AdjointSimManager.hh.

Constructor & Destructor Documentation

◆ G4AdjointSimManager()

G4AdjointSimManager::G4AdjointSimManager ( )
private

Definition at line 65 of file G4AdjointSimManager.cc.

66{
67 // Create adjoint actions;
68 //----------------------
77
78 // Create messenger
79 //----------------
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}
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()
G4AdjointSteppingAction * theAdjointSteppingAction
G4AdjointStackingAction * theAdjointStackingAction
G4AdjointSimMessenger * theMessenger
G4AdjointTrackingAction * theAdjointTrackingAction
G4AdjointPrimaryGeneratorAction * theAdjointPrimaryGeneratorAction
void SetListOfPrimaryFwdParticles(std::vector< G4ParticleDefinition * > *aListOfParticles)

References G4AdjointPrimaryGeneratorAction::GetListOfPrimaryFwdParticles(), G4AdjointTrackingAction::SetListOfPrimaryFwdParticles(), theAdjointPrimaryGeneratorAction, theAdjointStackingAction, theAdjointSteppingAction, theAdjointTrackingAction, and theMessenger.

Referenced by GetInstance().

◆ ~G4AdjointSimManager()

G4AdjointSimManager::~G4AdjointSimManager ( )
private

Member Function Documentation

◆ BackToFwdSimulationMode()

void G4AdjointSimManager::BackToFwdSimulationMode ( )

Definition at line 207 of file G4AdjointSimManager.cc.

208{
209 // Restore the user defined actions
210 //--------------------------------
212 adjoint_sim_mode = false;
213}

References adjoint_sim_mode, and ResetUserActions().

Referenced by RunAdjointSimulation().

◆ BeginOfRunAction()

void G4AdjointSimManager::BeginOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 719 of file G4AdjointSimManager.cc.

720{
721 /*
722 if (!adjoint_sim_mode){
723 if(fUserRunAction) fUserRunAction->BeginOfRunAction(aRun);
724 }
725 else {
726 if (theAdjointRunAction) theAdjointRunAction->BeginOfRunAction(aRun);
727 }
728 */
730}
G4UserRunAction * fUserRunAction
virtual void BeginOfRunAction(const G4Run *aRun)

References G4UserRunAction::BeginOfRunAction(), and fUserRunAction.

◆ ClearEndOfAdjointTrackInfoVectors()

void G4AdjointSimManager::ClearEndOfAdjointTrackInfoVectors ( )

◆ ConsiderParticleAsPrimary()

void G4AdjointSimManager::ConsiderParticleAsPrimary ( const G4String particle_name)

◆ DefineAdjointSourceOnTheExtSurfaceOfAVolume()

G4bool G4AdjointSimManager::DefineAdjointSourceOnTheExtSurfaceOfAVolume ( const G4String volume_name)

Definition at line 596 of file G4AdjointSimManager.cc.

598{
599 G4double area;
600 G4bool aBool =
602 "AdjointSource", volume_name, area);
604 if(aBool)
605 {
608 }
609 return aBool;
610}
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
G4bool AddanExtSurfaceOfAvolume(const G4String &SurfaceName, const G4String &volume_name, G4double &area)
static G4AdjointCrossSurfChecker * GetInstance()
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)

References G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(), area_of_the_adjoint_source, G4AdjointCrossSurfChecker::GetInstance(), G4AdjointPrimaryGeneratorAction::SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(), and theAdjointPrimaryGeneratorAction.

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineExtSourceOnTheExtSurfaceOfAVolume()

G4bool G4AdjointSimManager::DefineExtSourceOnTheExtSurfaceOfAVolume ( const G4String volume_name)

◆ DefineSphericalAdjointSource()

G4bool G4AdjointSimManager::DefineSphericalAdjointSource ( G4double  radius,
G4ThreeVector  pos 
)

Definition at line 565 of file G4AdjointSimManager.cc.

567{
568 G4double area;
570 "AdjointSource", radius, pos, area);
572 pos);
574 return aBool;
575}
static const G4double pos
G4bool AddaSphericalSurface(const G4String &SurfaceName, G4double radius, G4ThreeVector pos, G4double &area)
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)

References G4AdjointCrossSurfChecker::AddaSphericalSurface(), area_of_the_adjoint_source, G4AdjointCrossSurfChecker::GetInstance(), pos, G4AdjointPrimaryGeneratorAction::SetSphericalAdjointPrimarySource(), and theAdjointPrimaryGeneratorAction.

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume()

G4bool G4AdjointSimManager::DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume ( G4double  radius,
const G4String volume_name 
)

Definition at line 580 of file G4AdjointSimManager.cc.

582{
583 G4double area;
584 G4ThreeVector center;
587 "AdjointSource", radius, volume_name, center, area);
589 center);
591 return aBool;
592}
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String &SurfaceName, G4double radius, const G4String &volume_name, G4ThreeVector &center, G4double &area)

References G4AdjointCrossSurfChecker::AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(), area_of_the_adjoint_source, G4AdjointCrossSurfChecker::GetInstance(), G4AdjointPrimaryGeneratorAction::SetSphericalAdjointPrimarySource(), and theAdjointPrimaryGeneratorAction.

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineSphericalExtSource()

G4bool G4AdjointSimManager::DefineSphericalExtSource ( G4double  radius,
G4ThreeVector  pos 
)

◆ DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume()

G4bool G4AdjointSimManager::DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume ( G4double  radius,
const G4String volume_name 
)

◆ DefineUserActions()

void G4AdjointSimManager::DefineUserActions ( )
private

Definition at line 307 of file G4AdjointSimManager.cc.

308{
309 G4RunManager* theRunManager = G4RunManager::GetRunManager();
311 const_cast<G4UserTrackingAction*>(theRunManager->GetUserTrackingAction());
313 const_cast<G4UserEventAction*>(theRunManager->GetUserEventAction());
315 const_cast<G4UserSteppingAction*>(theRunManager->GetUserSteppingAction());
318 theRunManager->GetUserPrimaryGeneratorAction());
320 const_cast<G4UserRunAction*>(theRunManager->GetUserRunAction());
322 const_cast<G4UserStackingAction*>(theRunManager->GetUserStackingAction());
324}
G4UserTrackingAction * fUserTrackingAction
G4UserSteppingAction * fUserSteppingAction
G4UserEventAction * fUserEventAction
G4VUserPrimaryGeneratorAction * fUserPrimaryGeneratorAction
G4UserStackingAction * fUserStackingAction
void SetUserForwardSteppingAction(G4UserSteppingAction *anAction)
const G4UserTrackingAction * GetUserTrackingAction() const
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
const G4UserEventAction * GetUserEventAction() const
static G4RunManager * GetRunManager()
const G4UserStackingAction * GetUserStackingAction() const
const G4UserSteppingAction * GetUserSteppingAction() const
const G4UserRunAction * GetUserRunAction() const

References fUserEventAction, fUserPrimaryGeneratorAction, fUserRunAction, fUserStackingAction, fUserSteppingAction, fUserTrackingAction, G4RunManager::GetRunManager(), G4RunManager::GetUserEventAction(), G4RunManager::GetUserPrimaryGeneratorAction(), G4RunManager::GetUserRunAction(), G4RunManager::GetUserStackingAction(), G4RunManager::GetUserSteppingAction(), G4RunManager::GetUserTrackingAction(), G4AdjointSteppingAction::SetUserForwardSteppingAction(), theAdjointSteppingAction, and user_action_already_defined.

Referenced by SetAdjointActions(), SetAdjointPrimaryRunAndStackingActions(), and SetRestOfAdjointActions().

◆ EndOfRunAction()

void G4AdjointSimManager::EndOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 734 of file G4AdjointSimManager.cc.

735{
737 {
740 }
741 else if(theAdjointRunAction)
743 /*
744 #ifdef G4MULTITHREADED
745 if (G4RunManager::GetRunManager()->GetRunManagerType() ==
746 G4RunManager::workerRM)
747 {
748 if (adjoint_sim_mode) BackToFwdSimulationMode();
749 }
750 #endif
751 */
752}
virtual void EndOfRunAction(const G4Run *aRun)

References adjoint_sim_mode, G4UserRunAction::EndOfRunAction(), fUserRunAction, and theAdjointRunAction.

◆ GenerateRun()

G4Run * G4UserRunAction::GenerateRun ( )
virtualinherited

◆ GetAdjointSimMode()

G4bool G4AdjointSimManager::GetAdjointSimMode ( )
inline

Definition at line 178 of file G4AdjointSimManager.hh.

179 {
180 return adjoint_sim_mode;
181 } // true if an adjoint simulation is running

References adjoint_sim_mode.

◆ GetAdjointSourceArea()

G4double G4AdjointSimManager::GetAdjointSourceArea ( )
inline

◆ GetAdjointTrackingMode()

G4bool G4AdjointSimManager::GetAdjointTrackingMode ( )

◆ GetCosthAtEndOfLastAdjointTrack()

G4double G4AdjointSimManager::GetCosthAtEndOfLastAdjointTrack ( std::size_t  i = 0)

◆ GetDidAdjParticleReachTheExtSource()

G4bool G4AdjointSimManager::GetDidAdjParticleReachTheExtSource ( )

Definition at line 362 of file G4AdjointSimManager.cc.

363{
365}
std::size_t GetNbOfAdointTracksReachingTheExternalSurface()

References GetNbOfAdointTracksReachingTheExternalSurface().

Referenced by SetAdjointTrackingMode().

◆ GetDirectionAtEndOfLastAdjointTrack()

G4ThreeVector G4AdjointSimManager::GetDirectionAtEndOfLastAdjointTrack ( std::size_t  i = 0)

◆ GetEkinAtEndOfLastAdjointTrack()

G4double G4AdjointSimManager::GetEkinAtEndOfLastAdjointTrack ( std::size_t  i = 0)

◆ GetEkinNucAtEndOfLastAdjointTrack()

G4double G4AdjointSimManager::GetEkinNucAtEndOfLastAdjointTrack ( std::size_t  i = 0)

◆ GetFwdParticleIndexAtEndOfLastAdjointTrack()

G4int G4AdjointSimManager::GetFwdParticleIndexAtEndOfLastAdjointTrack ( std::size_t  i = 0)

◆ GetFwdParticleNameAtEndOfLastAdjointTrack()

const G4String & G4AdjointSimManager::GetFwdParticleNameAtEndOfLastAdjointTrack ( )

◆ GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack()

G4int G4AdjointSimManager::GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack ( std::size_t  i = 0)

◆ GetIDOfLastAdjParticleReachingExtSource()

G4int G4AdjointSimManager::GetIDOfLastAdjParticleReachingExtSource ( )
inline

◆ GetInstance()

G4AdjointSimManager * G4AdjointSimManager::GetInstance ( )
static

Definition at line 105 of file G4AdjointSimManager.cc.

106{
107 if(instance == nullptr)
109 return instance;
110}
static G4ThreadLocal G4AdjointSimManager * instance

References G4AdjointSimManager(), and instance.

Referenced by G4AdjointPrimaryGeneratorAction::ComputeEnergyDistWeight(), and G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ GetLastGeneratedFwdPrimaryParticle()

G4ParticleDefinition * G4AdjointSimManager::GetLastGeneratedFwdPrimaryParticle ( )

◆ GetListOfPrimaryFwdParticles()

std::vector< G4ParticleDefinition * > * G4AdjointSimManager::GetListOfPrimaryFwdParticles ( )

◆ GetNbEvtOfLastRun()

G4int G4AdjointSimManager::GetNbEvtOfLastRun ( )
inline

◆ GetNbOfAdointTracksReachingTheExternalSurface()

std::size_t G4AdjointSimManager::GetNbOfAdointTracksReachingTheExternalSurface ( )

◆ GetNbOfPrimaryFwdParticles()

std::size_t G4AdjointSimManager::GetNbOfPrimaryFwdParticles ( )

◆ GetNormalisationMode()

G4int G4AdjointSimManager::GetNormalisationMode ( )
inline

Definition at line 235 of file G4AdjointSimManager.hh.

References normalisation_mode.

◆ GetNumberNucleonsInIon()

G4double G4AdjointSimManager::GetNumberNucleonsInIon ( )
inline

Definition at line 236 of file G4AdjointSimManager.hh.

236{ return nb_nuc; }

References nb_nuc.

◆ GetPositionAtEndOfLastAdjointTrack()

G4ThreeVector G4AdjointSimManager::GetPositionAtEndOfLastAdjointTrack ( std::size_t  i = 0)

◆ GetPrimaryIonName()

const G4String & G4AdjointSimManager::GetPrimaryIonName ( )

◆ GetWeightAtEndOfLastAdjointTrack()

G4double G4AdjointSimManager::GetWeightAtEndOfLastAdjointTrack ( std::size_t  i = 0)

◆ IsMaster()

G4bool G4UserRunAction::IsMaster ( ) const
inlineinherited

Definition at line 64 of file G4UserRunAction.hh.

64{ return isMaster; }

References G4UserRunAction::isMaster.

◆ NeglectParticleAsPrimary()

void G4AdjointSimManager::NeglectParticleAsPrimary ( const G4String particle_name)

◆ RegisterAdjointPrimaryWeight()

void G4AdjointSimManager::RegisterAdjointPrimaryWeight ( G4double  aWeight)

◆ RegisterAtEndOfAdjointTrack()

void G4AdjointSimManager::RegisterAtEndOfAdjointTrack ( )

Definition at line 473 of file G4AdjointSimManager.cc.

474{
480
482
483 last_fwd_part_name.erase(0, 4);
484
487 ->GetPDGEncoding();
488
489 std::vector<G4ParticleDefinition*>* aList =
492 std::size_t i = 0;
493 while(i < aList->size() && last_fwd_part_index < 0)
494 {
495 if((*aList)[i]->GetParticleName() == last_fwd_part_name)
497 ++i;
498 }
499
502 if(aPartDef->GetParticleType() == "adjoint_nucleus")
503 {
504 nb_nuc = double(aPartDef->GetBaryonNumber());
506 }
507
509
510 last_pos_vec.push_back(last_pos);
512 last_ekin_vec.push_back(last_ekin);
514 last_cos_th_vec.push_back(last_cos_th);
515 last_weight_vec.push_back(last_weight);
521}
double z() const
double mag() const
std::vector< G4int > ID_of_last_particle_that_reach_the_ext_source_vec
std::vector< G4ThreeVector > last_pos_vec
std::vector< G4int > last_fwd_part_index_vec
std::vector< G4int > last_fwd_part_PDGEncoding_vec
std::vector< G4double > last_cos_th_vec
std::vector< G4double > last_weight_vec
std::vector< G4double > last_ekin_nuc_vec
std::vector< G4double > last_ekin_vec
std::vector< G4ThreeVector > last_direction_vec
G4ParticleDefinition * GetLastPartDef()
const G4String & GetParticleType() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()

References G4ParticleTable::FindParticle(), G4ParticleDefinition::GetBaryonNumber(), G4AdjointSteppingAction::GetLastEkin(), G4AdjointSteppingAction::GetLastMomentum(), G4AdjointSteppingAction::GetLastPartDef(), G4AdjointSteppingAction::GetLastPosition(), G4AdjointSteppingAction::GetLastWeight(), G4AdjointPrimaryGeneratorAction::GetListOfPrimaryFwdParticles(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetParticleType(), G4ParticleDefinition::GetPDGEncoding(), ID_of_last_particle_that_reach_the_ext_source, ID_of_last_particle_that_reach_the_ext_source_vec, last_cos_th, last_cos_th_vec, last_direction, last_direction_vec, last_ekin, last_ekin_nuc, last_ekin_nuc_vec, last_ekin_vec, last_fwd_part_index, last_fwd_part_index_vec, last_fwd_part_name, last_fwd_part_PDGEncoding, last_fwd_part_PDGEncoding_vec, last_pos, last_pos_vec, last_weight, last_weight_vec, CLHEP::Hep3Vector::mag(), nb_nuc, theAdjointPrimaryGeneratorAction, theAdjointSteppingAction, and CLHEP::Hep3Vector::z().

Referenced by SetAdjointTrackingMode().

◆ ResetDidOneAdjPartReachExtSourceDuringEvent()

void G4AdjointSimManager::ResetDidOneAdjPartReachExtSourceDuringEvent ( )

◆ ResetRestOfUserActions()

void G4AdjointSimManager::ResetRestOfUserActions ( )
private

Definition at line 281 of file G4AdjointSimManager.cc.

282{
283 G4RunManager* theRunManager = G4RunManager::GetRunManager();
284
285 // Restore the user defined actions
286 //-------------------------------
287
288 theRunManager->G4RunManager::SetUserAction(fUserEventAction);
289 theRunManager->G4RunManager::SetUserAction(fUserSteppingAction);
290 theRunManager->G4RunManager::SetUserAction(fUserTrackingAction);
291}

References fUserEventAction, fUserSteppingAction, fUserTrackingAction, and G4RunManager::GetRunManager().

Referenced by SetAdjointTrackingMode().

◆ ResetUserActions()

void G4AdjointSimManager::ResetUserActions ( )
private

Definition at line 265 of file G4AdjointSimManager.cc.

266{
267 G4RunManager* theRunManager = G4RunManager::GetRunManager();
268
269 // Restore the user defined actions
270 //-------------------------------
271 theRunManager->G4RunManager::SetUserAction(fUserRunAction);
272 theRunManager->G4RunManager::SetUserAction(fUserEventAction);
273 theRunManager->G4RunManager::SetUserAction(fUserSteppingAction);
274 theRunManager->G4RunManager::SetUserAction(fUserTrackingAction);
275 theRunManager->G4RunManager::SetUserAction(fUserPrimaryGeneratorAction);
276 theRunManager->G4RunManager::SetUserAction(fUserStackingAction);
277}

References fUserEventAction, fUserPrimaryGeneratorAction, fUserRunAction, fUserStackingAction, fUserSteppingAction, fUserTrackingAction, and G4RunManager::GetRunManager().

Referenced by BackToFwdSimulationMode().

◆ ResetUserPrimaryRunAndStackingActions()

void G4AdjointSimManager::ResetUserPrimaryRunAndStackingActions ( )
private

Definition at line 295 of file G4AdjointSimManager.cc.

296{
297 G4RunManager* theRunManager = G4RunManager::GetRunManager();
298 // Restore the user defined actions
299 //-------------------------------
300 theRunManager->G4RunManager::SetUserAction(fUserRunAction);
301 theRunManager->G4RunManager::SetUserAction(fUserPrimaryGeneratorAction);
302 theRunManager->G4RunManager::SetUserAction(fUserStackingAction);
303}

References fUserPrimaryGeneratorAction, fUserRunAction, fUserStackingAction, and G4RunManager::GetRunManager().

◆ RunAdjointSimulation()

void G4AdjointSimManager::RunAdjointSimulation ( G4int  nb_evt)

Definition at line 114 of file G4AdjointSimManager.cc.

115{
116 if(G4RunManager::GetRunManager()->GetRunManagerType() !=
118 return; // only for sequential mode
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;
145
146 // Back to Fwd Simulation Mode
147 //--------------------------------
149
150 /*
151 //Register the weight vector
152 //--------------------------
153 std::ofstream FileOutputElectronWeight("ElectronWeight.txt", std::ios::out);
154 FileOutputElectronWeight<<std::setiosflags(std::ios::scientific);
155 FileOutputElectronWeight<<std::setprecision(6);
156 G4bool aBool = electron_last_weight_vector->Store(FileOutputElectronWeight,
157 true); FileOutputElectronWeight.close();
158
159 std::ofstream FileOutputProtonWeight("ProtonWeight.txt", std::ios::out);
160 FileOutputProtonWeight<<std::setiosflags(std::ios::scientific);
161 FileOutputProtonWeight<<std::setprecision(6);
162 aBool = proton_last_weight_vector->Store(FileOutputProtonWeight, true);
163 FileOutputProtonWeight.close();
164
165 std::ofstream FileOutputGammaWeight("GammaWeight.txt", std::ios::out);
166 FileOutputGammaWeight<<std::setiosflags(std::ios::scientific);
167 FileOutputGammaWeight<<std::setprecision(6);
168 aBool = gamma_last_weight_vector->Store(FileOutputGammaWeight, true);
169 FileOutputGammaWeight.close();
170 */
171}
G4GLOB_DLL std::ostream G4cout
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)

References BackToFwdSimulationMode(), G4RunManager::BeamOn(), G4cout, G4AdjointPrimaryGeneratorAction::GetNbOfAdjointPrimaryTypes(), G4RunManager::GetRunManager(), nb_evt_of_last_run, G4RunManager::sequentialRM, SwitchToAdjointSimulationMode(), theAdjointPrimaryGeneratorAction, and welcome_message.

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetAdjointActions()

void G4AdjointSimManager::SetAdjointActions ( )
private

Definition at line 217 of file G4AdjointSimManager.cc.

218{
219 G4RunManager* theRunManager = G4RunManager::GetRunManager();
220
223
224 // Replace the user action by the adjoint actions
225 //-------------------------------------------------
226 theRunManager->G4RunManager::SetUserAction(this);
227 theRunManager->G4RunManager::SetUserAction(theAdjointPrimaryGeneratorAction);
228 theRunManager->G4RunManager::SetUserAction(theAdjointStackingAction);
231 else
233 theRunManager->G4RunManager::SetUserAction(theAdjointEventAction);
234 theRunManager->G4RunManager::SetUserAction(theAdjointSteppingAction);
235 theRunManager->G4RunManager::SetUserAction(theAdjointTrackingAction);
238 else
240}
void SetUserFwdStackingAction(G4UserStackingAction *anAction)
void SetUserForwardTrackingAction(G4UserTrackingAction *anAction)

References DefineUserActions(), fUserStackingAction, fUserTrackingAction, G4RunManager::GetRunManager(), G4AdjointTrackingAction::SetUserForwardTrackingAction(), G4AdjointStackingAction::SetUserFwdStackingAction(), theAdjointEventAction, theAdjointPrimaryGeneratorAction, theAdjointStackingAction, theAdjointSteppingAction, theAdjointTrackingAction, use_user_StackingAction, use_user_TrackingAction, and user_action_already_defined.

Referenced by SwitchToAdjointSimulationMode().

◆ SetAdjointEventAction()

void G4AdjointSimManager::SetAdjointEventAction ( G4UserEventAction anAction)

Definition at line 667 of file G4AdjointSimManager.cc.

668{
669 theAdjointEventAction = anAction;
670}

References theAdjointEventAction.

◆ SetAdjointPrimaryRunAndStackingActions()

void G4AdjointSimManager::SetAdjointPrimaryRunAndStackingActions ( )
private

Definition at line 244 of file G4AdjointSimManager.cc.

245{
246 G4RunManager* theRunManager = G4RunManager::GetRunManager();
247
250
251 // Replace the user action by the adjoint actions
252 //-------------------------------------------------
253
254 theRunManager->G4RunManager::SetUserAction(theAdjointRunAction);
255 theRunManager->G4RunManager::SetUserAction(theAdjointPrimaryGeneratorAction);
256 theRunManager->G4RunManager::SetUserAction(theAdjointStackingAction);
259 else
261}

References DefineUserActions(), fUserStackingAction, G4RunManager::GetRunManager(), G4AdjointStackingAction::SetUserFwdStackingAction(), theAdjointPrimaryGeneratorAction, theAdjointRunAction, theAdjointStackingAction, use_user_StackingAction, and user_action_already_defined.

◆ SetAdjointRunAction()

void G4AdjointSimManager::SetAdjointRunAction ( G4UserRunAction anAction)

Definition at line 691 of file G4AdjointSimManager.cc.

692{
693 theAdjointRunAction = anAction;
694}

References theAdjointRunAction.

◆ SetAdjointSourceEmax()

void G4AdjointSimManager::SetAdjointSourceEmax ( G4double  Emax)

◆ SetAdjointSourceEmin()

void G4AdjointSimManager::SetAdjointSourceEmin ( G4double  Emin)

◆ SetAdjointStackingAction()

void G4AdjointSimManager::SetAdjointStackingAction ( G4UserStackingAction anAction)

◆ SetAdjointSteppingAction()

void G4AdjointSimManager::SetAdjointSteppingAction ( G4UserSteppingAction anAction)

◆ SetAdjointTrackingMode()

void G4AdjointSimManager::SetAdjointTrackingMode ( G4bool  aBool)

Definition at line 335 of file G4AdjointSimManager.cc.

References adjoint_tracking_mode, GetDidAdjParticleReachTheExtSource(), RegisterAtEndOfAdjointTrack(), ResetRestOfUserActions(), G4AdjointStackingAction::SetAdjointMode(), G4AdjointStackingAction::SetKillTracks(), SetRestOfAdjointActions(), and theAdjointStackingAction.

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ SetExtSourceEmax()

void G4AdjointSimManager::SetExtSourceEmax ( G4double  Emax)

◆ SetMaster()

virtual void G4UserRunAction::SetMaster ( G4bool  val = true)
inlinevirtualinherited

◆ SetNbAdjointPrimaryElectronsPerEvent()

void G4AdjointSimManager::SetNbAdjointPrimaryElectronsPerEvent ( G4int  nb)

◆ SetNbAdjointPrimaryGammasPerEvent()

void G4AdjointSimManager::SetNbAdjointPrimaryGammasPerEvent ( G4int  nb)

◆ SetNbOfPrimaryFwdGammasPerEvent()

void G4AdjointSimManager::SetNbOfPrimaryFwdGammasPerEvent ( G4int  nb)

◆ SetNormalisationMode()

void G4AdjointSimManager::SetNormalisationMode ( G4int  n)
inline

Definition at line 234 of file G4AdjointSimManager.hh.

References CLHEP::detail::n, and normalisation_mode.

◆ SetPrimaryIon()

void G4AdjointSimManager::SetPrimaryIon ( G4ParticleDefinition adjointIon,
G4ParticleDefinition fwdIon 
)

Definition at line 644 of file G4AdjointSimManager.cc.

646{
648}
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)

References G4AdjointPrimaryGeneratorAction::SetPrimaryIon(), and theAdjointPrimaryGeneratorAction.

◆ SetRestOfAdjointActions()

void G4AdjointSimManager::SetRestOfAdjointActions ( )
private

Definition at line 175 of file G4AdjointSimManager.cc.

176{
177 G4RunManager* theRunManager = G4RunManager::GetRunManager();
178
181
182 // Replace the user action by the adjoint actions
183 //-------------------------------------------------
184
185 theRunManager->G4RunManager::SetUserAction(theAdjointEventAction);
186 theRunManager->G4RunManager::SetUserAction(theAdjointSteppingAction);
187 theRunManager->G4RunManager::SetUserAction(theAdjointTrackingAction);
188}

References DefineUserActions(), G4RunManager::GetRunManager(), theAdjointEventAction, theAdjointSteppingAction, theAdjointTrackingAction, and user_action_already_defined.

Referenced by SetAdjointTrackingMode().

◆ SwitchToAdjointSimulationMode()

void G4AdjointSimManager::SwitchToAdjointSimulationMode ( )

Definition at line 192 of file G4AdjointSimManager.cc.

193{
194 // Replace the user defined actions by the adjoint actions
195 //---------------------------------------------------------
197
198 // Update the list of primaries
199 //-----------------------------
201 adjoint_sim_mode = true;
203}

References adjoint_sim_mode, ID_of_last_particle_that_reach_the_ext_source, SetAdjointActions(), theAdjointPrimaryGeneratorAction, and G4AdjointPrimaryGeneratorAction::UpdateListOfPrimaryParticles().

Referenced by RunAdjointSimulation().

◆ UseUserStackingActionInFwdTrackingPhase()

void G4AdjointSimManager::UseUserStackingActionInFwdTrackingPhase ( G4bool  aBool)
inline

Definition at line 247 of file G4AdjointSimManager.hh.

248 {
250 }

References use_user_StackingAction.

◆ UseUserTrackingActionInFwdTrackingPhase()

void G4AdjointSimManager::UseUserTrackingActionInFwdTrackingPhase ( G4bool  aBool)
inline

Definition at line 251 of file G4AdjointSimManager.hh.

252 {
254 }

References use_user_TrackingAction.

Field Documentation

◆ adjoint_sim_mode

G4bool G4AdjointSimManager::adjoint_sim_mode = false
private

◆ adjoint_tracking_mode

G4bool G4AdjointSimManager::adjoint_tracking_mode = false
private

Definition at line 324 of file G4AdjointSimManager.hh.

Referenced by SetAdjointTrackingMode().

◆ area_of_the_adjoint_source

G4double G4AdjointSimManager::area_of_the_adjoint_source = 0.0
private

◆ fUserEventAction

G4UserEventAction* G4AdjointSimManager::fUserEventAction = nullptr
private

◆ fUserPrimaryGeneratorAction

G4VUserPrimaryGeneratorAction* G4AdjointSimManager::fUserPrimaryGeneratorAction = nullptr
private

◆ fUserRunAction

G4UserRunAction* G4AdjointSimManager::fUserRunAction = nullptr
private

◆ fUserStackingAction

G4UserStackingAction* G4AdjointSimManager::fUserStackingAction = nullptr
private

◆ fUserSteppingAction

G4UserSteppingAction* G4AdjointSimManager::fUserSteppingAction = nullptr
private

◆ fUserTrackingAction

G4UserTrackingAction* G4AdjointSimManager::fUserTrackingAction = nullptr
private

◆ ID_of_last_particle_that_reach_the_ext_source

G4int G4AdjointSimManager::ID_of_last_particle_that_reach_the_ext_source = 0
private

◆ ID_of_last_particle_that_reach_the_ext_source_vec

std::vector<G4int> G4AdjointSimManager::ID_of_last_particle_that_reach_the_ext_source_vec
private

Definition at line 337 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ instance

G4ThreadLocal G4AdjointSimManager * G4AdjointSimManager::instance = nullptr
staticprivate

Definition at line 280 of file G4AdjointSimManager.hh.

Referenced by GetInstance().

◆ isMaster

G4bool G4UserRunAction::isMaster = true
protectedinherited

Definition at line 68 of file G4UserRunAction.hh.

Referenced by G4UserRunAction::IsMaster(), and G4UserRunAction::SetMaster().

◆ last_cos_th

G4double G4AdjointSimManager::last_cos_th = 0.0
private

Definition at line 343 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_cos_th_vec

std::vector<G4double> G4AdjointSimManager::last_cos_th_vec
private

Definition at line 333 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_direction

G4ThreeVector G4AdjointSimManager::last_direction
private

Definition at line 340 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_direction_vec

std::vector<G4ThreeVector> G4AdjointSimManager::last_direction_vec
private

Definition at line 330 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_ekin

G4double G4AdjointSimManager::last_ekin = 0.0
private

Definition at line 341 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_ekin_nuc

G4double G4AdjointSimManager::last_ekin_nuc = 0.0
private

Definition at line 341 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_ekin_nuc_vec

std::vector<G4double> G4AdjointSimManager::last_ekin_nuc_vec
private

Definition at line 332 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_ekin_vec

std::vector<G4double> G4AdjointSimManager::last_ekin_vec
private

Definition at line 331 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_fwd_part_index

G4int G4AdjointSimManager::last_fwd_part_index = 0
private

Definition at line 346 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_fwd_part_index_vec

std::vector<G4int> G4AdjointSimManager::last_fwd_part_index_vec
private

Definition at line 336 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_fwd_part_name

G4String G4AdjointSimManager::last_fwd_part_name
private

Definition at line 344 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_fwd_part_PDGEncoding

G4int G4AdjointSimManager::last_fwd_part_PDGEncoding = 0
private

Definition at line 345 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_fwd_part_PDGEncoding_vec

std::vector<G4int> G4AdjointSimManager::last_fwd_part_PDGEncoding_vec
private

Definition at line 335 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_pos

G4ThreeVector G4AdjointSimManager::last_pos
private

Definition at line 339 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_pos_vec

std::vector<G4ThreeVector> G4AdjointSimManager::last_pos_vec
private

Definition at line 329 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_weight

G4double G4AdjointSimManager::last_weight = 0.0
private

Definition at line 347 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ last_weight_vec

std::vector<G4double> G4AdjointSimManager::last_weight_vec
private

Definition at line 334 of file G4AdjointSimManager.hh.

Referenced by RegisterAtEndOfAdjointTrack().

◆ nb_evt_of_last_run

G4int G4AdjointSimManager::nb_evt_of_last_run = 0
private

Definition at line 350 of file G4AdjointSimManager.hh.

Referenced by GetNbEvtOfLastRun(), and RunAdjointSimulation().

◆ nb_nuc

G4double G4AdjointSimManager::nb_nuc = 1.0
private

Definition at line 356 of file G4AdjointSimManager.hh.

Referenced by GetNumberNucleonsInIon(), and RegisterAtEndOfAdjointTrack().

◆ normalisation_mode

G4int G4AdjointSimManager::normalisation_mode = 3
private

Definition at line 351 of file G4AdjointSimManager.hh.

Referenced by GetNormalisationMode(), and SetNormalisationMode().

◆ theAdjointEventAction

G4UserEventAction* G4AdjointSimManager::theAdjointEventAction = nullptr
private

◆ theAdjointPrimaryGeneratorAction

G4AdjointPrimaryGeneratorAction* G4AdjointSimManager::theAdjointPrimaryGeneratorAction = nullptr
private

◆ theAdjointPrimaryWeight

G4double G4AdjointSimManager::theAdjointPrimaryWeight = 0.0
private

Definition at line 357 of file G4AdjointSimManager.hh.

Referenced by RegisterAdjointPrimaryWeight().

◆ theAdjointRunAction

G4UserRunAction* G4AdjointSimManager::theAdjointRunAction = nullptr
private

◆ theAdjointStackingAction

G4AdjointStackingAction* G4AdjointSimManager::theAdjointStackingAction = nullptr
private

◆ theAdjointSteppingAction

G4AdjointSteppingAction* G4AdjointSimManager::theAdjointSteppingAction = nullptr
private

◆ theAdjointTrackingAction

G4AdjointTrackingAction* G4AdjointSimManager::theAdjointTrackingAction = nullptr
private

◆ theMessenger

G4AdjointSimMessenger* G4AdjointSimManager::theMessenger = nullptr
private

Definition at line 298 of file G4AdjointSimManager.hh.

Referenced by G4AdjointSimManager(), and ~G4AdjointSimManager().

◆ use_user_StackingAction

G4bool G4AdjointSimManager::use_user_StackingAction = false
private

◆ use_user_TrackingAction

G4bool G4AdjointSimManager::use_user_TrackingAction = false
private

◆ user_action_already_defined

G4bool G4AdjointSimManager::user_action_already_defined = false
private

◆ welcome_message

G4bool G4AdjointSimManager::welcome_message = true
private

Definition at line 365 of file G4AdjointSimManager.hh.

Referenced by RunAdjointSimulation().


The documentation for this class was generated from the following files: