Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
@@ -0,0 +1,21 @@
# --------------------------------------------------------------
# $Id: GNUmakefile,v 1.4 2000/11/16 13:46:04 nartallo Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := XrayTel
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
G4VIS_USE = 1
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
+68
View File
@@ -0,0 +1,68 @@
$Id: History,v 1.9 2000/12/06 18:34:34 nartallo 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 *
----------------------------------------------------------
06.12.2000 - RN, tag xraytel-V02-00-10
Removed old XrayTelPrimaryGeneratorMessenger.cc and .hh
files from cvs
30.11.2000 - RN, tag xraytel-V02-00-09
Removed longsection.macro file from cvs
30.11.2000 - RN, tag xraytel-V02-00-08
Implemented AnalysisManager class and related histograming
code. Analysis is limited to the Lizard package for now.
16.11.2000 - RN, tag xraytel-V02-00-07
Removed analysis directory
16.11.2000 - RN, tag xraytel-V02-00-06
Replace standard gun with General Particle Source
Remove all code related to old Histogram implementation
Modified all macros to work with GPS
Cleaned GNUmakefile
Started drafting README file
08.11.2000 - RN, tag xraytel-V02-00-05
Tydied up macros
Small bug fixes to compile on Linux, SUN and DEC platforms
06.11.2000 - RN, tag xraytel-V02-00-04
Tydied up code added headers
18.10.2000 - RN, tag xraytel-V02-00-03
Modified geometry and PrimaryGenerator to speed up events
Modified SteppingAction.cc to call histoManager analyser
Modified Histogram.cc to do all the histo work
17.10.2000 - RN, tag xraytel-V02-00-02
Added histograming capability
Added XrayTelHistogram.hh, XrayTelHistogram.cc
Modified: GNUmakefile
XrayTel.cc
XrayTelSteppingAction.hh
XrayTelSteppingAction.cc
17.10.2000 - RN, tag xraytel-V02-00-01
Tydied up geometry
Add all physics processes to XrayTelPhysicsList.cc
Modified *.hh accordingly
06.10.2000 - RN, tag xraytel-V02-00-00
First submission of XrayTel advanced example.
+171
View File
@@ -0,0 +1,171 @@
$Id: README,v 1.5 2000/12/06 18:34:42 nartallo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
xray_telescope
--------------
XrayTel is an advanced Geant4 example based on a realistic simulation of
an X-ray Telescope. It is based on work carried out by a team of Geant4
experts to simulate the interaction between X-ray Telescopes XMM-Newton
and Chandra with low energy protons present in the orbital radiation
background. The X-ray mirrors are designed to collect x-ray photons at
grazing-incidence angles and focus them onto detectors at the focal plane.
However, this mechanism also seems to work for low energy protons which,
if they reach the detectors in sufficient numbers, can cause damage.
In this example, the geometry has been simplified by using a single mirror
shell and no baffles, but all the dimensions and materials are realistic.
The aim of this advanced example is to illustrate the use advanced
GUI, visualisation, particle generation and analysis schemes available
in Geant4:
- the simulation can be run from GAG or the command prompt
- macros are provided to display the geometry and particle tracks with
OpenGL, DAWN Postscript or VRML visualisation
- the generation of particles is done via the new General Particle Source
- histograming facilities are provided for the Linux environment only
with the Lizard system at present, other analysis systems such as
OpenScientist and JAS will be implemented at a later stage
In order to be able to use any of these packages, prior installation is
necessary and a number of environment variables will have to be set.
1. Setting up the environment variables for GAG, Visualisation and
Analysis options (example based on Linux at CERN)
#set up GAG
setenv G4UI_BUILD_GAG_SESSION 1
setenv G4UI_USE_GAG 1
#set up VRMLview
setenv G4VIS_BUILD_VRMLFILE_DRIVER 1
setenv G4VIS_USE_VRML 1
setenv G4VIS_USE_VRMLFILE 1
setenv G4VRMLFILE_MAX_FILE_NUM 100
setenv G4VRMLFILE_VIEWER vrmlview #if installed
setenv G4VIS_USE_VRML 1
setenv G4VIS_USE_VRMLFILE 1
setenv PATH ${PATH}:"/afs/cern.ch/sw/contrib/VRML/bin/Linux"
#set up OpenGL or Mesa
setenv G4VIS_BUILD_OPENGLX_DRIVER 1
setenv G4VIS_USE_OPENGLX 1
setenv OGLHOME /afs/cern.ch/sw/geant4/dev/Mesa/Linux-g++
#set up DAWN
setenv G4VIS_BUILD_DAWN_DRIVER 1
setenv G4VIS_BUILD_DAWNFILE_DRIVER 1
setenv G4VIS_USE_DAWN 1
setenv G4VIS_USE_DAWNFILE 1
setenv PATH ${PATH}:"/afs/cern.ch/sw/geant4/dev/DAWN/Linux-g++"
#set up Lizard
setenv LIZARDROOT /usr/local/freeLizard/3.2.0 #get correct path
setenv G4ANALYSIS_SYSTEM Lizard
setenv G4ANALYSIS_USE 1
setenv G4ANALYSIS_USE_LIZARD 1
setenv G4ANALYSIS_BUILD 1
setenv G4ANALYSIS_BUILD_LIZARD 1
#add to the LD_LIBRARY_PATH
setenv LD_LIBRARY_PATH /usr/local/freeLizard/3.2.0/Linux/lib:$OGLHOME/lib
IMPORTANT WARNING!
setenv G4ANALYSIS_BUILD 1
must always be set to build the example even if the analysis option
is not required
Sources
-------
GAG can be obtained from
http://erpc1.naruto-u.ac.jp/~geant4/
OpenGL Mesa needs to be installed prior to building Geant4 and can be
downloaded from
http://www.mesa3d.org/download.html
DAWN can be obtained from
http://133.7.51.8/dawn/
VRMLview for Linux can be obtained from
2. Run
To execute a sample simulation with visualisation of proton tracks
reaching the detector run:
XrayTel opengl.mac for OpenGL display
XrayTel vrml.mac for VRML display and output file
XrayTel dawn.mac for dawn display and PS output file
To execute a run without visualisation
XrayTel test.mac
If the Lizard analysis options are set, histograming windows will
automatically open and the corresponding files will be created.
A 2D histogram (scatter plot) will display in real time every proton
hit that reaches the detector.
A 1D histogram will display the energy distribution of the protons
that reach the detector at the end of the run.
The final energy and (x,y,z) position of the protons that reach the
detector is output to a file "detector.hits". This file is created
if it does not exist or appended to if it does.
3. Detector description
The telescope and detector geometry is defined in
XrayTelDetectorConstruction.cc
4. Physics processes
The physics processes are in XrayTelPhysicsList.cc
The main process in this example is MultipleScattering of the protons
on the mirror surfaces.
5. Event generation
This is done using the new General Particle Source. Documentation for
this can be found in
http://www.space.dera.gov.uk/space_env/gspm.html
6. Analysis
At present the analysis package implemented is Lizard. As this is still
under development only simple histograming is used. The main purpose of
including this facility was to provide the basis for the implementation of
AIDA interfaces between Geant4 and analysis packages, in particular
Lizard, OpenScientist and JAS. More complex analysis features may be
implemented in future releases.
The current implementation of the analysis class is very preliminary
and new tags of this example are anticipated to be released soon after
the general release
Lizard is not currently implemented on platforms other than Linux.
To build and execute the example on other platforms the analysis
environment variables must not be set, except for G4ANALYSIS_BUILD
which is required for building the executable.
+124
View File
@@ -0,0 +1,124 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTel.cc main file *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// HISTORY
// -------
//
// The development of this advanced example is based on earlier work
// carried out by a team of Geant4 collaborators to simulate the Chandra
// and XMM X-ray observatories. The authors involved in those models are
// J Apostolakis, P Arce, S Giani, F Lei, R Nartallo, S Magni,
// P Truscott, L Urban
//
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 R. Nartallo, A. Pfeiffer
// - Implementation of analysis manager code for histograming
//
// 15.11.2000 R. Nartallo
// - Minor changes proposed by F. Lei to implement the GPS module now
// replacing the standard particle gun
// - Remove commented lines related to old histograming code
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
// - Lines for using GAG and the histogram manager are commented out.
//
//
// **********************************************************************
#include "G4RunManager.hh"
#include "G4UImanager.hh"
//#include "G4UIGAG.hh"
#include "G4UIterminal.hh"
#include "G4UIXm.hh"
#include "XrayTelDetectorConstruction.hh"
#include "XrayTelPhysicsList.hh"
#include "XrayTelVisManager.hh"
#include "XrayTelEventAction.hh"
#include "XrayTelRunAction.hh"
#include "XrayTelSteppingAction.hh"
#include "XrayTelPrimaryGeneratorAction.hh"
#include <iostream.h>
#include "g4std/vector"
#include "XrayTelAnalysisManager.hh"
int main( int argc, char** argv )
{
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
runManager->SetUserInitialization(new XrayTelDetectorConstruction ) ;
runManager->SetUserInitialization(new XrayTelPhysicsList);
// setup some of the common variables
G4bool drawEvent;
G4std::vector<G4double*> EnteringEnergy;
G4std::vector<G4ThreeVector*> EnteringDirection;
// create manager for analysis.
char* s = getenv("G4ANALYSIS_SYSTEM");
XrayTelAnalysisManager* analysisManager = new XrayTelAnalysisManager(s?s:"");
// set mandatory user action class
runManager->SetUserAction(new XrayTelPrimaryGeneratorAction);
runManager->SetUserAction(new XrayTelRunAction(&EnteringEnergy,
&EnteringDirection, &drawEvent, analysisManager));
runManager->SetUserAction(new XrayTelEventAction(&drawEvent));
runManager->SetUserAction(new XrayTelSteppingAction(
&EnteringEnergy, &EnteringDirection, &drawEvent, analysisManager));
// visualization manager
G4VisManager* visManager = new XrayTelVisManager;
visManager->Initialize();
//Initialize G4 kernel
runManager->Initialize();
// get the pointer to the User Interface manager
G4UImanager *UI = G4UImanager::GetUIpointer();
if ( argc==1 ){
// G4UIsession * session = new G4UIGAG;
G4UIsession * session = new G4UIterminal;
session->SessionStart();
delete session;
}
else {
// Create a pointer to the User Interface manager
G4String command = "/control/execute ";
for (int i=2; i<=argc; i++) {
G4String macroFileName = argv[i-1];
UI->ApplyCommand(command+macroFileName);
}
}
// job termination
delete visManager;
delete analysisManager;
delete runManager;
return 0;
}
+131
View File
@@ -0,0 +1,131 @@
#######################################################################
# #
# This code implementation is the intellectual property of #
# the 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. #
# #
# ******************************************************************* #
# * * #
# * GEANT 4 xray_telescope advanced example * #
# * * #
# * MACRO: dawn.mac * #
# * ------ demostrates the DAWN DRIVER * #
# * * #
# * Version: 0.6 * #
# * Date: 15/11/00 * #
# * Author: R Nartallo * #
# * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * #
# * * #
# ******************************************************************* #
# #
# NOTES #
# ----- #
# USAGE: Idle> /control/execute dawn.mac #
# prompt> XrayTel dawn.mac #
# #
# REQUIRED PLATFORMS & SOFTWARE: DAWN (version 3.85 or after) #
# Ghostview #
# #
# ENVIRONMENT VARIABLES (C-MACROS) FOR INSTALLATION: #
# (See geant4/source/visualization/README for details.) #
# #
# % setenv G4VIS_USE_DAWN 1 #
# % setenv G4VIS_USE_DAWNFILE 1 #
# % setenv G4VIS_BUILD_DAWN_DRIVER 1 #
# % setenv G4VIS_BUILD_DAWNFILE_DRIVER 1 #
# #
# Addional Notes: #
# #
# * You may have to set the command path to the directory where #
# a Fukui Renderer DAWN is installed, e.g., to #
# "/afs/cern.ch/sw/contrib/DAWN/3.85/bin/Linux/" #
# at CERN. #
# #
# * Set as follows to skip DAWN GUI: #
# % setenv G4DAWNFILE_VIEWER "dawn -d" #
# #
# * In order to make the generated PostScript file "g4_XX.eps" #
# printable, append the "showpage" PostScript command to the file. #
# You can do it with the 4th page of the DAWN GUI panel #
# or by editing the file by hand. #
# #
#######################################################################
# #
# CHANGE HISTORY #
# -------------- #
# #
# 15.11.2000 R. Nartallo #
# - Replaced standard particle gun by GPS set options #
# #
# 08.11.2000 R. Nartallo #
# - Modified version #
# #
# 17.10.2000 S. Tanaka #
# - First implementation #
# #
#######################################################################
# Set verbose level
/run/verbose 2
# Invoke the DAWNFILE driver
/vis/open DAWNFILE
# Create a new scene
/vis/scene/create
# Attach the current scene handler to the current scene
/vis/sceneHandler/attach
# Add the world volume to the current scene
/vis/scene/add/volume
# Set drawing style
/vis/viewer/set/style surface
#/vis/viewer/set/style wireframe
# Set camera
/vis/camera/reset
/vis/camera/viewpoint 25 0
# Visualize one event added to the current scene
# * Command "/vis/scene/notifyHandlers" is written in
# XrayTelRunAction::BeginOfRunAction()
# * Command "/vis/show/view" is written in
# XrayTelRunAction::EndOfRunAction()
# Store particle trajactories for visualization
/tracking/storeTrajectory 1
# Set to draw tracks of positively charged particles
/event/drawTracks charged
# Set General Particle Source options
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
# Set number of particles and start
/run/beamOn 10000
@@ -0,0 +1,91 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelAnalysisManager.cc *
// * ------- *
// * *
// * Version: 0.2 *
// * Date: 30/11/00 *
// * Author: A. Pfeiffer, G. Barrand, MG Pia, R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 M.G. Pia, R. Nartallo
// - Simplification of code
// - Inheritance directly from the base class G4VAnalysisManager instead
// of the derived class G4AnalysisManager
//
// 16.10.2000 G. Barrand
// - First implementation of XrayAnalysisManager class
// - Provision of code for various AIDA and non-AIDA systems
//
// **********************************************************************
#ifndef XrayTelAnalysisManager_h
#define XrayTelAnalysisManager_h 1
#include "G4VAnalysisManager.hh"
#include "globals.hh"
#include "g4std/vector"
#include "G4ThreeVector.hh"
class G4SteppingManager;
class G4VAnalysisSystem;
#ifdef G4ANALYSIS_USE
class IHistogramFactory;
class IHistogram1D;
class IHistogram2D;
#endif
#ifdef G4ANALYSIS_USE
class XrayTelAnalysisManager: public G4VAnalysisManager {
#endif
#ifndef G4ANALYSIS_USE
class XrayTelAnalysisManager {
#endif
public:
XrayTelAnalysisManager(const G4String&);
~XrayTelAnalysisManager();
G4bool RegisterAnalysisSystem(G4VAnalysisSystem*);
#ifdef G4ANALYSIS_USE
IHistogramFactory* GetHistogramFactory(const G4String&);
virtual void Store(IHistogram* = 0,const G4String& = "");
virtual void Plot(IHistogram*);
#endif
void BeginOfRun();
void EndOfRun();
void Step(const G4SteppingManager*);
private:
G4VAnalysisSystem* analysisSystem;
#ifdef G4ANALYSIS_USE
IHistogramFactory* hFactory;
IHistogram1D* enteringEnergyHistogram;
IHistogram2D* yzHistogram;
#endif
};
#endif
@@ -0,0 +1,59 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelDetectorConstruction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelDetectorConstruction_H
#define XrayTelDetectorConstruction_H 1
class G4VPhysicalVolume;
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
class XrayTelDetectorConstruction : public G4VUserDetectorConstruction
{
public:
XrayTelDetectorConstruction();
~XrayTelDetectorConstruction();
public:
G4VPhysicalVolume* Construct();
private:
G4double world_x;
G4double world_y;
G4double world_z;
void ConstructTelescope();
void ConstructFocalPlane();
G4VPhysicalVolume* physicalWorld;
};
#endif
@@ -0,0 +1,66 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventAction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelEventAction_h
#define XrayTelEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class XrayTelEventActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelEventAction : public G4UserEventAction
{
public:
XrayTelEventAction(G4bool* dEvent);
~XrayTelEventAction();
public:
void BeginOfEventAction(const G4Event* anEvent);
void EndOfEventAction(const G4Event* anEvent);
void SetDrawFlag(G4String val) {drawFlag = val;};
private:
G4bool* drawEvent;
G4String drawFlag; // control the drawing of event
XrayTelEventActionMessenger* eventMessenger;
};
#endif
@@ -0,0 +1,62 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventActionMessenger.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelEventActionMessenger_h
#define XrayTelEventActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class XrayTelEventAction;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelEventActionMessenger: public G4UImessenger
{
public:
XrayTelEventActionMessenger(XrayTelEventAction*);
~XrayTelEventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
XrayTelEventAction* eventAction;
G4UIcmdWithAString* DrawCmd;
};
#endif
@@ -0,0 +1,85 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPhysicsList.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelPhysicsList_h
#define XrayTelPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
class XrayTelPhysicsList: public G4VUserPhysicsList
{
public:
XrayTelPhysicsList();
~XrayTelPhysicsList();
protected:
// Construct particle and physics process
void ConstructParticle();
void ConstructProcess();
void SetCuts();
public:
// Set/Get cut values
void SetCutForGamma(G4double);
void SetCutForElectron(G4double);
void SetCutForProton(G4double);
G4double GetCutForGamma() const;
G4double GetCutForElectron() const;
G4double GetCutForProton() const;
protected:
// these methods Construct particles
void ConstructBosons();
void ConstructLeptons();
void ConstructMesons();
void ConstructBaryons();
void ConstructAllShortLiveds();
protected:
// these methods Construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForProton;
};
#endif
@@ -0,0 +1,62 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPrimaryGeneratorAction.hh *
// * ------- *
// * *
// * Version: 0.5 *
// * Date: 15/11/00 *
// * Author: F.Lei *
// * Organisation: DERA, UK *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 15.11.2000 F.Lei
// - New version of PrimaryGeneratorAction using the GPS insead of the
// standard particle gun.
// - The PrimaryGeneratorMessenger is no longer needed.
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelPrimaryGeneratorAction_h
#define XrayTelPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4GeneralParticleSource;
class G4Event;
class XrayTelPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
XrayTelPrimaryGeneratorAction();
~XrayTelPrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent);
private:
G4GeneralParticleSource* particleGun;
};
#endif
@@ -0,0 +1,67 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelRunAction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelRunAction_h
#define XrayTelRunAction_h 1
#include "G4UserRunAction.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include "g4std/vector"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Run;
class XrayTelAnalysisManager;
class XrayTelRunAction : public G4UserRunAction
{
public:
XrayTelRunAction(G4std::vector<G4double*> *enEnergy,
G4std::vector<G4ThreeVector*> *enDirect,
G4bool* dEvent,
XrayTelAnalysisManager* = 0);
~XrayTelRunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
private:
G4bool* drawEvent;
G4std::vector<G4double*>* enteringEnergy;
G4std::vector<G4ThreeVector*>* enteringDirection;
XrayTelAnalysisManager* fAnalysisManager;
};
#endif
@@ -0,0 +1,128 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelStepCut.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelStepCut_h
#define XrayTelStepCut_h 1
#include "G4ios.hh"
#include "G4VDiscreteProcess.hh"
#include "G4Step.hh"
#include "globals.hh"
class XrayTelStepCut : public G4VDiscreteProcess
{
public:
XrayTelStepCut(const G4String& processName ="UserStepCut" );
XrayTelStepCut(XrayTelStepCut &);
~XrayTelStepCut();
G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
G4VParticleChange* PostStepDoIt(
const G4Track& ,
const G4Step&
);
void SetMaxStep(G4double);
protected:
// it is not needed here !
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
);
private:
// hide assignment operator as private
XrayTelStepCut & operator=(const XrayTelStepCut &right);
private:
G4double MaxChargedStep ;
};
// inlined function members implementation
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4UserLimits.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
inline G4double XrayTelStepCut::PostStepGetPhysicalInteractionLength(
const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double ProposedStep = DBL_MAX;
if((MaxChargedStep > 0.) &&
(aTrack.GetVolume() != NULL) &&
(aTrack.GetVolume()->GetName() == "Absorber") &&
(aTrack.GetDynamicParticle()->GetDefinition()->GetPDGCharge() != 0.))
ProposedStep = MaxChargedStep ;
return ProposedStep;
}
inline G4VParticleChange* XrayTelStepCut::PostStepDoIt(
const G4Track& aTrack,
const G4Step&
)
{
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
}
inline G4double XrayTelStepCut::GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
)
{
return 0.;
}
#endif
@@ -0,0 +1,63 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelSteppingAction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelSteppingAction_h
#define XrayTelSteppingAction_h 1
class XrayTelAnalysisManager;
#include "G4UserSteppingAction.hh"
#include "G4ThreeVector.hh"
#include "g4std/vector"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelSteppingAction : public G4UserSteppingAction
{
public:
XrayTelSteppingAction(
G4std::vector<G4double*> *enEnergy,
G4std::vector<G4ThreeVector*> *enDirect,
G4bool* dEvent,
XrayTelAnalysisManager* = 0);
virtual ~XrayTelSteppingAction();
virtual void UserSteppingAction(const G4Step*);
private:
G4bool* drawEvent;
G4std::vector<G4double*>* enteringEnergy;
G4std::vector<G4ThreeVector*>* enteringDirection;
XrayTelAnalysisManager* fAnalysisManager;
};
#endif
@@ -0,0 +1,54 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelVisManager.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelVisManager_h
#define XrayTelVisManager_h 1
#ifdef G4VIS_USE
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelVisManager: public G4VisManager {
public:
XrayTelVisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif
#endif
+115
View File
@@ -0,0 +1,115 @@
#######################################################################
# #
# This code implementation is the intellectual property of #
# the 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. #
# #
# ******************************************************************* #
# * * #
# * GEANT 4 xray_telescope advanced example * #
# * * #
# * MACRO: opengl.mac * #
# * ------ demostrates the OGLIX DRIVER * #
# * * #
# * Version: 0.6 * #
# * Date: 15/11/00 * #
# * Author: R Nartallo * #
# * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * #
# * * #
# ******************************************************************* #
# #
# NOTES #
# ----- #
# USAGE: Idle> /control/execute opengl.mac. #
# prompt> XrayTel opengl.mac #
# #
# REQUIRED PLATFORMS & SOFTWARE: OpenGL, e.g. Mesa #
# #
# ENVIRONMENT VARIABLES (C-MACROS) FOR INSTALLATION: #
# (See geant4/source/visualization/README for details.) #
# #
# % setenv OGLHOME opengl_home_dir #
# (where opengl_home_dir is e.g. /usr/local/Mesa-3.2.1 #
# #
# % setenv G4VIS_USE_OPENGLX 1 #
# % setenv G4VIS_BUILD_OPENGLX_DRIVER 1 #
# #
#######################################################################
# #
# CHANGE HISTORY #
# -------------- #
# #
# 15.11.2000 R. Nartallo #
# - Replaced standard particle gun by GPS set options #
# #
# 08.11.2000 R. Nartallo #
# - First implementation #
# #
#######################################################################
# Set verbose level
/run/verbose 2
# Invoke the OGLIX driver
/vis/open OGLIX
# Create a new scene
/vis/scene/create
# Attach the current scene handler to the current scene
/vis/sceneHandler/attach
# Add the world volume to the current scene
/vis/scene/add/volume
# Add all trajectories to the current scene
#/vis/scene/add/trajectories
# Set drawing style
/vis/viewer/set/style surface
# Set camera
/vis/camera/reset
/vis/camera/viewpoint 25 0
#/vis/camera/spin 360 1
# Visualize one event added to the current scene
# * Command "/vis/scene/notifyHandlers" is written in
# XrayTelRunAction::BeginOfRunAction()
# * Command "/vis/show/view" is written in
# XrayTelRunAction::EndOfRunAction()
# Store particle trajactories for visualization
/tracking/storeTrajectory 1
# Set to draw tracks of positively charged particles
# /event/drawTracks charged
# Set General Particle Source options
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
# Set number of particles and start
/run/beamOn 10000
@@ -0,0 +1,166 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelAnalysisManager.cc *
// * ------- *
// * *
// * Version: 0.2 *
// * Date: 30/11/00 *
// * Author: A. Pfeiffer, G. Barrand, MG Pia, R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 M.G. Pia, R. Nartallo
// - Simplification of code: removal of non-Lizard specific code
// - Inheritance directly from the base class G4VAnalysisManager instead
// of the derived class G4AnalysisManager
//
// 15.11.2000 A. Pfeiffer
// - Adaptation to Lizard
//
// 16.10.2000 G. Barrand
// - First implementation of XrayAnalysisManager
// - Provision of code for various AIDA and non-AIDA systems
//
// **********************************************************************
#include "g4std/fstream"
#include "G4ios.hh"
#include "G4Run.hh"
#include "G4Event.hh"
#include "G4Track.hh"
#include "G4VVisManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4SteppingManager.hh"
#include "G4VAnalysisSystem.hh"
#ifdef G4ANALYSIS_USE
#include <IHistogramFactory.h>
#endif
#ifdef G4ANALYSIS_USE_LIZARD
#include <IHistogram1D.h>
#include <IHistogram2D.h>
#include "G4LizardSystem.hh"
#endif
#include "XrayTelAnalysisManager.hh"
#ifndef G4ANALYSIS_USE
XrayTelAnalysisManager::XrayTelAnalysisManager(G4String const& aSystem)
{
}
XrayTelAnalysisManager::~XrayTelAnalysisManager()
{
}
#endif
#ifdef G4ANALYSIS_USE
XrayTelAnalysisManager::XrayTelAnalysisManager(G4String const& aSystem)
:
enteringEnergyHistogram(0),
yzHistogram(0)
{
// The Lizard analysis system is provided here as default
// other analysis systems will be implemented at a later stage
analysisSystem = new G4LizardSystem;
IHistogramFactory* hFactory = analysisSystem->GetHistogramFactory();
if(hFactory) {
// Histogram creation :
enteringEnergyHistogram = hFactory->create1D("Entering energy",100,0,0.5);
// Book the histogram for the 2D position.
// Instead of using a scatter plot, just book enough bins ...
yzHistogram = hFactory->create2D("YZ",200, -50, 50, 200, -50, 50);
}
}
XrayTelAnalysisManager::~XrayTelAnalysisManager()
{
// delete hFactory;
delete enteringEnergyHistogram;
delete yzHistogram;
delete analysisSystem;
}
G4bool XrayTelAnalysisManager::RegisterAnalysisSystem(
G4VAnalysisSystem* )
{
return true;
}
IHistogramFactory* XrayTelAnalysisManager::GetHistogramFactory(
const G4String& aSystem)
{
return hFactory;
}
void XrayTelAnalysisManager::Store(IHistogram* aHistogram,const G4String& aSID)
{
analysisSystem->Store(aHistogram,aSID);
}
void XrayTelAnalysisManager::Plot(IHistogram* aHistogram)
{
analysisSystem->Plot(aHistogram);
}
void XrayTelAnalysisManager::BeginOfRun(){
if(enteringEnergyHistogram)
enteringEnergyHistogram->reset();
if(yzHistogram)
yzHistogram->reset();
}
void XrayTelAnalysisManager::EndOfRun(){
// the following things cannot be done in Run::EndOfRun()
// only now plot the energy of the particles
if(enteringEnergyHistogram) {
Plot(enteringEnergyHistogram);
}
// and store the histograms
if(enteringEnergyHistogram) {
Store(enteringEnergyHistogram,"ekin.vop");
}
if(yzHistogram) {
Store(yzHistogram,"position.vop");
}
}
void XrayTelAnalysisManager::Step(const G4SteppingManager* aSteppingManager) {
if(!aSteppingManager) return;
G4Track* track = aSteppingManager->GetTrack();
G4ThreeVector pos = track->GetPosition();
if(enteringEnergyHistogram) {
enteringEnergyHistogram->fill(track->GetKineticEnergy());
}
if(yzHistogram) {
yzHistogram->fill(pos.y(), pos.z());
Plot(yzHistogram);
}
}
#endif
@@ -0,0 +1,408 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelDetectorConstruction.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope geometry
// - Based on Chandra and XMM models by R Nartallo, P Truscott, F Lei
// and P Arce
//
//
// **********************************************************************
#include "G4UnitsTable.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "globals.hh"
#include "XrayTelDetectorConstruction.hh"
XrayTelDetectorConstruction::XrayTelDetectorConstruction()
{
world_x = 2500.*cm;
world_y = 2500.*cm;
world_z = 2500.*cm;
}
XrayTelDetectorConstruction::~XrayTelDetectorConstruction()
{;}
G4VPhysicalVolume* XrayTelDetectorConstruction::Construct( )
{
// Material: Vacuum
G4Material* Vacuum = new G4Material("Vacuum",
1.0 , 1.01*g/mole, 1.0E-25*g/cm3,
kStateGas, 2.73*kelvin, 3.0E-18*pascal );
// Visualization attributes
G4VisAttributes* VisAttWorld= new G4VisAttributes( G4Colour(204/255.,255/255.,255/255.));
// World
G4Box * solidWorld = new G4Box( "world_S", world_x, world_y, world_z );
G4LogicalVolume * logicalWorld = new G4LogicalVolume( solidWorld, // solid
Vacuum, // material
"world_L", // name
0,0,0);
logicalWorld -> SetVisAttributes(VisAttWorld);
// Physical volume
physicalWorld= new G4PVPlacement( 0,
G4ThreeVector(),
"world_P", // name (2nd constructor)
logicalWorld, // logical volume
NULL, // mother volume
false, // no boolean operation
0); // copy number
// Make Invisible
logicalWorld -> SetVisAttributes(G4VisAttributes::Invisible);
// Construct geometry
ConstructTelescope();
ConstructFocalPlane();
return physicalWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Construct Telescope
void XrayTelDetectorConstruction::ConstructTelescope()
{
// Construct Mirror
// Single shell mirror made of Nickel with thin Gold coating
// Mirror made up of two cones approximating the parabolic section and
// two cones approximating the hyperbolic section
// The centre of the mirror is filled wiith a solid aluminium rod shaped as the
// mirrors, so as to leave a constant BaffleGap distance from the mirror surface
// Build materials
G4Material* Ni = new G4Material("Nickel", 28., 58.6934*g/mole, 8.902*g/cm3);
G4Material* Au = new G4Material("Gold", 79., 196.96654*g/mole, 19.300*g/cm3);
G4Material* Al = new G4Material("Aluminium", 13., 26.98*g/mole, 2.700*g/cm3);
// Visualization attributes
G4VisAttributes* VisAttMirror = new G4VisAttributes(
G4Colour(0/255., 0/255.,255/255.));
G4VisAttributes* VisAttAuCoating = new G4VisAttributes(
G4Colour(255/255., 255/255., 0/255.));
G4VisAttributes* VisAttBaffle = new G4VisAttributes(
G4Colour(128/255., 128/255., 128/255.));
// Rotation Matrix
G4RotationMatrix *rotateMatrix = new G4RotationMatrix();
rotateMatrix -> rotateY(90.*deg);
// Construct cones to make Mirror sections
G4int i;
G4double MirrorEnd[5] = { 34.9995975*cm, 34.8277209*cm, 34.6549918*cm,
34.1347834*cm, 33.6137753*cm };
G4double MirrorPosition[4] = { 772.5*cm, 757.5*cm, 742.5*cm, 727.5*cm };
G4double MirrorSectionLength = 15.0*cm;
G4double MirrorNiThickness = 1.07*mm;
G4double MirrorAuCoating = 50.0e-6*mm;
G4double BaffleGap = 4.0*mm;
G4Cons* MirrorSolid[4];
G4Cons* MirrorAuCoatingSolid[4];
G4Cons* BaffleSolid[4];
G4LogicalVolume* MirrorLogicalVolume[4];
G4LogicalVolume* MirrorAuCoatingLogicalVolume[4];
G4LogicalVolume* BaffleLogicalVolume[4];
for ( i=0; i<4; i++ ) {
// Mirror Nickel base
MirrorSolid[i] = new G4Cons( "Mirror_S",
MirrorEnd[i], MirrorEnd[i] + MirrorNiThickness,
MirrorEnd[i+1], MirrorEnd[i+1] + MirrorNiThickness,
MirrorSectionLength/2, 0*deg, 360.*deg);
MirrorLogicalVolume[i] = new G4LogicalVolume(
MirrorSolid[i], Ni, "Mirror_L", 0, 0, 0 );
MirrorLogicalVolume[i]->SetVisAttributes(VisAttMirror);
// Gold coating on mirror
MirrorAuCoatingSolid[i] = new G4Cons(
"MirrorAuCoating_S",
MirrorEnd[i] - MirrorAuCoating, MirrorEnd[i],
MirrorEnd[i+1] - MirrorAuCoating, MirrorEnd[i+1],
MirrorSectionLength/2, 0*deg, 360.*deg);
MirrorAuCoatingLogicalVolume[i] = new G4LogicalVolume(
MirrorAuCoatingSolid[i],
Au,
"MirrorAuCoating_L",
0, 0, 0 );
MirrorAuCoatingLogicalVolume[i]->SetVisAttributes(VisAttAuCoating);
// Aluminium baffle inside mirror
BaffleSolid[i] = new G4Cons( "Baffle_S",
0, MirrorEnd[i] - BaffleGap,
0, MirrorEnd[i+1] - BaffleGap,
MirrorSectionLength/2, 0*deg, 360.*deg);
BaffleLogicalVolume[i] = new G4LogicalVolume(
BaffleSolid[i], Al, "Baffle_L", 0, 0, 0 );
BaffleLogicalVolume[i]-> SetVisAttributes(VisAttBaffle);
}
// Physical volume
G4VPhysicalVolume* MirrorPhysicalVolume[4];
G4VPhysicalVolume* MirrorAuCoatingPhysicalVolume[4];
G4VPhysicalVolume* BafflePhysicalVolume[4];
for ( i=0; i<4; i++ ) {
MirrorPhysicalVolume[i] = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
"Mirror_P",
MirrorLogicalVolume[i],
physicalWorld, false, 0 );
MirrorAuCoatingPhysicalVolume[i] = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
"MirrorAuCoating_P",
MirrorAuCoatingLogicalVolume[i],
physicalWorld, false, 0 );
BafflePhysicalVolume[i] = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
"Baffle_P",
BaffleLogicalVolume[i],
physicalWorld, false, 0 );
}
// Make Mirror Invisible
for ( i=0; i<4; i++ ) {
// MirrorLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
// MirrorAuCoatingLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
BaffleLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
}
// Construct Optical Bench
// Main Telescope carbon fibre tube and two aluminium end caps
G4int nel;
G4String symbol;
// Elements
G4Element* C = new G4Element("Carbon", symbol="C", 6., 12.011*g/mole);
G4Element* H = new G4Element("Hydrogen",symbol="H", 1., 1.00794*g/mole);
// Materials from Combination
G4Material* Cf = new G4Material("Carbon Fibre", 2.0*g/cm3, nel=2);
Cf->AddElement(C,1);
Cf->AddElement(H,2);
// Visualization attributes
G4VisAttributes* VisAttBench = new G4VisAttributes(
G4Colour(0/255., 200/255., 0/255.));
// Construct Optical bench
G4double BenchThickness = 1.0*cm;
G4double BenchFrontEndMinRadiusOut = MirrorEnd[4] +
( MirrorEnd[3] - MirrorEnd[4] )*7.5/15
+ MirrorNiThickness;
G4double BenchFrontEndMinRadiusIn = MirrorEnd[4] +
( MirrorEnd[3] - MirrorEnd[4] )*7.4/15
+ MirrorNiThickness;
G4double BenchFrontEndMaxRadius = MirrorEnd[4] + MirrorNiThickness + 25.*cm;
G4double BenchBackEndMinRadius = 0.0*cm;
G4double BenchBackEndMaxRadius = MirrorEnd[4] + MirrorNiThickness + 5.*cm;
G4double BenchMainLength;
BenchMainLength = MirrorPosition[3] - BenchThickness;
G4Cons* BenchFrontEndSolid;
G4Tubs* BenchBackEndSolid;
G4Cons* BenchMainSolid;
G4LogicalVolume* BenchFrontEndLogicalVolume;
G4LogicalVolume* BenchBackEndLogicalVolume;
G4LogicalVolume* BenchMainLogicalVolume;
BenchFrontEndSolid = new G4Cons( "BenchFrontEnd_S",
BenchFrontEndMinRadiusOut, BenchFrontEndMaxRadius,
BenchFrontEndMinRadiusIn, BenchFrontEndMaxRadius,
BenchThickness/2, 0*deg, 360.*deg );
BenchFrontEndLogicalVolume = new G4LogicalVolume(
BenchFrontEndSolid, Al, "BenchFrontEnd_L", 0, 0, 0 );
BenchFrontEndLogicalVolume->SetVisAttributes(VisAttBench);
BenchBackEndSolid = new G4Tubs( "BenchBackEnd_S",
BenchBackEndMinRadius, BenchBackEndMaxRadius,
BenchThickness/2, 0*deg, 360.*deg );
BenchBackEndLogicalVolume = new G4LogicalVolume(
BenchBackEndSolid, Al, "BenchBackEnd_L", 0, 0, 0 );
BenchBackEndLogicalVolume->SetVisAttributes(VisAttBench);
BenchMainSolid = new G4Cons( "BenchMain_S",
BenchFrontEndMaxRadius - BenchThickness,
BenchFrontEndMaxRadius,
BenchBackEndMaxRadius - BenchThickness,
BenchBackEndMaxRadius,
BenchMainLength/2, 0*deg, 360.*deg);
BenchMainLogicalVolume = new G4LogicalVolume(
BenchMainSolid, Cf, "BenchMain_L", 0, 0, 0 );
BenchMainLogicalVolume -> SetVisAttributes(VisAttBench);
// Physical volume
G4VPhysicalVolume* BenchFrontEndPhysicalVolume;
G4VPhysicalVolume* BenchBackEndPhysicalVolume;
G4VPhysicalVolume* BenchMainPhysicalVolume;
BenchFrontEndPhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( MirrorPosition[3] - BenchThickness/2,
0.0*cm, 0.0*cm ),
"BenchFrontEnd_P",
BenchFrontEndLogicalVolume,
physicalWorld, false, 0 );
BenchBackEndPhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector(0.0*cm - BenchThickness/2, 0.0*cm, 0.0*cm ),
"BenchBackEnd_P",
BenchBackEndLogicalVolume,
physicalWorld, false, 0 );
BenchMainPhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( BenchMainLength/2, 0.0*cm, 0.0*cm ),
"BenchMain_P",
BenchMainLogicalVolume,
physicalWorld, false, 0 );
//--- Make Bench Invisible
// BenchFrontEndLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
// BenchBackEndLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
BenchMainLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
return;
}
// Construct Focal Plane
// Conical Titanium baffle and silicon detector
void XrayTelDetectorConstruction::ConstructFocalPlane()
{
// Elements
G4Material* Ti = new G4Material("Titanium", 22., 47.867*g/mole, 4.54*g/cm3);
G4Material* Si = new G4Material("Silicon", 14., 28.090*g/mole, 2.33*g/cm3);
// Visualization attributes
G4VisAttributes* VisDetectorBaffle = new G4VisAttributes(
G4Colour(190/255., 255/255., 0/255.) );
G4VisAttributes* VisDetector = new G4VisAttributes(
G4Colour(255/255., 0/255., 0/255.) );
// Rotation Matrix
G4RotationMatrix *rotateMatrix = new G4RotationMatrix();
rotateMatrix -> rotateY(90.*deg);
// Construct Detector Baffle
G4double DetectorBaffleLength = 57.2*cm;
G4double DetectorBaffleOuterRadiusIn = 7.1*cm;
G4double DetectorBaffleOuterRadiusOut = 7.35*cm;
G4double DetectorBaffleInnerRadiusIn = 4.55*cm;
G4double DetectorBaffleInnerRadiusOut = 5.75*cm;
G4Cons* DetectorBaffleSolid;
G4LogicalVolume* DetectorBaffleLogicalVolume;
DetectorBaffleSolid = new G4Cons( "DetectorBaffle_S",
DetectorBaffleOuterRadiusIn,
DetectorBaffleOuterRadiusOut,
DetectorBaffleInnerRadiusIn,
DetectorBaffleInnerRadiusOut,
DetectorBaffleLength/2, 0*deg, 360.*deg);
DetectorBaffleLogicalVolume = new G4LogicalVolume(
DetectorBaffleSolid, Ti, "DetectorBaffle_L", 0, 0, 0 );
DetectorBaffleLogicalVolume -> SetVisAttributes( VisDetectorBaffle );
// Physical volume
G4VPhysicalVolume* DetectorBafflePhysicalVolume;
DetectorBafflePhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( DetectorBaffleLength/2, 0.0*cm, 0.0*cm),
"DetectorBaffle_P",
DetectorBaffleLogicalVolume,
physicalWorld, false, 0 );
//--- Make Invisible
// DetectorBaffleLogicalVolume -> SetVisAttributes( G4VisAttributes::Invisible );
// Construct Detector
G4double DetectorRadius = 32.5*mm;
G4double DetectorThickness = 50e-6*m;
G4Tubs* DetectorSolid;
G4LogicalVolume* DetectorLogicalVolume;
DetectorSolid = new G4Tubs( "Detector_S",
0, DetectorRadius,
DetectorThickness/2, 0*deg, 360.*deg);
DetectorLogicalVolume = new G4LogicalVolume(
DetectorSolid, Si, "Detector_L", 0, 0, 0 );
DetectorLogicalVolume -> SetVisAttributes( VisDetector );
// Physical volume
G4VPhysicalVolume* DetectorPhysicalVolume;
DetectorPhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( DetectorThickness/2, 0.0*cm, 0.0*cm),
"Detector_P",
DetectorLogicalVolume,
physicalWorld, false, 0 );
//--- Make Invisible
// DetectorLogicalVolume -> SetVisAttributes( G4VisAttributes::Invisible );
return;
}
@@ -0,0 +1,137 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventAction.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope event action
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4ios.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4UImanager.hh"
#include "G4UnitsTable.hh"
#include "XrayTelEventAction.hh"
#include "XrayTelEventActionMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelEventAction::XrayTelEventAction(G4bool* dEvent)
: drawFlag("all"),eventMessenger(NULL), drawEvent(dEvent)
{
eventMessenger = new XrayTelEventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelEventAction::~XrayTelEventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelEventAction::BeginOfEventAction(const G4Event* Ev)
{
*drawEvent=false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelEventAction::EndOfEventAction(const G4Event* Ev)
{
if (*drawEvent){
const G4Event* evt = fpEventManager->GetConstCurrentEvent();
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if ( trajectoryContainer ){
n_trajectories = trajectoryContainer->entries();
}
if ( G4VVisManager::GetConcreteInstance() ) {
for ( G4int i=0; i<n_trajectories; i++ ) {
G4Trajectory* trj = (G4Trajectory*)(*(evt->GetTrajectoryContainer()))[i];
if ( drawFlag == "all" ) trj->DrawTrajectory(50);
else if ( (drawFlag == "charged")&&(trj->GetCharge() > 0.) )
trj->DrawTrajectory(50);
trj->ShowTrajectory();
}
}
}
}
@@ -0,0 +1,71 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventActionMessenger.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope event action messenger
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4UIcmdWithAString.hh"
#include "globals.hh"
#include "XrayTelEventAction.hh"
#include "XrayTelEventActionMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelEventActionMessenger::XrayTelEventActionMessenger(XrayTelEventAction* EvAct)
:eventAction(EvAct)
{
DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
DrawCmd->SetGuidance("Draw the tracks in the event");
DrawCmd->SetGuidance(" Choice : none, charged, all (default)");
DrawCmd->SetParameterName("choice",true);
DrawCmd->SetDefaultValue("charged");
DrawCmd->SetCandidates("none charged all");
DrawCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelEventActionMessenger::~XrayTelEventActionMessenger()
{
delete DrawCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelEventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
}
@@ -0,0 +1,257 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPhysicsList.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "XrayTelPhysicsList.hh"
XrayTelPhysicsList::XrayTelPhysicsList(): G4VUserPhysicsList()
{
// Default cut values
defaultCutValue = 2.0*mm;
cutForGamma = 1.0*micrometer;
cutForElectron = 1.0*micrometer;
cutForProton = 1.0*micrometer;
SetVerboseLevel(1);
}
XrayTelPhysicsList::~XrayTelPhysicsList()
{}
void XrayTelPhysicsList::ConstructParticle()
{
// Here are constructed all particles
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBaryons();
ConstructAllShortLiveds();
}
// In this method, static member functions should be called for ALL particles to be used.
void XrayTelPhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
void XrayTelPhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
void XrayTelPhysicsList::ConstructMesons()
{
}
void XrayTelPhysicsList::ConstructBaryons()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
void XrayTelPhysicsList::ConstructAllShortLiveds()
{
}
void XrayTelPhysicsList::ConstructProcess()
{
// Transportation, electromagnetic and general processes
AddTransportation();
ConstructEM();
ConstructGeneral();
}
// Here are respective header files for chosen processes
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MultipleScattering.hh"
#include "G4hLowEnergyIonisation.hh"
void XrayTelPhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma")
{
//gamma
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4GammaConversion());
}
else if (particleName == "e-")
{
//electron
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
}
else if (particleName == "e+")
{
//positron
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1,4);
}
else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino"))
{
//all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
G4double demax = 0.05; // try to lose at most 5% of the energy in
// a single step (in limit of large energies)
G4double stmin = 1.e-9 * m; // length of the final step: 10 angstrom
// reproduced angular distribution of TRIM
G4hLowEnergyIonisation* lowEIonisation = new G4hLowEnergyIonisation();
pmanager->AddProcess( lowEIonisation, -1,2,2);
lowEIonisation->SetStepFunction( demax, stmin );
}
}
}
#include "G4Decay.hh"
void XrayTelPhysicsList::ConstructGeneral()
{
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
void XrayTelPhysicsList::SetCuts()
{
// defaultCutValue you have typed in is used
if (verboseLevel >1){
G4cout << "XrayTelPhysicsList::SetCuts:" << G4endl;
}
// set cut values for gamma at first and for e- second
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForElectron, "e+");
// set cut values for proton
SetCutValue(cutForProton, "proton");
SetCutValue(cutForProton, "anti_proton");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel >1) {
DumpCutValuesTable();
}
}
void XrayTelPhysicsList::SetCutForGamma(G4double cut)
{
ResetCuts();
cutForGamma = cut;
}
void XrayTelPhysicsList::SetCutForElectron(G4double cut)
{
ResetCuts();
cutForElectron = cut;
}
void XrayTelPhysicsList::SetCutForProton(G4double cut)
{
ResetCuts();
cutForProton = cut;
}
G4double XrayTelPhysicsList::GetCutForGamma() const
{
return cutForGamma;
}
G4double XrayTelPhysicsList::GetCutForElectron() const
{
return cutForElectron;
}
G4double XrayTelPhysicsList::GetCutForProton() const
{
return cutForProton;
}
@@ -0,0 +1,59 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPrimaryGeneratorAction.cc *
// * ------- *
// * *
// * Version: 0.5 *
// * Date: 15/11/00 *
// * Author: F.Lei *
// * Organisation: DERA, UK *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 15.11.2000 F.Lei
// - New version of PrimaryGeneratorAction using the GPS insead of the
// standard particle gun.
// - The PrimaryGeneratorMessenger is no longer needed.
//
// 06.11.2000 R.Nartallo
// - First implementation of PrimaryGeneratorAction
// - Based on Chandra and XMM models by S Magni and F Lei
//
// **********************************************************************
#include "G4Event.hh"
#include "G4GeneralParticleSource.hh"
#include "XrayTelPrimaryGeneratorAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelPrimaryGeneratorAction::XrayTelPrimaryGeneratorAction()
{
particleGun = new G4GeneralParticleSource ();
}
XrayTelPrimaryGeneratorAction::~XrayTelPrimaryGeneratorAction()
{
delete particleGun;
}
void XrayTelPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,151 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelRunAction.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 R. Nartallo
// - Add pre-processor directives to compile without analysis option
//
// 16.11.2000 A. Pfeiffer
// - Implementation of analysis manager call
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "g4std/fstream"
#include "g4std/vector"
#include "XrayTelRunAction.hh"
#include "XrayTelAnalysisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelRunAction::XrayTelRunAction(G4std::vector<G4double*> *enEnergy,
G4std::vector<G4ThreeVector*> *enDirect,
G4bool* dEvent,
XrayTelAnalysisManager* aAnalysisManager)
:enteringEnergy(enEnergy),
enteringDirection(enDirect),drawEvent(dEvent),
fAnalysisManager(aAnalysisManager)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelRunAction::~XrayTelRunAction()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelRunAction::BeginOfRunAction(const G4Run* aRun)
{
G4int RunN = aRun->GetRunID();
if ( RunN % 1000 == 0 )
G4cout << "### Run : " << RunN << G4endl;
if (G4VVisManager::GetConcreteInstance()) {
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/clear/view");
UI->ApplyCommand("/vis/draw/current");
}
enteringEnergy->clear();
enteringDirection->clear();
#ifdef G4ANALYSIS_USE
if(fAnalysisManager) fAnalysisManager->BeginOfRun();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelRunAction::EndOfRunAction(const G4Run* )
{
G4int i;
if (G4VVisManager::GetConcreteInstance())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
G4std::ofstream outscat("detector.hist", ios::app);
G4cout << "End of Run summary" << G4endl << G4endl;
G4double totEnteringEnergy = 0.0;
for (i=0;i< enteringEnergy->size();i++)
totEnteringEnergy += *(*enteringEnergy)[i];
G4cout << "Total Entering Detector : " << enteringEnergy->size() << G4endl;
G4cout << "Total Entering Detector Energy : " << totEnteringEnergy << G4endl;
for (i=0;i<enteringEnergy->size();i++) {
outscat << " "
<< *(*enteringEnergy)[i]
<< " "
<< (*enteringDirection)[i]->x()
<< " "
<< (*enteringDirection)[i]->y()
<< " "
<< (*enteringDirection)[i]->z()
<< G4endl;
}
outscat.close();
#ifdef G4ANALYSIS_USE
if(fAnalysisManager) fAnalysisManager->EndOfRun();
#endif
}
@@ -0,0 +1,58 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelStepCut.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4Step.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
#include "XrayTelStepCut.hh"
XrayTelStepCut::XrayTelStepCut(const G4String& aName)
: G4VDiscreteProcess(aName),MaxChargedStep(DBL_MAX)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
}
XrayTelStepCut::~XrayTelStepCut()
{
}
XrayTelStepCut::XrayTelStepCut(XrayTelStepCut& right)
:G4VDiscreteProcess(right)
{}
void XrayTelStepCut::SetMaxStep(G4double step)
{
MaxChargedStep = step ;
}
@@ -0,0 +1,115 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelSteppingAction.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 R. Nartallo
// - Add pre-processor directives to compile without analysis option
//
// 16.11.2000 A. Pfeiffer
// - Implementation of analysis manager call
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4ios.hh"
#include "G4Track.hh"
#include "G4SteppingManager.hh"
#include "globals.hh"
#include <assert.h>
#include "g4std/fstream"
#include "g4std/iomanip"
#include "g4std/iostream"
#include "g4std/vector"
#include "XrayTelSteppingAction.hh"
#include "XrayTelAnalysisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelSteppingAction::XrayTelSteppingAction(
G4std::vector<G4double*>* enEnergy,
G4std::vector<G4ThreeVector*>* enDirect,
G4bool* dEvent,
XrayTelAnalysisManager* aAnalysisManager)
: enteringEnergy(enEnergy),
enteringDirection(enDirect),drawEvent(dEvent),
fAnalysisManager(aAnalysisManager)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelSteppingAction::~XrayTelSteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelSteppingAction::UserSteppingAction(const G4Step*)
{
const G4SteppingManager* pSM = fpSteppingManager;
G4Track* fTrack = pSM->GetTrack();
G4Step* fStep = pSM->GetStep();
G4int TrackID = fTrack->GetTrackID();
G4int StepNo = fTrack->GetCurrentStepNumber();
if(StepNo >= 10000) fTrack->SetTrackStatus(fStopAndKill);
G4String volName;
if ( fTrack->GetVolume() )
volName = fTrack->GetVolume()->GetName();
G4String nextVolName;
if ( fTrack->GetNextVolume() )
nextVolName = fTrack->GetNextVolume()->GetName();
G4ThreeVector pos = fTrack->GetPosition();
//--- Entering Detector
if(volName != "Detector_P" && nextVolName == "Detector_P") {
enteringEnergy->push_back ( new G4double (fTrack->GetKineticEnergy()) );
enteringDirection->push_back (new G4ThreeVector (pos));
// now we want to do some analysis at this step ...
// call back to the analysis-manger to do the analysis ...
#ifdef G4ANALYSIS_USE
if(fAnalysisManager) fAnalysisManager->Step(fpSteppingManager);
#endif
*drawEvent = true;
}
}
@@ -0,0 +1,157 @@
// This code implementation is the intellectual property of
// the 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelVisManager.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifdef G4VIS_USE
#include "XrayTelVisManager.hh"
// Supported drivers...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_DAWNFILE
#include "G4DAWNFILE.hh"
#endif
#ifdef G4VIS_USE_OPACS
#include "G4Wo.hh"
#include "G4Xo.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_RAYX
#include "G4RayX.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
#ifdef G4VIS_USE_VRMLFILE
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelVisManager::XrayTelVisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelVisManager::RegisterGraphicsSystems () {
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_DAWNFILE
RegisterGraphicsSystem (new G4DAWNFILE);
#endif
#ifdef G4VIS_USE_OPACS
RegisterGraphicsSystem (new G4Wo);
RegisterGraphicsSystem (new G4Xo);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_RAYX
RegisterGraphicsSystem (new G4RayX);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
#ifdef G4VIS_USE_VRMLFILE
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+20
View File
@@ -0,0 +1,20 @@
/run/verbose 1
/tracking/storeTrajectory 1
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
/run/beamOn 100000
+142
View File
@@ -0,0 +1,142 @@
#######################################################################
# #
# This code implementation is the intellectual property of #
# the 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. #
# #
# ******************************************************************* #
# * * #
# * GEANT 4 xray_telescope advanced example * #
# * * #
# * MACRO: vrml.mac * #
# * ------ demostrates the VRML DRIVER * #
# * * #
# * Version: 0.6 * #
# * Date: 15/11/00 * #
# * Author: R Nartallo * #
# * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * #
# * * #
# ******************************************************************* #
# #
# NOTES #
# ----- #
# USAGE: Idle> /control/execute vrml.mac #
# prompt> XrayTel vrml.mac #
# #
# REQUIRED PLATFORMS & SOFTWARE: VRML viewer, e.g. VRMLview #
# #
# ENVIRONMENT VARIABLES (C-MACROS) FOR INSTALLATION: #
# (See geant4/source/visualization/README for details.) #
# #
# % setenv G4VIS_USE_VRML 1 #
# % setenv G4VIS_USE_VRMLFILE 1 #
# % setenv G4VIS_BUILD_VRMLFILE_DRIVER 1 #
# #
# RECOMMENDED ENVIRONMENT VARIABLES FOR THE VRML VIEWER: #
# #
# % setenv G4VRMLFILE_VIEWER vrmlview //default value is "NONE" #
# % setenv G4VRMLFILE_MAX_FILE_NUM 100 //default value is "1" #
# #
# Addional Notes: #
# You may have to set the command path to the directory where #
# a VRML viewer is installed, e.g., to #
# "/afs/cern.ch/sw/contrib/VRML/bin/Linux/" at CERN #
# #
#######################################################################
# #
# CHANGE HISTORY #
# -------------- #
# #
# 15.11.2000 R. Nartallo #
# - Replaced standard particle gun by GPS set options #
# #
# 08.11.2000 R. Nartallo #
# - Modified version #
# #
# 17.10.2000 S. Tanaka #
# - First implementation #
# #
#######################################################################
# Set verbose level
/run/verbose 2
#################################################
# Visualization of detector geometry with
# the VRML2FILE driver.
#################################################
# Invoke the VRML2FILE driver
#/vis/open VRML2FILE
# Visualize of the whole detector geometry
#/vis/viewer/set/style surface
#/vis/drawVolume
#/vis/viewer/update
#################################################
# Visualization of detector geometry and events
# with the VRML2FILE driver.
#################################################
# Invoke the VRML2FILE driver
/vis/open VRML2FILE
# Create a new scene
/vis/scene/create
# Add the world volume to the current scene
/vis/scene/add/volume
# Attach the current scene handler to the current scene
/vis/sceneHandler/attach
# Visualize one event added to the current scene
# * Command "/vis/scene/notifyHandlers" is written in
# XrayTelRunAction::BeginOfRunAction()
# * Command "/vis/viewer/update" is written in
# XrayTelRunAction::EndOfRunAction()
# Set viewer rendering style
# "wireframe" means "half-transparent" in VRML2FILE driver
#/vis/viewer/set/style surface
/vis/viewer/set/style wireframe
# Store particle trajactories for visualization
/tracking/storeTrajectory 1
# Set to draw tracks of positively charged particles
/event/drawTracks charged
# Set General Particle Source options
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
# Set number of particles and start
/run/beamOn 10000