Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4AdjointSimManager Class Reference

#include <G4AdjointSimManager.hh>

Inheritance diagram for G4AdjointSimManager:
G4UserRunAction

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)
 
G4int GetIDOfLastAdjParticleReachingExtSource ()
 
G4ThreeVector GetPositionAtEndOfLastAdjointTrack ()
 
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack ()
 
G4double GetEkinAtEndOfLastAdjointTrack ()
 
G4double GetEkinNucAtEndOfLastAdjointTrack ()
 
G4double GetWeightAtEndOfLastAdjointTrack ()
 
G4double GetCosthAtEndOfLastAdjointTrack ()
 
const G4StringGetFwdParticleNameAtEndOfLastAdjointTrack ()
 
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack ()
 
G4int GetFwdParticleIndexAtEndOfLastAdjointTrack ()
 
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 SwitchToAdjointSimulationMode ()
 
void BackToFwdSimulationMode ()
 
- Public Member Functions inherited from G4UserRunAction
 G4UserRunAction ()
 
virtual ~G4UserRunAction ()
 
virtual G4RunGenerateRun ()
 
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 150 of file G4AdjointSimManager.hh.

Member Function Documentation

void G4AdjointSimManager::BackToFwdSimulationMode ( )

Definition at line 216 of file G4AdjointSimManager.cc.

Referenced by RunAdjointSimulation().

217 { //Restore the user defined actions
218  //--------------------------------
219  ResetUserActions();
220  adjoint_sim_mode=false;
221 }
void G4AdjointSimManager::BeginOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 598 of file G4AdjointSimManager.cc.

References G4UserRunAction::BeginOfRunAction(), and G4cout.

599 {
600 G4cout<<"G4AdjointSimManager::BeginOfRunAction"<<std::endl;
601 
602  if (!adjoint_sim_mode){
603  if(fUserRunAction) fUserRunAction->BeginOfRunAction(aRun);
604  }
605  else {
606  if (theAdjointRunAction) theAdjointRunAction->BeginOfRunAction(aRun);
607  }
608 }
G4GLOB_DLL std::ostream G4cout
virtual void BeginOfRunAction(const G4Run *aRun)
void G4AdjointSimManager::ConsiderParticleAsPrimary ( const G4String particle_name)

Definition at line 532 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::ConsiderParticleAsPrimary().

Referenced by G4AdjointPhysicsList::ConstructEM(), and G4AdjointSimMessenger::SetNewValue().

533 {
534  theAdjointPrimaryGeneratorAction->ConsiderParticleAsPrimary(particle_name);
535 }
void ConsiderParticleAsPrimary(const G4String &particle_name)
G4bool G4AdjointSimManager::DefineAdjointSourceOnTheExtSurfaceOfAVolume ( const G4String volume_name)

Definition at line 508 of file G4AdjointSimManager.cc.

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

Referenced by G4AdjointSimMessenger::SetNewValue().

509 {
510  G4double area;
511  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "AdjointSource", volume_name,area);
512  area_of_the_adjoint_source=area;
513  if (aBool) {
514  theAdjointPrimaryGeneratorAction->SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(volume_name);
515  }
516  return aBool;
517 }
bool G4bool
Definition: G4Types.hh:79
static G4AdjointCrossSurfChecker * GetInstance()
G4bool AddanExtSurfaceOfAvolume(const G4String &SurfaceName, const G4String &volume_name, G4double &area)
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String &volume_name)
double G4double
Definition: G4Types.hh:76
G4bool G4AdjointSimManager::DefineExtSourceOnTheExtSurfaceOfAVolume ( const G4String volume_name)

Definition at line 474 of file G4AdjointSimManager.cc.

References G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(), and G4AdjointCrossSurfChecker::GetInstance().

Referenced by G4AdjointSimMessenger::SetNewValue().

475 {
476  G4double area;
477  return G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "ExternalSource", volume_name,area);
478 }
static G4AdjointCrossSurfChecker * GetInstance()
G4bool AddanExtSurfaceOfAvolume(const G4String &SurfaceName, const G4String &volume_name, G4double &area)
double G4double
Definition: G4Types.hh:76
G4bool G4AdjointSimManager::DefineSphericalAdjointSource ( G4double  radius,
G4ThreeVector  pos 
)

Definition at line 487 of file G4AdjointSimManager.cc.

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

Referenced by G4AdjointSimMessenger::SetNewValue().

488 {
489  G4double area;
490  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("AdjointSource", radius, pos, area);
491  theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, pos);
492  area_of_the_adjoint_source=area;
493  return aBool;
494 }
G4bool AddaSphericalSurface(const G4String &SurfaceName, G4double radius, G4ThreeVector pos, G4double &area)
bool G4bool
Definition: G4Types.hh:79
static G4AdjointCrossSurfChecker * GetInstance()
double G4double
Definition: G4Types.hh:76
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
G4bool G4AdjointSimManager::DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume ( G4double  radius,
const G4String volume_name 
)

Definition at line 497 of file G4AdjointSimManager.cc.

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

Referenced by G4AdjointSimMessenger::SetNewValue().

498 {
499  G4double area;
500  G4ThreeVector center;
501  G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "AdjointSource", radius, volume_name,center, area);
502  theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, center);
503  area_of_the_adjoint_source=area;
504  return aBool;
505 }
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String &SurfaceName, G4double radius, const G4String &volume_name, G4ThreeVector &center, G4double &area)
bool G4bool
Definition: G4Types.hh:79
static G4AdjointCrossSurfChecker * GetInstance()
double G4double
Definition: G4Types.hh:76
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos)
G4bool G4AdjointSimManager::DefineSphericalExtSource ( G4double  radius,
G4ThreeVector  pos 
)

Definition at line 459 of file G4AdjointSimManager.cc.

References G4AdjointCrossSurfChecker::AddaSphericalSurface(), and G4AdjointCrossSurfChecker::GetInstance().

Referenced by G4AdjointSimMessenger::SetNewValue().

460 {
461  G4double area;
462  return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("ExternalSource", radius, pos, area);
463 }
G4bool AddaSphericalSurface(const G4String &SurfaceName, G4double radius, G4ThreeVector pos, G4double &area)
static G4AdjointCrossSurfChecker * GetInstance()
double G4double
Definition: G4Types.hh:76
G4bool G4AdjointSimManager::DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume ( G4double  radius,
const G4String volume_name 
)

Definition at line 466 of file G4AdjointSimManager.cc.

References G4AdjointCrossSurfChecker::AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(), and G4AdjointCrossSurfChecker::GetInstance().

Referenced by G4AdjointSimMessenger::SetNewValue().

467 {
468  G4double area;
469  G4ThreeVector center;
470  return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "ExternalSource", radius, volume_name,center, area);
471 }
G4bool AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String &SurfaceName, G4double radius, const G4String &volume_name, G4ThreeVector &center, G4double &area)
static G4AdjointCrossSurfChecker * GetInstance()
double G4double
Definition: G4Types.hh:76
void G4AdjointSimManager::EndOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 611 of file G4AdjointSimManager.cc.

References G4UserRunAction::EndOfRunAction().

612 {if (!adjoint_sim_mode){
613  if(fUserRunAction) fUserRunAction->EndOfRunAction(aRun);
614  }
615  else if (theAdjointRunAction) theAdjointRunAction->EndOfRunAction(aRun);
616 /*
617 #ifdef G4MULTITHREADED
618  if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::workerRM){
619  if (adjoint_sim_mode) BackToFwdSimulationMode();
620  }
621 #endif
622 */
623 
624 }
virtual void EndOfRunAction(const G4Run *aRun)
G4bool G4AdjointSimManager::GetAdjointSimMode ( )
inline

Definition at line 166 of file G4AdjointSimManager.hh.

Referenced by RMC01AnalysisManager::BeginOfRun().

166 {return adjoint_sim_mode;} //true if an adjoint simulation is running
G4double G4AdjointSimManager::GetAdjointSourceArea ( )
inline

Definition at line 199 of file G4AdjointSimManager.hh.

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

199 {return area_of_the_adjoint_source;}
G4bool G4AdjointSimManager::GetAdjointTrackingMode ( )
inline

Definition at line 165 of file G4AdjointSimManager.hh.

165 {return adjoint_tracking_mode;} //true if an adjoint track is being processed
G4double G4AdjointSimManager::GetCosthAtEndOfLastAdjointTrack ( )

Definition at line 383 of file G4AdjointSimManager.cc.

References G4AdjointTrackingAction::GetCosthAtEndOfLastAdjointTrack().

383  {
384  return theAdjointTrackingAction->GetCosthAtEndOfLastAdjointTrack();
385 }
G4bool G4AdjointSimManager::GetDidAdjParticleReachTheExtSource ( )

Definition at line 338 of file G4AdjointSimManager.cc.

References G4AdjointSteppingAction::GetDidAdjParticleReachTheExtSource().

Referenced by SetAdjointTrackingMode().

339 {
340  return theAdjointSteppingAction->GetDidAdjParticleReachTheExtSource();
341 }
G4ThreeVector G4AdjointSimManager::GetDirectionAtEndOfLastAdjointTrack ( )

Definition at line 363 of file G4AdjointSimManager.cc.

References G4AdjointTrackingAction::GetDirectionAtEndOfLastAdjointTrack().

363  {
364  return theAdjointTrackingAction->GetDirectionAtEndOfLastAdjointTrack();
365 }
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack()
G4double G4AdjointSimManager::GetEkinAtEndOfLastAdjointTrack ( )

Definition at line 368 of file G4AdjointSimManager.cc.

References G4AdjointTrackingAction::GetEkinAtEndOfLastAdjointTrack().

368  {
369  return theAdjointTrackingAction->GetEkinAtEndOfLastAdjointTrack();
370 }
G4double G4AdjointSimManager::GetEkinNucAtEndOfLastAdjointTrack ( )

Definition at line 373 of file G4AdjointSimManager.cc.

References G4AdjointTrackingAction::GetEkinNucAtEndOfLastAdjointTrack().

373  {
374  return theAdjointTrackingAction->GetEkinNucAtEndOfLastAdjointTrack();
375 }
G4int G4AdjointSimManager::GetFwdParticleIndexAtEndOfLastAdjointTrack ( )
inline

Definition at line 181 of file G4AdjointSimManager.hh.

181 {return last_fwd_part_index;}
const G4String & G4AdjointSimManager::GetFwdParticleNameAtEndOfLastAdjointTrack ( )

Definition at line 388 of file G4AdjointSimManager.cc.

References G4AdjointTrackingAction::GetFwdParticleNameAtEndOfLastAdjointTrack().

389 {return theAdjointTrackingAction->GetFwdParticleNameAtEndOfLastAdjointTrack();
390 }
const G4String & GetFwdParticleNameAtEndOfLastAdjointTrack()
G4int G4AdjointSimManager::GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack ( )

Definition at line 393 of file G4AdjointSimManager.cc.

References G4AdjointTrackingAction::GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack().

393  {
394  return theAdjointTrackingAction->GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack();
395 }
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack()
G4int G4AdjointSimManager::GetIDOfLastAdjParticleReachingExtSource ( )
inline

Definition at line 172 of file G4AdjointSimManager.hh.

172 {return ID_of_last_particle_that_reach_the_ext_source;};
G4AdjointSimManager * G4AdjointSimManager::GetInstance ( void  )
static
std::vector< G4ParticleDefinition * > G4AdjointSimManager::GetListOfPrimaryFwdParticles ( )

Definition at line 344 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::GetListOfPrimaryFwdParticles().

345 {
346  return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
347 }
std::vector< G4ParticleDefinition * > GetListOfPrimaryFwdParticles()
G4int G4AdjointSimManager::GetNbEvtOfLastRun ( )
inline

Definition at line 162 of file G4AdjointSimManager.hh.

Referenced by RMC01AnalysisManager::BeginOfRun(), and RMC01AnalysisManager::EndOfRun().

162 {return nb_evt_of_last_run;}
size_t G4AdjointSimManager::GetNbOfPrimaryFwdParticles ( )

Definition at line 350 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::GetListOfPrimaryFwdParticles().

351 {
352  return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles().size();
353 }
std::vector< G4ParticleDefinition * > GetListOfPrimaryFwdParticles()
G4int G4AdjointSimManager::GetNormalisationMode ( )
inline

Definition at line 206 of file G4AdjointSimManager.hh.

206 {return normalisation_mode;};
G4double G4AdjointSimManager::GetNumberNucleonsInIon ( )
inline

Definition at line 207 of file G4AdjointSimManager.hh.

207 {return nb_nuc;};
G4ThreeVector G4AdjointSimManager::GetPositionAtEndOfLastAdjointTrack ( )

Definition at line 357 of file G4AdjointSimManager.cc.

References G4AdjointTrackingAction::GetPositionAtEndOfLastAdjointTrack().

357  {
358  return theAdjointTrackingAction->GetPositionAtEndOfLastAdjointTrack();
359 }
G4ThreeVector GetPositionAtEndOfLastAdjointTrack()
const G4String & G4AdjointSimManager::GetPrimaryIonName ( )

Definition at line 557 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::GetPrimaryIonName().

558 {
559  return theAdjointPrimaryGeneratorAction->GetPrimaryIonName();
560 }
G4double G4AdjointSimManager::GetWeightAtEndOfLastAdjointTrack ( )

Definition at line 378 of file G4AdjointSimManager.cc.

References G4AdjointTrackingAction::GetWeightAtEndOfLastAdjointTrack().

378  {
379  return theAdjointTrackingAction->GetWeightAtEndOfLastAdjointTrack();
380 }
void G4AdjointSimManager::NeglectParticleAsPrimary ( const G4String particle_name)

Definition at line 538 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::NeglectParticleAsPrimary().

Referenced by G4AdjointSimMessenger::SetNewValue().

539 {
540  theAdjointPrimaryGeneratorAction->NeglectParticleAsPrimary(particle_name);
541 }
void NeglectParticleAsPrimary(const G4String &particle_name)
void G4AdjointSimManager::RegisterAdjointPrimaryWeight ( G4double  aWeight)

Definition at line 563 of file G4AdjointSimManager.cc.

References G4AdjointSteppingAction::SetPrimWeight().

564 {
565  theAdjointPrimaryWeight = aWeight;
566  theAdjointSteppingAction->SetPrimWeight(aWeight);
567 }
void SetPrimWeight(G4double weight)
void G4AdjointSimManager::RegisterAtEndOfAdjointTrack ( )

Definition at line 399 of file G4AdjointSimManager.cc.

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(), CLHEP::Hep3Vector::mag(), G4String::remove(), and CLHEP::Hep3Vector::z().

Referenced by SetAdjointTrackingMode().

400 {
401  last_pos = theAdjointSteppingAction->GetLastPosition();
402  last_direction = theAdjointSteppingAction->GetLastMomentum();
403  last_direction /=last_direction.mag();
404  last_cos_th = last_direction.z();
405  G4ParticleDefinition* aPartDef= theAdjointSteppingAction->GetLastPartDef();
406 
407  last_fwd_part_name= aPartDef->GetParticleName();
408 
409  last_fwd_part_name.remove(0,4);
410 
411  last_fwd_part_PDGEncoding=G4ParticleTable::GetParticleTable()->FindParticle(last_fwd_part_name)->GetPDGEncoding();
412 
413  std::vector<G4ParticleDefinition*> aList = theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
414  last_fwd_part_index=-1;
415  size_t i=0;
416  while(i<aList.size() && last_fwd_part_index<0) {
417  if (aList[i]->GetParticleName() == last_fwd_part_name) last_fwd_part_index=i;
418  i++;
419  }
420 
421  last_ekin = theAdjointSteppingAction->GetLastEkin();
422  last_ekin_nuc = last_ekin;
423  if (aPartDef->GetParticleType() == "adjoint_nucleus") {
424  nb_nuc=double(aPartDef->GetBaryonNumber());
425  last_ekin_nuc /=nb_nuc;
426  }
427 
428  last_weight = theAdjointSteppingAction->GetLastWeight();
429 
430  /* G4PhysicsLogVector* theWeightVector=0;
431  if (last_fwd_part_name =="e-") theWeightVector=electron_last_weight_vector;
432  else if (last_fwd_part_name =="gamma") theWeightVector=gamma_last_weight_vector;
433  else if (last_fwd_part_name =="proton") theWeightVector=proton_last_weight_vector;
434 
435  if (theWeightVector){
436 
437  size_t ind = size_t(std::log10(last_weight/theAdjointPrimaryWeight)*10. + 200);
438  G4double low_val =theWeightVector->GetLowEdgeEnergy(ind);
439  G4bool aBool = true;
440  G4double bin_weight = theWeightVector->GetValue(low_val, aBool)+1.;
441  theWeightVector->PutValue(ind, bin_weight);
442  }
443  */
444  /*if ((last_weight/theAdjointPrimaryWeight)>1.) last_weight*=1000. ;
445  else if ( (last_weight/theAdjointPrimaryWeight)>0.1) last_weight*=100. ;
446  else if ( (last_weight/theAdjointPrimaryWeight)>0.01) last_weight*=10. ;*/
447 
448 
449  //G4cout <<"Last Weight "<<last_weight<<'\t'<<theAdjointPrimaryWeight<<'\t'<<last_weight/theAdjointPrimaryWeight<<std::endl;
450  /*if (last_weight/theAdjointPrimaryWeight >10.) {
451  G4cout<<"Warning a weight increase by a factor : "<<last_weight/theAdjointPrimaryWeight<<std::endl;
452  }
453  */
454 
455  ID_of_last_particle_that_reach_the_ext_source++;
456 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
G4String & remove(str_size)
const G4String & GetParticleName() const
double z() const
const G4String & GetParticleType() const
G4ParticleDefinition * GetLastPartDef()
static G4ParticleTable * GetParticleTable()
std::vector< G4ParticleDefinition * > GetListOfPrimaryFwdParticles()
double mag() const
void G4AdjointSimManager::RunAdjointSimulation ( G4int  nb_evt)

Definition at line 136 of file G4AdjointSimManager.cc.

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

Referenced by G4AdjointSimMessenger::SetNewValue().

137 { if (G4RunManager::GetRunManager()->GetRunManagerType() != G4RunManager::sequentialRM) return; //only for sequential mode
138  if (welcome_message) {
139  G4cout<<"****************************************************************"<<std::endl;
140  G4cout<<"*** Geant4 Reverse/Adjoint Monte Carlo mode ***"<<std::endl;
141  G4cout<<"*** Author: L.Desorgher ***"<<std::endl;
142  G4cout<<"*** Company: SpaceIT GmbH, Bern, Switzerland ***"<<std::endl;
143  G4cout<<"*** Sponsored by: ESA/ESTEC contract contract 21435/08/NL/AT ***"<<std::endl;
144  G4cout<<"****************************************************************"<<std::endl;
145  welcome_message=false;
146  }
147 
148  //Switch to adjoint simulation mode
149  //---------------------------------------------------------
151 
152  //Make the run
153  //------------
154 
155  nb_evt_of_last_run =nb_evt;
156  G4RunManager::GetRunManager()->BeamOn(nb_evt*theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes());
157  //G4RunManager::GetRunManager()->BeamOn(theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes()*2*nb_evt);
158 
159  //Back to Fwd Simulation Mode
160  //--------------------------------
162 
163  /*
164  //Register the weight vector
165  //--------------------------
166  std::ofstream FileOutputElectronWeight("ElectronWeight.txt", std::ios::out);
167  FileOutputElectronWeight<<std::setiosflags(std::ios::scientific);
168  FileOutputElectronWeight<<std::setprecision(6);
169  G4bool aBool = electron_last_weight_vector->Store(FileOutputElectronWeight, true);
170  FileOutputElectronWeight.close();
171 
172  std::ofstream FileOutputProtonWeight("ProtonWeight.txt", std::ios::out);
173  FileOutputProtonWeight<<std::setiosflags(std::ios::scientific);
174  FileOutputProtonWeight<<std::setprecision(6);
175  aBool = proton_last_weight_vector->Store(FileOutputProtonWeight, true);
176  FileOutputProtonWeight.close();
177 
178  std::ofstream FileOutputGammaWeight("GammaWeight.txt", std::ios::out);
179  FileOutputGammaWeight<<std::setiosflags(std::ios::scientific);
180  FileOutputGammaWeight<<std::setprecision(6);
181  aBool = gamma_last_weight_vector->Store(FileOutputGammaWeight, true);
182  FileOutputGammaWeight.close();
183  */
184 }
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
void G4AdjointSimManager::SetAdjointEventAction ( G4UserEventAction anAction)

Definition at line 571 of file G4AdjointSimManager.cc.

Referenced by main().

572 {
573  theAdjointEventAction = anAction;
574 }
void G4AdjointSimManager::SetAdjointRunAction ( G4UserRunAction anAction)

Definition at line 590 of file G4AdjointSimManager.cc.

Referenced by main().

591 {
592  theAdjointRunAction=anAction;
593 }
void G4AdjointSimManager::SetAdjointSourceEmax ( G4double  Emax)

Definition at line 526 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::SetEmax().

Referenced by G4AdjointSimMessenger::SetNewValue().

527 {
528  theAdjointPrimaryGeneratorAction->SetEmax(Emax);
529 }
void G4AdjointSimManager::SetAdjointSourceEmin ( G4double  Emin)

Definition at line 520 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::SetEmin().

Referenced by G4AdjointSimMessenger::SetNewValue().

521 {
522  theAdjointPrimaryGeneratorAction->SetEmin(Emin);
523 }
void G4AdjointSimManager::SetAdjointStackingAction ( G4UserStackingAction anAction)

Definition at line 583 of file G4AdjointSimManager.cc.

References G4AdjointStackingAction::SetUserAdjointStackingAction().

584 {
585  theAdjointStackingAction->SetUserAdjointStackingAction(anAction);
586 }
void SetUserAdjointStackingAction(G4UserStackingAction *anAction)
void G4AdjointSimManager::SetAdjointSteppingAction ( G4UserSteppingAction anAction)

Definition at line 577 of file G4AdjointSimManager.cc.

References G4AdjointSteppingAction::SetUserAdjointSteppingAction().

578 {
579  theAdjointSteppingAction->SetUserAdjointSteppingAction(anAction);
580 }
void SetUserAdjointSteppingAction(G4UserSteppingAction *anAction)
void G4AdjointSimManager::SetAdjointTrackingMode ( G4bool  aBool)

Definition at line 315 of file G4AdjointSimManager.cc.

References GetDidAdjParticleReachTheExtSource(), RegisterAtEndOfAdjointTrack(), G4AdjointStackingAction::SetAdjointMode(), and G4AdjointStackingAction::SetKillTracks().

Referenced by G4AdjointPrimaryGeneratorAction::GeneratePrimaries().

316 {
317  adjoint_tracking_mode = aBool;
318 
319  if (adjoint_tracking_mode) {
320  SetRestOfAdjointActions();
321  theAdjointStackingAction->SetAdjointMode(true);
322  theAdjointStackingAction->SetKillTracks(false);
323 
324  }
325  else {
326 
327  ResetRestOfUserActions();
328  theAdjointStackingAction->SetAdjointMode(false);
330  theAdjointStackingAction->SetKillTracks(false);
332  }
333  else theAdjointStackingAction->SetKillTracks(true);
334  }
335 }
G4bool GetDidAdjParticleReachTheExtSource()
void G4AdjointSimManager::SetExtSourceEmax ( G4double  Emax)

Definition at line 481 of file G4AdjointSimManager.cc.

References G4AdjointSteppingAction::SetExtSourceEMax().

Referenced by G4AdjointSimMessenger::SetNewValue().

482 {
483  theAdjointSteppingAction->SetExtSourceEMax(Emax);
484 }
void SetExtSourceEMax(G4double Emax)
void G4AdjointSimManager::SetNormalisationMode ( G4int  n)
inline

Definition at line 205 of file G4AdjointSimManager.hh.

References n.

205 {normalisation_mode=n;};
const G4int n
void G4AdjointSimManager::SetPrimaryIon ( G4ParticleDefinition adjointIon,
G4ParticleDefinition fwdIon 
)

Definition at line 551 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::SetPrimaryIon().

552 {
553  theAdjointPrimaryGeneratorAction->SetPrimaryIon(adjointIon, fwdIon);
554 }
void SetPrimaryIon(G4ParticleDefinition *adjointIon, G4ParticleDefinition *fwdIon)
void G4AdjointSimManager::SwitchToAdjointSimulationMode ( )

Definition at line 203 of file G4AdjointSimManager.cc.

References G4AdjointPrimaryGeneratorAction::UpdateListOfPrimaryParticles().

Referenced by RunAdjointSimulation().

204 { //Replace the user defined actions by the adjoint actions
205  //---------------------------------------------------------
206  SetAdjointActions();
207 
208  //Update the list of primaries
209  //-----------------------------
210  theAdjointPrimaryGeneratorAction->UpdateListOfPrimaryParticles();
211  adjoint_sim_mode=true;
212  ID_of_last_particle_that_reach_the_ext_source=0;
213 }
void G4AdjointSimManager::UseUserStackingActionInFwdTrackingPhase ( G4bool  aBool)
inline

Definition at line 218 of file G4AdjointSimManager.hh.

218 {use_user_StackingAction=aBool;}

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