Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AdjointSimManager Class Reference

#include <G4AdjointSimManager.hh>

+ Inheritance diagram for G4AdjointSimManager:

Public Member Functions

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

Static Public Member Functions

static G4AdjointSimManagerGetInstance ()
 

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster = true
 

Detailed Description

Definition at line 162 of file G4AdjointSimManager.hh.

Member Function Documentation

◆ BackToFwdSimulationMode()

void G4AdjointSimManager::BackToFwdSimulationMode ( )

Definition at line 208 of file G4AdjointSimManager.cc.

209{
210 // Restore the user defined actions
211 //--------------------------------
212 ResetUserActions();
213 adjoint_sim_mode = false;
214}

Referenced by RunAdjointSimulation().

◆ BeginOfRunAction()

void G4AdjointSimManager::BeginOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 720 of file G4AdjointSimManager.cc.

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}
virtual void BeginOfRunAction(const G4Run *aRun)

◆ ClearEndOfAdjointTrackInfoVectors()

void G4AdjointSimManager::ClearEndOfAdjointTrackInfoVectors ( )

Definition at line 467 of file G4AdjointSimManager.cc.

468{
469 theAdjointTrackingAction->ClearEndOfAdjointTrackInfoVectors();
470}

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ ConsiderParticleAsPrimary()

void G4AdjointSimManager::ConsiderParticleAsPrimary ( const G4String particle_name)

Definition at line 629 of file G4AdjointSimManager.cc.

631{
632 theAdjointPrimaryGeneratorAction->ConsiderParticleAsPrimary(particle_name);
633}
void ConsiderParticleAsPrimary(const G4String &particle_name)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineAdjointSourceOnTheExtSurfaceOfAVolume()

G4bool G4AdjointSimManager::DefineAdjointSourceOnTheExtSurfaceOfAVolume ( const G4String volume_name)

Definition at line 597 of file G4AdjointSimManager.cc.

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}
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)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineExtSourceOnTheExtSurfaceOfAVolume()

G4bool G4AdjointSimManager::DefineExtSourceOnTheExtSurfaceOfAVolume ( const G4String volume_name)

Definition at line 549 of file G4AdjointSimManager.cc.

551{
552 G4double area;
554 "ExternalSource", volume_name, area);
555}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineSphericalAdjointSource()

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

Definition at line 566 of file G4AdjointSimManager.cc.

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}
G4bool AddaSphericalSurface(const G4String &SurfaceName, G4double radius, G4ThreeVector pos, G4double &area)
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume()

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

Definition at line 581 of file G4AdjointSimManager.cc.

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}
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String &SurfaceName, G4double radius, const G4String &volume_name, G4ThreeVector &center, G4double &area)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineSphericalExtSource()

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

Definition at line 526 of file G4AdjointSimManager.cc.

528{
529 G4double area;
531 "ExternalSource", radius, pos, area);
532}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume()

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

Definition at line 537 of file G4AdjointSimManager.cc.

539{
540 G4double area;
541 G4ThreeVector center;
544 "ExternalSource", radius, volume_name, center, area);
545}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ EndOfRunAction()

void G4AdjointSimManager::EndOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 735 of file G4AdjointSimManager.cc.

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}
virtual void EndOfRunAction(const G4Run *aRun)

◆ 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

◆ GetAdjointSourceArea()

G4double G4AdjointSimManager::GetAdjointSourceArea ( )
inline

Definition at line 224 of file G4AdjointSimManager.hh.

225 {
226 return area_of_the_adjoint_source;
227 }

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ GetAdjointTrackingMode()

G4bool G4AdjointSimManager::GetAdjointTrackingMode ( )

Definition at line 329 of file G4AdjointSimManager.cc.

330{
331 return theAdjointTrackingAction->GetIsAdjointTrackingMode();
332}

◆ GetCosthAtEndOfLastAdjointTrack()

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

Definition at line 426 of file G4AdjointSimManager.cc.

428{
429 return theAdjointTrackingAction->GetCosthAtEndOfLastAdjointTrack(i);
430}
G4double GetCosthAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetDidAdjParticleReachTheExtSource()

G4bool G4AdjointSimManager::GetDidAdjParticleReachTheExtSource ( )

Definition at line 363 of file G4AdjointSimManager.cc.

364{
366}
std::size_t GetNbOfAdointTracksReachingTheExternalSurface()

Referenced by SetAdjointTrackingMode().

◆ GetDirectionAtEndOfLastAdjointTrack()

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

Definition at line 394 of file G4AdjointSimManager.cc.

396{
397 return theAdjointTrackingAction->GetDirectionAtEndOfLastAdjointTrack(i);
398}
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetEkinAtEndOfLastAdjointTrack()

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

Definition at line 402 of file G4AdjointSimManager.cc.

404{
405 return theAdjointTrackingAction->GetEkinAtEndOfLastAdjointTrack(i);
406}
G4double GetEkinAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetEkinNucAtEndOfLastAdjointTrack()

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

Definition at line 410 of file G4AdjointSimManager.cc.

412{
413 return theAdjointTrackingAction->GetEkinNucAtEndOfLastAdjointTrack(i);
414}
G4double GetEkinNucAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetFwdParticleIndexAtEndOfLastAdjointTrack()

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

Definition at line 450 of file G4AdjointSimManager.cc.

452{
453 return theAdjointTrackingAction->GetLastFwdParticleIndex(i);
454}
G4int GetLastFwdParticleIndex(std::size_t i=0)

◆ GetFwdParticleNameAtEndOfLastAdjointTrack()

const G4String & G4AdjointSimManager::GetFwdParticleNameAtEndOfLastAdjointTrack ( )

Definition at line 434 of file G4AdjointSimManager.cc.

435{
436 return theAdjointTrackingAction->GetFwdParticleNameAtEndOfLastAdjointTrack();
437}
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()

◆ GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack()

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

Definition at line 441 of file G4AdjointSimManager.cc.

443{
444 return theAdjointTrackingAction
446}
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetIDOfLastAdjParticleReachingExtSource()

G4int G4AdjointSimManager::GetIDOfLastAdjParticleReachingExtSource ( )
inline

Definition at line 188 of file G4AdjointSimManager.hh.

189 {
190 return ID_of_last_particle_that_reach_the_ext_source;
191 }

◆ GetInstance()

G4AdjointSimManager * G4AdjointSimManager::GetInstance ( )
static

Definition at line 105 of file G4AdjointSimManager.cc.

106{
107 if(instance == nullptr)
108 instance = new G4AdjointSimManager;
109 return instance;
110}

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ GetLastGeneratedFwdPrimaryParticle()

G4ParticleDefinition * G4AdjointSimManager::GetLastGeneratedFwdPrimaryParticle ( )

Definition at line 757 of file G4AdjointSimManager.cc.

758{
759 return theAdjointPrimaryGeneratorAction->GetLastGeneratedFwdPrimaryParticle();
760}
G4ParticleDefinition * GetLastGeneratedFwdPrimaryParticle()

◆ GetListOfPrimaryFwdParticles()

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

Definition at line 371 of file G4AdjointSimManager.cc.

372{
373 return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
374}
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()

◆ GetNbEvtOfLastRun()

G4int G4AdjointSimManager::GetNbEvtOfLastRun ( )
inline

Definition at line 172 of file G4AdjointSimManager.hh.

172{ return nb_evt_of_last_run; }

◆ GetNbOfAdointTracksReachingTheExternalSurface()

std::size_t G4AdjointSimManager::GetNbOfAdointTracksReachingTheExternalSurface ( )

Definition at line 458 of file G4AdjointSimManager.cc.

460{
461 return theAdjointTrackingAction
463}
std::size_t GetNbOfAdointTracksReachingTheExternalSurface()

Referenced by GetDidAdjParticleReachTheExtSource().

◆ GetNbOfPrimaryFwdParticles()

std::size_t G4AdjointSimManager::GetNbOfPrimaryFwdParticles ( )

Definition at line 378 of file G4AdjointSimManager.cc.

379{
380 return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles()
381 ->size();
382}

◆ GetNormalisationMode()

G4int G4AdjointSimManager::GetNormalisationMode ( )
inline

Definition at line 235 of file G4AdjointSimManager.hh.

235{ return normalisation_mode; }

◆ GetNumberNucleonsInIon()

G4double G4AdjointSimManager::GetNumberNucleonsInIon ( )
inline

Definition at line 236 of file G4AdjointSimManager.hh.

236{ return nb_nuc; }

◆ GetPositionAtEndOfLastAdjointTrack()

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

Definition at line 386 of file G4AdjointSimManager.cc.

388{
389 return theAdjointTrackingAction->GetPositionAtEndOfLastAdjointTrack(i);
390}
G4ThreeVector GetPositionAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetPrimaryIonName()

const G4String & G4AdjointSimManager::GetPrimaryIonName ( )

Definition at line 653 of file G4AdjointSimManager.cc.

654{
655 return theAdjointPrimaryGeneratorAction->GetPrimaryIonName();
656}

◆ GetWeightAtEndOfLastAdjointTrack()

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

Definition at line 418 of file G4AdjointSimManager.cc.

420{
421 return theAdjointTrackingAction->GetWeightAtEndOfLastAdjointTrack(i);
422}
G4double GetWeightAtEndOfLastAdjointTrack(std::size_t i=0)

◆ NeglectParticleAsPrimary()

void G4AdjointSimManager::NeglectParticleAsPrimary ( const G4String particle_name)

Definition at line 637 of file G4AdjointSimManager.cc.

639{
640 theAdjointPrimaryGeneratorAction->NeglectParticleAsPrimary(particle_name);
641}
void NeglectParticleAsPrimary(const G4String &particle_name)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ RegisterAdjointPrimaryWeight()

void G4AdjointSimManager::RegisterAdjointPrimaryWeight ( G4double  aWeight)

Definition at line 660 of file G4AdjointSimManager.cc.

661{
662 theAdjointPrimaryWeight = aWeight;
663 theAdjointSteppingAction->SetPrimWeight(aWeight);
664}
void SetPrimWeight(G4double weight)

◆ RegisterAtEndOfAdjointTrack()

void G4AdjointSimManager::RegisterAtEndOfAdjointTrack ( )

Definition at line 474 of file G4AdjointSimManager.cc.

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}
int G4int
Definition: G4Types.hh:85
double z() const
double mag() const
G4ParticleDefinition * GetLastPartDef()
const G4String & GetParticleType() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()

Referenced by SetAdjointTrackingMode().

◆ ResetDidOneAdjPartReachExtSourceDuringEvent()

void G4AdjointSimManager::ResetDidOneAdjPartReachExtSourceDuringEvent ( )

Definition at line 764 of file G4AdjointSimManager.cc.

765{
766 theAdjointSteppingAction->ResetDidOneAdjPartReachExtSourceDuringEvent();
767}

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ 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
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}
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetRunManager()
virtual void BeamOn(G4int n_event, const char *macroFile=nullptr, G4int n_select=-1)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetAdjointEventAction()

void G4AdjointSimManager::SetAdjointEventAction ( G4UserEventAction anAction)

Definition at line 668 of file G4AdjointSimManager.cc.

669{
670 theAdjointEventAction = anAction;
671}

◆ SetAdjointRunAction()

void G4AdjointSimManager::SetAdjointRunAction ( G4UserRunAction anAction)

Definition at line 692 of file G4AdjointSimManager.cc.

693{
694 theAdjointRunAction = anAction;
695}

◆ SetAdjointSourceEmax()

void G4AdjointSimManager::SetAdjointSourceEmax ( G4double  Emax)

Definition at line 622 of file G4AdjointSimManager.cc.

623{
624 theAdjointPrimaryGeneratorAction->SetEmax(Emax);
625}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetAdjointSourceEmin()

void G4AdjointSimManager::SetAdjointSourceEmin ( G4double  Emin)

Definition at line 615 of file G4AdjointSimManager.cc.

616{
617 theAdjointPrimaryGeneratorAction->SetEmin(Emin);
618}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetAdjointStackingAction()

void G4AdjointSimManager::SetAdjointStackingAction ( G4UserStackingAction anAction)

Definition at line 683 of file G4AdjointSimManager.cc.

685{
686 theAdjointStackingAction->SetUserAdjointStackingAction(anAction);
687}
void SetUserAdjointStackingAction(G4UserStackingAction *anAction)

◆ SetAdjointSteppingAction()

void G4AdjointSimManager::SetAdjointSteppingAction ( G4UserSteppingAction anAction)

Definition at line 675 of file G4AdjointSimManager.cc.

677{
678 theAdjointSteppingAction->SetUserAdjointSteppingAction(anAction);
679}
void SetUserAdjointSteppingAction(G4UserSteppingAction *anAction)

◆ SetAdjointTrackingMode()

void G4AdjointSimManager::SetAdjointTrackingMode ( G4bool  aBool)

Definition at line 336 of file G4AdjointSimManager.cc.

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}
G4bool GetDidAdjParticleReachTheExtSource()

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ SetExtSourceEmax()

void G4AdjointSimManager::SetExtSourceEmax ( G4double  Emax)

Definition at line 559 of file G4AdjointSimManager.cc.

560{
561 theAdjointSteppingAction->SetExtSourceEMax(Emax);
562}
void SetExtSourceEMax(G4double Emax)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetNbAdjointPrimaryElectronsPerEvent()

void G4AdjointSimManager::SetNbAdjointPrimaryElectronsPerEvent ( G4int  nb)

Definition at line 713 of file G4AdjointSimManager.cc.

714{
715 theAdjointPrimaryGeneratorAction->SetNbAdjointPrimaryElectronsPerEvent(nb);
716}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetNbAdjointPrimaryGammasPerEvent()

void G4AdjointSimManager::SetNbAdjointPrimaryGammasPerEvent ( G4int  nb)

Definition at line 706 of file G4AdjointSimManager.cc.

707{
708 theAdjointPrimaryGeneratorAction->SetNbAdjointPrimaryGammasPerEvent(nb);
709}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetNbOfPrimaryFwdGammasPerEvent()

void G4AdjointSimManager::SetNbOfPrimaryFwdGammasPerEvent ( G4int  nb)

Definition at line 699 of file G4AdjointSimManager.cc.

700{
701 theAdjointPrimaryGeneratorAction->SetNbPrimaryFwdGammasPerEvent(nb);
702}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetNormalisationMode()

void G4AdjointSimManager::SetNormalisationMode ( G4int  n)
inline

Definition at line 234 of file G4AdjointSimManager.hh.

234{ normalisation_mode = n; }

◆ SetPrimaryIon()

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

Definition at line 645 of file G4AdjointSimManager.cc.

647{
648 theAdjointPrimaryGeneratorAction->SetPrimaryIon(adjointIon, fwdIon);
649}
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)

◆ SwitchToAdjointSimulationMode()

void G4AdjointSimManager::SwitchToAdjointSimulationMode ( )

Definition at line 193 of file G4AdjointSimManager.cc.

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}

Referenced by RunAdjointSimulation().

◆ UseUserStackingActionInFwdTrackingPhase()

void G4AdjointSimManager::UseUserStackingActionInFwdTrackingPhase ( G4bool  aBool)
inline

Definition at line 247 of file G4AdjointSimManager.hh.

248 {
249 use_user_StackingAction = aBool;
250 }

◆ UseUserTrackingActionInFwdTrackingPhase()

void G4AdjointSimManager::UseUserTrackingActionInFwdTrackingPhase ( G4bool  aBool)
inline

Definition at line 251 of file G4AdjointSimManager.hh.

252 {
253 use_user_TrackingAction = aBool;
254 }

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