Geant4 10.7.0
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 (size_t i=0)
 
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack (size_t i=0)
 
G4double GetEkinAtEndOfLastAdjointTrack (size_t i=0)
 
G4double GetEkinNucAtEndOfLastAdjointTrack (size_t i=0)
 
G4double GetWeightAtEndOfLastAdjointTrack (size_t i=0)
 
G4double GetCosthAtEndOfLastAdjointTrack (size_t i=0)
 
const G4StringGetFwdParticleNameAtEndOfLastAdjointTrack ()
 
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack (size_t i=0)
 
G4int GetFwdParticleIndexAtEndOfLastAdjointTrack (size_t i=0)
 
size_t GetNbOfAdointTracksReachingTheExternalSurface ()
 
void ClearEndOfAdjointTrackInfoVectors ()
 
G4ParticleDefinitionGetLastGeneratedFwdPrimaryParticle ()
 
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles ()
 
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
 

Detailed Description

Definition at line 182 of file G4AdjointSimManager.hh.

Member Function Documentation

◆ BackToFwdSimulationMode()

void G4AdjointSimManager::BackToFwdSimulationMode ( )

Definition at line 252 of file G4AdjointSimManager.cc.

253{ // Restore the user defined actions
254 //--------------------------------
255 ResetUserActions();
256 adjoint_sim_mode = false;
257}

Referenced by RunAdjointSimulation().

◆ BeginOfRunAction()

void G4AdjointSimManager::BeginOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 751 of file G4AdjointSimManager.cc.

752{
753 /*
754 if (!adjoint_sim_mode){
755 if(fUserRunAction) fUserRunAction->BeginOfRunAction(aRun);
756 }
757 else {
758 if (theAdjointRunAction) theAdjointRunAction->BeginOfRunAction(aRun);
759 }
760 */
761 fUserRunAction->BeginOfRunAction(aRun);
762}
virtual void BeginOfRunAction(const G4Run *aRun)

◆ ClearEndOfAdjointTrackInfoVectors()

void G4AdjointSimManager::ClearEndOfAdjointTrackInfoVectors ( )

Definition at line 486 of file G4AdjointSimManager.cc.

487{
488 theAdjointTrackingAction->ClearEndOfAdjointTrackInfoVectors();
489}

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ ConsiderParticleAsPrimary()

void G4AdjointSimManager::ConsiderParticleAsPrimary ( const G4String particle_name)

Definition at line 664 of file G4AdjointSimManager.cc.

666{
667 theAdjointPrimaryGeneratorAction->ConsiderParticleAsPrimary(particle_name);
668}
void ConsiderParticleAsPrimary(const G4String &particle_name)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineAdjointSourceOnTheExtSurfaceOfAVolume()

G4bool G4AdjointSimManager::DefineAdjointSourceOnTheExtSurfaceOfAVolume ( const G4String volume_name)

Definition at line 635 of file G4AdjointSimManager.cc.

637{
638 G4double area;
639 G4bool aBool =
641 "AdjointSource", volume_name, area);
642 area_of_the_adjoint_source = area;
643 if(aBool)
644 {
645 theAdjointPrimaryGeneratorAction
647 }
648 return aBool;
649}
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 591 of file G4AdjointSimManager.cc.

593{
594 G4double area;
596 "ExternalSource", volume_name, area);
597}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineSphericalAdjointSource()

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

Definition at line 606 of file G4AdjointSimManager.cc.

608{
609 G4double area;
611 "AdjointSource", radius, pos, area);
612 theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius,
613 pos);
614 area_of_the_adjoint_source = area;
615 return aBool;
616}
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 620 of file G4AdjointSimManager.cc.

622{
623 G4double area;
624 G4ThreeVector center;
627 "AdjointSource", radius, volume_name, center, area);
628 theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius,
629 center);
630 area_of_the_adjoint_source = area;
631 return aBool;
632}
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 570 of file G4AdjointSimManager.cc.

572{
573 G4double area;
575 "ExternalSource", radius, pos, area);
576}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume()

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

Definition at line 580 of file G4AdjointSimManager.cc.

582{
583 G4double area;
584 G4ThreeVector center;
587 "ExternalSource", radius, volume_name, center, area);
588}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ EndOfRunAction()

void G4AdjointSimManager::EndOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 765 of file G4AdjointSimManager.cc.

766{
767 if(!adjoint_sim_mode)
768 {
769 if(fUserRunAction)
770 fUserRunAction->EndOfRunAction(aRun);
771 }
772 else if(theAdjointRunAction)
773 theAdjointRunAction->EndOfRunAction(aRun);
774 /*
775 #ifdef G4MULTITHREADED
776 if (G4RunManager::GetRunManager()->GetRunManagerType() ==
777 G4RunManager::workerRM){ if (adjoint_sim_mode) BackToFwdSimulationMode();
778 }
779 #endif
780 */
781}
virtual void EndOfRunAction(const G4Run *aRun)

◆ GetAdjointSimMode()

G4bool G4AdjointSimManager::GetAdjointSimMode ( )
inline

Definition at line 197 of file G4AdjointSimManager.hh.

198 {
199 return adjoint_sim_mode;
200 } // true if an adjoint simulation is running

◆ GetAdjointSourceArea()

G4double G4AdjointSimManager::GetAdjointSourceArea ( )
inline

Definition at line 243 of file G4AdjointSimManager.hh.

243{ return area_of_the_adjoint_source; }

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ GetAdjointTrackingMode()

G4bool G4AdjointSimManager::GetAdjointTrackingMode ( )

Definition at line 367 of file G4AdjointSimManager.cc.

368{
369 return theAdjointTrackingAction->GetIsAdjointTrackingMode();
370}

◆ GetCosthAtEndOfLastAdjointTrack()

G4double G4AdjointSimManager::GetCosthAtEndOfLastAdjointTrack ( size_t  i = 0)

Definition at line 452 of file G4AdjointSimManager.cc.

453{
454 return theAdjointTrackingAction->GetCosthAtEndOfLastAdjointTrack(i);
455}
G4double GetCosthAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetDidAdjParticleReachTheExtSource()

G4bool G4AdjointSimManager::GetDidAdjParticleReachTheExtSource ( )

Definition at line 399 of file G4AdjointSimManager.cc.

400{
402}
size_t GetNbOfAdointTracksReachingTheExternalSurface()

Referenced by SetAdjointTrackingMode().

◆ GetDirectionAtEndOfLastAdjointTrack()

G4ThreeVector G4AdjointSimManager::GetDirectionAtEndOfLastAdjointTrack ( size_t  i = 0)

Definition at line 428 of file G4AdjointSimManager.cc.

429{
430 return theAdjointTrackingAction->GetDirectionAtEndOfLastAdjointTrack(i);
431}
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetEkinAtEndOfLastAdjointTrack()

G4double G4AdjointSimManager::GetEkinAtEndOfLastAdjointTrack ( size_t  i = 0)

Definition at line 434 of file G4AdjointSimManager.cc.

435{
436 return theAdjointTrackingAction->GetEkinAtEndOfLastAdjointTrack(i);
437}
G4double GetEkinAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetEkinNucAtEndOfLastAdjointTrack()

G4double G4AdjointSimManager::GetEkinNucAtEndOfLastAdjointTrack ( size_t  i = 0)

Definition at line 440 of file G4AdjointSimManager.cc.

441{
442 return theAdjointTrackingAction->GetEkinNucAtEndOfLastAdjointTrack(i);
443}
G4double GetEkinNucAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetFwdParticleIndexAtEndOfLastAdjointTrack()

G4int G4AdjointSimManager::GetFwdParticleIndexAtEndOfLastAdjointTrack ( size_t  i = 0)

Definition at line 473 of file G4AdjointSimManager.cc.

474{
475 return theAdjointTrackingAction->GetLastFwdParticleIndex(i);
476}
G4int GetLastFwdParticleIndex(std::size_t i=0)

◆ GetFwdParticleNameAtEndOfLastAdjointTrack()

const G4String & G4AdjointSimManager::GetFwdParticleNameAtEndOfLastAdjointTrack ( )

Definition at line 458 of file G4AdjointSimManager.cc.

459{
460 return theAdjointTrackingAction->GetFwdParticleNameAtEndOfLastAdjointTrack();
461}
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()

◆ GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack()

G4int G4AdjointSimManager::GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack ( size_t  i = 0)

Definition at line 464 of file G4AdjointSimManager.cc.

466{
467 return theAdjointTrackingAction
469}
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetIDOfLastAdjParticleReachingExtSource()

G4int G4AdjointSimManager::GetIDOfLastAdjParticleReachingExtSource ( )
inline

Definition at line 207 of file G4AdjointSimManager.hh.

208 {
209 return ID_of_last_particle_that_reach_the_ext_source;
210 };

◆ GetInstance()

G4AdjointSimManager * G4AdjointSimManager::GetInstance ( )
static

Definition at line 154 of file G4AdjointSimManager.cc.

155{
156 if(instance == 0)
157 instance = new G4AdjointSimManager;
158 return instance;
159}

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ GetLastGeneratedFwdPrimaryParticle()

G4ParticleDefinition * G4AdjointSimManager::GetLastGeneratedFwdPrimaryParticle ( )

Definition at line 784 of file G4AdjointSimManager.cc.

785{
786 return theAdjointPrimaryGeneratorAction->GetLastGeneratedFwdPrimaryParticle();
787}
G4ParticleDefinition * GetLastGeneratedFwdPrimaryParticle()

◆ GetListOfPrimaryFwdParticles()

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

Definition at line 407 of file G4AdjointSimManager.cc.

408{
409 return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
410}
std::vector< G4ParticleDefinition * > * GetListOfPrimaryFwdParticles()

◆ GetNbEvtOfLastRun()

G4int G4AdjointSimManager::GetNbEvtOfLastRun ( )
inline

Definition at line 192 of file G4AdjointSimManager.hh.

192{ return nb_evt_of_last_run; }

◆ GetNbOfAdointTracksReachingTheExternalSurface()

size_t G4AdjointSimManager::GetNbOfAdointTracksReachingTheExternalSurface ( )

Definition at line 479 of file G4AdjointSimManager.cc.

480{
481 return theAdjointTrackingAction
483}
std::size_t GetNbOfAdointTracksReachingTheExternalSurface()

Referenced by GetDidAdjParticleReachTheExtSource().

◆ GetNbOfPrimaryFwdParticles()

size_t G4AdjointSimManager::GetNbOfPrimaryFwdParticles ( )

Definition at line 413 of file G4AdjointSimManager.cc.

414{
415 return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles()
416 ->size();
417}

◆ GetNormalisationMode()

G4int G4AdjointSimManager::GetNormalisationMode ( )
inline

Definition at line 251 of file G4AdjointSimManager.hh.

251{ return normalisation_mode; };

◆ GetNumberNucleonsInIon()

G4double G4AdjointSimManager::GetNumberNucleonsInIon ( )
inline

Definition at line 252 of file G4AdjointSimManager.hh.

252{ return nb_nuc; };

◆ GetPositionAtEndOfLastAdjointTrack()

G4ThreeVector G4AdjointSimManager::GetPositionAtEndOfLastAdjointTrack ( size_t  i = 0)

Definition at line 421 of file G4AdjointSimManager.cc.

422{
423 return theAdjointTrackingAction->GetPositionAtEndOfLastAdjointTrack(i);
424}
G4ThreeVector GetPositionAtEndOfLastAdjointTrack(std::size_t i=0)

◆ GetPrimaryIonName()

const G4String & G4AdjointSimManager::GetPrimaryIonName ( )

Definition at line 692 of file G4AdjointSimManager.cc.

693{
694 return theAdjointPrimaryGeneratorAction->GetPrimaryIonName();
695}

◆ GetWeightAtEndOfLastAdjointTrack()

G4double G4AdjointSimManager::GetWeightAtEndOfLastAdjointTrack ( size_t  i = 0)

Definition at line 446 of file G4AdjointSimManager.cc.

447{
448 return theAdjointTrackingAction->GetWeightAtEndOfLastAdjointTrack(i);
449}
G4double GetWeightAtEndOfLastAdjointTrack(std::size_t i=0)

◆ NeglectParticleAsPrimary()

void G4AdjointSimManager::NeglectParticleAsPrimary ( const G4String particle_name)

Definition at line 671 of file G4AdjointSimManager.cc.

673{
674 theAdjointPrimaryGeneratorAction->NeglectParticleAsPrimary(particle_name);
675}
void NeglectParticleAsPrimary(const G4String &particle_name)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ RegisterAdjointPrimaryWeight()

void G4AdjointSimManager::RegisterAdjointPrimaryWeight ( G4double  aWeight)

Definition at line 698 of file G4AdjointSimManager.cc.

699{
700 theAdjointPrimaryWeight = aWeight;
701 theAdjointSteppingAction->SetPrimWeight(aWeight);
702}
void SetPrimWeight(G4double weight)

◆ RegisterAtEndOfAdjointTrack()

void G4AdjointSimManager::RegisterAtEndOfAdjointTrack ( )

Definition at line 493 of file G4AdjointSimManager.cc.

494{
495 last_pos = theAdjointSteppingAction->GetLastPosition();
496 last_direction = theAdjointSteppingAction->GetLastMomentum();
497 last_direction /= last_direction.mag();
498 last_cos_th = last_direction.z();
499 G4ParticleDefinition* aPartDef = theAdjointSteppingAction->GetLastPartDef();
500
501 last_fwd_part_name = aPartDef->GetParticleName();
502
503 last_fwd_part_name.remove(0, 4);
504
505 last_fwd_part_PDGEncoding = G4ParticleTable::GetParticleTable()
506 ->FindParticle(last_fwd_part_name)
507 ->GetPDGEncoding();
508
509 std::vector<G4ParticleDefinition*>* aList =
510 theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
511 last_fwd_part_index = -1;
512 size_t i = 0;
513 while(i < aList->size() && last_fwd_part_index < 0)
514 {
515 if((*aList)[i]->GetParticleName() == last_fwd_part_name)
516 last_fwd_part_index = i;
517 i++;
518 }
519
520 last_ekin = theAdjointSteppingAction->GetLastEkin();
521 last_ekin_nuc = last_ekin;
522 if(aPartDef->GetParticleType() == "adjoint_nucleus")
523 {
524 nb_nuc = double(aPartDef->GetBaryonNumber());
525 last_ekin_nuc /= nb_nuc;
526 }
527
528 last_weight = theAdjointSteppingAction->GetLastWeight();
529
530 last_pos_vec.push_back(last_pos);
531 last_direction_vec.push_back(last_direction);
532 last_ekin_vec.push_back(last_ekin);
533 last_ekin_nuc_vec.push_back(last_ekin_nuc);
534 last_cos_th_vec.push_back(last_cos_th);
535 last_weight_vec.push_back(last_weight);
536 last_fwd_part_PDGEncoding_vec.push_back(last_fwd_part_PDGEncoding);
537 last_fwd_part_index_vec.push_back(last_fwd_part_index);
538 ID_of_last_particle_that_reach_the_ext_source++;
539 ID_of_last_particle_that_reach_the_ext_source_vec.push_back(
540 ID_of_last_particle_that_reach_the_ext_source);
541
542 /* G4PhysicsLogVector* theWeightVector=0;
543 if (last_fwd_part_name =="e-") theWeightVector=electron_last_weight_vector;
544 else if (last_fwd_part_name =="gamma")
545 theWeightVector=gamma_last_weight_vector; else if (last_fwd_part_name
546 =="proton") theWeightVector=proton_last_weight_vector;
547
548 if (theWeightVector){
549
550 size_t ind = size_t(std::log10(last_weight/theAdjointPrimaryWeight)*10. +
551 200); G4double low_val =theWeightVector->GetLowEdgeEnergy(ind); G4bool aBool =
552 true; G4double bin_weight = theWeightVector->GetValue(low_val, aBool)+1.;
553 theWeightVector->PutValue(ind, bin_weight);
554 }
555 */
556 /*if ((last_weight/theAdjointPrimaryWeight)>1.) last_weight*=1000. ;
557 else if ( (last_weight/theAdjointPrimaryWeight)>0.1) last_weight*=100. ;
558 else if ( (last_weight/theAdjointPrimaryWeight)>0.01) last_weight*=10. ;*/
559
560 // G4cout <<"Last Weight
561 // "<<last_weight<<'\t'<<theAdjointPrimaryWeight<<'\t'<<last_weight/theAdjointPrimaryWeight<<std::endl;
562 /*if (last_weight/theAdjointPrimaryWeight >10.) {
563 G4cout<<"Warning a weight increase by a factor :
564 "<<last_weight/theAdjointPrimaryWeight<<std::endl;
565 }
566 */
567}
double z() const
double mag() const
G4ParticleDefinition * GetLastPartDef()
const G4String & GetParticleType() const
const G4String & GetParticleName() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4String & remove(str_size)

Referenced by SetAdjointTrackingMode().

◆ ResetDidOneAdjPartReachExtSourceDuringEvent()

void G4AdjointSimManager::ResetDidOneAdjPartReachExtSourceDuringEvent ( )

Definition at line 790 of file G4AdjointSimManager.cc.

791{
792 theAdjointSteppingAction->ResetDidOneAdjPartReachExtSourceDuringEvent();
793}

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ RunAdjointSimulation()

void G4AdjointSimManager::RunAdjointSimulation ( G4int  nb_evt)

Definition at line 162 of file G4AdjointSimManager.cc.

163{
164 if(G4RunManager::GetRunManager()->GetRunManagerType() !=
166 return; // only for sequential mode
167 if(welcome_message)
168 {
169 G4cout << "****************************************************************"
170 << std::endl;
171 G4cout << "*** Geant4 Reverse/Adjoint Monte Carlo mode ***"
172 << std::endl;
173 G4cout << "*** Author: L.Desorgher ***" << std::endl;
174 G4cout << "*** Company: SpaceIT GmbH, Bern, Switzerland ***"
175 << std::endl;
176 G4cout << "*** Sponsored by: ESA/ESTEC contract contract 21435/08/NL/AT ***"
177 << std::endl;
178 G4cout << "****************************************************************"
179 << std::endl;
180 welcome_message = false;
181 }
182
183 // Switch to adjoint simulation mode
184 //---------------------------------------------------------
186
187 // Make the run
188 //------------
189
190 nb_evt_of_last_run = nb_evt;
192 nb_evt * theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes());
193 // G4RunManager::GetRunManager()->BeamOn(theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes()*2*nb_evt);
194
195 // Back to Fwd Simulation Mode
196 //--------------------------------
198
199 /*
200 //Register the weight vector
201 //--------------------------
202 std::ofstream FileOutputElectronWeight("ElectronWeight.txt", std::ios::out);
203 FileOutputElectronWeight<<std::setiosflags(std::ios::scientific);
204 FileOutputElectronWeight<<std::setprecision(6);
205 G4bool aBool = electron_last_weight_vector->Store(FileOutputElectronWeight,
206 true); FileOutputElectronWeight.close();
207
208 std::ofstream FileOutputProtonWeight("ProtonWeight.txt", std::ios::out);
209 FileOutputProtonWeight<<std::setiosflags(std::ios::scientific);
210 FileOutputProtonWeight<<std::setprecision(6);
211 aBool = proton_last_weight_vector->Store(FileOutputProtonWeight, true);
212 FileOutputProtonWeight.close();
213
214 std::ofstream FileOutputGammaWeight("GammaWeight.txt", std::ios::out);
215 FileOutputGammaWeight<<std::setiosflags(std::ios::scientific);
216 FileOutputGammaWeight<<std::setprecision(6);
217 aBool = gamma_last_weight_vector->Store(FileOutputGammaWeight, true);
218 FileOutputGammaWeight.close();
219 */
220}
G4GLOB_DLL std::ostream G4cout
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:84

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetAdjointEventAction()

void G4AdjointSimManager::SetAdjointEventAction ( G4UserEventAction anAction)

Definition at line 706 of file G4AdjointSimManager.cc.

707{
708 theAdjointEventAction = anAction;
709}

◆ SetAdjointRunAction()

void G4AdjointSimManager::SetAdjointRunAction ( G4UserRunAction anAction)

Definition at line 727 of file G4AdjointSimManager.cc.

728{
729 theAdjointRunAction = anAction;
730}

◆ SetAdjointSourceEmax()

void G4AdjointSimManager::SetAdjointSourceEmax ( G4double  Emax)

Definition at line 658 of file G4AdjointSimManager.cc.

659{
660 theAdjointPrimaryGeneratorAction->SetEmax(Emax);
661}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetAdjointSourceEmin()

void G4AdjointSimManager::SetAdjointSourceEmin ( G4double  Emin)

Definition at line 652 of file G4AdjointSimManager.cc.

653{
654 theAdjointPrimaryGeneratorAction->SetEmin(Emin);
655}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetAdjointStackingAction()

void G4AdjointSimManager::SetAdjointStackingAction ( G4UserStackingAction anAction)

Definition at line 719 of file G4AdjointSimManager.cc.

721{
722 theAdjointStackingAction->SetUserAdjointStackingAction(anAction);
723}
void SetUserAdjointStackingAction(G4UserStackingAction *anAction)

◆ SetAdjointSteppingAction()

void G4AdjointSimManager::SetAdjointSteppingAction ( G4UserSteppingAction anAction)

Definition at line 712 of file G4AdjointSimManager.cc.

714{
715 theAdjointSteppingAction->SetUserAdjointSteppingAction(anAction);
716}
void SetUserAdjointSteppingAction(G4UserSteppingAction *anAction)

◆ SetAdjointTrackingMode()

void G4AdjointSimManager::SetAdjointTrackingMode ( G4bool  aBool)

Definition at line 373 of file G4AdjointSimManager.cc.

375{
376 adjoint_tracking_mode = aBool;
377
378 if(adjoint_tracking_mode)
379 {
380 SetRestOfAdjointActions();
381 theAdjointStackingAction->SetAdjointMode(true);
382 theAdjointStackingAction->SetKillTracks(false);
383 }
384 else
385 {
386 ResetRestOfUserActions();
387 theAdjointStackingAction->SetAdjointMode(false);
389 {
390 theAdjointStackingAction->SetKillTracks(false);
392 }
393 else
394 theAdjointStackingAction->SetKillTracks(true);
395 }
396}
G4bool GetDidAdjParticleReachTheExtSource()

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

◆ SetExtSourceEmax()

void G4AdjointSimManager::SetExtSourceEmax ( G4double  Emax)

Definition at line 600 of file G4AdjointSimManager.cc.

601{
602 theAdjointSteppingAction->SetExtSourceEMax(Emax);
603}
void SetExtSourceEMax(G4double Emax)

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetNbAdjointPrimaryElectronsPerEvent()

void G4AdjointSimManager::SetNbAdjointPrimaryElectronsPerEvent ( G4int  nb)

Definition at line 745 of file G4AdjointSimManager.cc.

746{
747 theAdjointPrimaryGeneratorAction->SetNbAdjointPrimaryElectronsPerEvent(nb);
748}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetNbAdjointPrimaryGammasPerEvent()

void G4AdjointSimManager::SetNbAdjointPrimaryGammasPerEvent ( G4int  nb)

Definition at line 739 of file G4AdjointSimManager.cc.

740{
741 theAdjointPrimaryGeneratorAction->SetNbAdjointPrimaryGammasPerEvent(nb);
742}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetNbOfPrimaryFwdGammasPerEvent()

void G4AdjointSimManager::SetNbOfPrimaryFwdGammasPerEvent ( G4int  nb)

Definition at line 733 of file G4AdjointSimManager.cc.

734{
735 theAdjointPrimaryGeneratorAction->SetNbPrimaryFwdGammasPerEvent(nb);
736}

Referenced by G4AdjointSimMessenger::SetNewValue().

◆ SetNormalisationMode()

void G4AdjointSimManager::SetNormalisationMode ( G4int  n)
inline

Definition at line 250 of file G4AdjointSimManager.hh.

250{ normalisation_mode = n; };

◆ SetPrimaryIon()

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

Definition at line 685 of file G4AdjointSimManager.cc.

687{
688 theAdjointPrimaryGeneratorAction->SetPrimaryIon(adjointIon, fwdIon);
689}
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)

◆ SwitchToAdjointSimulationMode()

void G4AdjointSimManager::SwitchToAdjointSimulationMode ( )

Definition at line 239 of file G4AdjointSimManager.cc.

240{ // Replace the user defined actions by the adjoint actions
241 //---------------------------------------------------------
242 SetAdjointActions();
243
244 // Update the list of primaries
245 //-----------------------------
246 theAdjointPrimaryGeneratorAction->UpdateListOfPrimaryParticles();
247 adjoint_sim_mode = true;
248 ID_of_last_particle_that_reach_the_ext_source = 0;
249}

Referenced by RunAdjointSimulation().

◆ UseUserStackingActionInFwdTrackingPhase()

void G4AdjointSimManager::UseUserStackingActionInFwdTrackingPhase ( G4bool  aBool)
inline

Definition at line 263 of file G4AdjointSimManager.hh.

264 {
265 use_user_StackingAction = aBool;
266 }

◆ UseUserTrackingActionInFwdTrackingPhase()

void G4AdjointSimManager::UseUserTrackingActionInFwdTrackingPhase ( G4bool  aBool)
inline

Definition at line 267 of file G4AdjointSimManager.hh.

268 {
269 use_user_TrackingAction = aBool;
270 }

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