Import Geant4 9.3.0 source tree
This commit is contained in:
+46
-1
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.177 2008/07/10 09:27:41 gcosmo Exp $
|
||||
$Id: History,v 1.191 2009/11/18 18:02:06 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,51 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
November 18th, 2009 G.Cosmo (run-V09-02-09)
|
||||
- Fixes to "Adjoint" classes to allow build of DLLs on Windows: renamed all
|
||||
methods and data holding "External" as keyword to "Ext".
|
||||
Cleanup of the code: use "const G4String&" instead of "G4String" wherever
|
||||
possible; use G4 types in consistent way; avoid usage of "isNan"; code
|
||||
formatting cleanup; added Geant4 disclaimer.
|
||||
|
||||
November 13, 2009 Makoto Asai (run-V09-02-08)
|
||||
- Fixing two minor bugs in G4RunManager and G4RunManagerKernel.
|
||||
|
||||
November 6,2009 L.Desorgher (run-V09-02-07)
|
||||
- First commit of G4Adjoint classes for run category
|
||||
New classes are G4AdjointSimManager, G4AdjointSimMessenger, G4AdjointPrimaryGeneratorAction
|
||||
|
||||
Oct 19, 2009, Hisaya Kurashige (run-V09-02-06)
|
||||
- Add /run/setCutForAGivenParticle command in G4UserPhysicsListMessenger
|
||||
|
||||
Makoto Asai (run-V09-02-05)
|
||||
Sep 20, 2009, Makoto Asai (run-V09-02-05)
|
||||
- G4RunManagerKernel checks G4VUserPhysicsList to confirm no particle
|
||||
is registered when G4RunManagerKernel is instantiated.
|
||||
|
||||
Aug 10, 2009, Makoto Asai (run-V09-02-04)
|
||||
- G4RunManagerKernel now invokes G4VUserPhysicsList::CheckParticleList
|
||||
just before invoking G4VUserPhysicsList::SetCuts.
|
||||
|
||||
Aug 05, 2009, Hisaya Kurashige (run-V09-02-03)
|
||||
- Add G4VUserPhysicsList::DisableCheckParticleList method
|
||||
- Modify G4VUserPhysicsList::CheckParticleList to check existence
|
||||
of any EM processes
|
||||
|
||||
Aug 03, 2009, Hisaya Kurashige (run-V09-02-02)
|
||||
- Modify G4VUserPhysicsList to fit with proton cuts
|
||||
- Modify G4VUserPhysicsList::BuildPhysicsTable
|
||||
to avoid problem when ions are created in Pre-Init state
|
||||
|
||||
May 22nd, 2009, Hisaya Kurashige (run-V09-02-01)
|
||||
- Add G4VUserPhysicsList::CheckParticleList() to check consistencies of
|
||||
list of particles before constructing processes
|
||||
- Change severity of G4Exception in G4VUserPhysicsList
|
||||
'FatalException' is assigned if core dump is foreseen
|
||||
|
||||
May 21st, 2009, Hisaya Kurashige (run-V09-02-00)
|
||||
- Add check of process manager in G4VUserPhysicsList::BuildPhysicsTable
|
||||
|
||||
July 10th, 2008, Gabriele Cosmo (run-V09-01-02)
|
||||
- G4RunManagerKernel: avoid deletion of default root-region which is now
|
||||
taken care by the geometry stores. It resolves the ambiguity of explicitely
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPrimaryGeneratorAction.hh,v 1.2 2009/11/18 18:02:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointPosOnPhysVolGenerator
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
// ChangeHistory:
|
||||
// 10-01-2007 creation by L. Desorgher
|
||||
// 1-11-2009 Splitting of G4AdjointPrimaryGeneratorAction in two classes G4AdjointPrimaryGeneratorAction and G4AdjointPrimaryGenerator L.Desorgher
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------
|
||||
// Documentation:
|
||||
// This class represents the PrimaryGeneratorAction that is used during the entire adjoint simulation.
|
||||
// It uses the class G4AdjointPrimaryGenerator to generate randomly adjoint primary particles on a user selected
|
||||
// adjoint source (External surface of a volume or Sphere).
|
||||
// The spectrum of the primary adjoint particles is set as 1/E with user defined max and min energy.
|
||||
// The weight of the primary is set according to ReverseMC theory as w=log(Emax/Emin)*E*adjoint_source_area*pi/n, with E the energy of the
|
||||
// particle, n the number of adjoint primary particles of same type that will be generated during the simulation.
|
||||
// Different types of adjoint particles are generated event after event in order
|
||||
// to cover all the type of primaries and secondaries needed for the simulation. For example if reverse e- ionisation, brem, photo electric effect, and
|
||||
// compton are considered both adjoint gamma and adjoint e- will be considered alternatively as adjoint primary.
|
||||
// The user can decide to consider/neglect some type of particle by using the macro
|
||||
// commands /adjoint/ConsiderAsPrimary and /adjoint/NeglectAsPrimary. If an adjoint primary or its secondary has reached the external surface,
|
||||
// in the next event a fwd primary particle equivalent to the last generated adjoint primary is generated with the same position, energy but opposite direction
|
||||
// and the forward tracking phase starts.
|
||||
//
|
||||
//
|
||||
//
|
||||
#ifndef G4AdjointPrimaryGeneratorAction_h
|
||||
#define G4AdjointPrimaryGeneratorAction_h 1
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
#include"G4ThreeVector.hh"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <iterator>
|
||||
|
||||
class G4AdjointPosOnPhysVolGenerator;
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
class G4AdjointPrimaryGenerator;
|
||||
class G4ParticleDefinition;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class G4AdjointPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public: //constructor, destructor
|
||||
|
||||
G4AdjointPrimaryGeneratorAction();
|
||||
~G4AdjointPrimaryGeneratorAction();
|
||||
|
||||
public: //public methods
|
||||
|
||||
void GeneratePrimaries(G4Event*);
|
||||
void SetRndmFlag(const G4String& val) { rndmFlag = val;}
|
||||
void SetEmin(G4double val);
|
||||
void SetEmax(G4double val);
|
||||
void SetEminIon(G4double val);
|
||||
void SetEmaxIon(G4double val);
|
||||
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos);
|
||||
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String& volume_name);
|
||||
void ConsiderParticleAsPrimary(const G4String& particle_name);
|
||||
void NeglectParticleAsPrimary(const G4String& particle_name);
|
||||
void SetPrimaryIon(G4ParticleDefinition* adjointIon, G4ParticleDefinition* fwdIon);
|
||||
void UpdateListOfPrimaryParticles();
|
||||
inline size_t GetNbOfAdjointPrimaryTypes(){return ListOfPrimaryAdjParticles.size();}
|
||||
inline std::vector<G4ParticleDefinition*> GetListOfPrimaryFwdParticles(){return ListOfPrimaryFwdParticles;}
|
||||
inline const G4String& GetPrimaryIonName(){return ion_name;}
|
||||
|
||||
private: //private methods
|
||||
|
||||
G4double ComputeEnergyDistWeight(G4double energy, G4double E1, G4double E2);
|
||||
|
||||
private: //attributes
|
||||
|
||||
G4String rndmFlag; //flag for a rndm impact point
|
||||
|
||||
//The generator of primary vertex except for weight
|
||||
G4AdjointPrimaryGenerator* theAdjointPrimaryGenerator;
|
||||
|
||||
//Emin and Emax energies of the adjoint source
|
||||
//---------------------------------------------
|
||||
G4double Emin;
|
||||
G4double Emax;
|
||||
G4double EminIon;
|
||||
G4double EmaxIon;
|
||||
|
||||
//List of type of primary adjoint and forward particle used in the simulation
|
||||
//---------------------------------------------------------------------------
|
||||
std::vector<G4ParticleDefinition*> ListOfPrimaryFwdParticles;
|
||||
std::vector<G4ParticleDefinition*> ListOfPrimaryAdjParticles;
|
||||
std::map<G4String, G4bool> PrimariesConsideredInAdjointSim; //if true considered if false not considered
|
||||
G4int NbOfAdjointPrimaryTypes;
|
||||
|
||||
size_t index_particle;
|
||||
G4bool last_generated_part_was_adjoint;
|
||||
G4ThreeVector pos, direction, p;
|
||||
|
||||
G4String type_of_adjoint_source; //Spherical ExtSurfaceOfAVolume
|
||||
G4double radius_spherical_source;
|
||||
G4ThreeVector center_spherical_source;
|
||||
|
||||
//For simulation with ions
|
||||
//--------------------------
|
||||
G4ParticleDefinition* fwd_ion;
|
||||
G4ParticleDefinition* adj_ion;
|
||||
G4String ion_name;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,318 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointSimManager.hh,v 1.2 2009/11/18 18:02:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointSimManager.hh
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
// ChangeHistory:
|
||||
// -15-01-2007 creation by L. Desorgher
|
||||
// -March 2008 Redesigned as a non RunManager. L. Desorgher
|
||||
// -01-11-2009 Add the possibility to use user defined run, event, tracking, stepping,
|
||||
// and stacking actions during the adjoint tracking phase. L. Desorgher
|
||||
//
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------
|
||||
// Documentation:
|
||||
// This class represents the Manager of an adjoint/reverse MC simulation.
|
||||
// An adjoint run is divided in a serie of alternative adjoint and forward tracking
|
||||
// of adjoint and normal particles.
|
||||
//
|
||||
// Reverse tracking phase:
|
||||
// -----------------------
|
||||
// An adjoint particle of a given type (adjoint_e-, adjoint_gamma,...) is first generated on the so called adjoint source
|
||||
// with a random energy (1/E distribution) and direction. The adjoint source is the
|
||||
// external surface of a user defined volume or of a user defined sphere. The adjoint
|
||||
// source should contain one or several sensitive volumes and should be small
|
||||
// compared to the entire geometry.
|
||||
// The user can set the min and max energy of the adjoint source. After its
|
||||
// generation the adjoint primary particle is tracked
|
||||
// bacward in the geometry till a user defined external surface (spherical or boundary of a volume)
|
||||
// or is killed before if it reaches a user defined upper energy limit that represents
|
||||
// the maximum energy of the external source. During the reverse tracking, reverse
|
||||
// processes take place where the adjoint particle being tracked can be either scattered
|
||||
// or transformed in another type of adjoint paticle. During the reverse tracking the
|
||||
// G4SimulationManager replaces the user defined Primary, Run, ... actions, by its own actions.
|
||||
//
|
||||
// Forward tracking phase
|
||||
// -----------------------
|
||||
// When an adjoint particle reaches the external surface its weight,type, position,
|
||||
// and directions are registered and a normal primary particle with a type equivalent to the last generated primary adjoint is
|
||||
// generated with the same energy, position but opposite direction and is tracked normally in the sensitive region as in a fwd MC simulation.
|
||||
// During this forward tracking phase the
|
||||
// event, stacking, stepping, tracking actions defined by the user for its general fwd application are used. By this clear separation between
|
||||
// adjoint and fwd tracking phases , the code of the user developed for a fwd simulation should be only slightly modified to adapt it for an adjoint
|
||||
// simulation. Indeed the computation of the signal is done by the same actions or classes that the one used in the fwd simulation mode.
|
||||
//
|
||||
// Modification to brought in a existing G4 application to use the ReverseMC method
|
||||
// -------------------------------
|
||||
// In order to be able to use the ReverseMC method in his simulation, the user should modify its code as such:
|
||||
// 1) Adapt its physics list to use ReverseProcesses for adjoint particles. An example of such physics list is provided in an extended
|
||||
// example.
|
||||
// 2) Create an instance of G4AdjointSimManager somewhere in the main code.
|
||||
// 3) Modify the analysis part of the code to normalise the signal computed during the fwd phase to the weight of the last adjoint particle
|
||||
// that reaches the external surface. This is done by using the following method of G4AdjointSimManager.
|
||||
//
|
||||
// G4int GetIDOfLastAdjParticleReachingExtSource()
|
||||
// G4ThreeVector GetPositionAtEndOfLastAdjointTrack(){ return last_pos;}
|
||||
// G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(){ return last_direction;}
|
||||
// G4double GetEkinAtEndOfLastAdjointTrack(){ return last_ekin;}
|
||||
// G4double GetEkinNucAtEndOfLastAdjointTrack(){ return last_ekin_nuc;}
|
||||
// G4double GetWeightAtEndOfLastAdjointTrack(){return last_weight;}
|
||||
// G4double GetCosthAtEndOfLastAdjointTrack(){return last_cos_th;}
|
||||
// G4String GetFwdParticleNameAtEndOfLastAdjointTrack(){return last_fwd_part_name;}
|
||||
// G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(){return last_fwd_part_PDGEncoding;}
|
||||
// G4int GetFwdParticleIndexAtEndOfLastAdjointTrack().
|
||||
//
|
||||
// In orther to have a code working for both forward and adjoint simulation mode, the extra code needed in user actions for the adjoint
|
||||
// simulation mode can be seperated to the code needed only for the normal forward simulation by using the following method
|
||||
//
|
||||
// G4bool GetAdjointSimMode() that return true if an adjoint simulation is running and false if not!
|
||||
//
|
||||
// Example of modification in the analysis part of the code:
|
||||
// -------------------------------------------------------------
|
||||
// Let say that in the forward simulation a G4 application computes the energy deposited in a volume.
|
||||
// The user wants to normalise its results for an external isotropic source of e- with differential spectrum given by f(E).
|
||||
// A possible modification of the code where the deposited energy Edep during an event is registered would be the following
|
||||
//
|
||||
// G4AdjointSimManager* theAdjSimManager = G4AdjointSimManager::GetInstance();
|
||||
// if (theAdjSimManager->GetAdjointSimMode()) {
|
||||
// //code of the user that should be consider only for forwrad simulation
|
||||
// G4double normalised_edep = 0.;
|
||||
// if (theAdjSimManager->GetFwdParticleNameAtEndOfLastAdjointTrack() == "e-"){
|
||||
// G4double ekin_prim = theAdjSimManager->GetEkinAtEndOfLastAdjointTrack();
|
||||
// G4double weight_prim = theAdjSimManager->GetWeightAtEndOfLastAdjointTrack();
|
||||
// normalised_edep = weight_prim*f(ekin_prim);
|
||||
// }
|
||||
// //then follow the code where normalised_edep is printed, or registered or whatever ....
|
||||
// }
|
||||
//
|
||||
// else { //code of the user that should be consider only for forward simulation
|
||||
// }
|
||||
// Note that in this example a normalisation to only primary e- with only one spectrum f(E) is considered. The example code could be easily
|
||||
// adapted for a normalisatin to several spectra and several type of primary particles in the same simulation.
|
||||
//
|
||||
|
||||
#ifndef G4AdjointSimManager_h
|
||||
#define G4AdjointSimManager_h 1
|
||||
#include "globals.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <vector>
|
||||
|
||||
|
||||
class G4UserEventAction;
|
||||
class G4VUserPrimaryGeneratorAction;
|
||||
class G4UserTrackingAction;
|
||||
class G4UserSteppingAction;
|
||||
class G4UserStackingAction;
|
||||
class G4UserRunAction;
|
||||
class G4AdjointRunAction;
|
||||
class G4AdjointPrimaryGeneratorAction;
|
||||
class G4AdjointSteppingAction;
|
||||
class G4AdjointEventAction;
|
||||
class G4AdjointStackingAction;
|
||||
class G4ParticleDefinition;
|
||||
class G4AdjointSimMessenger;
|
||||
class G4PhysicsLogVector;
|
||||
|
||||
class G4AdjointSimManager
|
||||
{
|
||||
public:
|
||||
|
||||
static G4AdjointSimManager* GetInstance();
|
||||
|
||||
public: //publich methods
|
||||
|
||||
void RunAdjointSimulation(G4int nb_evt);
|
||||
|
||||
inline G4int GetNbEvtOfLastRun(){return nb_evt_of_last_run;}
|
||||
|
||||
void SetAdjointTrackingMode(G4bool aBool);
|
||||
inline G4bool GetAdjointTrackingMode(){return adjoint_tracking_mode;} //true if an adjoint track is being processed
|
||||
inline G4bool GetAdjointSimMode(){return adjoint_sim_mode;} //true if an adjoint simulation is running
|
||||
|
||||
G4bool GetDidAdjParticleReachTheExtSource();
|
||||
void RegisterAtEndOfAdjointTrack();
|
||||
void RegisterAdjointPrimaryWeight(G4double aWeight);
|
||||
|
||||
inline G4int GetIDOfLastAdjParticleReachingExtSource(){return ID_of_last_particle_that_reach_the_ext_source;};
|
||||
inline G4ThreeVector GetPositionAtEndOfLastAdjointTrack(){ return last_pos;}
|
||||
inline G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(){ return last_direction;}
|
||||
inline G4double GetEkinAtEndOfLastAdjointTrack(){ return last_ekin;}
|
||||
inline G4double GetEkinNucAtEndOfLastAdjointTrack(){ return last_ekin_nuc;}
|
||||
inline G4double GetWeightAtEndOfLastAdjointTrack(){return last_weight;}
|
||||
inline G4double GetCosthAtEndOfLastAdjointTrack(){return last_cos_th;}
|
||||
inline const G4String& GetFwdParticleNameAtEndOfLastAdjointTrack(){return last_fwd_part_name;}
|
||||
inline G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(){return last_fwd_part_PDGEncoding;}
|
||||
inline G4int GetFwdParticleIndexAtEndOfLastAdjointTrack(){return last_fwd_part_index;}
|
||||
|
||||
std::vector<G4ParticleDefinition*> GetListOfPrimaryFwdParticles();
|
||||
|
||||
G4bool DefineSphericalExtSource(G4double radius, G4ThreeVector pos);
|
||||
G4bool DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String& volume_name);
|
||||
G4bool DefineExtSourceOnTheExtSurfaceOfAVolume(const G4String& volume_name);
|
||||
void SetExtSourceEmax(G4double Emax);
|
||||
|
||||
//Definition of adjoint source
|
||||
//----------------------------
|
||||
|
||||
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);
|
||||
inline G4double GetAdjointSourceArea(){return area_of_the_adjoint_source;}
|
||||
void ConsiderParticleAsPrimary(const G4String& particle_name);
|
||||
void NeglectParticleAsPrimary(const G4String& particle_name);
|
||||
void SetPrimaryIon(G4ParticleDefinition* adjointIon, G4ParticleDefinition* fwdIon);
|
||||
const G4String& GetPrimaryIonName();
|
||||
|
||||
inline void SetNormalisationMode(G4int n){normalisation_mode=n;};
|
||||
G4int GetNormalisationMode(){return normalisation_mode;};
|
||||
G4double GetNumberNucleonsInIon(){return nb_nuc;};
|
||||
|
||||
//Definition of user actions for the adjoint tracking phase
|
||||
//----------------------------
|
||||
void SetAdjointEventAction(G4UserEventAction* anAction);
|
||||
void SetAdjointSteppingAction(G4UserSteppingAction* anAction);
|
||||
void SetAdjointStackingAction(G4UserStackingAction* anAction);
|
||||
void SetAdjointTrackingAction(G4UserTrackingAction* anAction);
|
||||
void SetAdjointRunAction(G4UserRunAction* anAction);
|
||||
|
||||
//Set methods for user run actions
|
||||
//--------------------------------
|
||||
inline void UseUserStackingActionInFwdTrackingPhase(G4bool aBool){use_user_StackingAction=aBool;}
|
||||
|
||||
//Convergence test
|
||||
//-----------------------
|
||||
/*
|
||||
void RegisterSignalForConvergenceTest(G4double aSignal);
|
||||
void DefineExponentialPrimarySpectrumForConvergenceTest(G4ParticleDefinition* aPartDef, G4double E0);
|
||||
void DefinePowerLawPrimarySpectrumForConvergenceTest(G4ParticleDefinition* aPartDef, G4double alpha);
|
||||
|
||||
*/
|
||||
|
||||
private:
|
||||
|
||||
static G4AdjointSimManager* instance;
|
||||
|
||||
private: // methods
|
||||
|
||||
void SetRestOfAdjointActions();
|
||||
void SetAdjointPrimaryRunAndStackingActions();
|
||||
void ResetRestOfUserActions();
|
||||
void ResetUserPrimaryRunAndStackingActions();
|
||||
void DefineUserActions();
|
||||
|
||||
private: //constructor and destructor
|
||||
|
||||
G4AdjointSimManager();
|
||||
~G4AdjointSimManager();
|
||||
|
||||
private ://attributes
|
||||
|
||||
//Messenger
|
||||
//----------
|
||||
G4AdjointSimMessenger* theMessenger;
|
||||
|
||||
//user defined actions for the normal fwd simulation. Taken from the G4RunManager
|
||||
//-------------------------------------------------
|
||||
bool user_action_already_defined;
|
||||
G4UserRunAction* fUserRunAction;
|
||||
G4UserEventAction* fUserEventAction;
|
||||
G4VUserPrimaryGeneratorAction* fUserPrimaryGeneratorAction;
|
||||
G4UserTrackingAction* fUserTrackingAction;
|
||||
G4UserSteppingAction* fUserSteppingAction;
|
||||
G4UserStackingAction* fUserStackingAction;
|
||||
bool use_user_StackingAction; //only for fwd part of the adjoint simulation
|
||||
|
||||
//action for adjoint simulation
|
||||
//-----------------------------
|
||||
G4UserRunAction* theAdjointRunAction;
|
||||
G4UserEventAction* theAdjointEventAction;
|
||||
G4AdjointPrimaryGeneratorAction* theAdjointPrimaryGeneratorAction;
|
||||
G4UserTrackingAction* theAdjointTrackingAction;
|
||||
G4AdjointSteppingAction* theAdjointSteppingAction;
|
||||
G4AdjointStackingAction* theAdjointStackingAction;
|
||||
|
||||
//adjoint mode
|
||||
//-------------
|
||||
G4bool adjoint_tracking_mode;
|
||||
G4bool adjoint_sim_mode;
|
||||
|
||||
//adjoint particle information on the external surface
|
||||
//-----------------------------
|
||||
G4ThreeVector last_pos;
|
||||
G4ThreeVector last_direction;
|
||||
G4double last_ekin,last_ekin_nuc; //last_ekin_nuc=last_ekin/nuc, nuc is 1 if not a nucleus
|
||||
G4double last_cos_th;
|
||||
G4String last_fwd_part_name;
|
||||
G4int last_fwd_part_PDGEncoding;
|
||||
G4int last_fwd_part_index;
|
||||
G4double last_weight;
|
||||
G4int ID_of_last_particle_that_reach_the_ext_source;
|
||||
|
||||
G4int nb_evt_of_last_run;
|
||||
G4int normalisation_mode;
|
||||
|
||||
//Adjoint source
|
||||
//--------------
|
||||
G4double area_of_the_adjoint_source;
|
||||
G4double nb_nuc;
|
||||
G4double theAdjointPrimaryWeight;
|
||||
|
||||
//Weight Analysis
|
||||
//----------
|
||||
G4PhysicsLogVector* electron_last_weight_vector;
|
||||
G4PhysicsLogVector* proton_last_weight_vector;
|
||||
G4PhysicsLogVector* gamma_last_weight_vector;
|
||||
|
||||
G4bool welcome_message;
|
||||
|
||||
/* For the future
|
||||
//Convergence test
|
||||
//----------------
|
||||
|
||||
G4double normalised_signal;
|
||||
G4double error_signal;
|
||||
G4bool convergence_test_is_used;
|
||||
G4bool power_law_spectrum_for_convergence_test; // true PowerLaw, ;
|
||||
G4ParticleDefinition* the_par_def_for_convergence_test;
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointSimMessenger.hh,v 1.2 2009/11/18 18:02:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointSimMessenger.hh
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
// ChangeHistory:
|
||||
// -1st January 2007 creation by L. Desorgher
|
||||
// -November-December 2009 Some cleaning and adaptation for the first Release in the Geant4 toolkit, L. Desorgher
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------
|
||||
// Documentation:
|
||||
// This class represents the Messenger that defined the G4UI macro comands allowing the
|
||||
// user contreol an adjoint/reverse MC simulation. It calls methods of G4AdjointSimManager
|
||||
// List of commands
|
||||
// -----------------
|
||||
// 1)Start an adjoint simulation
|
||||
// --------------------------------------------
|
||||
// Command:
|
||||
// -/adjoint/start_run nb: Start an adjoint simulation with a number of events given by nb.
|
||||
// 2)Definition of the external source
|
||||
// ---------------------------------------------------
|
||||
// The external source represents the real external source of particles till which adjoint particles are tracked in the reverse tracking mode
|
||||
// of the simulation (see G4AdjointSimManager.hh and G4Application Developer guide for more infos).
|
||||
// The user can define the source as the external surface of a sphere or of G4 volume of the geometry. He can also set the maximum energy of the
|
||||
// source. If an adjoint particle get an energy higher than this maximum energy before reaching the external surface source it is killed without being registered.
|
||||
// Commands:
|
||||
// -/adjoint/DefineSphericalExtSource R X Y Z unit_length:
|
||||
// The external source is set on a sphere with radius R and centered on position (X,Y,Z)
|
||||
//
|
||||
// -/adjoint/DefineSphericalExtSourceCenteredOnAVolume phys_vol_name R unit_length
|
||||
// The external source is set on a sphere with radius R and with its center position located at the center of the
|
||||
// the physical volume specified by the name phys_vol_name.
|
||||
// -/adjoint/DefineExtSourceOnExtSurfaceOfAVolume phys_vol_name
|
||||
// The external surface is set as the external boundary of a the physical volume with name phys_vol_name
|
||||
// -/adjoint/SetExtSourceEmax Emax energy_unit
|
||||
// Set the maximum energy of the external source
|
||||
//
|
||||
//
|
||||
// 3)Definition of the adjoint source
|
||||
// ---------------------------------------------------
|
||||
// The adjoint source represents the source from which adjoint primary particles are generated.(see G4AdjointSimManager.hh and G4Application Developer guide for more infos)
|
||||
// The user can define the source as the external surface of a sphere or of G4 volume of the geometry. He set the minimum maximum energy of the
|
||||
// source and define which type of adjoint primary particles should be considered.
|
||||
// Commands:
|
||||
// -/adjoint/DefineSphericalAdjSource R X Y Z unit_length:
|
||||
// The adjoint source is set on a sphere with radius R and centered on position (X,Y,Z)
|
||||
//
|
||||
// -/adjoint/DefineSphericalAdjSourceCenteredOnAVolume phys_vol_name R unit_length
|
||||
// The external source is set on a sphere with radius R and with its center position located at the center of the
|
||||
// the physical volume specified by the name phys_vol_name.
|
||||
// -/adjoint/DefineAdjSourceOnExtSurfaceOfAVolume phys_vol_name
|
||||
// The external surface is set as the external boundary of a the physical volume with name phys_vol_name
|
||||
//
|
||||
// -/adjoint/SetAdjSourceEmin Emin energy_unit
|
||||
// Set the minimum energy of the external source
|
||||
//
|
||||
// -/adjoint/SetAdjSourceEmax Emax energy_unit
|
||||
// Set the maximum energy of the external source
|
||||
//
|
||||
// -/adjoint/ConsiderAsPrimary particle_name
|
||||
// The type of particle specified by "particle_name" will be added in the list of primary adjoint particles.
|
||||
// The list of candidates depends on the reverse physics processes considered in the simulation. At the most the
|
||||
// potential candidates are (e-, gamma, proton , ion)
|
||||
//
|
||||
// -/adjoint/NeglectAsPrimary particle_name
|
||||
// The type of particle specified by "particle_name" will be removed from the list of primary adjoint particles.
|
||||
// The list of candidates depends on the reverse physics processes considered in the simulation. At the most the
|
||||
// potential candidates are (e-, gamma, proton , ion)
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef G4AdjointSimMessenger_h
|
||||
#define G4AdjointSimMessenger_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class G4AdjointSimManager;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWith3VectorAndUnit;
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithADouble;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class G4AdjointSimMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4AdjointSimMessenger(G4AdjointSimManager* );
|
||||
~G4AdjointSimMessenger();
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
G4AdjointSimManager* theAdjointRunManager;
|
||||
|
||||
G4UIdirectory* AdjointSimDir;
|
||||
G4UIdirectory* PhysicsDir;
|
||||
|
||||
G4UIcommand * beamOnCmd;
|
||||
G4UIcommand * testSourceCmd;
|
||||
|
||||
G4UIcommand * DefineSpherExtSourceCmd;
|
||||
G4UIcommand * DefineSpherExtSourceCenteredOnAVolumeCmd;
|
||||
G4UIcmdWithAString * DefineExtSourceOnAVolumeExtSurfaceCmd;
|
||||
G4UIcmdWithADoubleAndUnit* setExtSourceEMaxCmd;
|
||||
|
||||
G4UIcommand * DefineSpherAdjSourceCmd;
|
||||
G4UIcommand * DefineSpherAdjSourceCenteredOnAVolumeCmd;
|
||||
G4UIcmdWithAString * DefineAdjSourceOnAVolumeExtSurfaceCmd;
|
||||
|
||||
G4UIcmdWithADoubleAndUnit* setAdjSourceEminCmd;
|
||||
G4UIcmdWithADoubleAndUnit* setAdjSourceEmaxCmd;
|
||||
|
||||
|
||||
G4UIcmdWithAString* ConsiderParticleAsPrimaryCmd;
|
||||
G4UIcmdWithAString* NeglectParticleAsPrimaryCmd;
|
||||
|
||||
};
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunManager.hh,v 1.51 2007/11/13 19:25:13 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4RunManager.hh,v 1.52 2009/11/13 23:14:46 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -440,7 +440,7 @@ class G4RunManager
|
||||
|
||||
public:
|
||||
void ConstructScoringWorlds();
|
||||
private:
|
||||
protected:
|
||||
void UpdateScoring();
|
||||
};
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UserPhysicsListMessenger.hh,v 1.18 2007/05/30 10:34:54 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4UserPhysicsListMessenger.hh,v 1.20 2009/10/20 07:07:51 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -96,6 +96,7 @@ public: // with description
|
||||
G4UIcmdWithADoubleAndUnit * setPCutCmd;
|
||||
G4UIcmdWithADoubleAndUnit * setCutCmd;
|
||||
G4UIcommand * setCutRCmd;
|
||||
G4UIcommand * setCutForAGivenParticleCmd;
|
||||
G4UIcmdWithAnInteger * verboseCmd;
|
||||
G4UIcmdWithoutParameter * dumpListCmd;
|
||||
G4UIcmdWithAString * addProcManCmd;
|
||||
|
||||
@@ -24,20 +24,20 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserPhysicsList.hh,v 1.35 2007/05/30 10:16:27 ahoward Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4VUserPhysicsList.hh,v 1.41 2009/08/09 14:31:46 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
// Class Description:
|
||||
// This class is an abstruct class for
|
||||
// This class is an abstract class for
|
||||
// constructing particles and processes.
|
||||
// User must implement following four virtual methods
|
||||
// in his own concrete class derived from this class.
|
||||
// User must implement following three virtual methods
|
||||
// in his/her own concrete class derived from this class.
|
||||
// G4VUserPhysicsList::ConstructParticle()
|
||||
// Construct particles
|
||||
// G4VUserPhysicsList::constructPhysics()
|
||||
// G4VUserPhysicsList::ConstructProcess()
|
||||
// Construct procesess and register them to particles
|
||||
// G4VUserPhysicsList::SetCuts()
|
||||
// set cut values in range to all particles
|
||||
@@ -110,7 +110,7 @@ class G4VUserPhysicsList
|
||||
|
||||
// Each physics process will be instantiated and
|
||||
// registered to the process manager of each particle type
|
||||
// This method is invoked in Construct" method
|
||||
// This method is invoked in Construct method
|
||||
virtual void ConstructProcess() = 0;
|
||||
|
||||
protected: // with description
|
||||
@@ -177,7 +177,7 @@ class G4VUserPhysicsList
|
||||
public: // with description
|
||||
// Request to print out information of cut values
|
||||
// Printing will be performed when all tables are made
|
||||
void DumpCutValuesTable(G4int nParticles=3);
|
||||
void DumpCutValuesTable(G4int nParticles=4);
|
||||
|
||||
// The following method actually trigger the print-out requested
|
||||
// by the above method. This method must be invoked by RunManager
|
||||
@@ -257,7 +257,18 @@ class G4VUserPhysicsList
|
||||
void AddProcessManager(G4ParticleDefinition* newParticle,
|
||||
G4ProcessManager* newManager = 0 );
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
// check consistencies of list of particles
|
||||
|
||||
void CheckParticleList();
|
||||
|
||||
void DisableCheckParticleList();
|
||||
|
||||
protected:
|
||||
|
||||
bool fDisableCheckParticleList;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
protected:
|
||||
// the particle table has the complete List of existing particle types
|
||||
@@ -292,6 +303,9 @@ class G4VUserPhysicsList
|
||||
// flag for displaying the range cuts & energy thresholds
|
||||
G4int fDisplayThreshold;
|
||||
|
||||
// flag for Physics Table has been built
|
||||
G4bool fIsPhysicsTableBuilt;
|
||||
|
||||
private:
|
||||
enum { FixedStringLengthForStore = 32 };
|
||||
|
||||
@@ -332,6 +346,7 @@ inline void G4VUserPhysicsList::Construct()
|
||||
if (verboseLevel >1) G4cout << "Construct processes " << G4endl;
|
||||
#endif
|
||||
ConstructProcess();
|
||||
|
||||
}
|
||||
|
||||
inline G4double G4VUserPhysicsList::GetDefaultCutValue() const
|
||||
@@ -384,5 +399,13 @@ inline
|
||||
{
|
||||
fStoredInAscii = false;
|
||||
}
|
||||
|
||||
inline
|
||||
void G4VUserPhysicsList::DisableCheckParticleList()
|
||||
{
|
||||
fDisableCheckParticleList = true;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPrimaryGeneratorAction.cc,v 1.2 2009/11/18 18:02:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4AdjointPrimaryGeneratorAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4AdjointSimManager.hh"
|
||||
#include "G4AdjointPrimaryGenerator.hh"
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointPrimaryGeneratorAction::G4AdjointPrimaryGeneratorAction()
|
||||
{
|
||||
theAdjointPrimaryGenerator= new G4AdjointPrimaryGenerator();
|
||||
|
||||
PrimariesConsideredInAdjointSim[G4String("e-")]=false;
|
||||
PrimariesConsideredInAdjointSim[G4String("gamma")]=false;
|
||||
PrimariesConsideredInAdjointSim[G4String("proton")]=false;
|
||||
PrimariesConsideredInAdjointSim[G4String("ion")]=false;
|
||||
|
||||
ListOfPrimaryFwdParticles.clear();
|
||||
ListOfPrimaryAdjParticles.clear();
|
||||
|
||||
last_generated_part_was_adjoint=false;
|
||||
index_particle=100000;
|
||||
|
||||
ion_name="not_defined";
|
||||
fwd_ion = 0;
|
||||
adj_ion = 0;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointPrimaryGeneratorAction::~G4AdjointPrimaryGeneratorAction()
|
||||
{
|
||||
delete theAdjointPrimaryGenerator;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
if ( !last_generated_part_was_adjoint ) {
|
||||
|
||||
index_particle++;
|
||||
if (index_particle >= ListOfPrimaryAdjParticles.size()) index_particle =0;
|
||||
|
||||
|
||||
G4double E1=Emin;
|
||||
G4double E2=Emax;
|
||||
if (!ListOfPrimaryAdjParticles[index_particle]) UpdateListOfPrimaryParticles();//ion has not been created yet
|
||||
|
||||
if (ListOfPrimaryAdjParticles[index_particle]->GetParticleName() == "adj_proton") {
|
||||
E1=EminIon;
|
||||
E2=EmaxIon;
|
||||
}
|
||||
if (ListOfPrimaryAdjParticles[index_particle]->GetParticleType() == "adjoint_nucleus") {
|
||||
G4int A= ListOfPrimaryAdjParticles[index_particle]->GetAtomicMass();
|
||||
E1=EminIon*A;
|
||||
E2=EmaxIon*A;
|
||||
}
|
||||
theAdjointPrimaryGenerator->GenerateAdjointPrimaryVertex(anEvent,
|
||||
ListOfPrimaryAdjParticles[index_particle],
|
||||
E1,E2);
|
||||
G4PrimaryVertex* aPrimVertex = anEvent->GetPrimaryVertex();
|
||||
|
||||
|
||||
p=aPrimVertex->GetPrimary()->GetMomentum();
|
||||
pos=aPrimVertex->GetPosition();
|
||||
G4double pmag=p.mag();
|
||||
|
||||
G4double m0=ListOfPrimaryAdjParticles[index_particle]->GetPDGMass();
|
||||
G4double ekin=std::sqrt( m0*m0 + pmag*pmag) -m0;
|
||||
|
||||
|
||||
//The factor pi is to normalise the weight to the directional flux
|
||||
G4double adjoint_source_area = G4AdjointSimManager::GetInstance()->GetAdjointSourceArea();
|
||||
G4double adjoint_weight = ComputeEnergyDistWeight(ekin,E1,E2)*adjoint_source_area*pi;
|
||||
|
||||
aPrimVertex->SetWeight(adjoint_weight);
|
||||
|
||||
last_generated_part_was_adjoint =true;
|
||||
G4AdjointSimManager::GetInstance()->SetAdjointTrackingMode(true);
|
||||
G4AdjointSimManager::GetInstance()->RegisterAdjointPrimaryWeight(adjoint_weight);
|
||||
}
|
||||
else {
|
||||
//fwd particle equivalent to the last generated adjoint particle ios generated
|
||||
G4PrimaryVertex* aPrimVertex = new G4PrimaryVertex();
|
||||
aPrimVertex->SetPosition(pos.x(),pos.y(),pos.z());
|
||||
aPrimVertex->SetT0(0.);
|
||||
G4PrimaryParticle* aPrimParticle = new G4PrimaryParticle(ListOfPrimaryFwdParticles[index_particle],
|
||||
-p.x(),-p.y(),-p.z());
|
||||
|
||||
aPrimVertex->SetPrimary(aPrimParticle);
|
||||
anEvent->AddPrimaryVertex(aPrimVertex);
|
||||
last_generated_part_was_adjoint =false;
|
||||
G4AdjointSimManager::GetInstance()->SetAdjointTrackingMode(false);
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::SetEmin(G4double val)
|
||||
{
|
||||
Emin=val;
|
||||
EminIon=val;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::SetEmax(G4double val)
|
||||
{
|
||||
Emax=val;
|
||||
EmaxIon=val;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::SetEminIon(G4double val)
|
||||
{
|
||||
EminIon=val;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::SetEmaxIon(G4double val)
|
||||
{
|
||||
EmaxIon=val;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPrimaryGeneratorAction::ComputeEnergyDistWeight(G4double E ,G4double E1, G4double E2)
|
||||
{
|
||||
// We generate N numbers of primaries with a 1/E energy law distribution.
|
||||
// We have therefore an energy distribution function
|
||||
// f(E)=C/E (1)
|
||||
// with C a constant that is such that
|
||||
// N=Integral(f(E),E1,E2)=C.std::log(E2/E1) (2)
|
||||
// Therefore from (2) we get
|
||||
// C=N/ std::log(E2/E1) (3)
|
||||
// and
|
||||
// f(E)=N/ std::log(E2/E1)/E (4)
|
||||
//For the adjoint simulation we need a energy distribution f'(E)=1..
|
||||
//To get that we need therefore to apply a weight to the primary
|
||||
// W=1/f(E)=E*std::log(E2/E1)/N
|
||||
//
|
||||
return std::log(E2/E1)*E/G4AdjointSimManager::GetInstance()->GetNbEvtOfLastRun();
|
||||
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector center_pos)
|
||||
{
|
||||
radius_spherical_source = radius;
|
||||
center_spherical_source = center_pos;
|
||||
type_of_adjoint_source ="Spherical";
|
||||
theAdjointPrimaryGenerator->SetSphericalAdjointPrimarySource(radius,center_pos);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String& volume_name)
|
||||
{
|
||||
type_of_adjoint_source ="ExternalSurfaceOfAVolume";
|
||||
theAdjointPrimaryGenerator->SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(volume_name);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::ConsiderParticleAsPrimary(const G4String& particle_name)
|
||||
{
|
||||
if (PrimariesConsideredInAdjointSim.find(particle_name) != PrimariesConsideredInAdjointSim.end()){
|
||||
PrimariesConsideredInAdjointSim[particle_name]=true;
|
||||
}
|
||||
UpdateListOfPrimaryParticles();
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::NeglectParticleAsPrimary(const G4String& particle_name)
|
||||
{
|
||||
if (PrimariesConsideredInAdjointSim.find(particle_name) != PrimariesConsideredInAdjointSim.end()){
|
||||
PrimariesConsideredInAdjointSim[particle_name]= false;
|
||||
}
|
||||
UpdateListOfPrimaryParticles();
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::UpdateListOfPrimaryParticles()
|
||||
{
|
||||
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
|
||||
ListOfPrimaryFwdParticles.clear();
|
||||
ListOfPrimaryAdjParticles.clear();
|
||||
std::map<G4String, G4bool>::iterator iter;
|
||||
for( iter = PrimariesConsideredInAdjointSim.begin(); iter != PrimariesConsideredInAdjointSim.end(); ++iter ) {
|
||||
if(iter->second) {
|
||||
G4String fwd_particle_name = iter->first;
|
||||
if ( fwd_particle_name != "ion") {
|
||||
G4String adj_particle_name = G4String("adj_") + fwd_particle_name;
|
||||
ListOfPrimaryFwdParticles.push_back(theParticleTable->FindParticle(fwd_particle_name));
|
||||
ListOfPrimaryAdjParticles.push_back(theParticleTable->FindParticle(adj_particle_name));
|
||||
}
|
||||
else {
|
||||
if (fwd_ion ){
|
||||
ion_name=fwd_ion->GetParticleName();
|
||||
G4String adj_ion_name=G4String("adj_") +ion_name;
|
||||
ListOfPrimaryFwdParticles.push_back(fwd_ion);
|
||||
ListOfPrimaryAdjParticles.push_back(adj_ion);
|
||||
}
|
||||
else {
|
||||
ListOfPrimaryFwdParticles.push_back(0);
|
||||
ListOfPrimaryAdjParticles.push_back(0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGeneratorAction::SetPrimaryIon(G4ParticleDefinition* adjointIon, G4ParticleDefinition* fwdIon)
|
||||
{
|
||||
fwd_ion = fwdIon;
|
||||
adj_ion = adjointIon;
|
||||
UpdateListOfPrimaryParticles();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,491 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointSimManager.cc,v 1.2 2009/11/18 18:02:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4AdjointSimManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4UserTrackingAction.hh"
|
||||
#include "G4UserSteppingAction.hh"
|
||||
#include "G4UserStackingAction.hh"
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
#include "G4AdjointPrimaryGeneratorAction.hh"
|
||||
#include "G4AdjointSteppingAction.hh"
|
||||
#include "G4AdjointStackingAction.hh"
|
||||
|
||||
#include "G4AdjointSimMessenger.hh"
|
||||
|
||||
#include "G4AdjointCrossSurfChecker.hh"
|
||||
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4PhysicsLogVector.hh"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSimManager* G4AdjointSimManager::instance = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSimManager::G4AdjointSimManager()
|
||||
{
|
||||
//Create adjoint actions;
|
||||
//----------------------
|
||||
|
||||
theAdjointRunAction = 0;
|
||||
theAdjointPrimaryGeneratorAction = new G4AdjointPrimaryGeneratorAction();
|
||||
theAdjointSteppingAction = new G4AdjointSteppingAction();
|
||||
theAdjointEventAction = 0;
|
||||
theAdjointTrackingAction = 0;
|
||||
theAdjointStackingAction = new G4AdjointStackingAction();
|
||||
|
||||
//Create messenger
|
||||
//----------------
|
||||
theMessenger = new G4AdjointSimMessenger(this);
|
||||
|
||||
user_action_already_defined=false;
|
||||
use_user_StackingAction = false;
|
||||
|
||||
fUserTrackingAction= 0;
|
||||
fUserEventAction= 0;
|
||||
fUserSteppingAction= 0;
|
||||
fUserPrimaryGeneratorAction= 0;
|
||||
fUserRunAction= 0;
|
||||
fUserStackingAction= 0;
|
||||
|
||||
adjoint_sim_mode = false;
|
||||
|
||||
normalisation_mode=3;
|
||||
|
||||
nb_nuc=1.;
|
||||
|
||||
welcome_message =true;
|
||||
|
||||
/*electron_last_weight_vector = new G4PhysicsLogVector(1.e-20,1.e20,400);
|
||||
proton_last_weight_vector = new G4PhysicsLogVector(1.e-20,1.e20,400);
|
||||
gamma_last_weight_vector = new G4PhysicsLogVector(1.e-20,1.e20,400);*/
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSimManager::~G4AdjointSimManager()
|
||||
{
|
||||
if (theAdjointRunAction) delete theAdjointRunAction;
|
||||
if (theAdjointPrimaryGeneratorAction) delete theAdjointPrimaryGeneratorAction;
|
||||
if (theAdjointSteppingAction) delete theAdjointSteppingAction;
|
||||
if (theAdjointEventAction) delete theAdjointEventAction;
|
||||
if (theAdjointTrackingAction) delete theAdjointTrackingAction;
|
||||
if (theAdjointStackingAction) delete theAdjointStackingAction;
|
||||
if (theMessenger) delete theMessenger;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSimManager* G4AdjointSimManager::GetInstance()
|
||||
{
|
||||
if (instance == 0) instance = new G4AdjointSimManager;
|
||||
return instance;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::RunAdjointSimulation(G4int nb_evt)
|
||||
{
|
||||
if (welcome_message) {
|
||||
G4cout<<"****************************************************************"<<std::endl;
|
||||
G4cout<<"*** Geant4 Reverse/Adjoint Monte Carlo mode ***"<<std::endl;
|
||||
G4cout<<"*** Author: L.Desorgher ***"<<std::endl;
|
||||
G4cout<<"*** Company: SpaceIT GmbH, Bern, Switzerland ***"<<std::endl;
|
||||
G4cout<<"*** Sponsored by: ESA/ESTEC contract contract 21435/08/NL/AT ***"<<std::endl;
|
||||
G4cout<<"****************************************************************"<<std::endl;
|
||||
welcome_message=false;
|
||||
}
|
||||
|
||||
//Replace the user defined actions by the adjoint actions
|
||||
//---------------------------------------------------------
|
||||
SetAdjointPrimaryRunAndStackingActions();
|
||||
SetRestOfAdjointActions();
|
||||
|
||||
//Update the list of primaries
|
||||
//-----------------------------
|
||||
theAdjointPrimaryGeneratorAction->UpdateListOfPrimaryParticles();
|
||||
|
||||
adjoint_sim_mode=true;
|
||||
|
||||
ID_of_last_particle_that_reach_the_ext_source=0;
|
||||
|
||||
//Make the run
|
||||
//------------
|
||||
|
||||
nb_evt_of_last_run =nb_evt;
|
||||
G4RunManager::GetRunManager()->BeamOn(theAdjointPrimaryGeneratorAction->GetNbOfAdjointPrimaryTypes()*2*nb_evt);
|
||||
|
||||
//Restore the user defined actions
|
||||
//--------------------------------
|
||||
ResetRestOfUserActions();
|
||||
ResetUserPrimaryRunAndStackingActions();
|
||||
adjoint_sim_mode=false;
|
||||
|
||||
/*
|
||||
//Register the weight vector
|
||||
//--------------------------
|
||||
std::ofstream FileOutputElectronWeight("ElectronWeight.txt", std::ios::out);
|
||||
FileOutputElectronWeight<<std::setiosflags(std::ios::scientific);
|
||||
FileOutputElectronWeight<<std::setprecision(6);
|
||||
G4bool aBool = electron_last_weight_vector->Store(FileOutputElectronWeight, true);
|
||||
FileOutputElectronWeight.close();
|
||||
|
||||
std::ofstream FileOutputProtonWeight("ProtonWeight.txt", std::ios::out);
|
||||
FileOutputProtonWeight<<std::setiosflags(std::ios::scientific);
|
||||
FileOutputProtonWeight<<std::setprecision(6);
|
||||
aBool = proton_last_weight_vector->Store(FileOutputProtonWeight, true);
|
||||
FileOutputProtonWeight.close();
|
||||
|
||||
std::ofstream FileOutputGammaWeight("GammaWeight.txt", std::ios::out);
|
||||
FileOutputGammaWeight<<std::setiosflags(std::ios::scientific);
|
||||
FileOutputGammaWeight<<std::setprecision(6);
|
||||
aBool = gamma_last_weight_vector->Store(FileOutputGammaWeight, true);
|
||||
FileOutputGammaWeight.close();
|
||||
*/
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetRestOfAdjointActions()
|
||||
{
|
||||
G4RunManager* theRunManager = G4RunManager::GetRunManager();
|
||||
|
||||
if (!user_action_already_defined) DefineUserActions();
|
||||
|
||||
//Replace the user action by the adjoint actions
|
||||
//-------------------------------------------------
|
||||
|
||||
theRunManager->SetUserAction(theAdjointEventAction);
|
||||
theRunManager->SetUserAction(theAdjointSteppingAction);
|
||||
theRunManager->SetUserAction(theAdjointTrackingAction);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointPrimaryRunAndStackingActions()
|
||||
{
|
||||
G4RunManager* theRunManager = G4RunManager::GetRunManager();
|
||||
|
||||
if (!user_action_already_defined) DefineUserActions();
|
||||
|
||||
//Replace the user action by the adjoint actions
|
||||
//-------------------------------------------------
|
||||
|
||||
theRunManager->SetUserAction(theAdjointRunAction);
|
||||
theRunManager->SetUserAction(theAdjointPrimaryGeneratorAction);
|
||||
theRunManager->SetUserAction(theAdjointStackingAction);
|
||||
if (use_user_StackingAction) theAdjointStackingAction->SetUserFwdStackingAction(fUserStackingAction);
|
||||
else theAdjointStackingAction->SetUserFwdStackingAction(0);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::ResetRestOfUserActions()
|
||||
{
|
||||
G4RunManager* theRunManager = G4RunManager::GetRunManager();
|
||||
|
||||
//Restore the user defined actions
|
||||
//-------------------------------
|
||||
|
||||
theRunManager->SetUserAction(fUserEventAction);
|
||||
theRunManager->SetUserAction(fUserSteppingAction);
|
||||
theRunManager->SetUserAction(fUserTrackingAction);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::ResetUserPrimaryRunAndStackingActions()
|
||||
{
|
||||
G4RunManager* theRunManager = G4RunManager::GetRunManager();
|
||||
//Restore the user defined actions
|
||||
//-------------------------------
|
||||
theRunManager->SetUserAction(fUserRunAction);
|
||||
theRunManager->SetUserAction(fUserPrimaryGeneratorAction);
|
||||
theRunManager->SetUserAction(fUserStackingAction);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::DefineUserActions()
|
||||
{
|
||||
G4RunManager* theRunManager = G4RunManager::GetRunManager();
|
||||
fUserTrackingAction= const_cast<G4UserTrackingAction* >( theRunManager->GetUserTrackingAction() );
|
||||
fUserEventAction= const_cast<G4UserEventAction* >( theRunManager->GetUserEventAction() );
|
||||
fUserSteppingAction= const_cast<G4UserSteppingAction* >( theRunManager->GetUserSteppingAction() );
|
||||
fUserPrimaryGeneratorAction= const_cast<G4VUserPrimaryGeneratorAction* >( theRunManager->GetUserPrimaryGeneratorAction() );
|
||||
fUserRunAction= const_cast<G4UserRunAction*>( theRunManager->GetUserRunAction() );
|
||||
fUserStackingAction= const_cast<G4UserStackingAction* >( theRunManager->GetUserStackingAction() );
|
||||
user_action_already_defined=true;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointTrackingMode(G4bool aBool)
|
||||
{
|
||||
adjoint_tracking_mode = aBool;
|
||||
|
||||
if (adjoint_tracking_mode) {
|
||||
SetRestOfAdjointActions();
|
||||
theAdjointStackingAction->SetAdjointMode(true);
|
||||
theAdjointStackingAction->SetKillTracks(false);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
ResetRestOfUserActions();
|
||||
theAdjointStackingAction->SetAdjointMode(false);
|
||||
if (GetDidAdjParticleReachTheExtSource()){
|
||||
theAdjointStackingAction->SetKillTracks(false);
|
||||
RegisterAtEndOfAdjointTrack();
|
||||
}
|
||||
else theAdjointStackingAction->SetKillTracks(true);
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointSimManager::GetDidAdjParticleReachTheExtSource()
|
||||
{
|
||||
return theAdjointSteppingAction->GetDidAdjParticleReachTheExtSource();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
std::vector<G4ParticleDefinition*> G4AdjointSimManager::GetListOfPrimaryFwdParticles()
|
||||
{
|
||||
return theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::RegisterAtEndOfAdjointTrack()
|
||||
{
|
||||
last_pos = theAdjointSteppingAction->GetLastPosition();
|
||||
last_direction = theAdjointSteppingAction->GetLastMomentum();
|
||||
last_direction /=last_direction.mag();
|
||||
last_cos_th = last_direction.z();
|
||||
G4ParticleDefinition* aPartDef= theAdjointSteppingAction->GetLastPartDef();
|
||||
|
||||
last_fwd_part_name= aPartDef->GetParticleName();
|
||||
|
||||
last_fwd_part_name.remove(0,4);
|
||||
|
||||
last_fwd_part_PDGEncoding=G4ParticleTable::GetParticleTable()->FindParticle(last_fwd_part_name)->GetPDGEncoding();
|
||||
|
||||
std::vector<G4ParticleDefinition*> aList = theAdjointPrimaryGeneratorAction->GetListOfPrimaryFwdParticles();
|
||||
last_fwd_part_index=-1;
|
||||
size_t i=0;
|
||||
while(i<aList.size() && last_fwd_part_index<0) {
|
||||
if (aList[i]->GetParticleName() == last_fwd_part_name) last_fwd_part_index=i;
|
||||
i++;
|
||||
}
|
||||
|
||||
last_ekin = theAdjointSteppingAction->GetLastEkin();
|
||||
last_ekin_nuc = last_ekin;
|
||||
if (aPartDef->GetParticleType() == "adjoint_nucleus") {
|
||||
nb_nuc=double(aPartDef->GetBaryonNumber());
|
||||
last_ekin_nuc /=nb_nuc;
|
||||
}
|
||||
|
||||
last_weight = theAdjointSteppingAction->GetLastWeight();
|
||||
|
||||
/* G4PhysicsLogVector* theWeightVector=0;
|
||||
if (last_fwd_part_name =="e-") theWeightVector=electron_last_weight_vector;
|
||||
else if (last_fwd_part_name =="gamma") theWeightVector=gamma_last_weight_vector;
|
||||
else if (last_fwd_part_name =="proton") theWeightVector=proton_last_weight_vector;
|
||||
|
||||
if (theWeightVector){
|
||||
|
||||
size_t ind = size_t(std::log10(last_weight/theAdjointPrimaryWeight)*10. + 200);
|
||||
G4double low_val =theWeightVector->GetLowEdgeEnergy(ind);
|
||||
G4bool aBool = true;
|
||||
G4double bin_weight = theWeightVector->GetValue(low_val, aBool)+1.;
|
||||
theWeightVector->PutValue(ind, bin_weight);
|
||||
}
|
||||
*/
|
||||
/*if ((last_weight/theAdjointPrimaryWeight)>1.) last_weight*=1000. ;
|
||||
else if ( (last_weight/theAdjointPrimaryWeight)>0.1) last_weight*=100. ;
|
||||
else if ( (last_weight/theAdjointPrimaryWeight)>0.01) last_weight*=10. ;*/
|
||||
|
||||
|
||||
//G4cout <<"Last Weight "<<last_weight<<'\t'<<theAdjointPrimaryWeight<<'\t'<<last_weight/theAdjointPrimaryWeight<<std::endl;
|
||||
/*if (last_weight/theAdjointPrimaryWeight >10.) {
|
||||
G4cout<<"Warning a weight increase by a factor : "<<last_weight/theAdjointPrimaryWeight<<std::endl;
|
||||
}
|
||||
*/
|
||||
|
||||
ID_of_last_particle_that_reach_the_ext_source++;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointSimManager::DefineSphericalExtSource(G4double radius, G4ThreeVector pos)
|
||||
{
|
||||
G4double area;
|
||||
return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("ExternalSource", radius, pos, area);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointSimManager::DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String& volume_name)
|
||||
{
|
||||
G4double area;
|
||||
G4ThreeVector center;
|
||||
return G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "ExternalSource", radius, volume_name,center, area);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointSimManager::DefineExtSourceOnTheExtSurfaceOfAVolume(const G4String& volume_name)
|
||||
{
|
||||
G4double area;
|
||||
return G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "ExternalSource", volume_name,area);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetExtSourceEmax(G4double Emax)
|
||||
{
|
||||
theAdjointSteppingAction->SetExtSourceEMax(Emax);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointSimManager::DefineSphericalAdjointSource(G4double radius, G4ThreeVector pos)
|
||||
{
|
||||
G4double area;
|
||||
G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurface("AdjointSource", radius, pos, area);
|
||||
theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, pos);
|
||||
area_of_the_adjoint_source=area;
|
||||
return aBool;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointSimManager::DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String& volume_name)
|
||||
{
|
||||
G4double area;
|
||||
G4ThreeVector center;
|
||||
G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume( "AdjointSource", radius, volume_name,center, area);
|
||||
theAdjointPrimaryGeneratorAction->SetSphericalAdjointPrimarySource(radius, center);
|
||||
area_of_the_adjoint_source=area;
|
||||
return aBool;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointSimManager::DefineAdjointSourceOnTheExtSurfaceOfAVolume(const G4String& volume_name)
|
||||
{
|
||||
G4double area;
|
||||
G4bool aBool = G4AdjointCrossSurfChecker::GetInstance()->AddanExtSurfaceOfAvolume( "AdjointSource", volume_name,area);
|
||||
area_of_the_adjoint_source=area;
|
||||
if (aBool) {
|
||||
theAdjointPrimaryGeneratorAction->SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(volume_name);
|
||||
}
|
||||
return aBool;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointSourceEmin(G4double Emin)
|
||||
{
|
||||
theAdjointPrimaryGeneratorAction->SetEmin(Emin);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointSourceEmax(G4double Emax)
|
||||
{
|
||||
theAdjointPrimaryGeneratorAction->SetEmax(Emax);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::ConsiderParticleAsPrimary(const G4String& particle_name)
|
||||
{
|
||||
theAdjointPrimaryGeneratorAction->ConsiderParticleAsPrimary(particle_name);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::NeglectParticleAsPrimary(const G4String& particle_name)
|
||||
{
|
||||
theAdjointPrimaryGeneratorAction->NeglectParticleAsPrimary(particle_name);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/*void G4AdjointSimManager::SetPrimaryIon(G4int Z, G4int A)
|
||||
{
|
||||
theAdjointPrimaryGeneratorAction->SetPrimaryIon(Z, A);
|
||||
}
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetPrimaryIon(G4ParticleDefinition* adjointIon, G4ParticleDefinition* fwdIon)
|
||||
{
|
||||
theAdjointPrimaryGeneratorAction->SetPrimaryIon(adjointIon, fwdIon);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
const G4String& G4AdjointSimManager::GetPrimaryIonName()
|
||||
{
|
||||
return theAdjointPrimaryGeneratorAction->GetPrimaryIonName();
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::RegisterAdjointPrimaryWeight(G4double aWeight)
|
||||
{
|
||||
theAdjointPrimaryWeight = aWeight;
|
||||
theAdjointSteppingAction->SetPrimWeight(aWeight);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointEventAction(G4UserEventAction* anAction)
|
||||
{
|
||||
theAdjointEventAction = anAction;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointSteppingAction(G4UserSteppingAction* anAction)
|
||||
{
|
||||
theAdjointSteppingAction->SetUserAdjointSteppingAction(anAction);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointStackingAction(G4UserStackingAction* anAction)
|
||||
{
|
||||
theAdjointStackingAction->SetUserAdjointStackingAction(anAction);
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointTrackingAction(G4UserTrackingAction* anAction)
|
||||
{
|
||||
theAdjointTrackingAction=anAction;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSimManager::SetAdjointRunAction(G4UserRunAction* anAction)
|
||||
{
|
||||
theAdjointRunAction=anAction;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -0,0 +1,250 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointSimMessenger.cc,v 1.2 2009/11/18 18:02:06 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4AdjointSimMessenger.hh"
|
||||
#include "G4AdjointSimManager.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4UIcmdWith3VectorAndUnit.hh"
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSimMessenger::G4AdjointSimMessenger(G4AdjointSimManager* pAdjointRunManager)
|
||||
: theAdjointRunManager(pAdjointRunManager)
|
||||
{
|
||||
AdjointSimDir = new G4UIdirectory("/adjoint/");
|
||||
AdjointSimDir->SetGuidance("Control of the adjoint or reverse monte carlo simulation");
|
||||
|
||||
//Start and adjoint Run
|
||||
//---------------------
|
||||
|
||||
beamOnCmd = new G4UIcommand("/adjoint/start_run",this);
|
||||
beamOnCmd->SetGuidance("Start an adjoint Run.");
|
||||
beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
|
||||
beamOnCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
|
||||
p1->SetDefaultValue(1);
|
||||
p1->SetParameterRange("numberOfEvent >= 0");
|
||||
beamOnCmd->SetParameter(p1);
|
||||
|
||||
//Commands to define parameters relative to the external source
|
||||
//------------------------------------------------------------
|
||||
|
||||
G4UIparameter* pos_x_par = new G4UIparameter("X",'d',true);
|
||||
|
||||
G4UIparameter* pos_y_par = new G4UIparameter("Y",'d',true);
|
||||
|
||||
G4UIparameter* pos_z_par = new G4UIparameter("Z",'d',true);
|
||||
|
||||
G4UIparameter* radius_par = new G4UIparameter("R",'d',true);
|
||||
|
||||
radius_par->SetParameterRange("R >= 0");
|
||||
|
||||
G4UIparameter* unit_par = new G4UIparameter("unit",'s',true);
|
||||
|
||||
DefineSpherExtSourceCmd = new G4UIcommand("/adjoint/DefineSphericalExtSource",this);
|
||||
DefineSpherExtSourceCmd->SetGuidance("Define a spherical external source.");
|
||||
DefineSpherExtSourceCmd->SetParameter(pos_x_par);
|
||||
DefineSpherExtSourceCmd->SetParameter(pos_y_par);
|
||||
DefineSpherExtSourceCmd->SetParameter(pos_z_par);
|
||||
DefineSpherExtSourceCmd->SetParameter(radius_par);
|
||||
DefineSpherExtSourceCmd->SetParameter(unit_par);
|
||||
|
||||
G4UIparameter* phys_vol_name_par = new G4UIparameter("phys_vol_name",'s',true);
|
||||
|
||||
DefineSpherExtSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalExtSourceCenteredOnAVolume",this);
|
||||
DefineSpherExtSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical external source with the center located at the center of a physical volume");
|
||||
DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
|
||||
DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
|
||||
DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
|
||||
|
||||
DefineExtSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineExtSourceOnExtSurfaceOfAVolume",this);
|
||||
DefineExtSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the external source on the external surface of a physical volume");
|
||||
DefineExtSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false);
|
||||
|
||||
setExtSourceEMaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetExtSourceEmax",this);
|
||||
setExtSourceEMaxCmd->SetGuidance("Set the maximum energy of the external source");
|
||||
setExtSourceEMaxCmd->SetParameterName("Emax",false);
|
||||
setExtSourceEMaxCmd->SetUnitCategory("Energy");
|
||||
setExtSourceEMaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
//Commands to define the adjoint source
|
||||
//------------------------------------------------------------
|
||||
|
||||
DefineSpherAdjSourceCmd = new G4UIcommand("/adjoint/DefineSphericalAdjSource",this);
|
||||
DefineSpherAdjSourceCmd->SetGuidance("Define a spherical adjoint source.");
|
||||
DefineSpherAdjSourceCmd->SetParameter(pos_x_par);
|
||||
DefineSpherAdjSourceCmd->SetParameter(pos_y_par);
|
||||
DefineSpherAdjSourceCmd->SetParameter(pos_z_par);
|
||||
DefineSpherAdjSourceCmd->SetParameter(radius_par);
|
||||
DefineSpherAdjSourceCmd->SetParameter(unit_par);
|
||||
|
||||
DefineSpherAdjSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalAdjSourceCenteredOnAVolume",this);
|
||||
DefineSpherAdjSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical adjoint source with the center located at the center of a physical volume");
|
||||
DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
|
||||
DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
|
||||
DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
|
||||
|
||||
DefineAdjSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineAdjSourceOnExtSurfaceOfAVolume",this);
|
||||
DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the adjoint source on the external surface of physical volume");
|
||||
DefineAdjSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false);
|
||||
|
||||
setAdjSourceEminCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmin",this);
|
||||
setAdjSourceEminCmd->SetGuidance("Set the minimum energy of the adjoint source");
|
||||
setAdjSourceEminCmd->SetParameterName("Emin",false);
|
||||
setAdjSourceEminCmd->SetUnitCategory("Energy");
|
||||
setAdjSourceEminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
setAdjSourceEmaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmax",this);
|
||||
setAdjSourceEmaxCmd->SetGuidance("Set the maximum energy of the adjoint source");
|
||||
setAdjSourceEmaxCmd->SetParameterName("Emax",false);
|
||||
setAdjSourceEmaxCmd->SetUnitCategory("Energy");
|
||||
setAdjSourceEmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
ConsiderParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/ConsiderAsPrimary",this);
|
||||
ConsiderParticleAsPrimaryCmd->SetGuidance("Set the selected particle as primary");
|
||||
ConsiderParticleAsPrimaryCmd->SetParameterName("particle",false);
|
||||
ConsiderParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
|
||||
|
||||
NeglectParticleAsPrimaryCmd= new G4UIcmdWithAString("/adjoint/NeglectAsPrimary",this);
|
||||
NeglectParticleAsPrimaryCmd->SetGuidance("Remove the selected particle from the lits of primaries");
|
||||
NeglectParticleAsPrimaryCmd->SetParameterName("particle",false);
|
||||
NeglectParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
G4AdjointSimMessenger::~G4AdjointSimMessenger()
|
||||
{
|
||||
delete beamOnCmd;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
void G4AdjointSimMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command==beamOnCmd )
|
||||
{
|
||||
G4int nev;
|
||||
const char* nv = (const char*)newValue;
|
||||
std::istringstream is(nv);
|
||||
is >> nev ;
|
||||
theAdjointRunManager->RunAdjointSimulation(nev);
|
||||
}
|
||||
else if ( command==DefineSpherExtSourceCmd){
|
||||
|
||||
G4double x,y,z,r;
|
||||
G4String unit;
|
||||
const char* nv = (const char*)newValue;
|
||||
std::istringstream is(nv);
|
||||
is >> x>>y>>z>>r>>unit;
|
||||
|
||||
x*=G4UnitDefinition::GetValueOf(unit);
|
||||
y*=G4UnitDefinition::GetValueOf(unit);
|
||||
z*=G4UnitDefinition::GetValueOf(unit);
|
||||
r*=G4UnitDefinition::GetValueOf(unit);
|
||||
theAdjointRunManager->DefineSphericalExtSource(r,G4ThreeVector(x,y,z));
|
||||
}
|
||||
else if ( command==DefineSpherExtSourceCenteredOnAVolumeCmd){
|
||||
|
||||
G4double r;
|
||||
G4String vol_name, unit;
|
||||
const char* nv = (const char*)newValue;
|
||||
std::istringstream is(nv);
|
||||
is >>vol_name>>r>>unit;
|
||||
r*=G4UnitDefinition::GetValueOf(unit);
|
||||
theAdjointRunManager->DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
|
||||
}
|
||||
else if ( command==DefineExtSourceOnAVolumeExtSurfaceCmd){
|
||||
theAdjointRunManager->DefineExtSourceOnTheExtSurfaceOfAVolume(newValue);
|
||||
}
|
||||
else if ( command== setExtSourceEMaxCmd){
|
||||
|
||||
theAdjointRunManager->SetExtSourceEmax(setExtSourceEMaxCmd->GetNewDoubleValue(newValue));
|
||||
}
|
||||
else if ( command==DefineSpherAdjSourceCmd){
|
||||
|
||||
G4double x,y,z,r;
|
||||
G4String unit;
|
||||
const char* nv = (const char*)newValue;
|
||||
std::istringstream is(nv);
|
||||
is >> x>>y>>z>>r>>unit;
|
||||
|
||||
x*=G4UnitDefinition::GetValueOf(unit);
|
||||
y*=G4UnitDefinition::GetValueOf(unit);
|
||||
z*=G4UnitDefinition::GetValueOf(unit);
|
||||
r*=G4UnitDefinition::GetValueOf(unit);
|
||||
theAdjointRunManager->DefineSphericalAdjointSource(r,G4ThreeVector(x,y,z));
|
||||
}
|
||||
else if ( command==DefineSpherAdjSourceCenteredOnAVolumeCmd){
|
||||
|
||||
G4double r;
|
||||
G4String vol_name, unit;
|
||||
const char* nv = (const char*)newValue;
|
||||
std::istringstream is(nv);
|
||||
is >>vol_name>>r>>unit;
|
||||
r*=G4UnitDefinition::GetValueOf(unit);
|
||||
theAdjointRunManager->DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
|
||||
}
|
||||
else if ( command==DefineAdjSourceOnAVolumeExtSurfaceCmd){
|
||||
|
||||
theAdjointRunManager->DefineAdjointSourceOnTheExtSurfaceOfAVolume(newValue);
|
||||
}
|
||||
else if ( command== setAdjSourceEminCmd){
|
||||
|
||||
theAdjointRunManager->SetAdjointSourceEmin(setAdjSourceEminCmd->GetNewDoubleValue(newValue));
|
||||
}
|
||||
else if ( command== setAdjSourceEmaxCmd){
|
||||
|
||||
theAdjointRunManager->SetAdjointSourceEmax(setAdjSourceEmaxCmd->GetNewDoubleValue(newValue));
|
||||
}
|
||||
else if ( command==ConsiderParticleAsPrimaryCmd){
|
||||
|
||||
theAdjointRunManager->ConsiderParticleAsPrimary(newValue);
|
||||
}
|
||||
else if ( command==NeglectParticleAsPrimaryCmd){
|
||||
|
||||
theAdjointRunManager->NeglectParticleAsPrimary(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RunManagerKernel.cc,v 1.43 2008/07/10 09:27:19 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4RunManagerKernel.cc,v 1.47 2009/11/13 23:13:40 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -82,6 +82,21 @@ G4RunManagerKernel::G4RunManagerKernel()
|
||||
}
|
||||
fRunManagerKernel = this;
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
if(particleTable->entries()>0)
|
||||
{
|
||||
// No particle should be registered beforehand
|
||||
G4cerr<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<G4endl;
|
||||
G4cerr<<" G4RunManagerKernel fatal exception"<<G4endl;
|
||||
G4cerr<<" -- Following particles have already been registered"<<G4endl;
|
||||
G4cerr<<" before G4RunManagerKernel is instantiated."<<G4endl;
|
||||
for(int i=0;i<particleTable->entries();i++)
|
||||
{ G4cerr<<" "<<particleTable->GetParticle(i)->GetParticleName()<<G4endl; }
|
||||
G4cerr<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<G4endl;
|
||||
G4Exception("G4RunManagerKernel::G4RunManagerKernel()","StaticParticleDefinition",
|
||||
FatalException,"Particles have already been instantiated before G4RunManagerKernel.");
|
||||
}
|
||||
|
||||
// construction of Geant4 kernel classes
|
||||
eventManager = new G4EventManager();
|
||||
defaultRegion = new G4Region("DefaultRegionForTheWorld"); // deleted by store
|
||||
@@ -263,6 +278,8 @@ void G4RunManagerKernel::InitializePhysics()
|
||||
if(numberOfParallelWorld>0) physicsList->UseCoupledTransportation();
|
||||
physicsList->Construct();
|
||||
|
||||
if(verboseLevel>1) G4cout << "physicsList->CheckParticleList() start." << G4endl;
|
||||
physicsList->CheckParticleList();
|
||||
if(verboseLevel>1) G4cout << "physicsList->setCut() start." << G4endl;
|
||||
physicsList->SetCuts();
|
||||
CheckRegions();
|
||||
@@ -443,7 +460,7 @@ void G4RunManagerKernel::DumpRegion(G4Region* region) const
|
||||
size_t nRootLV = region->GetNumberOfRootVolumes();
|
||||
std::vector<G4LogicalVolume*>::iterator lvItr = region->GetRootLogicalVolumeIterator();
|
||||
for(size_t j=0;j<nRootLV;j++)
|
||||
{ G4cout << (*lvItr)->GetName() << " "; }
|
||||
{ G4cout << (*lvItr)->GetName() << " "; lvItr++; }
|
||||
G4cout << G4endl;
|
||||
|
||||
G4cout << " Pointers : G4VUserRegionInformation[" << region->GetUserInformation()
|
||||
@@ -475,9 +492,10 @@ void G4RunManagerKernel::DumpRegion(G4Region* region) const
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->GetDefaultProductionCuts());
|
||||
}
|
||||
G4cout << " Production cuts : "
|
||||
<< " gamma " << G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
|
||||
<< " e- " << G4BestUnit(cuts->GetProductionCut("e-"),"Length")
|
||||
<< " e+ " << G4BestUnit(cuts->GetProductionCut("e+"),"Length")
|
||||
<< " gamma " << G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
|
||||
<< " e- " << G4BestUnit(cuts->GetProductionCut("e-"),"Length")
|
||||
<< " e+ " << G4BestUnit(cuts->GetProductionCut("e+"),"Length")
|
||||
<< " proton " << G4BestUnit(cuts->GetProductionCut("proton"),"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UserPhysicsListMessenger.cc,v 1.28 2007/05/30 10:34:54 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4UserPhysicsListMessenger.cc,v 1.30 2009/10/20 07:07:51 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -67,6 +67,15 @@ G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pPart
|
||||
verboseCmd->SetParameterName("level",true);
|
||||
verboseCmd->SetDefaultValue(0);
|
||||
verboseCmd->SetRange("level >=0 && level <=3");
|
||||
|
||||
// /run/setCut command
|
||||
setCutCmd = new G4UIcmdWithADoubleAndUnit("/run/setCut",this);
|
||||
setCutCmd->SetGuidance("Set default cut value ");
|
||||
setCutCmd->SetParameterName("cut",false);
|
||||
setCutCmd->SetDefaultValue(1.0);
|
||||
setCutCmd->SetRange("cut >0.0");
|
||||
setCutCmd->SetDefaultUnit("mm");
|
||||
setCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
// /run/particle/setCut command
|
||||
setPCutCmd = new G4UIcmdWithADoubleAndUnit("/run/particle/setCut",this);
|
||||
@@ -78,15 +87,22 @@ G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pPart
|
||||
setPCutCmd->SetRange("cut >0.0");
|
||||
setPCutCmd->SetDefaultUnit("mm");
|
||||
setPCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
// /run/setCut command
|
||||
setCutCmd = new G4UIcmdWithADoubleAndUnit("/run/setCut",this);
|
||||
setCutCmd->SetGuidance("Set default cut value ");
|
||||
setCutCmd->SetParameterName("cut",false);
|
||||
setCutCmd->SetDefaultValue(1.0);
|
||||
setCutCmd->SetRange("cut >0.0");
|
||||
setCutCmd->SetDefaultUnit("mm");
|
||||
setCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
// /run/setCutForAGivenParticle command
|
||||
setCutForAGivenParticleCmd = new G4UIcommand("/run/setCutForAGivenParticle",this) ;
|
||||
setCutForAGivenParticleCmd->SetGuidance("Set a cut value to a specific particle") ;
|
||||
setCutForAGivenParticleCmd->SetGuidance("Usage: /run/setCutForAGivenParticle gamma 1. mm") ;
|
||||
param = new G4UIparameter("particleName",'s',false) ;
|
||||
param->SetParameterCandidates("e- e+ gamma proton");
|
||||
setCutForAGivenParticleCmd->SetParameter(param) ;
|
||||
param = new G4UIparameter("cut",'d',false) ;
|
||||
param->SetDefaultValue("1.") ;
|
||||
param->SetParameterRange("cut>0.0") ;
|
||||
setCutForAGivenParticleCmd->SetParameter(param) ;
|
||||
param = new G4UIparameter("unit",'s',false) ;
|
||||
param->SetDefaultValue("mm") ;
|
||||
setCutForAGivenParticleCmd->SetParameter(param) ;
|
||||
setCutForAGivenParticleCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
// /run/setCutForRegion command
|
||||
setCutRCmd = new G4UIcommand("/run/setCutForRegion",this);
|
||||
@@ -186,7 +202,8 @@ G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger()
|
||||
{
|
||||
delete setPCutCmd;
|
||||
delete setCutCmd;
|
||||
delete setCutRCmd;
|
||||
delete setCutRCmd;
|
||||
delete setCutForAGivenParticleCmd;
|
||||
delete verboseCmd;
|
||||
delete dumpListCmd;
|
||||
delete addProcManCmd;
|
||||
@@ -201,17 +218,24 @@ G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger()
|
||||
|
||||
void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command==setCutCmd || command==setPCutCmd ){
|
||||
if( command==setCutCmd ){
|
||||
G4double newCut = setCutCmd->GetNewDoubleValue(newValue);
|
||||
thePhysicsList->SetDefaultCutValue(newCut);
|
||||
thePhysicsList->SetCutsWithDefault();
|
||||
|
||||
} else if( command==setPCutCmd ){
|
||||
G4cout << "Please use /run/setCut command instead. This command will be removed" << G4endl;
|
||||
G4double newCut = setCutCmd->GetNewDoubleValue(newValue);
|
||||
thePhysicsList->SetDefaultCutValue(newCut);
|
||||
thePhysicsList->SetCutsWithDefault();
|
||||
|
||||
} else if( command==setCutForAGivenParticleCmd ){
|
||||
G4String particleName, unit ; G4double cut ;
|
||||
std::istringstream str (newValue) ;
|
||||
str >> particleName >> cut >> unit ;
|
||||
thePhysicsList->SetCutValue(cut*G4UIcommand::ValueOf(unit), particleName) ;
|
||||
|
||||
} else if( command==setCutRCmd ){
|
||||
//G4Tokenizer next( newValue );
|
||||
//G4String rName = G4String(next());
|
||||
//G4String cValue = G4String(next())+" "+G4String(next());
|
||||
//G4double newCut = setCutCmd->GetNewDoubleValue(cValue);
|
||||
//thePhysicsList->SetCutsForRegion(newCut,rName);
|
||||
std::istringstream is(newValue);
|
||||
char regName[50];
|
||||
G4double cVal;
|
||||
@@ -280,7 +304,7 @@ G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
G4String candidates("none");
|
||||
G4ParticleTable::G4PTblDicIterator *piter = (G4ParticleTable::GetParticleTable())->GetIterator();
|
||||
|
||||
if( command==setCutCmd || command==setPCutCmd ){
|
||||
if( command==setCutCmd ) {
|
||||
cv = setCutCmd->ConvertToString( thePhysicsList->GetDefaultCutValue(), "mm" );
|
||||
|
||||
} else if( command==verboseCmd ){
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserPhysicsList.cc,v 1.64 2008/05/09 13:00:42 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4VUserPhysicsList.cc,v 1.71 2009/08/09 14:31:46 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -67,13 +67,15 @@
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
G4VUserPhysicsList::G4VUserPhysicsList()
|
||||
:verboseLevel(1),
|
||||
: fDisableCheckParticleList(false),
|
||||
verboseLevel(1),
|
||||
fRetrievePhysicsTable(false),
|
||||
fStoredInAscii(true),
|
||||
fIsCheckedForRetrievePhysicsTable(false),
|
||||
fIsRestoredCutValues(false),
|
||||
directoryPhysicsTable("."),
|
||||
fDisplayThreshold(0),
|
||||
fIsPhysicsTableBuilt(false),
|
||||
useCoupledTransportation(false)
|
||||
{
|
||||
// default cut value (1.0mm)
|
||||
@@ -153,10 +155,14 @@ void G4VUserPhysicsList::AddProcessManager(G4ParticleDefinition* newParticle,
|
||||
} else {
|
||||
// no process manager has been registered yet
|
||||
newManager = new G4ProcessManager(newParticle);
|
||||
G4Exception("G4VUserPhysicsList::AddProcessManager","Error in GenericIon",
|
||||
RunMustBeAborted,"GenericIon has no ProcessMamanger");
|
||||
}
|
||||
} else {
|
||||
// "GenericIon" does not exist
|
||||
newManager = new G4ProcessManager(newParticle);
|
||||
G4Exception("G4VUserPhysicsList::AddProcessManager","No GenericIon",
|
||||
RunMustBeAborted,"GenericIon does not exist");
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -179,13 +185,118 @@ void G4VUserPhysicsList::AddProcessManager(G4ParticleDefinition* newParticle,
|
||||
newManager->DumpInfo();
|
||||
}
|
||||
#endif
|
||||
if (newParticle->GetParticleType() == "nucleus") {
|
||||
if ( fIsPhysicsTableBuilt
|
||||
&& (newParticle->GetParticleType() == "nucleus")) {
|
||||
PreparePhysicsTable(newParticle);
|
||||
BuildPhysicsTable(newParticle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::CheckParticleList()
|
||||
{
|
||||
|
||||
// skip if fDisableCheckParticleList is set
|
||||
if (fDisableCheckParticleList) return;
|
||||
|
||||
bool isElectron = false;
|
||||
bool isPositron = false;
|
||||
bool isGamma = false;
|
||||
bool isProton = false;
|
||||
bool isGenericIon = false;
|
||||
bool isAnyIon = false;
|
||||
bool isAnyChargedBaryon = false;
|
||||
bool isEmProc = false;
|
||||
|
||||
// loop over all particles in G4ParticleTable
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4String name = particle->GetParticleName();
|
||||
// check if any EM process exists
|
||||
if (!isEmProc) {
|
||||
G4ProcessVector* list = particle->GetProcessManager()->GetProcessList();
|
||||
for (int idx=0; idx<list->size(); idx++){
|
||||
isEmProc = ((*list)[idx])->GetProcessType() == fElectromagnetic;
|
||||
if (isEmProc) break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( name == "e-") isElectron = true;
|
||||
else if ( name == "e+") isPositron = true;
|
||||
else if ( name == "gamma") isGamma = true;
|
||||
else if ( name == "GenericIon") isGenericIon = true;
|
||||
else if ( name == "proton") isProton = true;
|
||||
else if ( particle->GetParticleType() == "nucleus") isAnyIon = true;
|
||||
else if ( particle->GetParticleType() == "baryon") {
|
||||
if ( particle->GetPDGCharge() != 0.0 ) isAnyChargedBaryon = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isEmProc) return;
|
||||
|
||||
// RULE 1
|
||||
// e+, e- and gamma should exist
|
||||
// if one of them exist
|
||||
bool isEmBasic = isElectron || isPositron || isGamma;
|
||||
bool isMissingEmBasic = !isElectron || !isPositron || !isGamma;
|
||||
if (isEmBasic && isMissingEmBasic) {
|
||||
G4String missingName="";
|
||||
if (!isElectron) missingName += "e- ";
|
||||
if (!isPositron) missingName += "e+ ";
|
||||
if (!isGamma) missingName += "gamma ";
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel >0){
|
||||
G4cout << "G4VUserPhysicsList::CheckParticleList: ";
|
||||
G4cout << missingName << " do not exist " << G4endl;
|
||||
G4cout << " These particle are necessary for basic EM processes" << G4endl;
|
||||
}
|
||||
#endif
|
||||
missingName += " should be created ";
|
||||
G4Exception("G4VUserPhysicsList::CheckParticleList","Missing EM basic particle",
|
||||
FatalException, missingName);
|
||||
}
|
||||
|
||||
// RULE 2
|
||||
// proton should exist
|
||||
// if any other charged baryon exist
|
||||
if (!isProton && isAnyChargedBaryon) {
|
||||
G4String missingName="proton ";
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel >0){
|
||||
G4cout << "G4VUserPhysicsList::CheckParticleList: ";
|
||||
G4cout << missingName << " does not exist "<< G4endl;
|
||||
G4cout << " Proton is necessary for EM baryon processes" << G4endl;
|
||||
}
|
||||
#endif
|
||||
missingName += " should be created ";
|
||||
G4Exception("G4VUserPhysicsList::CheckParticleList","Missing Proton",
|
||||
FatalException, missingName);
|
||||
}
|
||||
|
||||
// RULE 3
|
||||
// GenericIonn should exist
|
||||
// if any other ion exist
|
||||
if (!isGenericIon && isAnyIon) {
|
||||
G4String missingName="GenericIon ";
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel >0){
|
||||
G4cout << "G4VUserPhysicsList::CheckParticleList: ";
|
||||
G4cout << missingName << " does not exist "<< G4endl;
|
||||
G4cout << " GenericIon should be created if any ion is necessary" << G4endl;
|
||||
}
|
||||
#endif
|
||||
missingName += " should be created ";
|
||||
G4Exception("G4VUserPhysicsList::CheckParticleList","Missing GenericIon",
|
||||
FatalException, missingName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::InitializeProcessManager()
|
||||
{
|
||||
@@ -202,7 +313,7 @@ void G4VUserPhysicsList::InitializeProcessManager()
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::RemoveProcessManager()
|
||||
{
|
||||
// loop over all particles in G4ParticleTable
|
||||
@@ -262,7 +373,7 @@ void G4VUserPhysicsList::AddTransportation()
|
||||
// Error !! no process manager
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4Exception("G4VUserPhysicsList::AddTransportation","No process manager",
|
||||
RunMustBeAborted, particleName );
|
||||
FatalException, particleName );
|
||||
} else {
|
||||
// add transportation with ordering = ( -1, "first", "first" )
|
||||
pmanager ->AddProcess(theTransportationProcess);
|
||||
@@ -276,7 +387,7 @@ void G4VUserPhysicsList::AddTransportation()
|
||||
// Error !! no process manager
|
||||
G4String particleName = particle->GetParticleName();
|
||||
G4Exception("G4VUserPhysicsList::AddTransportation","No process manager",
|
||||
RunMustBeAborted, particleName );
|
||||
FatalException, particleName );
|
||||
} else {
|
||||
// add transportation with ordering = ( -1, "first", "first" )
|
||||
pmanager ->AddProcess(theTransportationProcess);
|
||||
@@ -358,6 +469,7 @@ void G4VUserPhysicsList::SetCutsWithDefault()
|
||||
SetCutValue(cut, "gamma");
|
||||
SetCutValue(cut, "e-");
|
||||
SetCutValue(cut, "e+");
|
||||
SetCutValue(cut, "proton");
|
||||
|
||||
// dump Cut values if verboseLevel==3
|
||||
if (verboseLevel>2) {
|
||||
@@ -373,6 +485,7 @@ void G4VUserPhysicsList::SetCutsForRegion(G4double aCut, const G4String& rname)
|
||||
SetCutValue(aCut, "gamma", rname);
|
||||
SetCutValue(aCut, "e-", rname);
|
||||
SetCutValue(aCut, "e+", rname);
|
||||
SetCutValue(aCut, "proton", rname);
|
||||
}
|
||||
|
||||
|
||||
@@ -449,6 +562,10 @@ void G4VUserPhysicsList::BuildPhysicsTable()
|
||||
BuildPhysicsTable(particle);
|
||||
}
|
||||
}
|
||||
|
||||
// Set flag
|
||||
fIsPhysicsTableBuilt = true;
|
||||
|
||||
}
|
||||
///////////////////////////////////////////////////////////////
|
||||
void G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition* particle)
|
||||
@@ -486,7 +603,22 @@ void G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition* particle)
|
||||
// Rebuild the physics tables for every process for this particle type
|
||||
// if particle is not ShortLived
|
||||
if(!particle->IsShortLived()) {
|
||||
G4ProcessVector* pVector = particle->GetProcessManager()->GetProcessList();
|
||||
G4ProcessManager* pManager = particle->GetProcessManager();
|
||||
if (!pManager) {
|
||||
G4cerr << "G4VUserPhysicsList::BuildPhysicsTable : No Process Manager for "
|
||||
<< particle->GetParticleName() <<G4endl;
|
||||
G4cerr << particle->GetParticleName() << " should be created in your PhysicsList" <<G4endl;
|
||||
G4Exception("G4VUserPhysicsList::BuildPhysicsTable","No process manager",
|
||||
FatalException, particle->GetParticleName() );
|
||||
}
|
||||
G4ProcessVector* pVector = pManager->GetProcessList();
|
||||
if (!pVector) {
|
||||
G4cerr << "G4VUserPhysicsList::BuildPhysicsTable : No Process Vector for "
|
||||
<< particle->GetParticleName() <<G4endl;
|
||||
G4cerr << particle->GetParticleName() << " should be created in your PhysicsList" <<G4endl;
|
||||
G4Exception("G4VUserPhysicsList::BuildPhysicsTable","No process Vector",
|
||||
FatalException, particle->GetParticleName() );
|
||||
}
|
||||
for (G4int j=0; j < pVector->size(); ++j) {
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
@@ -505,10 +637,17 @@ void G4VUserPhysicsList::PreparePhysicsTable(G4ParticleDefinition* particle)
|
||||
<< particle->GetParticleName() <<G4endl;
|
||||
G4cerr << particle->GetParticleName() << " should be created in your PhysicsList" <<G4endl;
|
||||
G4Exception("G4VUserPhysicsList::PreparePhysicsTable","No process manager",
|
||||
RunMustBeAborted, particle->GetParticleName() );
|
||||
FatalException, particle->GetParticleName() );
|
||||
}
|
||||
|
||||
G4ProcessVector* pVector = pManager->GetProcessList();
|
||||
if (!pVector) {
|
||||
G4cerr << "G4VUserPhysicsList::PreparePhysicsTable : No Process Vector for "
|
||||
<< particle->GetParticleName() <<G4endl;
|
||||
G4cerr << particle->GetParticleName() << " should be created in your PhysicsList" <<G4endl;
|
||||
G4Exception("G4VUserPhysicsList::PreparePhysicsTable","No process Vector",
|
||||
FatalException, particle->GetParticleName() );
|
||||
}
|
||||
for (G4int j=0; j < pVector->size(); ++j) {
|
||||
(*pVector)[j]->PreparePhysicsTable(*particle);
|
||||
}
|
||||
@@ -689,6 +828,7 @@ void G4VUserPhysicsList::SetApplyCuts(G4bool value, const G4String& name)
|
||||
theParticleTable->FindParticle("gamma")->SetApplyCutsFlag(value);
|
||||
theParticleTable->FindParticle("e-")->SetApplyCutsFlag(value);
|
||||
theParticleTable->FindParticle("e+")->SetApplyCutsFlag(value);
|
||||
theParticleTable->FindParticle("proton")->SetApplyCutsFlag(value);
|
||||
} else {
|
||||
theParticleTable->FindParticle(name)->SetApplyCutsFlag(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user