Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
+19
View File
@@ -0,0 +1,19 @@
# --------------------------------------------------------------
# $Id: GNUmakefile,v 1.1 2008/06/04 12:58:23 sincerti Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := Microdosimetry
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
+27
View File
@@ -0,0 +1,27 @@
-------------------------------------------------------------------
$Id: History,v 1.8 2008/06/27 20:33:05 sincerti Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - Microdosimetry example
=========================================================
Package History file
--------------------
27 June 2008 - S. Incerti - microdosimetry-V09-01-04
- modified PhysicsList.cc and SteppingAction.cc to take into account
new G4CrossSectionElasticScreenedRutherfordLE and HE classes
(from emlowen-V09-01-21 only !)
- removed G4CrossSectionExcitationEmfietzoglou.cc
20 June 2008 - S. Incerti - microdosimetry-V09-01-03
- updated History
10 June 2008 - S. Incerti - microdosimetry-V09-01-02
- added G4CrossSectionExcitationEmfietzoglou.cc with higher low energy limit (10 eV) than default (7.4 eV)
- added G4DNA process names in Physics list
- removed useless G4DNAProcess.hh and G4DNAProcess.icc files
06 June 2008 - S. Incerti - microdosimetry-V09-01-01
- Package created.
+108
View File
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: Microdosimetry.cc,v 1.1 2008/06/04 12:58:23 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int main(int argc,char** argv)
{
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// Set mandatory user initialization classes
DetectorConstruction* detector = new DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new PhysicsList);
// Set mandatory user action classes
runManager->SetUserAction(new PrimaryGeneratorAction(detector));
PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
// Set optional user action classes
RunAction* RunAct = new RunAction(detector);
runManager->SetUserAction(RunAct);
runManager->SetUserAction(new EventAction(RunAct));
runManager->SetUserAction(new SteppingAction(RunAct,detector,primary));
#ifdef G4VIS_USE
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
#endif
// Initialize G4 kernel
runManager->Initialize();
system ("rm -rf track.txt");
// Get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
if (argc==1) // Define UI session for interactive mode.
{
G4UIsession * session = new G4UIterminal(new G4UItcsh);
UI->ApplyCommand("/control/execute microdosimetry.mac");
session->SessionStart();
delete session;
}
else // Batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
return 0;
}
+140
View File
@@ -0,0 +1,140 @@
-------------------------------------------------------------------
$Id: README,v 1.5 2008/06/11 11:56:16 sincerti Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - Microdosimetry example
=========================================================
README file
----------------------
CORRESPONDING AUTHOR
S. Incerti (a, *) et al.
a. Centre d'Etudes Nucleaires de Bordeaux-Gradignan
(CENBG), IN2P3 / CNRS / Bordeaux 1 University, 33175 Gradignan, France
* e-mail:incerti@cenbg.in2p3.fr
Last modified by S. Incerti, 27/02/2007
---->0. INTRODUCTION.
The microdosimetry example simulates the track of a 10 keV Helium+ (positive
charge is +e) particle in liquid water using only G4DNA processes.
---->1. GEOMETRY SET-UP.
The geometry is a 1 mm side cube of liquid water.
---->2. SET-UP
- a standard Geant4 example GNUmakefile is provided
setup with:
compiler = gcc-3.4.6
G4SYSTEM = linux-g++
The following section gives the necessary environment variables.
------->>2.1 ENVIRONMENT VARIABLES
All variables are defined with their default value.
- G4SYSTEM = Linux-g++
- G4INSTALL points to the installation directory of GEANT4;
- G4LIB point to the compiled libraries of GEANT4;
- G4WORKDIR points to the work directory;
- CLHEP_BASE_DIR points to the installation directory of CHLEP;
- G4LEDATA points to the low energy electromagnetic libraries;
- LD_LIBRARY_PATH = $CLHEP_BASE_DIR/lib
- G4LEVELGAMMADATA points to the photoevaporation library;
- NeutronHPCrossSections points to the neutron data files;
- G4RADIOACTIVEDATA points to the libraries for radio-active decay
hadronic processes;
However, the $G4LEVELGAMMADATA, $NeutronHPCrossSections and $G4RADIOACTIVEDATA
variables do not need to be defined for this example.
Once these variables have been set, simply type gmake to compile the
Microdosimetry example.
------->>2.2 VISUALIZATION
Visualization is not activated by default.
---->3. HOW TO RUN THE EXAMPLE
In interactive mode, run:
> $G4WORDIR/bin/$G4SYSTEM/Microdosimetry
The macro microdosimetry.mac is executed by default.
To get visualization, make sure to uncomment the /vis/... lines in the macro.
---->4. PHYSICS
This example shows how to use the Geant4 DNA processes AND how to affect them a
name.
Look at the PhyscisList.cc file.
Note that the G4CrossSectionElasticScreenedRutherford.cc is put in the src
directory with an increased (10 eV instead of 7 eV) lower limit of the model energy range to
avoid an energy region where electrons do not lose any energy and may undergo
elastic scattering without limit.
Same remark for the G4CrossSectionExcitationEmfietzoglou.cc file whre the lower
limit has been set to 10 eV instead of 7.4 eV.
---->5. SIMULATION OUTPUT AND RESULT ANALYZIS
This example does not need any external analysis package.
The output results consists in a track.txt file, containing at each line :
- the type of particle for the current step
- the type of process for the current step
- the track position of the current step (in nanometers)
This file can be easily analyzed using for example the provided ROOT macro
file plot.C; to do so :
* be sure to have ROOT installed on your machine
* be sure to be in the microdosimetry directory
* launch ROOT by typing root
* under your ROOT session, type in : .X plot.C to execute the macro file
The naming scheme on the displayed ROOT plots is as follows (see SteppingAction.cc):
-particles:
e- : 1
proton : 2
hydrogen : 3
alpha : 4
alpha+ : 5
helium : 6
-processes:
ElasticBrennerZaider : 11
ElasticScreenedRutherford : 12
ExcitationBorn : 13
ExcitationEmfietzoglou : 14
ExcitationMillerGreen : 15
IonisationBorn : 16
IonisationRudd : 17
ChargeDecrease : 18
ChargeIncrease : 19
---------------------------------------------------------------------------
Should you have any enquiry, please do not hesitate to contact:
incerti@cenbg.in2p3.fr
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: DetectorConstruction.hh,v 1.1 2008/06/04 12:58:24 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Sphere.hh"
#include "G4Material.hh"
#include "G4PVPlacement.hh"
#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction();
G4VPhysicalVolume* Construct();
private:
G4double WorldSizeX;
G4double WorldSizeY;
G4double WorldSizeZ;
G4VPhysicalVolume* physiWorld;
G4LogicalVolume* logicWorld;
G4Box* solidWorld;
G4Material* waterMaterial;
void DefineMaterials();
G4VPhysicalVolume* ConstructDetector();
};
#endif
+56
View File
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: EventAction.hh,v 1.1 2008/06/04 12:58:24 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class RunAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class EventAction : public G4UserEventAction
{
public:
EventAction(RunAction*);
~EventAction();
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
private:
RunAction* Run;
};
#endif
+78
View File
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: PhysicsList.hh,v 1.2 2008/12/18 12:56:18 gunter Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef PhysicsList_h
#define PhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class PhysicsList: public G4VUserPhysicsList
{
public:
PhysicsList();
~PhysicsList();
void SetGammaCut(G4double);
void SetElectronCut(G4double);
void SetPositronCut(G4double);
void SetProtonCut(G4double);
protected:
// these methods construct particles
void ConstructBosons();
void ConstructLeptons();
void ConstructBarions();
// these methods construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
// Construct particle and physics
void ConstructParticle();
void ConstructProcess();
// set cuts
void SetCuts();
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForPositron;
G4double cutForProton;
};
#endif
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: PrimaryGeneratorAction.hh,v 1.1 2008/06/04 12:58:24 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction();
void GeneratePrimaries(G4Event*);
private:
G4ParticleGun* particleGun;
DetectorConstruction* Detector;
};
#endif
+57
View File
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: RunAction.hh,v 1.1 2008/06/04 12:58:24 sincerti Exp $
// -------------------------------------------------------------------
#ifndef RunAction_h
#define RunAction_h 1
#include "DetectorConstruction.hh"
#include "G4UserRunAction.hh"
#include "globals.hh"
#include <iostream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Run;
class RunAction : public G4UserRunAction
{
public:
RunAction(DetectorConstruction*);
~RunAction();
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
private:
DetectorConstruction* Detector;
};
#endif
+59
View File
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: SteppingAction.hh,v 1.1 2008/06/04 12:58:24 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef SteppingAction_h
#define SteppingAction_h 1
#include "G4UserSteppingAction.hh"
class RunAction;
class DetectorConstruction;
class PrimaryGeneratorAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(RunAction*, DetectorConstruction*, PrimaryGeneratorAction*);
~SteppingAction();
void UserSteppingAction(const G4Step*);
private:
RunAction* Run;
DetectorConstruction* Detector;
PrimaryGeneratorAction* Primary;
};
#endif
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: SteppingVerbose.hh,v 1.1 2008/06/04 12:58:24 sincerti Exp $
// -------------------------------------------------------------------
class SteppingVerbose;
#ifndef SteppingVerbose_h
#define SteppingVerbose_h 1
#include "G4SteppingVerbose.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class SteppingVerbose : public G4SteppingVerbose
{
public:
SteppingVerbose();
~SteppingVerbose();
void StepInfo();
void TrackingStarted();
};
#endif
+15
View File
@@ -0,0 +1,15 @@
#/vis/scene/create
#/vis/scene/add/volume
#/vis/sceneHandler/create OGLIX
#/vis/viewer/create
#/vis/viewer/set/viewpointThetaPhi 70 10
/tracking/storeTrajectory 1
#/vis/scene/endOfEventAction accumulate
/tracking/verbose 0
/run/verbose 0
/run/beamOn 1
+85
View File
@@ -0,0 +1,85 @@
// -------------------------------------------------------------------
// $Id: plot.C,v 1.2 2008/06/11 11:56:16 sincerti Exp $
// -------------------------------------------------------------------
//
// *********************************************************************
// To execute this macro under ROOT,
// 1 - launch ROOT (usually type 'root' at your machine's prompt)
// 2 - type '.X plot.C' at the ROOT session prompt
// This macro needs the track.txt file
// *********************************************************************
{
gROOT->Reset();
gStyle->SetPalette(1);
gROOT->SetStyle("Plain");
Double_t scale;
c1 = new TCanvas ("c1","",20,20,1000,500);
c1.Divide(2,1);
FILE * fp = fopen("track.txt","r");
Float_t process,part,x,y,z;
Int_t ncols=0;
Int_t nlines = 0;
TNtuple *ntuple = new TNtuple("result","ntuple","process:part:x:y:z");
while (1)
{
ncols = fscanf(fp,"%f %f %f %f %f",&part,&process,&x,&y,&z);
if (ncols < 0) break;
ntuple->Fill(process,part,x,y,z);
nlines++;
}
fclose(fp);
c1.cd(1);
gStyle->SetOptStat(000000);
ntuple->Draw("process","");
ntuple->SetFillColor(2);
ntuple->Draw("process","process==13||process==14||process==15","same");
ntuple->SetFillColor(3);
ntuple->Draw("process","process==11||process==12","same");
ntuple->SetFillColor(4);
ntuple->Draw("process","process==16||process==17","same");
ntuple->SetFillColor(5);
ntuple->Draw("process","process==18||process==19","same");
gPad->SetLogy();
htemp->GetXaxis()->SetLabelSize(0.025);
htemp->GetYaxis()->SetLabelSize(0.025);
htemp->GetZaxis()->SetLabelSize(0.025);
htemp->GetXaxis()->SetTitleSize(0.035);
htemp->GetYaxis()->SetTitleSize(0.035);
htemp->GetXaxis()->SetTitleOffset(1.4);
htemp->GetYaxis()->SetTitleOffset(1.4);
htemp->GetXaxis()->SetTitle("Process");
htemp->GetYaxis()->SetTitle("");
htemp->SetTitle("G4DNA Processes");
c1.cd(2);
ntuple->SetMarkerColor(1);
ntuple->Draw("x:y:z/1000","");
ntuple->SetMarkerColor(2);
ntuple->Draw("x:y:z/1000","process==13||process==14||process==15","same");
ntuple->SetMarkerColor(3);
ntuple->Draw("x:y:z/1000","process==11||process==12","same");
ntuple->SetMarkerColor(4);
ntuple->Draw("x:y:z/1000","process==16||process==17","same");
ntuple->SetMarkerColor(5);
ntuple->Draw("x:y:z/1000","process==18||process==19","same");
htemp->GetXaxis()->SetLabelSize(0.025);
htemp->GetYaxis()->SetLabelSize(0.025);
htemp->GetZaxis()->SetLabelSize(0.025);
htemp->GetXaxis()->SetTitleSize(0.035);
htemp->GetYaxis()->SetTitleSize(0.035);
htemp->GetZaxis()->SetTitleSize(0.035);
htemp->GetXaxis()->SetTitleOffset(1.6);
htemp->GetYaxis()->SetTitleOffset(1.6);
htemp->GetZaxis()->SetTitleOffset(1.6);
htemp->GetXaxis()->SetTitle("z (micrometer)");
htemp->GetYaxis()->SetTitle("x (nanometer)");
htemp->GetZaxis()->SetTitle("y (nanometer)");
htemp->SetTitle("Track Structure in liquid water");
}
@@ -0,0 +1,111 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: DetectorConstruction.cc,v 1.2 2008/12/18 12:56:20 gunter Exp $
// -------------------------------------------------------------------
#include "DetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DetectorConstruction::DetectorConstruction()
:physiWorld(NULL), logicWorld(NULL), solidWorld(NULL)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DetectorConstruction::~DetectorConstruction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* DetectorConstruction::Construct()
{
DefineMaterials();
return ConstructDetector();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DetectorConstruction::DefineMaterials()
{
G4String name, symbol;
G4double density;
G4int ncomponents, natoms;
// Elements
G4Element* H = new G4Element ("Hydrogen", "H", 1. , 1.01*g/mole);
G4Element* O = new G4Element ("Oxygen" , "O", 8. , 16.00*g/mole);
// Water
density = 1.000*g/cm3;
G4Material* H2O = new G4Material(name="H2O" , density, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
// Default materials in setup.
waterMaterial = H2O;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* DetectorConstruction::ConstructDetector()
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// WORLD VOLUME
WorldSizeX = 1*mm;
WorldSizeY = 1*mm;
WorldSizeZ = 1*mm;
solidWorld = new G4Box("World", //its name
WorldSizeX/2,WorldSizeY/2,WorldSizeZ/2); //its size
logicWorld = new G4LogicalVolume(solidWorld, //its solid
waterMaterial, //its material
"World"); //its name
physiWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
"World", //its name
logicWorld, //its logical volume
NULL, //its mother volume
false, //no boolean operation
0); //copy number
// Visualization attributes
G4VisAttributes* worldVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); //White
worldVisAtt->SetVisibility(true);
logicWorld->SetVisAttributes(worldVisAtt);
return physiWorld;
}
+75
View File
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: EventAction.cc,v 1.1 2008/06/04 12:57:55 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "EventAction.hh"
#include "RunAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
EventAction::EventAction(RunAction* run)
:Run(run)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
EventAction::~EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void EventAction::BeginOfEventAction(const G4Event*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void EventAction::EndOfEventAction(const G4Event* evt)
{
if (G4VVisManager::GetConcreteInstance())
{
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for (G4int i=0; i<n_trajectories; i++)
{
G4Trajectory* trj = (G4Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
trj->DrawTrajectory(50);
}
}
}
+269
View File
@@ -0,0 +1,269 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: PhysicsList.cc,v 1.3 2008/06/27 20:33:05 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "PhysicsList.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
PhysicsList::PhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 1*nanometer;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForPositron = defaultCutValue;
cutForProton = defaultCutValue;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
PhysicsList::~PhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void PhysicsList::ConstructParticle()
{
ConstructBosons();
ConstructLeptons();
ConstructBarions();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void PhysicsList::ConstructBosons()
{
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//DNA
#include "G4DNAGenericIonsManager.hh"
//ENDDNA
void PhysicsList::ConstructBarions()
{
// baryons
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
// Geant4 DNA new particles
G4DNAGenericIonsManager * genericIonsManager;
genericIonsManager=G4DNAGenericIonsManager::Instance();
genericIonsManager->GetIon("alpha++");
genericIonsManager->GetIon("alpha+");
genericIonsManager->GetIon("helium");
genericIonsManager->GetIon("hydrogen");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructGeneral();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
#include "G4LowEnergyRayleigh.hh"
#include "G4LowEnergyIonisation.hh"
#include "G4LowEnergyBremsstrahlung.hh"
#include "G4hLowEnergyIonisation.hh"
#include "G4StepLimiter.hh"
// Geant4 DNA header files
#include "G4DNAGenericIonsManager.hh"
#include "G4FinalStateProduct.hh"
#include "G4DNAProcess.hh"
#include "G4CrossSectionExcitationEmfietzoglou.hh"
#include "G4FinalStateExcitationEmfietzoglou.hh"
#include "G4CrossSectionElasticScreenedRutherfordLE.hh"
#include "G4CrossSectionElasticScreenedRutherfordHE.hh"
#include "G4FinalStateElasticScreenedRutherford.hh"
#include "G4FinalStateElasticBrennerZaider.hh"
#include "G4CrossSectionExcitationBorn.hh"
#include "G4FinalStateExcitationBorn.hh"
#include "G4CrossSectionIonisationBorn.hh"
#include "G4FinalStateIonisationBorn.hh"
#include "G4CrossSectionIonisationRudd.hh"
#include "G4FinalStateIonisationRudd.hh"
#include "G4CrossSectionExcitationMillerGreen.hh"
#include "G4FinalStateExcitationMillerGreen.hh"
#include "G4CrossSectionChargeDecrease.hh"
#include "G4FinalStateChargeDecrease.hh"
#include "G4CrossSectionChargeIncrease.hh"
#include "G4FinalStateChargeIncrease.hh"
// Processes definition
typedef G4DNAProcess<G4CrossSectionElasticScreenedRutherfordHE,G4FinalStateElasticScreenedRutherford>
ElasticScreenedRutherfordHE;
typedef G4DNAProcess<G4CrossSectionElasticScreenedRutherfordLE,G4FinalStateElasticBrennerZaider>
ElasticScreenedRutherfordLE;
typedef G4DNAProcess<G4CrossSectionExcitationEmfietzoglou,G4FinalStateExcitationEmfietzoglou>
ExcitationEmfietzoglou;
typedef G4DNAProcess<G4CrossSectionExcitationBorn,G4FinalStateExcitationBorn>
ExcitationBorn;
typedef G4DNAProcess<G4CrossSectionIonisationBorn,G4FinalStateIonisationBorn>
IonisationBorn;
typedef G4DNAProcess<G4CrossSectionIonisationRudd,G4FinalStateIonisationRudd>
IonisationRudd;
typedef G4DNAProcess<G4CrossSectionExcitationMillerGreen,G4FinalStateExcitationMillerGreen>
ExcitationMillerGreen;
typedef G4DNAProcess<G4CrossSectionChargeDecrease,G4FinalStateChargeDecrease>
ChargeDecrease;
typedef G4DNAProcess<G4CrossSectionChargeIncrease,G4FinalStateChargeIncrease>
ChargeIncrease;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
// DNA processes per particle type
if (particleName == "e-") {
pmanager->AddDiscreteProcess(new ExcitationEmfietzoglou("ExcitationEmfietzoglou"));
pmanager->AddDiscreteProcess(new ElasticScreenedRutherfordLE("ElasticScreenedRutherfordLE"));
pmanager->AddDiscreteProcess(new ElasticScreenedRutherfordHE("ElasticScreenedRutherfordHE"));
pmanager->AddDiscreteProcess(new IonisationBorn("IonisationBorn"));
} else if ( particleName == "proton" ) {
pmanager->AddDiscreteProcess(new ExcitationMillerGreen("ExcitationMillerGreen"));
pmanager->AddDiscreteProcess(new ExcitationBorn("ExcitationBorn"));
pmanager->AddDiscreteProcess(new IonisationRudd("IonisationRudd"));
pmanager->AddDiscreteProcess(new IonisationBorn("IonisationBorn"));
pmanager->AddDiscreteProcess(new ChargeDecrease("ChargeDecrease"));
} else if ( particleName == "hydrogen" ) {
pmanager->AddDiscreteProcess(new IonisationRudd("IonisationRudd"));
pmanager->AddDiscreteProcess(new ChargeIncrease("ChargeIncrease"));
} else if ( particleName == "alpha" ) {
pmanager->AddDiscreteProcess(new ExcitationMillerGreen("ExcitationMillerGreen"));
pmanager->AddDiscreteProcess(new IonisationRudd("IonisationRudd"));
pmanager->AddDiscreteProcess(new ChargeDecrease("ChargeDecrease"));
} else if ( particleName == "alpha+" ) {
pmanager->AddDiscreteProcess(new ExcitationMillerGreen("ExcitationMillerGreen"));
pmanager->AddDiscreteProcess(new IonisationRudd("IonisationRudd"));
pmanager->AddDiscreteProcess(new ChargeDecrease("ChargeDecrease"));
pmanager->AddDiscreteProcess(new ChargeIncrease("ChargeIncrease"));
} else if ( particleName == "helium" ) {
pmanager->AddDiscreteProcess(new ExcitationMillerGreen("ExcitationMillerGreen"));
pmanager->AddDiscreteProcess(new IonisationRudd("IonisationRudd"));
pmanager->AddDiscreteProcess(new ChargeIncrease("ChargeIncrease"));
}
} // Loop on particles
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void PhysicsList::ConstructGeneral()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void PhysicsList::SetCuts()
{
if (verboseLevel >0)
{
G4cout << "PhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForPositron, "e+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
SetCutValue(cutForProton, "proton");
SetCutValue(cutForProton, "anti_proton");
if (verboseLevel>0) DumpCutValuesTable();
}
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: PrimaryGeneratorAction.cc,v 1.1 2008/06/04 12:57:55 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "PrimaryGeneratorAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
:Detector(DC)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4float var;
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4int numEvent;
numEvent=anEvent->GetEventID()+1;
G4double x0,y0,z0,theta,phi,xMom0,yMom0,zMom0,e0;
e0 = 10*keV ;
x0 = 0;
y0 = 0;
z0 = 0*micrometer;
theta = 0;
phi = 0;
xMom0 = std::sin(theta);
yMom0 = std::sin(phi);
zMom0 = std::sqrt(1.-xMom0*xMom0-yMom0*yMom0);
particleGun->SetParticleEnergy(e0);
particleGun->SetParticleMomentumDirection(G4ThreeVector(xMom0,yMom0,zMom0));
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
G4ParticleDefinition* particle=
G4ParticleTable::GetParticleTable()->FindParticle("alpha+");
particleGun->SetParticleDefinition(particle);
particleGun->GeneratePrimaryVertex(anEvent);
}
+52
View File
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: RunAction.cc,v 1.1 2008/06/04 12:57:55 sincerti Exp $
// -------------------------------------------------------------------
#include "RunAction.hh"
#include "G4Run.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
RunAction::RunAction(DetectorConstruction* det)
:Detector(det)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
RunAction::~RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void RunAction::BeginOfRunAction(const G4Run*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void RunAction::EndOfRunAction(const G4Run*)
{}
+94
View File
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: SteppingAction.cc,v 1.2 2008/06/27 20:33:05 sincerti Exp $
// -------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "SteppingAction.hh"
#include "RunAction.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4SteppingManager.hh"
#include "G4VTouchable.hh"
#include "G4VPhysicalVolume.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SteppingAction::SteppingAction(RunAction* run,DetectorConstruction* det,PrimaryGeneratorAction* pri)
:Run(run),Detector(det),Primary(pri)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SteppingAction::~SteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SteppingAction::UserSteppingAction(const G4Step* s)
{
G4int flagParticle=0;
G4int flagProcess=0;
if (s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "e-") flagParticle = 1;
if (s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "proton") flagParticle = 2;
if (s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "hydrogen") flagParticle = 3;
if (s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha") flagParticle = 4;
if (s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "alpha+") flagParticle = 5;
if (s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "helium") flagParticle = 6;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ElasticScreenedRutherfordLE") flagProcess =11;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ElasticScreenedRutherfordHE") flagProcess =12;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ExcitationBorn") flagProcess =13;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ExcitationEmfietzoglou") flagProcess =14;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ExcitationMillerGreen") flagProcess =15;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="IonisationBorn") flagProcess =16;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="IonisationRudd") flagProcess =17;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ChargeDecrease") flagProcess =18;
if (s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()=="ChargeIncrease") flagProcess =19;
if (
s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()!="initStep"
&&
s->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName()!="Transportation"
)
{
FILE* myFile;
myFile=fopen("track.txt","a");
fprintf
( myFile,"%i %i %e %e %e \n",
flagParticle,
flagProcess,
(s->GetTrack()->GetPosition().x())/nanometer,
(s->GetTrack()->GetPosition().y())/nanometer,
(s->GetTrack()->GetPosition().z())/nanometer
);
fclose (myFile);
}
}
+171
View File
@@ -0,0 +1,171 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// -------------------------------------------------------------------
// $Id: SteppingVerbose.cc,v 1.1 2008/06/04 12:57:55 sincerti Exp $
// -------------------------------------------------------------------
#include "SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SteppingVerbose::SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
SteppingVerbose::~SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << G4endl;
}
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << "User Limit";
}
G4cout << G4endl;
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " : "
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< std::setw(10)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
//G4cout<< "exit SteppingVerbose::StepInfo " <<G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if(fTrack->GetNextVolume()){
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName() << " ";
} else {
G4cout << std::setw(10) << "OutOfWorld" << " ";
}
G4cout << std::setw(10) << "initStep" << G4endl;
}
G4cout.precision(prec);
G4cout<< "exit SteppingVerbose::TrackingStarted() " <<G4endl;
}