Import Geant4 0.0.0 source tree
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# $Id: GNUmakefile,v 2.2 1998/12/05 09:45:13 kurasige Exp $
|
||||
# ----------------------------------------------------------
|
||||
# GNUmakefile for run library. Gabriele Cosmo, 3/4/1997.
|
||||
# ----------------------------------------------------------
|
||||
|
||||
name := G4run
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/global/HEPRandom/include \
|
||||
-I$(G4BASE)/global/HEPGeometry/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/particles/bosons/include \
|
||||
-I$(G4BASE)/particles/leptons/include \
|
||||
-I$(G4BASE)/particles/hadrons/barions/include \
|
||||
-I$(G4BASE)/particles/hadrons/ions/include \
|
||||
-I$(G4BASE)/particles/hadrons/mesons/include \
|
||||
-I$(G4BASE)/particles/shortlived/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/processes/general/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/standard/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/muons/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/utils/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/xrays/include \
|
||||
-I$(G4BASE)/processes/hadronic/include \
|
||||
-I$(G4BASE)/processes/transportation/include \
|
||||
-I$(G4BASE)/processes/decay/include \
|
||||
-I$(G4BASE)/geometry/management/include \
|
||||
-I$(G4BASE)/geometry/volumes/include \
|
||||
-I$(G4BASE)/geometry/magneticfield/include \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/tracking/include \
|
||||
-I$(G4BASE)/digits+hits/detector/include \
|
||||
-I$(G4BASE)/digits+hits/hits/include \
|
||||
-I$(G4BASE)/digits+hits/digits/include \
|
||||
-I$(G4BASE)/event/include \
|
||||
-I$(G4BASE)/graphics_reps/include \
|
||||
-I$(G4BASE)/intercoms/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
|
||||
.PHONY: global
|
||||
|
||||
global: lib
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
$Id: History,v 2.17 1998/12/09 11:41:38 kurasige Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
Dec. 9 98 H.Kurashige (tag run-00-04-01)
|
||||
- G4VUserPhysicsList is updated to use G4GenericIon (Hisaya)
|
||||
- G4VUserPhysicsList::ConstructAllParticles method is added (Hisaya)
|
||||
- G4VUserPhysicsList::DumpCutValues use BestOfUnits (Michel)
|
||||
|
||||
Nov 12, 98 M.Asai (tag run-00-03-05)
|
||||
- G4VUserPhysicsList.cc is updated for new EM physics processes (L.Urban).
|
||||
|
||||
Oct 13, 98 M.Asai (tag run-00-03-04)
|
||||
- PostStepDoIt of transportation is registered (J.Apostolakis).
|
||||
|
||||
Oct 01, 98 M.Asai (tag run-00-03-03)
|
||||
- G4RunManager now has a switch for optimizing the geometry.
|
||||
- G4RunMessenger has a UI command for above switch.
|
||||
|
||||
Sep 29, 98 M.Asai (tag run-00-03-02)
|
||||
- Modifications on G4VUserPhysicsList (M.Maire and L.Urban)
|
||||
|
||||
Sep 25, 98 M.Asai (tag run-00-03-01)
|
||||
- "BeamOn" accepts a macro file.
|
||||
affected files : G4RunManager.hh .cc, G4RunMessenger.hh .cc
|
||||
|
||||
Aug 31, 98 John Allison (tag run-00-02-02)
|
||||
- Re-implemented pVVisManager->GeometryHasChanged()!
|
||||
|
||||
Aug 17, 98 H.Kurashige (tag run-00-02-03)
|
||||
- Added create/delete G4ProcessTableMessenger
|
||||
|
||||
Aug 14, 98 John Allison (tag run-00-02-02)
|
||||
- Implemented pVVisManager->GeometryHasChanged() - code by M.Asai.
|
||||
|
||||
Aug 12, 98 M.Asai (tag run-00-02-01)
|
||||
- Modification of G4VUserPhysicsList.cc (H.Kurashige)
|
||||
|
||||
July 21, 98 M.Asai (tag run-00-01-06)
|
||||
|
||||
July 15, 98 M.Asai (tag-run-00-01-05)
|
||||
|
||||
July 13, 98 M.Asai (tag run-00-01-04)
|
||||
|
||||
July12 , 98 H.Kurashige
|
||||
- Added "/run/particle/addProcManager" command in G4UserPhysicsListMesseneger
|
||||
- Modified G4VUserPhysicsList:AddProcessManager
|
||||
|
||||
July 9, 98 M.Asai (tag run-00-01-03)
|
||||
- Bug fix for G4VUserPhysicsList.cc
|
||||
|
||||
July 7, 98 M.Asai (tag run-00-01-02)
|
||||
- G4RunManager trigger the construction of G4ParticleTableMessenger
|
||||
to avoid inconsistent ordering of command / unit objects' building.
|
||||
|
||||
|
||||
July 4, 98 M.Asai (tag run-00-01-01)
|
||||
- Includes the modification in G4VUserPhysicsList.cc (P.Urban)
|
||||
|
||||
June 30, 98 M.Asai (tag run-00-07-01)
|
||||
- G4Run uses G4Allocator.
|
||||
- example4 is updated with the new G4THitsCollection template.
|
||||
|
||||
June 30, 98 H.Kurashige
|
||||
- Modified G4VUserPhysicsList.cc and MyPhysicsList.cc in example4
|
||||
for shortlived particles
|
||||
|
||||
June 26, 98 G.Cosmo (run-00-06-06)
|
||||
- Modified GNUmakefiles for new electromagnetics structure.
|
||||
(by J.Allison)
|
||||
|
||||
June 25, 98 G.Cosmo (run-00-06-05)
|
||||
- Updated reference output and reference error of
|
||||
example1, example2, example7, EmPhys2, example_demo and example_ghost.
|
||||
- Protected visualization code with G4VIS_USE in EmPhys2.
|
||||
|
||||
June 25, 98 M.Asai (run-00-06-04)
|
||||
- Bug fixes for example4 (J.Allison)
|
||||
- Update ".out" for EmPhys2 (M.Maire)
|
||||
|
||||
June 22, 98 G.Cosmo (run-00-06-03 - re-tagged)
|
||||
- Added missing include paths to digits+hits/* (fix which was already
|
||||
in place in run-00-06-02 ...) to almost all GNUmakefiles.
|
||||
- Removed inclusion/usage of MyTrackerHit.hh (!?) in example4.cc and
|
||||
example_demo.cc.
|
||||
|
||||
June 22, 98 J.Allison (run-00-06-03)
|
||||
- Changed G4BASE = ../.. to G4BASE = $(shell (cd ../..; pwd)), etc.
|
||||
|
||||
June 19, 98 J.Allison
|
||||
- Changed many GNUmakefiles to use visualization/G4VIS_USE.gmk
|
||||
|
||||
June 15, 98 G.Cosmo (run-00-06-02)
|
||||
- Fixed bug in MyEventAction.cc for example5 (M.Asai).
|
||||
- Updated reference input macros for example4 (M.Asai).
|
||||
|
||||
June 12, 98 G.Cosmo
|
||||
- Added path to digits+hits/digits/include to GNUmakefiles in all
|
||||
examples.
|
||||
|
||||
June 9, 98 M.Asai
|
||||
- Some changes affected by new aspects of Particles.
|
||||
- Tagged as run-00-06-01.
|
||||
|
||||
June 6, 98 M.Asai
|
||||
- Modify G4Run and G4RunManager for the new "digits+hits" scheme
|
||||
- Update GNUmakefile
|
||||
|
||||
April 29, 98 G.Cosmo (run-00-05-05)
|
||||
- Updated reference output files in almost all examples
|
||||
(P.Urban and J.Apostolakis)
|
||||
- Updated MyPhysicsList in example2 and related input reference
|
||||
file (J.Apostolakis)
|
||||
- Set G4EXEC_BUILD flag inside all examples' GNUmakefiles.
|
||||
|
||||
April 23, 98 G.Cosmo (run-00-05-03)
|
||||
- Fixes and updated reference output files for exampleEmPhys1 and
|
||||
exampleEmPhys2 (by M.Maire).
|
||||
|
||||
April 21, 98 M.Asai (run-00-05-02)
|
||||
- Tagged as run-00-05-02.
|
||||
|
||||
April 08, 98 G.Cosmo
|
||||
- Added fixes for DEC-cxx 6.0 compiler, related to for-loop index
|
||||
declarations. List of modified files: G4VUserPhysicsList.cc
|
||||
|
||||
April 2, 98 G.Barrand
|
||||
- G4VIS_USE_OPENINVENTOR -> G4VIS_USE_OIX in example GNUmakefile.
|
||||
|
||||
March 27, 98 M.Asai (run-00-05-01)
|
||||
- G4RunManager can be derived to a user class
|
||||
- tagged as run-00-05-01
|
||||
|
||||
26th March 1998 John Allison
|
||||
- Changed G4VisManager to MyVisManager in the following files for
|
||||
vis-00-05-01 and later:
|
||||
run/example/example2.cc
|
||||
run/example4/example4.cc
|
||||
run/example_param/example_demo.cc
|
||||
run/example_param/example_ghost.cc
|
||||
run/exampleEmPhys2/EmPhys2.cc
|
||||
|
||||
March 24, 98 G.Barrand
|
||||
- run/example5/GNUmakefile.common : MAKESHLIB changed in G4MAKESHLIB
|
||||
|
||||
13th March 1998 G.Cosmo (run-00-04-04)
|
||||
- Fixed problems in example_param causing unresolveds at link time
|
||||
in case no visualization used. Co-works with param-00-04-06 in
|
||||
processes category. (P.Mora de Freitas)
|
||||
- Corrected reference input files for EmPhys1 (M.Maire)
|
||||
|
||||
12th March 1998 H.Kurashige (run-00-04-03)
|
||||
- Added the reference files for EmPhys1 and EmPhys2 (M.Maire)
|
||||
|
||||
11th March 1998 H.Kurashige (run-00-04-02)
|
||||
- Fixed bug in example2.cc (J.APOSTOLAKIS)
|
||||
- Fixed bug in G4RunManager (H.Kurashige)
|
||||
|
||||
5th March 1998 H.Kurashige (run-00-04-01)
|
||||
- Remove old sceme for initialization (G4UserProcessList,
|
||||
G4UserProcessList, G4UserParticleListMessenger)
|
||||
- Fixed bugs in MyPhysicsList.cc
|
||||
|
||||
27th February 1998 H.Kurashige
|
||||
- Fixed MyPhysicsList::constructGeneral() to add decay at rest
|
||||
|
||||
5th February 1998 G.Cosmo (run-00-03-04)
|
||||
- Added explicit build of G4paramenterisation library in GNUmakefile
|
||||
for example_param.
|
||||
|
||||
4th February 1998 G.Cosmo on behalf of M.Asai (run-00-03-03)
|
||||
- Added .in, .out, .err to several examples (P.Urban)
|
||||
- Fixed bug in MyEventAction for example5 (M.Asai)
|
||||
- G4UserParticleList updated (H.Kurasige)
|
||||
|
||||
2nd February 1998 G.Cosmo
|
||||
- Fixed bug in example5/GNUmakefile for target "clean". g4* files
|
||||
were all removed !
|
||||
|
||||
30th January 1998 G.Cosmo (run-00-03-02)
|
||||
- Updated order of libraries for example7 (G4intercoms)
|
||||
|
||||
27th January 1998 John Allison
|
||||
- Simplified use of G4VIS flags in test GNUmakefiles.
|
||||
- New way of instantiating G4VisManager in test main() programs.
|
||||
- Removed all references to G4VVisManager from G4RunManager.
|
||||
|
||||
December 19, 97 G. Cosmo - (alpha03)
|
||||
|
||||
- Created.
|
||||
@@ -0,0 +1,132 @@
|
||||
// $Id: README.TXT,v 2.0 1998/07/02 17:27:45 gunter Exp $
|
||||
|
||||
GEANT4
|
||||
|
||||
This directory contains several examples of GEANT4 main programs,
|
||||
from very simple cases (a purely batch program),
|
||||
to interactive programs based on the G4 command line interface,
|
||||
to more complex cases programs touching most of the G4 functionality.
|
||||
|
||||
Those main programs provide just examples of initialization and usage
|
||||
of the GEANT4 toolkit classes, but the user is also free to define his
|
||||
own way and functions to initialize G4 and write the main program.
|
||||
|
||||
A typical GEANT4 main program looks like the following:
|
||||
|
||||
int main() {
|
||||
|
||||
// Create Run Manager
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
|
||||
// Register User Classes to the RunManager
|
||||
// Mandatory classes -----------------------
|
||||
// Detector geometry
|
||||
runManager-> set_userInitialization(new MyDetectorConstruction);
|
||||
// Physics List
|
||||
runManager-> set_userInitialization(new MyPhysicsList);
|
||||
// Primary Generator
|
||||
runManager->set_userAction(new MyPrimaryGeneratorAction);
|
||||
|
||||
// Optiolnal classes -----------------------
|
||||
// User Actions
|
||||
runManager->set_userAction(new MyRunAction);
|
||||
runManager->set_userAction(new MyEventAction);
|
||||
runManager->set_userAction(new MyStackingAction);
|
||||
runManager->set_userAction(new MyTrackingAction);
|
||||
runManager->set_userAction(new MySteppingAction);
|
||||
|
||||
|
||||
// Define (G)UI terminal for interactive mode
|
||||
G4UIsession * session = new G4UIterminal;
|
||||
|
||||
// User interactions
|
||||
session->sessionStart();
|
||||
|
||||
// Termination
|
||||
delete session;
|
||||
delete runManager;
|
||||
return 0;
|
||||
}
|
||||
|
||||
First of all, user must create the RunManager. The RunManager controles
|
||||
run sequence by receiving messages from the user via UIsession.
|
||||
The following are a part of commands for run controle;
|
||||
/run/initialize * Initialize G4 kernel.
|
||||
/run/beamOn * Start a Run.
|
||||
/run/verbose * Set the verbose level of G4RunManager.
|
||||
/run/abort * Abort current run processing.
|
||||
For example, event loop will start by using "/run/beamOn" commands.
|
||||
|
||||
In order to execute simulation, user must provide geometrical
|
||||
configuration of his own detector. In addition information of
|
||||
primary events must be given with a list of particle types and
|
||||
processes for them.
|
||||
|
||||
So, user must provide his own classes derived from the following
|
||||
three abstract classes by implementing their pure virtual functions
|
||||
and register those user classes to the RunManager.
|
||||
|
||||
G4VUserDetectorConstruction - Detector Geometry, Materials
|
||||
pure virtual functions
|
||||
G4VPhysicalVolume* construct()
|
||||
- construct detectors;
|
||||
normally implemented to serve as the entry point
|
||||
for the tree of methods describing solids, volumes,
|
||||
materials and sensitive detectors.
|
||||
|
||||
G4VUserPhysicsList - Particle types and Processes
|
||||
pure virtual functions
|
||||
void constructParticle()
|
||||
- construct particles;
|
||||
normally implemented to select desired particle types.
|
||||
void constructPhysics()
|
||||
- construct procesess;
|
||||
normally implemented to select desired physics processes
|
||||
for each particle types and register them to the ProcessManager.
|
||||
void setCuts(G4double aValue)
|
||||
- sets a cut value;
|
||||
normally implemented to set cut value in range for all
|
||||
particle types.
|
||||
|
||||
G4VUserPrimaryGeneratorAction - Event Generator selection
|
||||
pure virtual functions
|
||||
void generatePrimaries(G4Event* anEvent)
|
||||
- generate a event with primary particles
|
||||
normally implemented to select the desired event generation
|
||||
mechanism, such as the ParticleGun or the PYTHIA interface.
|
||||
|
||||
In addition to the above mandatory classes, there are 5 user classes
|
||||
to customize the default functionality of GEANT4 simulation.
|
||||
|
||||
G4UserRunAction - Actions for each Run
|
||||
G4UserEventAction - Actions for each Event
|
||||
G4UserStackingAction - Tracks Stacking selection
|
||||
G4UserTrackingAction - Actions for each Track
|
||||
G4UserSteppingAction - Actions for each Step
|
||||
|
||||
The virtual functions belonging to the classes above are:
|
||||
|
||||
G4UserRunAction - void beginOfRunAction(G4Run*)
|
||||
- void endOfRunAction(G4Run*)
|
||||
|
||||
G4UserEventAction - void beginOfEventAction(G4Event*)
|
||||
- void endOfEventAction(G4Event*)
|
||||
|
||||
G4UserStackingAction - G4ClassificationOfNewTrack
|
||||
classifyNewTrack(G4Track *const)
|
||||
- void newStage()
|
||||
- void prepareNewEvent()
|
||||
|
||||
G4UserTrackingAction - void preUserTrackingAction()
|
||||
- void postUserTrackingAction()
|
||||
|
||||
G4UserSteppingAction - void userSteppingAction()
|
||||
|
||||
Finally, more details can be found in the header files and in the source
|
||||
code relative to the classes outlined above.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Run.hh,v 2.1 1998/07/12 03:08:30 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4Run_h
|
||||
#define G4Run_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4Allocator.hh"
|
||||
|
||||
class G4Event;
|
||||
class G4HCtable;
|
||||
class G4DCtable;
|
||||
|
||||
class G4Run
|
||||
{
|
||||
public:
|
||||
G4Run();
|
||||
virtual ~G4Run();
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void* aRun);
|
||||
|
||||
protected:
|
||||
G4int runID;
|
||||
G4int numberOfEvent;
|
||||
G4HCtable* HCtable;
|
||||
G4DCtable* DCtable;
|
||||
|
||||
public:
|
||||
inline void SetRunID(G4int id)
|
||||
{ runID = id; }
|
||||
inline G4int GetRunID() const
|
||||
{ return runID; }
|
||||
inline G4int GetNumberOfEvent() const
|
||||
{ return numberOfEvent; }
|
||||
inline virtual void RecordEvent(G4Event*)
|
||||
{ numberOfEvent++; }
|
||||
inline void SetHCtable(G4HCtable* HCtbl)
|
||||
{ HCtable = HCtbl; }
|
||||
inline const G4HCtable* GetHCtable() const
|
||||
{ return HCtable; }
|
||||
inline void SetDCtable(G4DCtable* DCtbl)
|
||||
{ DCtable = DCtbl; }
|
||||
inline const G4DCtable* GetDCtable() const
|
||||
{ return DCtable; }
|
||||
};
|
||||
|
||||
extern G4Allocator<G4Run> aRunAllocator;
|
||||
|
||||
inline void* G4Run::operator new(size_t)
|
||||
{
|
||||
void* aRun;
|
||||
aRun = (void*)aRunAllocator.MallocSingle();
|
||||
return aRun;
|
||||
}
|
||||
|
||||
inline void G4Run::operator delete(void* aRun)
|
||||
{
|
||||
aRunAllocator.FreeSingle((G4Run*)aRun);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RunManager.hh,v 2.3 1998/10/01 17:01:38 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// This is a class for run controle in GEANT4
|
||||
//
|
||||
// User must provide his own classes derived from the following
|
||||
// three abstract classes and register them to the RunManager.
|
||||
// G4VUserDetectorConstruction - Detector Geometry, Materials
|
||||
// G4VUserPhysicsList - Particle types and Processes
|
||||
// G4VUserPrimaryGeneratorAction - Event Generator selection
|
||||
//
|
||||
// In addition to the above mandatory classes, user can easily
|
||||
// customize of the default functionality of GEANT4 simulation
|
||||
// by making his own classes derived from the following 5 user
|
||||
// action classes.
|
||||
// G4UserRunAction - Actions for each Run
|
||||
// G4UserEventAction - Actions for each Event
|
||||
// G4UserStackingAction - Tracks Stacking selection
|
||||
// G4UserTrackingAction - Actions for each Track
|
||||
// G4UserSteppingAction - Actions for each Step
|
||||
//
|
||||
// History
|
||||
// first version by Makoto Asai
|
||||
// modified 11 Mar. 1998 by H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4RunManager_h
|
||||
#define G4RunManager_h 1
|
||||
|
||||
// userAction classes
|
||||
class G4VUserDetectorConstruction;
|
||||
class G4VUserPhysicsList;
|
||||
class G4UserRunAction;
|
||||
class G4VUserPrimaryGeneratorAction;
|
||||
class G4UserEventAction;
|
||||
class G4UserStackingAction;
|
||||
class G4UserTrackingAction;
|
||||
class G4UserSteppingAction;
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4Timer;
|
||||
class G4RunMessenger;
|
||||
class G4DCtable;
|
||||
class G4Run;
|
||||
#include "G4Event.hh"
|
||||
|
||||
#include "G4EventManager.hh"
|
||||
#include "globals.hh"
|
||||
#include <rw/tpordvec.h>
|
||||
|
||||
class G4RunManager
|
||||
{
|
||||
public:
|
||||
static G4RunManager* GetRunManager();
|
||||
|
||||
private:
|
||||
static G4RunManager* fRunManager;
|
||||
|
||||
public:
|
||||
G4RunManager();
|
||||
virtual ~G4RunManager();
|
||||
|
||||
public:
|
||||
virtual void BeamOn(G4int n_event,const char* macroFile=NULL,G4int n_select=-1);
|
||||
virtual void Initialize();
|
||||
virtual void DefineWorldVolume(G4VPhysicalVolume * worldVol);
|
||||
virtual void AbortRun();
|
||||
|
||||
protected:
|
||||
// methods invoked from Initialize()
|
||||
virtual void InitializeGeometry();
|
||||
virtual void InitializePhysics();
|
||||
virtual void InitializeCutOff();
|
||||
|
||||
// methods invoked from BeamOn()
|
||||
virtual G4bool ConfirmBeamOnCondition();
|
||||
virtual void RunInitialization();
|
||||
virtual void DoEventLoop(G4int n_event,const char* macroFile=NULL,G4int n_select=-1);
|
||||
virtual void RunTermination();
|
||||
|
||||
// methods invoked from DoEventLoop()
|
||||
virtual G4Event* GenerateEvent(G4int i_event);
|
||||
virtual void AnalyzeEvent(G4Event* anEvent);
|
||||
|
||||
protected:
|
||||
void StackPreviousEvent(G4Event* anEvent);
|
||||
|
||||
protected:
|
||||
G4EventManager * eventManager;
|
||||
G4VUserDetectorConstruction * userDetector;
|
||||
G4VUserPhysicsList * physicsList;
|
||||
G4UserRunAction * userRunAction;
|
||||
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction;
|
||||
|
||||
private:
|
||||
G4RunMessenger* runMessenger;
|
||||
|
||||
protected:
|
||||
G4bool geometryInitialized;
|
||||
G4bool physicsInitialized;
|
||||
G4bool cutoffInitialized;
|
||||
G4bool geometryNeedsToBeClosed;
|
||||
G4bool runAborted;
|
||||
G4bool initializedAtLeastOnce;
|
||||
G4bool geometryToBeOptimized;
|
||||
|
||||
G4bool pauseAtBeginOfEvent;
|
||||
G4bool pauseAtEndOfEvent;
|
||||
|
||||
G4int verboseLevel;
|
||||
G4Timer * timer;
|
||||
G4DCtable* DCtable;
|
||||
|
||||
G4Run* currentRun;
|
||||
G4Event* currentEvent;
|
||||
RWTPtrOrderedVector<G4Event>* previousEvents;
|
||||
G4int n_perviousEventsToBeStored;
|
||||
|
||||
public:
|
||||
inline void SetUserInitialization(G4VUserDetectorConstruction* userInit)
|
||||
{ userDetector = userInit; }
|
||||
inline void SetUserInitialization(G4VUserPhysicsList* userInit)
|
||||
{ physicsList = userInit; }
|
||||
inline void SetUserAction(G4UserRunAction* userAction)
|
||||
{ userRunAction = userAction; }
|
||||
inline void SetUserAction(G4VUserPrimaryGeneratorAction* userAction)
|
||||
{ userPrimaryGeneratorAction = userAction; }
|
||||
inline void SetUserAction(G4UserEventAction* userAction)
|
||||
{ eventManager->SetUserAction(userAction); }
|
||||
inline void SetUserAction(G4UserStackingAction* userAction)
|
||||
{ eventManager->SetUserAction(userAction); }
|
||||
inline void SetUserAction(G4UserTrackingAction* userAction)
|
||||
{ eventManager->SetUserAction(userAction); }
|
||||
inline void SetUserAction(G4UserSteppingAction* userAction)
|
||||
{ eventManager->SetUserAction(userAction); }
|
||||
|
||||
inline void GeometryHasBeenModified()
|
||||
{ geometryNeedsToBeClosed = true; }
|
||||
inline void CutOffHasBeenModified()
|
||||
{ cutoffInitialized = false; }
|
||||
|
||||
inline void SetPauseAtBeginOfEvent(G4bool vl)
|
||||
{ pauseAtBeginOfEvent = vl; }
|
||||
inline void SetPauseAtEndOfEvent(G4bool vl)
|
||||
{ pauseAtEndOfEvent = vl; }
|
||||
|
||||
inline void SetVerboseLevel(G4int vl)
|
||||
{ verboseLevel = vl; }
|
||||
inline G4int GetVerboseLevel() const
|
||||
{ return verboseLevel; }
|
||||
|
||||
inline void SetGeometryToBeOptimized(G4bool vl)
|
||||
{
|
||||
if(geometryToBeOptimized != vl)
|
||||
{
|
||||
geometryToBeOptimized = vl;
|
||||
geometryNeedsToBeClosed = true;
|
||||
}
|
||||
}
|
||||
inline G4bool GetGeometryToBeOptimized()
|
||||
{ return geometryToBeOptimized; }
|
||||
|
||||
inline void SetNumberOfEventsToBeStored(G4int val)
|
||||
{ n_perviousEventsToBeStored = val; }
|
||||
inline const G4Run* GetCurrentRun() const
|
||||
{ return currentRun; }
|
||||
inline const G4Event* GetCurrentEvent() const
|
||||
{ return currentEvent; }
|
||||
inline const G4Event* GetPreviousEvent(G4int i) const
|
||||
{
|
||||
if(i>=1 && i<=n_perviousEventsToBeStored)
|
||||
{ return (*previousEvents)[i-1]; }
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inline void SetDCtable(G4DCtable* DCtbl)
|
||||
{ DCtable = DCtbl; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RunMessenger.hh,v 2.4 1998/10/01 17:01:38 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// This is a messenger class for G4RunManager.
|
||||
// Implemented commands are following;
|
||||
//
|
||||
// Commands :
|
||||
// BeamOn * Start a Run.
|
||||
// Verbose * Set the Verbose level of G4RunManager.
|
||||
// optimizeGeometry * Set the optimization flag of closing geometry.
|
||||
// breakAtBeginOfEvent * Set a break point at the begining of every event.
|
||||
// breakAtEndOfEvent * Set a break point at the end of every event.
|
||||
// abort * Abort current run processing.
|
||||
// Initialize * Initialize G4 kernel.
|
||||
// geometryModified * Force geometry to be closed again.
|
||||
// cutoffModified * Force closssection tables to be calculated again.
|
||||
// (and rebuilding physics table will be invoked)
|
||||
//
|
||||
// History
|
||||
// first version by Makoto Asai
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4RunMessenger_h
|
||||
#define G4RunMessenger_h 1
|
||||
|
||||
class G4RunManager;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithABool;
|
||||
class G4UIcommand;
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4RunMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4RunMessenger(G4RunManager* runMgr);
|
||||
~G4RunMessenger();
|
||||
|
||||
public:
|
||||
void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
G4String GetCurrentValue(G4UIcommand * command);
|
||||
|
||||
private:
|
||||
G4RunManager * runManager;
|
||||
G4String macroFileName; // internal use only!!!
|
||||
|
||||
private: //commands
|
||||
G4UIdirectory * runDirectory;
|
||||
G4UIcommand * beamOnCmd;
|
||||
G4UIcmdWithAnInteger * verboseCmd;
|
||||
G4UIcmdWithABool * optCmd;
|
||||
G4UIcmdWithABool * brkBoECmd;
|
||||
G4UIcmdWithABool * brkEoECmd;
|
||||
G4UIcmdWithoutParameter * abortCmd;
|
||||
G4UIcmdWithoutParameter * initCmd;
|
||||
G4UIcmdWithoutParameter * geomCmd;
|
||||
G4UIcmdWithoutParameter * cutCmd;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UserPhysicsListMessenger.hh,v 2.3 1998/07/12 16:03:36 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4UserPhysicsListMessenger.hh
|
||||
//
|
||||
// Description:
|
||||
// This is a messenger class to interface to exchange information
|
||||
// between ParticleUserList and UI.
|
||||
//
|
||||
// ------------------------------------------------------
|
||||
// the List of Directory and Commands
|
||||
// ------------------------------------------------------
|
||||
// /run/particle/ Paricle control commands.
|
||||
// Commands :
|
||||
// SetCuts * Set default cut value
|
||||
// DumpList * Dump List of particles in G4VUserPhysicsList.
|
||||
// dumpCutValue * Dump cut value information
|
||||
// Verbose * Set the Verbose level of G4VUserPhysicsList.
|
||||
// ------------------------------------------------------------
|
||||
// History
|
||||
// first version 09 Jan. 1998 by H.Kurashige
|
||||
// second version 24 Jan. 1998 by H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#ifndef G4UserPhysicsListMessenger_h
|
||||
#define G4UserPhysicsListMessenger_h 1
|
||||
|
||||
class G4VUserPhysicsList;
|
||||
|
||||
class G4VUserPhysicsList;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithoutParameter;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
class G4UIcmdWithAString;
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4UserPhysicsListMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
G4UserPhysicsListMessenger(G4VUserPhysicsList* pParticleList);
|
||||
virtual ~G4UserPhysicsListMessenger();
|
||||
|
||||
public:
|
||||
void SetNewValue(G4UIcommand * command,G4String newValues);
|
||||
G4String GetCurrentValue(G4UIcommand * command);
|
||||
|
||||
protected:
|
||||
G4VUserPhysicsList* theParticleList;
|
||||
|
||||
private: //commands
|
||||
G4UIdirectory * theDirectory;
|
||||
G4UIcmdWithADoubleAndUnit * setCutCmd;
|
||||
G4UIcmdWithAnInteger * verboseCmd;
|
||||
G4UIcmdWithoutParameter * dumpListCmd;
|
||||
G4UIcmdWithAString * dumpCutValuesCmd;
|
||||
G4UIcmdWithAString * addProcManCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UserRunAction.hh,v 2.1 1998/07/12 03:08:32 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4UserRunAction_h
|
||||
#define G4UserRunAction_h 1
|
||||
|
||||
class G4Run;
|
||||
|
||||
class G4UserRunAction
|
||||
{
|
||||
public:
|
||||
G4UserRunAction();
|
||||
virtual ~G4UserRunAction();
|
||||
|
||||
public:
|
||||
virtual void BeginOfRunAction(G4Run* aRun);
|
||||
virtual void EndOfRunAction(G4Run* aRun);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VPersistencyManager.hh,v 2.1 1998/07/12 03:08:33 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VPersistencyManager_h
|
||||
#define G4VPersistencyManager_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Event;
|
||||
class G4Run;
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
class G4VPersistencyManager
|
||||
{
|
||||
public:
|
||||
static G4VPersistencyManager* GetPersistencyManager();
|
||||
|
||||
protected:
|
||||
G4VPersistencyManager();
|
||||
|
||||
public:
|
||||
virtual ~G4VPersistencyManager();
|
||||
|
||||
private:
|
||||
static G4VPersistencyManager * fPersistencyManager;
|
||||
|
||||
public:
|
||||
virtual G4bool Store(const G4Event* anEvent)=0;
|
||||
virtual G4bool Store(const G4Run* aRun)=0;
|
||||
virtual G4bool Store(const G4VPhysicalVolume* theWorld)=0;
|
||||
|
||||
virtual G4bool Retrieve(G4Event*& anEvent)=0;
|
||||
virtual G4bool Retrieve(G4Run*& aRun)=0;
|
||||
virtual G4bool Retrieve(G4VPhysicalVolume*& theWorld)=0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VUserDetectorConstruction.hh,v 2.1 1998/07/12 03:08:33 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VUserDetectorConstruction_h
|
||||
#define G4VUserDetectorConstruction_h 1
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
class G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
G4VUserDetectorConstruction();
|
||||
virtual ~G4VUserDetectorConstruction();
|
||||
|
||||
public:
|
||||
virtual G4VPhysicalVolume* Construct() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VUserPhysicsList.hh,v 2.3 1998/12/05 09:45:15 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// This class is an abstruct class for
|
||||
// constructing particles and processes.
|
||||
// User must implement following four virtual methods
|
||||
// in his own concrete class derived from this class.
|
||||
// G4VUserPhysicsList::ConstructParticle()
|
||||
// Construct particles
|
||||
// G4VUserPhysicsList::constructPhysics()
|
||||
// Construct procesess and register them to particles
|
||||
// G4VUserPhysicsList::SetCuts(G4double aValue)
|
||||
// set a cut value in range to all particles
|
||||
// (and rebuilding physics table will be invoked)
|
||||
//
|
||||
// History
|
||||
// first version 09 Jan. 1998 by H.Kurashige
|
||||
// modified 24 Jan. 1998 by H.Kurashige
|
||||
// rename DumpCutValues/DumpCutValuesTable
|
||||
// change SetCuts method
|
||||
// add SetCutsWithDefault method
|
||||
// modified 06 June 1998 by H.Kurashige
|
||||
// add AddProcessManager
|
||||
// add BuildPhysicsTable
|
||||
// modified 29 June 1998 by H.Kurashige
|
||||
// add AddProcessManager
|
||||
// modified 05 Dec. 1998 by H.Kurashige
|
||||
// add ConstructAllParticles()
|
||||
// ------------------------------------------------------------
|
||||
#ifndef G4VUserPhysicsList_h
|
||||
#define G4VUserPhysicsList_h 1
|
||||
#include "globals.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
class G4UserPhysicsListMessenger;
|
||||
|
||||
class G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
G4VUserPhysicsList();
|
||||
virtual ~G4VUserPhysicsList();
|
||||
|
||||
public:
|
||||
// By calling the "Construct" method,
|
||||
// particles and processes are created
|
||||
void Construct();
|
||||
|
||||
protected:
|
||||
// These two methods of ConstructParticle() and ConstructProcess()
|
||||
// will be invoked in the Construct() method.
|
||||
|
||||
// each particle type will be instantiated
|
||||
virtual void ConstructParticle() = 0;
|
||||
|
||||
// each physics process will be instantiated and
|
||||
// registered to the process manager of each particle type
|
||||
virtual void ConstructProcess() = 0;
|
||||
|
||||
protected:
|
||||
// User must invoke this method in his ConstructProcess()
|
||||
// implementation in order to insures particle transportation.
|
||||
// !! Caution: this class must not be overriden !!
|
||||
void AddTransportation();
|
||||
|
||||
// Construct All particles
|
||||
virtual void ConstructAllParticles();
|
||||
// these methods Construct all particles in each category
|
||||
virtual void ConstructAllBosons();
|
||||
virtual void ConstructAllLeptons();
|
||||
virtual void ConstructAllMesons();
|
||||
virtual void ConstructAllBarions();
|
||||
virtual void ConstructAllIons();
|
||||
virtual void ConstructAllShortLiveds();
|
||||
|
||||
public:
|
||||
// "SetCuts" method sets a cut value for all particle types
|
||||
// in the particle table
|
||||
virtual void SetCuts(G4double aCut) = 0;
|
||||
|
||||
// "SetCutsWithDefault" method sets a cut value with the default
|
||||
// cut values for all particle types in the particle table
|
||||
void SetCutsWithDefault();
|
||||
|
||||
protected:
|
||||
//
|
||||
void BuildPhysicsTable(G4ParticleDefinition* );
|
||||
|
||||
protected:
|
||||
// Following are utility methods for SetCuts/reCalcCuts
|
||||
|
||||
// Reset cut values in energy for all particle types
|
||||
// By calling this methods, the run manager will invoke
|
||||
// SetCuts() just before event loop
|
||||
void ResetCuts();
|
||||
|
||||
// SetCutValue sets a cut value for a particle type
|
||||
void SetCutValue(G4double aCut, const G4String& name);
|
||||
void ReCalcCutValue(const G4String& name);
|
||||
|
||||
// "setCutsForOthers" method sets a cut value to all particle types
|
||||
// which have not be called SetCuts() methods yet.
|
||||
// (i.e. particles which have no definit cut values)
|
||||
void SetCutValueForOthers(G4double cutValue);
|
||||
|
||||
// "setCutsForOtherThan" sets a cut value to all particle types
|
||||
// other than particle types specified in arguments
|
||||
void SetCutValueForOtherThan(G4double cutValue,
|
||||
G4ParticleDefinition* first,
|
||||
G4ParticleDefinition* second = NULL,
|
||||
G4ParticleDefinition* third = NULL,
|
||||
G4ParticleDefinition* fourth = NULL,
|
||||
G4ParticleDefinition* fifth = NULL,
|
||||
G4ParticleDefinition* sixth = NULL,
|
||||
G4ParticleDefinition* seventh = NULL,
|
||||
G4ParticleDefinition* eighth = NULL,
|
||||
G4ParticleDefinition* nineth = NULL,
|
||||
G4ParticleDefinition* tenth = NULL );
|
||||
|
||||
// "reCalcCutsForOthers" method re-calculates a cut value
|
||||
// to all particle types which have not be called SetCuts() methods yet.
|
||||
void ReCalcCutValueForOthers();
|
||||
|
||||
public:
|
||||
// set/get the default cut value
|
||||
// Calling SetDefaultCutValue causes re-calcuration of cut values
|
||||
// and physics tables just before the next event loop
|
||||
void SetDefaultCutValue(G4double newCutValue);
|
||||
G4double GetDefaultCutValue() const;
|
||||
|
||||
protected:
|
||||
// this is the default cut value for all particles
|
||||
G4double defaultCutValue;
|
||||
|
||||
public:
|
||||
// Print out the List of registered particles types
|
||||
void DumpList() const;
|
||||
|
||||
public:
|
||||
// Print out information of cut values
|
||||
void DumpCutValuesTable() const;
|
||||
void DumpCutValues(const G4String &particle_name = "ALL") const;
|
||||
void DumpCutValues(G4ParticleDefinition* ) const;
|
||||
|
||||
protected:
|
||||
// adds new ProcessManager to all particles in the Particle Table
|
||||
// this routine is used in Construct()
|
||||
void InitializeProcessManager();
|
||||
|
||||
public:
|
||||
// add process manager for particles created on-the-fly
|
||||
void AddProcessManager(G4ParticleDefinition* newParticle,
|
||||
G4ProcessManager* newManager = NULL );
|
||||
|
||||
protected:
|
||||
// the particle table has the complete List of existing particle types
|
||||
G4ParticleTable* theParticleTable;
|
||||
G4ParticleTable::G4PTblDicIterator* theParticleIterator;
|
||||
|
||||
protected:
|
||||
// pointer to G4UserPhysicsListMessenger
|
||||
G4UserPhysicsListMessenger* theMessenger;
|
||||
|
||||
public:
|
||||
void SetVerboseLevel(G4int value);
|
||||
G4int GetVerboseLevel() const;
|
||||
|
||||
protected:
|
||||
G4int verboseLevel;
|
||||
// controle flag for output message
|
||||
// 0: Silent
|
||||
// 1: Warning message
|
||||
// 2: More
|
||||
|
||||
};
|
||||
|
||||
inline void G4VUserPhysicsList::SetCutsWithDefault()
|
||||
{
|
||||
SetCuts(defaultCutValue);
|
||||
}
|
||||
|
||||
inline void G4VUserPhysicsList::Construct()
|
||||
{
|
||||
if (verboseLevel >1) G4cout << "G4VUserPhysicsList::Construct()" << endl;
|
||||
|
||||
if (verboseLevel >1) G4cout << "Construct particles " << endl;
|
||||
ConstructParticle();
|
||||
|
||||
InitializeProcessManager();
|
||||
|
||||
if (verboseLevel >1) G4cout << "Construct processes " << endl;
|
||||
ConstructProcess();
|
||||
}
|
||||
|
||||
inline G4double G4VUserPhysicsList::GetDefaultCutValue() const
|
||||
{
|
||||
return defaultCutValue;
|
||||
}
|
||||
|
||||
inline void G4VUserPhysicsList::SetVerboseLevel(G4int value)
|
||||
{
|
||||
verboseLevel = value;
|
||||
if (verboseLevel >1){
|
||||
G4cerr << "G4VUserPhysicsList::SetVerboseLevel :";
|
||||
G4cerr << " Verbose level is set to " << verboseLevel << endl;
|
||||
}
|
||||
}
|
||||
|
||||
inline G4int G4VUserPhysicsList::GetVerboseLevel() const
|
||||
{
|
||||
return verboseLevel;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VUserPrimaryGeneratorAction.hh,v 2.1 1998/07/12 03:08:35 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#ifndef G4VUserPrimaryGeneratorAction_h
|
||||
#define G4VUserPrimaryGeneratorAction_h 1
|
||||
|
||||
class G4Event;
|
||||
|
||||
class G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
G4VUserPrimaryGeneratorAction();
|
||||
virtual ~G4VUserPrimaryGeneratorAction();
|
||||
|
||||
public:
|
||||
virtual void GeneratePrimaries(G4Event* anEvent) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Run.cc,v 2.0 1998/07/02 17:28:15 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4Run.hh"
|
||||
|
||||
G4Allocator<G4Run> aRunAllocator;
|
||||
|
||||
G4Run::G4Run()
|
||||
:runID(0),numberOfEvent(0),HCtable(NULL),DCtable(NULL)
|
||||
{;}
|
||||
|
||||
G4Run::~G4Run()
|
||||
{;}
|
||||
|
||||
@@ -0,0 +1,381 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RunManager.cc,v 2.10 1998/10/01 17:01:42 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunMessenger.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4VPersistencyManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ProcessTable.hh"
|
||||
#include "G4Timer.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4RunManager* G4RunManager::fRunManager = NULL;
|
||||
|
||||
G4RunManager* G4RunManager::GetRunManager()
|
||||
{ return fRunManager; }
|
||||
|
||||
G4RunManager::G4RunManager()
|
||||
:userDetector(NULL),physicsList(NULL),
|
||||
userRunAction(NULL),userPrimaryGeneratorAction(NULL),
|
||||
currentRun(NULL),currentEvent(NULL),n_perviousEventsToBeStored(0),
|
||||
geometryInitialized(false),physicsInitialized(false),cutoffInitialized(false),
|
||||
geometryNeedsToBeClosed(true),initializedAtLeastOnce(false),
|
||||
runAborted(false),pauseAtBeginOfEvent(false),pauseAtEndOfEvent(false),
|
||||
geometryToBeOptimized(true),verboseLevel(0),DCtable(NULL)
|
||||
{
|
||||
if(fRunManager)
|
||||
{ G4Exception("G4RunManager constructed twice."); }
|
||||
//G4UnitDefinition::BuildUnitsTable();
|
||||
fRunManager = this;
|
||||
eventManager = new G4EventManager();
|
||||
timer = new G4Timer();
|
||||
runMessenger = new G4RunMessenger(this);
|
||||
previousEvents = new RWTPtrOrderedVector<G4Event>;
|
||||
G4ParticleTable::GetParticleTable()->CreateMessenger();
|
||||
G4ProcessTable::GetProcessTable()->CreateMessenger();
|
||||
}
|
||||
|
||||
G4RunManager::~G4RunManager()
|
||||
{
|
||||
if(verboseLevel>0) G4cout << "G4 kernel has come to Quit state." << endl;
|
||||
G4StateManager* pStateManager = G4StateManager::GetStateManager();
|
||||
pStateManager->SetNewState(Quit);
|
||||
|
||||
if(verboseLevel>1) G4cout << "Deletion of G4 kernel class start." << endl;
|
||||
delete timer;
|
||||
delete runMessenger;
|
||||
G4ParticleTable::GetParticleTable()->DeleteMessenger();
|
||||
G4ProcessTable::GetProcessTable()->DeleteMessenger();
|
||||
delete previousEvents;
|
||||
if(userDetector)
|
||||
{
|
||||
delete userDetector;
|
||||
if(verboseLevel>1) G4cout << "UserDetectorConstruction deleted." << endl;
|
||||
}
|
||||
if(physicsList)
|
||||
{
|
||||
delete physicsList;
|
||||
if(verboseLevel>1) G4cout << "UserPhysicsList deleted." << endl;
|
||||
}
|
||||
if(userRunAction)
|
||||
{
|
||||
delete userRunAction;
|
||||
if(verboseLevel>1) G4cout << "UserRunAction deleted." << endl;
|
||||
}
|
||||
if(userPrimaryGeneratorAction)
|
||||
{
|
||||
delete userPrimaryGeneratorAction;
|
||||
if(verboseLevel>1) G4cout << "UserPrimaryGenerator deleted." << endl;
|
||||
}
|
||||
G4SDManager* fSDM = G4SDManager::GetSDMpointerIfExist();
|
||||
if(fSDM)
|
||||
{
|
||||
delete fSDM;
|
||||
if(verboseLevel>1) G4cout << "G4SDManager deleted." << endl;
|
||||
}
|
||||
delete eventManager;
|
||||
if(verboseLevel>1) G4cout << "EventManager deleted." << endl;
|
||||
G4UImanager* pUImanager = G4UImanager::GetUIpointer();
|
||||
{
|
||||
if(pUImanager) delete pUImanager;
|
||||
if(verboseLevel>1) G4cout << "UImanager deleted." << endl;
|
||||
}
|
||||
if(pStateManager)
|
||||
{
|
||||
delete pStateManager;
|
||||
if(verboseLevel>1) G4cout << "StateManager deleted." << endl;
|
||||
}
|
||||
if(verboseLevel>1) G4cout << "RunManager is deleting." << endl;
|
||||
}
|
||||
|
||||
void G4RunManager::BeamOn(G4int n_event,const char* macroFile,G4int n_select)
|
||||
{
|
||||
G4bool cond = ConfirmBeamOnCondition();
|
||||
if(cond)
|
||||
{
|
||||
RunInitialization();
|
||||
DoEventLoop(n_event,macroFile,n_select);
|
||||
RunTermination();
|
||||
}
|
||||
}
|
||||
|
||||
G4bool G4RunManager::ConfirmBeamOnCondition()
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
|
||||
G4ApplicationState currentState = stateManager->GetCurrentState();
|
||||
if(currentState!=PreInit && currentState!=Idle)
|
||||
{
|
||||
G4cerr << "Illegal application state - BeamOn() ignored." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!initializedAtLeastOnce)
|
||||
{
|
||||
G4cerr << " Geant4 kernel should be initialized" << endl;
|
||||
G4cerr << "before the first BeamOn(). - BeamOn ignored." << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!(geometryInitialized && physicsInitialized && cutoffInitialized))
|
||||
{
|
||||
if(verboseLevel>0)
|
||||
{
|
||||
G4cout << "Start re-initialization because " << endl;
|
||||
if(!geometryInitialized) G4cout << " Geometry" << endl;
|
||||
if(!physicsInitialized) G4cout << " Physics processes" << endl;
|
||||
if(!cutoffInitialized) G4cout << " Cutoff" << endl;
|
||||
G4cout << "has been modified since last Run." << endl;
|
||||
}
|
||||
Initialize();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void G4RunManager::RunInitialization()
|
||||
{
|
||||
currentRun = new G4Run();
|
||||
currentRun->SetDCtable(DCtable);
|
||||
G4SDManager* fSDM = G4SDManager::GetSDMpointerIfExist();
|
||||
if(fSDM)
|
||||
{ currentRun->SetHCtable(fSDM->GetHCtable()); }
|
||||
|
||||
if(userRunAction) userRunAction->BeginOfRunAction(currentRun);
|
||||
if(geometryNeedsToBeClosed)
|
||||
{
|
||||
if(verboseLevel>1) G4cout << "Start closing geometry." << endl;
|
||||
G4GeometryManager* geomManager = G4GeometryManager::GetInstance();
|
||||
geomManager->OpenGeometry();
|
||||
geomManager->CloseGeometry(geometryToBeOptimized);
|
||||
geometryNeedsToBeClosed = false;
|
||||
}
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
stateManager->SetNewState(GeomClosed);
|
||||
|
||||
previousEvents->clearAndDestroy();
|
||||
for(G4int i_prev=0;i_prev<n_perviousEventsToBeStored;i_prev++)
|
||||
{ previousEvents->insert((G4Event*)NULL); }
|
||||
|
||||
runAborted = false;
|
||||
if(verboseLevel>0) G4cout << "Start Run processing." << endl;
|
||||
}
|
||||
|
||||
void G4RunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_select)
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
|
||||
if(verboseLevel>0)
|
||||
{ timer->Start(); }
|
||||
|
||||
G4String msg;
|
||||
if(macroFile!=NULL)
|
||||
{
|
||||
if(n_select<0) n_select = n_event;
|
||||
msg = "/control/execute ";
|
||||
msg += macroFile;
|
||||
}
|
||||
else
|
||||
{ n_select = -1; }
|
||||
|
||||
G4int i_event;
|
||||
for( i_event=0; i_event<n_event; i_event++ )
|
||||
{
|
||||
stateManager->SetNewState(EventProc);
|
||||
if(pauseAtBeginOfEvent) stateManager->Pause("BeginOfEvent");
|
||||
|
||||
currentEvent = GenerateEvent(i_event);
|
||||
|
||||
eventManager->ProcessOneEvent(currentEvent);
|
||||
|
||||
AnalyzeEvent(currentEvent);
|
||||
|
||||
if(i_event<n_select) G4UImanager::GetUIpointer()->ApplyCommand(msg);
|
||||
if(pauseAtEndOfEvent) stateManager->Pause("EndOfEvent");
|
||||
stateManager->SetNewState(GeomClosed);
|
||||
StackPreviousEvent(currentEvent);
|
||||
currentEvent = NULL;
|
||||
if(runAborted) break;
|
||||
}
|
||||
|
||||
if(verboseLevel>0)
|
||||
{
|
||||
timer->Stop();
|
||||
G4cout << "Run terminated." << endl;
|
||||
G4cout << "Run Summary" << endl;
|
||||
if(runAborted)
|
||||
{ G4cout << " Run Aborted after " << i_event << " events processed." << endl; }
|
||||
else
|
||||
{ G4cout << " Number of events processed : " << n_event << endl; }
|
||||
G4cout << " " << *timer << endl;
|
||||
}
|
||||
}
|
||||
|
||||
G4Event* G4RunManager::GenerateEvent(G4int i_event)
|
||||
{
|
||||
if(!userPrimaryGeneratorAction)
|
||||
{
|
||||
G4Exception
|
||||
("G4RunManager::BeamOn - G4VUserPrimaryGeneratorAction is not defined.");
|
||||
}
|
||||
G4Event* anEvent = new G4Event(i_event);
|
||||
userPrimaryGeneratorAction->GeneratePrimaries(anEvent);
|
||||
return anEvent;
|
||||
}
|
||||
|
||||
void G4RunManager::AnalyzeEvent(G4Event* anEvent)
|
||||
{
|
||||
G4VPersistencyManager* fPersM = G4VPersistencyManager::GetPersistencyManager();
|
||||
if(fPersM) fPersM->Store(currentEvent);
|
||||
currentRun->RecordEvent(currentEvent);
|
||||
}
|
||||
|
||||
void G4RunManager::RunTermination()
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
|
||||
previousEvents->clearAndDestroy();
|
||||
|
||||
if(userRunAction) userRunAction->EndOfRunAction(currentRun);
|
||||
|
||||
G4VPersistencyManager* fPersM = G4VPersistencyManager::GetPersistencyManager();
|
||||
if(fPersM) fPersM->Store(currentRun);
|
||||
delete currentRun;
|
||||
currentRun = NULL;
|
||||
|
||||
stateManager->SetNewState(Idle);
|
||||
}
|
||||
|
||||
void G4RunManager::StackPreviousEvent(G4Event* anEvent)
|
||||
{
|
||||
G4Event* evt;
|
||||
if(n_perviousEventsToBeStored==0)
|
||||
{ evt = anEvent; }
|
||||
else
|
||||
{
|
||||
previousEvents->prepend(anEvent);
|
||||
evt = previousEvents->removeLast();
|
||||
}
|
||||
delete evt;
|
||||
}
|
||||
|
||||
void G4RunManager::Initialize()
|
||||
{
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
G4ApplicationState currentState = stateManager->GetCurrentState();
|
||||
if(currentState!=PreInit && currentState!=Idle)
|
||||
{
|
||||
G4cerr << "Illegal application state - "
|
||||
<< "G4RunManager::Initialize() ignored." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
stateManager->SetNewState(Init);
|
||||
if(!geometryInitialized) InitializeGeometry();
|
||||
if(!physicsInitialized) InitializePhysics();
|
||||
if(!cutoffInitialized) InitializeCutOff();
|
||||
stateManager->SetNewState(Idle);
|
||||
if(!initializedAtLeastOnce) initializedAtLeastOnce = true;
|
||||
}
|
||||
|
||||
void G4RunManager::InitializeGeometry()
|
||||
{
|
||||
if(!userDetector)
|
||||
{
|
||||
G4Exception
|
||||
("G4RunManager::InitializeGeometry - G4VUserDetectorConstruction is not defined.");
|
||||
}
|
||||
|
||||
if(verboseLevel>1) G4cout << "userDetector->Construct() start." << endl;
|
||||
DefineWorldVolume(userDetector->Construct());
|
||||
geometryInitialized = true;
|
||||
}
|
||||
|
||||
void G4RunManager::InitializePhysics()
|
||||
{
|
||||
if(physicsList)
|
||||
{
|
||||
if(verboseLevel>1) G4cout << "physicsList->Construct() start." << endl;
|
||||
physicsList->Construct();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4VUserPhysicsList is not defined");
|
||||
}
|
||||
physicsInitialized = true;
|
||||
}
|
||||
|
||||
void G4RunManager::InitializeCutOff()
|
||||
{
|
||||
if(physicsList)
|
||||
{
|
||||
if(verboseLevel>1) G4cout << "physicsList->setCut() start." << endl;
|
||||
physicsList->SetCutsWithDefault();
|
||||
}
|
||||
cutoffInitialized = true;
|
||||
}
|
||||
|
||||
void G4RunManager::AbortRun()
|
||||
{
|
||||
// This method is valid only for GeomClosed or EventProc state
|
||||
G4ApplicationState currentState =
|
||||
G4StateManager::GetStateManager()->GetCurrentState();
|
||||
if(currentState==GeomClosed || currentState==EventProc)
|
||||
{
|
||||
runAborted = true;
|
||||
if(currentState==EventProc) eventManager->AbortCurrentEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "Run is not in progress. AbortRun() ignored." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4RunManager::DefineWorldVolume(G4VPhysicalVolume* worldVol)
|
||||
{
|
||||
// set the world volume to the Navigator
|
||||
G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->SetWorldVolume(worldVol);
|
||||
|
||||
// Let VisManager know it
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager) pVVisManager->GeometryHasChanged();
|
||||
|
||||
geometryNeedsToBeClosed = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4RunMessenger.cc,v 2.6 1998/10/01 17:01:43 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4RunMessenger.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4ios.hh"
|
||||
#ifdef WIN32
|
||||
# include <Strstrea.h>
|
||||
#else
|
||||
# include <strstream.h>
|
||||
#endif
|
||||
|
||||
G4RunMessenger::G4RunMessenger(G4RunManager * runMgr)
|
||||
:runManager(runMgr)
|
||||
{
|
||||
runDirectory = new G4UIdirectory("/run/");
|
||||
runDirectory->SetGuidance("Run control commands.");
|
||||
|
||||
initCmd = new G4UIcmdWithoutParameter("/run/initialize",this);
|
||||
initCmd->SetGuidance("Initialize G4 kernel.");
|
||||
initCmd->AvailableForStates(PreInit,Idle),
|
||||
|
||||
beamOnCmd = new G4UIcommand("/run/beamOn",this);
|
||||
beamOnCmd->SetGuidance("Start a Run.");
|
||||
beamOnCmd->SetGuidance("If G4 kernel is not initialized, it will be initialized.");
|
||||
beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
|
||||
beamOnCmd->SetGuidance("The second and third arguments can be used for");
|
||||
beamOnCmd->SetGuidance("executing a macro file at the end of each event.");
|
||||
beamOnCmd->SetGuidance("If the second argument, i.e. name of the macro");
|
||||
beamOnCmd->SetGuidance("file, is given but the third argument is not,");
|
||||
beamOnCmd->SetGuidance("the macro file will be executed for all of the");
|
||||
beamOnCmd->SetGuidance("event.");
|
||||
beamOnCmd->SetGuidance("If the third argument (nSelect) is given, the");
|
||||
beamOnCmd->SetGuidance("macro file will be executed only for the first");
|
||||
beamOnCmd->SetGuidance("nSelect events.");
|
||||
beamOnCmd->AvailableForStates(PreInit,Idle);
|
||||
G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
|
||||
p1->SetDefaultValue(1);
|
||||
p1->SetParameterRange("numberOfEvent > 0");
|
||||
beamOnCmd->SetParameter(p1);
|
||||
G4UIparameter* p2 = new G4UIparameter("macroFile",'s',true);
|
||||
p2->SetDefaultValue("***NULL***");
|
||||
beamOnCmd->SetParameter(p2);
|
||||
G4UIparameter* p3 = new G4UIparameter("nSelect",'i',true);
|
||||
p3->SetDefaultValue(-1);
|
||||
p3->SetParameterRange("nSelect>=-1");
|
||||
beamOnCmd->SetParameter(p3);
|
||||
|
||||
verboseCmd = new G4UIcmdWithAnInteger("/run/verbose",this);
|
||||
verboseCmd->SetGuidance("Set the Verbose level of G4RunManager.");
|
||||
verboseCmd->SetGuidance(" 0 : Silent (default)");
|
||||
verboseCmd->SetGuidance(" 1 : Display main topics");
|
||||
verboseCmd->SetGuidance(" 2 : Display main topics and run summary");
|
||||
verboseCmd->SetParameterName("level",true);
|
||||
verboseCmd->SetDefaultValue(0);
|
||||
verboseCmd->SetRange("level >=0 && level <=2");
|
||||
|
||||
optCmd = new G4UIcmdWithABool("/run/optimizeGeometry",this);
|
||||
optCmd->SetGuidance("Set the optimization flag for geometry.");
|
||||
optCmd->SetGuidance("If it is set to TRUE, G4GeometryManager will optimize");
|
||||
optCmd->SetGuidance("the geometry definitions.");
|
||||
optCmd->SetGuidance("GEANT4 is initialized with this flag as TRUE.");
|
||||
optCmd->SetParameterName("optimizeFlag",true);
|
||||
optCmd->SetDefaultValue(true);
|
||||
optCmd->AvailableForStates(PreInit,Idle);
|
||||
|
||||
brkBoECmd = new G4UIcmdWithABool("/run/breakAtBeginOfEvent",this);
|
||||
brkBoECmd->SetGuidance("Set a break point at the begining of every event.");
|
||||
brkBoECmd->SetParameterName("flag",true);
|
||||
brkBoECmd->SetDefaultValue(true);
|
||||
|
||||
brkEoECmd = new G4UIcmdWithABool("/run/breakAtEndOfEvent",this);
|
||||
brkEoECmd->SetGuidance("Set a break point at the end of every event.");
|
||||
brkEoECmd->SetParameterName("flag",true);
|
||||
brkEoECmd->SetDefaultValue(true);
|
||||
|
||||
abortCmd = new G4UIcmdWithoutParameter("/run/abort",this);
|
||||
abortCmd->SetGuidance("Abort current run processing.");
|
||||
abortCmd->AvailableForStates(GeomClosed,EventProc);
|
||||
|
||||
geomCmd = new G4UIcmdWithoutParameter("/run/geometryModified",this);
|
||||
geomCmd->SetGuidance("Force geometry to be closed again.");
|
||||
geomCmd->SetGuidance("This command must be applied");
|
||||
geomCmd->SetGuidance(" if geometry has been modified after the");
|
||||
geomCmd->SetGuidance(" first initialization (or BeamOn).");
|
||||
geomCmd->AvailableForStates(PreInit,Idle),
|
||||
|
||||
cutCmd = new G4UIcmdWithoutParameter("/run/cutoffModified",this);
|
||||
cutCmd->SetGuidance("Force closssection tables to be calculated again.");
|
||||
cutCmd->SetGuidance("This command must be applied");
|
||||
cutCmd->SetGuidance(" if cutoff value(s) have been modified after the");
|
||||
cutCmd->SetGuidance(" first initialization (or BeamOn).");
|
||||
cutCmd->AvailableForStates(PreInit,Idle);
|
||||
}
|
||||
|
||||
G4RunMessenger::~G4RunMessenger()
|
||||
{
|
||||
delete beamOnCmd;
|
||||
delete verboseCmd;
|
||||
delete optCmd;
|
||||
delete brkBoECmd;
|
||||
delete brkEoECmd;
|
||||
delete abortCmd;
|
||||
delete initCmd;
|
||||
delete geomCmd;
|
||||
delete cutCmd;
|
||||
delete runDirectory;
|
||||
}
|
||||
|
||||
void G4RunMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command==beamOnCmd )
|
||||
{
|
||||
G4int nev;
|
||||
G4int ns;
|
||||
const char* nv = (const char*)newValue;
|
||||
istrstream is((char*)nv);
|
||||
is >> nev >> macroFileName >> ns;
|
||||
if(macroFileName=="***NULL***")
|
||||
{ runManager->BeamOn(nev); }
|
||||
else
|
||||
{ runManager->BeamOn(nev,macroFileName,ns); }
|
||||
}
|
||||
else if( command==verboseCmd )
|
||||
{ runManager->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue)); }
|
||||
else if( command==optCmd )
|
||||
{ runManager->SetGeometryToBeOptimized(optCmd->GetNewBoolValue(newValue)); }
|
||||
else if( command==brkBoECmd )
|
||||
{ runManager->SetPauseAtBeginOfEvent(brkBoECmd->GetNewBoolValue(newValue)); }
|
||||
else if( command==brkEoECmd )
|
||||
{ runManager->SetPauseAtEndOfEvent(brkEoECmd->GetNewBoolValue(newValue)); }
|
||||
else if( command==abortCmd )
|
||||
{ runManager->AbortRun(); }
|
||||
else if( command==initCmd )
|
||||
{ runManager->Initialize(); }
|
||||
else if( command==geomCmd )
|
||||
{ runManager->GeometryHasBeenModified(); }
|
||||
else if( command==cutCmd )
|
||||
{ runManager->CutOffHasBeenModified(); }
|
||||
}
|
||||
|
||||
G4String G4RunMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
{
|
||||
G4String cv;
|
||||
|
||||
if( command==verboseCmd )
|
||||
{ cv = verboseCmd->ConvertToString(runManager->GetVerboseLevel()); }
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UserPhysicsListMessenger.cc,v 2.5 1998/07/17 06:12:52 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4UserPhysicsListMessenger.cc
|
||||
// ------------------------------------------------------------
|
||||
// History
|
||||
// first version 09 Jan. 1998 by H.Kurashige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4UserPhysicsListMessenger.hh"
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4UserPhysicsListMessenger::G4UserPhysicsListMessenger(G4VUserPhysicsList* pParticleList):theParticleList(pParticleList)
|
||||
{
|
||||
// /run/particle directory
|
||||
theDirectory = new G4UIdirectory("/run/particle/");
|
||||
theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
|
||||
|
||||
// /run/particle/Verbose command
|
||||
verboseCmd = new G4UIcmdWithAnInteger("/run/particle/verbose",this);
|
||||
verboseCmd->SetGuidance("Set the Verbose level of G4VUserPhysicsList.");
|
||||
verboseCmd->SetGuidance(" 0 : Silent (default)");
|
||||
verboseCmd->SetGuidance(" 1 : Display warning messages");
|
||||
verboseCmd->SetGuidance(" 2 : Display more");
|
||||
verboseCmd->SetParameterName("level",true);
|
||||
verboseCmd->SetDefaultValue(0);
|
||||
verboseCmd->SetRange("level >=0 && level <=2");
|
||||
|
||||
// /run/particle/setCut command
|
||||
setCutCmd = new G4UIcmdWithADoubleAndUnit("/run/particle/setCut",this);
|
||||
setCutCmd->SetGuidance("Set default cut value ");
|
||||
setCutCmd->SetParameterName("cut",false);
|
||||
setCutCmd->SetDefaultValue(1.0);
|
||||
setCutCmd->SetRange("cut >0.0");
|
||||
setCutCmd->SetUnitCandidates("m cm mm microm");
|
||||
setCutCmd->SetDefaultUnit("mm");
|
||||
setCutCmd->AvailableForStates(PreInit,Idle);
|
||||
|
||||
// /run/particle/DumpList command
|
||||
dumpListCmd = new G4UIcmdWithoutParameter("/run/particle/dumpList",this);
|
||||
dumpListCmd->SetGuidance("Dump List of particles in G4VUserPhysicsList. ");
|
||||
|
||||
|
||||
// /run/particle/DumpCutValues command
|
||||
dumpCutValuesCmd = new G4UIcmdWithAString("/run/particle/dumpCutValues",this);
|
||||
dumpCutValuesCmd->SetGuidance("Dump cut value information ");
|
||||
dumpCutValuesCmd->SetGuidance("Enter particle name ");
|
||||
dumpCutValuesCmd->SetGuidance(" enter all for all particles");
|
||||
dumpCutValuesCmd->SetParameterName("particle", true);
|
||||
dumpCutValuesCmd->SetDefaultValue("table");
|
||||
dumpCutValuesCmd->AvailableForStates(Idle,GeomClosed,EventProc);
|
||||
|
||||
// /run/particle/addProcManager command
|
||||
addProcManCmd = new G4UIcmdWithAString("/run/particle/addProcManager", this);
|
||||
addProcManCmd->SetGuidance("add process manager");
|
||||
addProcManCmd->SetParameterName("particleType", true);
|
||||
addProcManCmd->SetDefaultValue("");
|
||||
addProcManCmd->AvailableForStates(Init,Idle,GeomClosed,EventProc);
|
||||
}
|
||||
|
||||
G4UserPhysicsListMessenger::~G4UserPhysicsListMessenger()
|
||||
{
|
||||
delete setCutCmd;
|
||||
delete verboseCmd;
|
||||
delete dumpListCmd;
|
||||
delete dumpCutValuesCmd;
|
||||
delete addProcManCmd;
|
||||
delete theDirectory;
|
||||
}
|
||||
|
||||
void G4UserPhysicsListMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command==setCutCmd ){
|
||||
G4double newCut = setCutCmd->GetNewDoubleValue(newValue);
|
||||
theParticleList->SetDefaultCutValue(newCut);
|
||||
} else if( command==verboseCmd ) {
|
||||
theParticleList->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
|
||||
|
||||
} else if( command==dumpListCmd ){
|
||||
theParticleList->DumpList();
|
||||
} else if( command==dumpCutValuesCmd ){
|
||||
if (newValue == "table") {
|
||||
theParticleList->DumpCutValuesTable();
|
||||
} else {
|
||||
theParticleList->DumpCutValues(newValue);
|
||||
}
|
||||
} else if( command == addProcManCmd ){
|
||||
G4ParticleDefinition* particle = (G4ParticleTable::GetParticleTable())->FindParticle(newValue);
|
||||
if (particle == NULL) return;
|
||||
if (particle->GetProcessManager() != NULL) return;
|
||||
theParticleList->AddProcessManager(particle);
|
||||
}
|
||||
}
|
||||
|
||||
G4String G4UserPhysicsListMessenger::GetCurrentValue(G4UIcommand * command)
|
||||
{
|
||||
G4String cv;
|
||||
|
||||
if( command==setCutCmd ){
|
||||
cv = setCutCmd->ConvertToString( theParticleList->GetDefaultCutValue(), "mm" );
|
||||
|
||||
} else if( command==verboseCmd ){
|
||||
cv = verboseCmd->ConvertToString(theParticleList->GetVerboseLevel());
|
||||
|
||||
} else if( command== addProcManCmd ){
|
||||
// set candidate list
|
||||
G4String candidates("none");
|
||||
G4ParticleTable::G4PTblDicIterator *piter = (G4ParticleTable::GetParticleTable())->GetIterator();
|
||||
piter -> reset();
|
||||
while( (*piter)() ){
|
||||
G4ParticleDefinition *particle = piter->value();
|
||||
candidates += " " + particle->GetParticleName();
|
||||
}
|
||||
addProcManCmd->SetCandidates(candidates);
|
||||
cv = "";
|
||||
}
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UserRunAction.cc,v 2.1 1998/07/12 03:08:39 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
G4UserRunAction::G4UserRunAction()
|
||||
{;}
|
||||
|
||||
G4UserRunAction::~G4UserRunAction()
|
||||
{;}
|
||||
|
||||
void G4UserRunAction::BeginOfRunAction(G4Run* aRun)
|
||||
{;}
|
||||
|
||||
void G4UserRunAction::EndOfRunAction(G4Run* aRun)
|
||||
{;}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VPersistencyManager.cc,v 2.1 1998/07/12 03:08:40 urbi Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4VPersistencyManager.hh"
|
||||
|
||||
G4VPersistencyManager* G4VPersistencyManager::fPersistencyManager = 0;
|
||||
|
||||
G4VPersistencyManager* G4VPersistencyManager::GetPersistencyManager()
|
||||
{
|
||||
return fPersistencyManager;
|
||||
}
|
||||
|
||||
G4VPersistencyManager::G4VPersistencyManager()
|
||||
{
|
||||
fPersistencyManager = this;
|
||||
}
|
||||
|
||||
G4VPersistencyManager::~G4VPersistencyManager()
|
||||
{
|
||||
fPersistencyManager = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VUserDetectorConstruction.cc,v 2.0 1998/07/02 17:28:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
G4VUserDetectorConstruction::G4VUserDetectorConstruction()
|
||||
{;}
|
||||
|
||||
G4VUserDetectorConstruction::~G4VUserDetectorConstruction()
|
||||
{;}
|
||||
|
||||
@@ -0,0 +1,603 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VUserPhysicsList.cc,v 2.16 1998/12/07 01:16:55 kurasige Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
// History
|
||||
// first version 09 Jan. 1998 by H.Kurashige
|
||||
// modified 24 Jan. 1998 by H.Kurashige
|
||||
// modified 06 June 1998 by H.Kurashige
|
||||
// add G4ParticleWithCuts::SetEnergyRange
|
||||
// 18 June 1998 by H.Kurashige
|
||||
// modifeid for short lived particles 27 June 1998 by H.Kurashige
|
||||
// G4BestUnit on output 12 nov. 1998 mma
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4BosonConstructor.hh"
|
||||
#include "G4LeptonConstructor.hh"
|
||||
#include "G4MesonConstructor.hh"
|
||||
#include "G4BarionConstructor.hh"
|
||||
#include "G4IonConstructor.hh"
|
||||
#include "G4ShortLivedConstructor.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4UserPhysicsListMessenger.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include <iomanip.h>
|
||||
|
||||
|
||||
G4VUserPhysicsList::G4VUserPhysicsList()
|
||||
:verboseLevel(1)
|
||||
{
|
||||
// default cut value (1.0mm)
|
||||
defaultCutValue = 1.0*mm;
|
||||
|
||||
// set energy range for SetCut calcuration
|
||||
G4ParticleWithCuts::SetEnergyRange(0.99*keV, 100*TeV);
|
||||
|
||||
// pointer to the particle table
|
||||
theParticleTable = G4ParticleTable::GetParticleTable();
|
||||
theParticleIterator = theParticleTable->GetIterator();
|
||||
|
||||
// UI Messenger
|
||||
theMessenger = new G4UserPhysicsListMessenger(this);
|
||||
}
|
||||
|
||||
G4VUserPhysicsList::~G4VUserPhysicsList()
|
||||
{
|
||||
if (theMessenger != NULL) {
|
||||
delete theMessenger;
|
||||
theMessenger = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::AddProcessManager(G4ParticleDefinition* newParticle,
|
||||
G4ProcessManager* newManager)
|
||||
{
|
||||
if (newParticle == NULL) return;
|
||||
if (newManager == NULL){
|
||||
newManager = new G4ProcessManager(newParticle);
|
||||
if (newParticle->GetParticleType() == "nucleus") {
|
||||
G4ParticleDefinition* genericIon =
|
||||
(G4ParticleTable::GetParticleTable())->FindParticle("GenericIon");
|
||||
if (genericIon != NULL) {
|
||||
G4ProcessManager* ionMan = genericIon->GetProcessManager();
|
||||
if (ionMan != NULL) {
|
||||
delete newManager;
|
||||
newManager = new G4ProcessManager(*ionMan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verboseLevel >2){
|
||||
G4cerr << "G4VUserPhysicsList::AddProcessManager: ";
|
||||
G4cerr << "adds ProcessManager to ";
|
||||
G4cerr << newParticle->GetParticleName() << endl;
|
||||
newManager->DumpInfo();
|
||||
}
|
||||
newManager->SetParticleType(newParticle);
|
||||
if (newParticle->GetProcessManager() == NULL) {
|
||||
newParticle->SetProcessManager(newManager);
|
||||
} else {
|
||||
if (verboseLevel >0){
|
||||
G4cerr << "G4VUserPhysicsList::AddProcessManager: ";
|
||||
G4cerr << newParticle->GetParticleName();
|
||||
G4cerr << " already has ProcessManager " << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4VUserPhysicsList::InitializeProcessManager()
|
||||
{
|
||||
// loop over all particles in G4ParticleTable
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
if (pmanager==NULL) {
|
||||
pmanager = new G4ProcessManager(particle);
|
||||
particle->SetProcessManager(pmanager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "G4Transportation.hh"
|
||||
void G4VUserPhysicsList::AddTransportation()
|
||||
{
|
||||
G4Transportation* theTransportationProcess= new G4Transportation();
|
||||
|
||||
// loop over all particles in G4ParticleTable
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
if (!particle->IsShortLived()) {
|
||||
pmanager ->AddProcess(theTransportationProcess);
|
||||
pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxAlongStep);
|
||||
pmanager ->SetProcessOrderingToFirst(theTransportationProcess, idxPostStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4VUserPhysicsList::SetDefaultCutValue(G4double value)
|
||||
{
|
||||
if (value<=0.0) {
|
||||
if (verboseLevel >0){
|
||||
G4cerr << "G4VUserPhysicsList::SetDefaultCutValue: negative cut values";
|
||||
G4cerr << " :" << value/mm << "[mm]" << endl;
|
||||
}
|
||||
} else {
|
||||
if (verboseLevel >1){
|
||||
G4cout << "G4VUserPhysicsList::SetDefaultCutValue:";
|
||||
G4cout << "default cut value is changed to :" ;
|
||||
G4cout << value/mm << "[mm]" << endl;
|
||||
}
|
||||
defaultCutValue = value;
|
||||
ResetCuts();
|
||||
}
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ResetCuts()
|
||||
{
|
||||
if (verboseLevel >1) {
|
||||
G4cout << "G4VUserPhysicsList::ResetCuts()" << endl;
|
||||
G4cout << " cut values in energy will be calculated later" << endl;
|
||||
}
|
||||
|
||||
// Reset cut values for other particles
|
||||
// loop over all particles in G4ParticleTable
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
if (!particle->IsShortLived()) particle->ResetCuts();
|
||||
}
|
||||
|
||||
// inform that cut values are modified to the run manager
|
||||
// i.e state will be changed and SetCuts will be invoked
|
||||
// just before event loop
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/run/cutoffModified");
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::SetCutValueForOtherThan(G4double cutValue,
|
||||
G4ParticleDefinition* first,
|
||||
G4ParticleDefinition* second,
|
||||
G4ParticleDefinition* third,
|
||||
G4ParticleDefinition* fourth,
|
||||
G4ParticleDefinition* fifth,
|
||||
G4ParticleDefinition* sixth,
|
||||
G4ParticleDefinition* seventh,
|
||||
G4ParticleDefinition* eighth,
|
||||
G4ParticleDefinition* nineth,
|
||||
G4ParticleDefinition* tenth )
|
||||
{
|
||||
// check cut value is positive
|
||||
if (cutValue <= 0.0) {
|
||||
if (verboseLevel >0){
|
||||
G4cerr << "G4VUserPhysicsList::SetCutValueForOtherThan: negative cut values";
|
||||
G4cerr << " :" << cutValue/mm << "[mm]" << endl;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (verboseLevel >1) {
|
||||
G4cout << "G4VUserPhysicsList::SetCutValueForOtherThan ";
|
||||
G4cout << " :" << cutValue/mm << "[mm]" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check specified particle types in arguments
|
||||
G4ParticleDefinition* specifiedParticles[10];
|
||||
G4int numberOfSpecifiedParticles = 0;
|
||||
if (first != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = first;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (second != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = second;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (third != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = third;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (fourth != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = fourth;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (fifth != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = fifth;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (sixth != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = sixth;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (seventh != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = seventh;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (eighth != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = eighth;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (nineth != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = nineth;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
if (tenth != 0) {
|
||||
specifiedParticles[numberOfSpecifiedParticles] = tenth;
|
||||
numberOfSpecifiedParticles +=1;
|
||||
}
|
||||
|
||||
// Set cut values for other particles
|
||||
G4bool isSpecified;
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
isSpecified = false;
|
||||
for (G4int index = 0; index <numberOfSpecifiedParticles; index++) {
|
||||
isSpecified = isSpecified || (particle == specifiedParticles[index]);
|
||||
}
|
||||
if (!isSpecified) {
|
||||
if (!particle->IsShortLived()) {
|
||||
particle->SetCuts(cutValue);
|
||||
if (verboseLevel >1)
|
||||
G4cout << "Set cuts for " << particle->GetParticleName() << endl;
|
||||
BuildPhysicsTable(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::SetCutValue(G4double aCut, const G4String& name)
|
||||
{
|
||||
G4ParticleDefinition* particle;
|
||||
if (particle = theParticleTable->FindParticle(name)){
|
||||
if (!particle->IsShortLived()) {
|
||||
particle->SetCuts( aCut );
|
||||
if (verboseLevel >1) G4cout << "Set cuts for " << name << endl;
|
||||
BuildPhysicsTable(particle);
|
||||
}
|
||||
} else {
|
||||
if (verboseLevel >0)
|
||||
G4cout << name << " is not found in ParticleTable" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void G4VUserPhysicsList::SetCutValueForOthers(G4double cutValue)
|
||||
{
|
||||
// check cut value is positive
|
||||
if (cutValue <= 0.0) {
|
||||
if (verboseLevel >0){
|
||||
G4cerr << "G4VUserPhysicsList::SetCutValueForOthers: negative cut values";
|
||||
G4cerr << " :" << cutValue/mm << "[mm]" << endl;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (verboseLevel >1) {
|
||||
G4cout << "G4VUserPhysicsList::SetCutValueForOthers ";
|
||||
G4cout << " :" << cutValue/mm << "[mm]" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Sets a cut value to particle types which have not be called SetCuts()
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
if (!particle->IsShortLived()) {
|
||||
if ((particle->GetLengthCuts()<0.0) ||(particle->GetEnergyCuts()==NULL)) {
|
||||
particle->SetCuts(cutValue);
|
||||
if (verboseLevel >1)
|
||||
G4cout << "Set cuts for " << particle->GetParticleName() << endl;
|
||||
BuildPhysicsTable(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ReCalcCutValue(const G4String& name)
|
||||
{
|
||||
G4ParticleDefinition* particle;
|
||||
if (particle = theParticleTable->FindParticle(name)){
|
||||
if (!particle->IsShortLived()) {
|
||||
particle->ReCalcCuts();
|
||||
if (verboseLevel >1) G4cout << "Recalc cuts for " << name << endl;
|
||||
BuildPhysicsTable(particle);
|
||||
}
|
||||
} else {
|
||||
if (verboseLevel >0)
|
||||
G4cout << name << " is not found in ParticleTable" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ReCalcCutValueForOthers()
|
||||
{
|
||||
if (verboseLevel >1) {
|
||||
G4cout << "G4VUserPhysicsList::ReCalcCutValueForOthers ";
|
||||
}
|
||||
|
||||
// Sets a cut value to particle types which have not be called SetCuts()
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
if (!particle->IsShortLived()) {
|
||||
if (particle->GetEnergyCuts()==NULL) {
|
||||
if (verboseLevel >1)
|
||||
G4cout << "ReCalc cuts for " << particle->GetParticleName() << endl;
|
||||
particle->ReCalcCuts();
|
||||
BuildPhysicsTable(particle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::BuildPhysicsTable(G4ParticleDefinition* particle)
|
||||
{
|
||||
G4int j;
|
||||
|
||||
// Rebuild the physics tables for every process for this particle type
|
||||
G4ProcessVector* pVector = (particle->GetProcessManager())->GetProcessList();
|
||||
for ( j=0; j < pVector->length(); ++j) {
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
for ( j=0; j < pVector->length(); ++j) {
|
||||
|
||||
//*********************************************************************
|
||||
// temporary addition to make the integral schema of electromagnetic
|
||||
// processes work.
|
||||
//
|
||||
if((*pVector)[j]->GetProcessName() == "Imsc")
|
||||
{
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
if((*pVector)[j]->GetProcessName() == "IeIoni")
|
||||
{
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
if((*pVector)[j]->GetProcessName() == "IeBrems")
|
||||
{
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
if((*pVector)[j]->GetProcessName() == "Iannihil")
|
||||
{
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
if((*pVector)[j]->GetProcessName() == "IhIoni")
|
||||
{
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
if((*pVector)[j]->GetProcessName() == "IMuIoni")
|
||||
{
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
if((*pVector)[j]->GetProcessName() == "IMuBrems")
|
||||
{
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
if((*pVector)[j]->GetProcessName() == "IMuPairProd")
|
||||
{
|
||||
(*pVector)[j]->BuildPhysicsTable(*particle);
|
||||
}
|
||||
//*********************************************************************
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ConstructAllParticles()
|
||||
{
|
||||
ConstructAllBosons();
|
||||
ConstructAllLeptons();
|
||||
ConstructAllMesons();
|
||||
ConstructAllBarions();
|
||||
ConstructAllIons();
|
||||
ConstructAllShortLiveds();
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ConstructAllBosons()
|
||||
{
|
||||
// Construct all bosons
|
||||
G4BosonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ConstructAllLeptons()
|
||||
{
|
||||
// Construct all leptons
|
||||
G4LeptonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ConstructAllMesons()
|
||||
{
|
||||
// Construct all mesons
|
||||
G4MesonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ConstructAllBarions()
|
||||
{
|
||||
// Construct all barions
|
||||
G4BarionConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ConstructAllIons()
|
||||
{
|
||||
// Construct light ions
|
||||
G4IonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::ConstructAllShortLiveds()
|
||||
{
|
||||
// Construct resonaces and quarks
|
||||
G4ShortLivedConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
|
||||
void G4VUserPhysicsList::DumpList() const
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
G4int idx = 0;
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4cout << particle->GetParticleName();
|
||||
if ((idx++ % 4) == 3) {
|
||||
G4cout << endl;
|
||||
} else {
|
||||
G4cout << ", ";
|
||||
}
|
||||
}
|
||||
G4cout << endl;
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::DumpCutValues(const G4String &particle_name) const
|
||||
{
|
||||
G4ParticleDefinition* particle;
|
||||
if ((particle_name == "ALL") || (particle_name == "all")) {
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
particle = theParticleIterator->value();
|
||||
DumpCutValues(particle);
|
||||
}
|
||||
} else {
|
||||
particle = theParticleTable->FindParticle(particle_name);
|
||||
if (particle != NULL) DumpCutValues(particle);
|
||||
}
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::DumpCutValues( G4ParticleDefinition* particle) const
|
||||
{
|
||||
if (particle == NULL) return;
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if (particle->IsShortLived()) {
|
||||
G4cout << " --- " << particle->GetParticleName() << " is a short lived particle ------ " << endl;
|
||||
} else {
|
||||
G4cout << " --- " << particle->GetParticleName() << " ------ " << endl;
|
||||
G4cout << " - Cut in range = " << G4BestUnit(particle->GetLengthCuts(),"Length") << endl;
|
||||
G4double* theKineticEnergyCuts = particle->GetEnergyCuts();
|
||||
|
||||
if (theKineticEnergyCuts != NULL) {
|
||||
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
|
||||
G4cout << " - Material ---------------- Energy Cut ---" << endl;
|
||||
for (G4int idx=0; idx<materialTable->length(); idx++){
|
||||
G4cout << " " << setw(19) << (*materialTable)[idx]->GetName();
|
||||
G4cout << " : " << setw(10) << G4BestUnit(theKineticEnergyCuts[idx],"Energy");
|
||||
G4cout << endl;
|
||||
}
|
||||
} else {
|
||||
G4cout << " - Cuts in energy are not calculated yet --" << endl;
|
||||
G4cout << " Enter /run/initialize command to calculate cuts " << endl;
|
||||
}
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
void G4VUserPhysicsList::DumpCutValuesTable() const
|
||||
{
|
||||
// This methods Print out a table of cut value information
|
||||
// for "e-", "gamma", "mu-", "proton" and "neutron"
|
||||
G4int prec = G4cout.precision(3);
|
||||
const G4int size = 5;
|
||||
G4String name[size] = {"gamma", "e-", "mu-", "proton", "neutron"};
|
||||
G4ParticleDefinition* particle[size];
|
||||
G4bool IsOK = true;
|
||||
G4int idx;
|
||||
for (idx=0; idx <size; idx++) {
|
||||
particle[idx] = theParticleTable->FindParticle(name[idx]);
|
||||
}
|
||||
|
||||
//line 1 //-- Commented out (M.Asai)
|
||||
//G4cout << "Default cut value in range :";
|
||||
//G4cout << defaultCutValue/mm << "[mm]" << endl;
|
||||
|
||||
//line 2
|
||||
G4cout << "============= The cut Energy ==============================" <<endl;
|
||||
|
||||
// line 3
|
||||
G4cout << " ";
|
||||
for (idx=0; idx <size; idx++) {
|
||||
G4cout << " " << setw(11) << name[idx] << " ";
|
||||
}
|
||||
G4cout << endl;
|
||||
|
||||
// line 4
|
||||
G4cout << "Cut in range ";
|
||||
for (idx=0; idx <size; idx++) {
|
||||
if (particle[idx] == NULL) {
|
||||
G4cout << " ";
|
||||
} else {
|
||||
G4cout << " " << setw(11) << G4BestUnit(particle[idx]->GetLengthCuts(),"Length");
|
||||
}
|
||||
}
|
||||
G4cout << endl;
|
||||
|
||||
// line 5
|
||||
G4cout << "Cut in energy";
|
||||
G4cout << endl;
|
||||
|
||||
// line 6 ..
|
||||
const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
|
||||
for (G4int J=0; J<materialTable->length(); J++) {
|
||||
G4cout << " " << setw(18) << ((*materialTable)[J])->GetName();
|
||||
for (idx=0; idx <size; idx++) {
|
||||
if (particle[idx] == NULL) {
|
||||
G4cout << " ";
|
||||
} else {
|
||||
if (particle[idx]->GetEnergyCuts() == NULL) {
|
||||
G4cout << " ---------- ";
|
||||
IsOK = false;
|
||||
} else {
|
||||
G4cout << " " << setw(11) << G4BestUnit((particle[idx]->GetEnergyCuts())[J],"Energy");
|
||||
}
|
||||
}
|
||||
}
|
||||
G4cout << endl;
|
||||
}
|
||||
|
||||
if (!IsOK) {
|
||||
G4cout << " Cuts in energy have not calculated yet !!" << endl;
|
||||
G4cout << " Enter /run/initialize command to calculate cuts " << endl;
|
||||
}
|
||||
|
||||
// last line
|
||||
G4cout << "===================================================" << endl;
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VUserPrimaryGeneratorAction.cc,v 2.0 1998/07/02 17:28:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-00 $
|
||||
//
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
G4VUserPrimaryGeneratorAction::G4VUserPrimaryGeneratorAction()
|
||||
{;}
|
||||
|
||||
G4VUserPrimaryGeneratorAction::~G4VUserPrimaryGeneratorAction()
|
||||
{;}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user