Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -0,0 +1,40 @@
# $Id: GNUmakefile,v 1.1 2004/06/14 10:09:19 maire Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := MuonProcesses
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
.PHONY: all
all: lib bin
#### G4ANALYSIS_USE := true
ifdef G4ANALYSIS_USE
USE_AIDA := true
endif
ifdef USE_AIDA
CPPFLAGS += -DG4ANALYSIS_USE
CPPFLAGS += -DUSE_AIDA
endif
include $(G4INSTALL)/config/architecture.gmk
ifdef USE_AIDA
# for the aida-config command see the README file
CPPFLAGS += `aida-config --include`
LDFLAGS += `aida-config --lib`
endif
include $(G4INSTALL)/config/binmake.gmk
visclean:
rm -f g4*.prim g4*.eps g4*.wrl
rm -f .DAWN_*
@@ -0,0 +1,23 @@
$Id: History,v 1.2 2004/06/16 10:46:47 maire Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
PhotonProcesses History file
--------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
16.06.04 V. Ivantchenko (muonprocesses-V06-01-01)
- std::max in MuCrossSections
14.06.04 Michel Maire (muonprocesses-V06-01-00)
- creation, from A. Bogdanov and R. Kokoulin's TestMu program.
@@ -0,0 +1,121 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
//
// $Id: MuonProcesses.cc,v 1.1 2004/06/14 10:09:20 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"
#include "StackingAction.hh"
#include "HistoManager.hh"
#ifdef G4VIS_USE
#include "VisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv) {
//choose the Random engine
HepRandom::setTheEngine(new RanecuEngine);
//my Verbose output class
G4VSteppingVerbose::SetInstance(new SteppingVerbose);
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
DetectorConstruction* det;
PrimaryGeneratorAction* prim;
runManager->SetUserInitialization(det = new DetectorConstruction);
runManager->SetUserInitialization(new PhysicsList);
runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
#ifdef G4VIS_USE
// visualization manager
G4VisManager* visManager = new VisManager;
visManager->Initialize();
#endif
HistoManager* histo = 0;
#ifdef G4ANALYSIS_USE
histo = new HistoManager();
#endif
// set user action classes
RunAction* run;
runManager->SetUserAction(run = new RunAction(det,prim,histo));
runManager->SetUserAction(new EventAction);
runManager->SetUserAction(new SteppingAction(run,histo));
runManager->SetUserAction(new StackingAction);
// Start execution
//
if (argc > 1) { // execute an argument macro file if exist
G4String command = "/control/execute ";
G4String fileName = argv[1];
G4UImanager::GetUIpointer()->ApplyCommand(command+fileName);
} else { // start interactive session
G4UIsession* session = 0;
#ifdef G4UI_USE_TCSH
session = new G4UIterminal(new G4UItcsh);
#else
session = new G4UIterminal();
#endif
session->SessionStart();
delete session;
}
// job termination
//
#ifdef G4ANALYSIS_USE
delete histo;
#endif
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,22 @@
# $Id: MuonProcesses.in,v 1.1 2004/06/14 10:09:20 maire Exp $
#
# Macro file for "MuonProcesses.cc"
# (can be run in batch, without graphic)
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setMat Iron
/testem/det/setSize 1 m
#
/testem/phys/addPhysics standard
/testem/phys/setCuts 1 mm
#
/run/initialize
#
/gun/particle mu+
/gun/energy 10 TeV
#
/testem/event/printModulo 1000
#
/run/beamOn 10000
@@ -0,0 +1,149 @@
$Id: README,v 1.2 2004/06/23 11:28:04 maire Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
MuonProcesses
-------------
This example is intended to check implementation of the processes
of muon interactions: ionization, direct (e+,e-) production,
bremsstrahlung, mu-nuclear interaction.
It allows to compute differential cross sections (as function of the
energy tranfered to secondaries), total cross sections and to compare
with analytic calculations.
1- GEOMETRY DEFINITION
It is a single box of homogeneous medium.
Two parameters define the geometry :
- the material of the box,
- the (full) size of the box.
The default geometry (1 m of Iron) is constructed in
DetectorConstruction, but the above parameters can be changed
interactively via the commands defined in DetectorMessenger.
2- PHYSICS LIST
The physics list contains only electromagnetic processes for muon,
adding G4MuNuclearInteraction and seting of upper energy range limit
to 1000 PeV).
Standard (default) and g4v52 (frozen at the release Genat4 v.5.2)
physics can be choosen.
3- AN EVENT : THE PRIMARY GENERATOR
The primary kinematic consists of a single particle starting at the edge
of the box. The type of the particle and its energy are set in
PrimaryGeneratorAction (mu+ 10 TeV), and can be changed via the G4
build-in commands of ParticleGun class (see the macros provided with
this example).
4- PHYSICS
The incident particle is a muon. During the tracking, secondary particles
are killed.
The number of interactions are plotted as a function of the energy
transfered to the secondaries.
The total number of interactions is recorded, and the total crossSection
computed from this.
At EndOfRun, the above results are compared with analytic calculations.
The functions which compute the theoritical crossSections have been
provided by the G4 MEPhI group, and grouped in MuCrossSection class.
5- HISTOGRAMS
The test contains 4 built-in 1D histograms, which are managed by the
HistoManager class and its Messenger.
1 Monte-Carlo relative transferred energy distribution histo
(log10(eps/Emu kin) for knock-on electrons (ionization)
2 -"- direct (e+,e-) pair production
3 -"- bremsstrahlung
4 -"- nuclear interaction
The histos can be activated individually with the command :
/testem/histo/setHisto id nbBins valMin valMax : min and max values of
log10(eps/Emu kin).
At EndOfRun the corresponding histos for analytic calculations are
automatically created anf filled (histo 6 to 9), and the comparison
(G4 divided by theory) is done in histos 11 to 14.
The histograms can be viewed using PAW. See below the note on
ANAPHE+AIDA.
Note that, by default, histograms are disabled. To activate them,
uncomment the flag G4ANALYSIS_USE in GNUmakefile.
6- VISUALIZATION
The Visualization Manager is set in the main().
The initialisation of the drawing is done via the commands
/vis/... in the macro vis.mac. To get visualisation:
> /control/execute vis.mac
The detector has a default view which is a longitudinal view of the
box.
The tracks are drawn at the end of event, and erased at the end of run.
7- HOW TO START ?
compile and link to generate an executable
% cd geant4/examples/extended/electromagnetic/MuonProcesses
% gmake
execute MuonProcesses in 'batch' mode from macro files :
% MuonProcesses allproc.mac
execute MuonProcesses in 'interactive mode' with visualization :
% MuonProcesses
Idle> control/execute vis.mac
....
Idle> type your commands
....
Idle> exit
8- Using histograms
-------------------
By default the histograms are not activated. To activate histograms
the environment variable G4ANALYSIS_USE should be defined. For instance
uncomment the flag G4ANALYSIS_USE in GNUmakefile.
To use histograms any of implementations of AIDA interfaces should
be available (see http://aida.freehep.org).
A package including AIDA and extended interfaces also using Python
is PI, available from: http://cern.ch/pi .
Once installed PI or PI-Lite in a specified local area $MYPY, it is
required to add the installation path to $PATH, i.e. for example,
for release 1.2.1 of PI:
setenv PATH ${PATH}:$MYPI/1.2.1/app/releases/PI/PI_1_2_1/rh73_gcc32/bin
CERN users can use the PATH to the LCG area on AFS.
Before compilation of the example it is optimal to clean up old
files:
gmake histclean
gmake
Before running the example the command should be issued:
eval `aida-config --runtime csh`
It is possible to choose the format of the output file with
histograms using UI command:
/testem/histo/setFileType type
The following types are available: hbook, root, xml.
@@ -0,0 +1,29 @@
# $Id: allproc.mac,v 1.1 2004/06/14 10:09:20 maire Exp $
#
# Macro file for "MuonProcesses.cc"
# (can be run in batch, without graphic)
#
/control/verbose 2
/run/verbose 2
#
/testem/det/setMat Iron
/testem/det/setSize 1 m
#
/testem/phys/addPhysics standard
### /testem/phys/addPhysics g4v52
#
/testem/phys/setCuts 1 mm
#
/run/initialize
#
/gun/particle mu+
/gun/energy 10 TeV
#
/testem/histo/setFileName allproc.paw
/testem/histo/setHisto 1 100 -10. 0.
/testem/histo/setHisto 2 100 -10. 0.
/testem/histo/setHisto 3 100 -10. 0.
#
/testem/event/printModulo 1000
#
/run/beamOn 10000
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
//
// $Id: DetectorConstruction.hh,v 1.1 2004/06/14 10:09:22 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4LogicalVolume;
class G4Material;
class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction();
public:
G4VPhysicalVolume* Construct();
void SetSize (G4double);
void SetMaterial (G4String);
void UpdateGeometry();
public:
const
G4VPhysicalVolume* GetWorld() {return pBox;};
G4double GetSize() {return BoxSize;};
G4Material* GetMaterial() {return aMaterial;};
void PrintParameters();
private:
G4VPhysicalVolume* pBox;
G4LogicalVolume* lBox;
G4double BoxSize;
G4Material* aMaterial;
DetectorMessenger* detectorMessenger;
private:
void DefineMaterials();
G4VPhysicalVolume* ConstructVolumes();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
//
// $Id: DetectorMessenger.hh,v 1.1 2004/06/14 10:09:22 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
~DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
DetectorConstruction* Detector;
G4UIdirectory* testemDir;
G4UIdirectory* detDir;
G4UIcmdWithAString* MaterCmd;
G4UIcmdWithADoubleAndUnit* SizeCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: EventAction.hh,v 1.1 2004/06/14 10:09:22 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class EventActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventAction : public G4UserEventAction
{
public:
EventAction();
~EventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
void SetPrintModulo(G4int val) {printModulo = val;};
private:
G4int printModulo;
EventActionMessenger* eventMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: EventActionMessenger.hh,v 1.1 2004/06/14 10:09:22 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventActionMessenger_h
#define EventActionMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class EventAction;
class G4UIdirectory;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventActionMessenger: public G4UImessenger
{
public:
EventActionMessenger(EventAction*);
~EventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
EventAction* eventAction;
G4UIdirectory* eventDir;
G4UIcmdWithAnInteger* PrintCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: HistoManager.hh,v 1.1 2004/06/14 10:09:22 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HistoManager_h
#define HistoManager_h 1
#ifdef USE_AIDA
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace AIDA {
class ITree;
class IHistogramFactory;
class IHistogram1D;
}
class HistoMessenger;
const G4int MaxHisto = 5;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoManager
{
public:
HistoManager();
~HistoManager();
void SetFileName (G4String name) { fileName = name;};
void SetFactory ();
void SaveFactory ();
void SetHisto (G4int, G4int, G4double, G4double, G4String unit="none");
void RemoveHisto (G4int);
AIDA::ITree* GetTree() {return tree;}
AIDA::IHistogramFactory* GetHistogramFactory() {return hf;}
AIDA::IHistogram1D* GetHisto(G4int id) {return histo[id];}
G4double GetHistoUnit(G4int id) {return Unit[id];}
G4double GetBinWidth (G4int id) {return Width[id];}
private:
G4String fileName;
AIDA::ITree* tree;
AIDA::IHistogramFactory* hf;
AIDA::IHistogram1D* histo[MaxHisto];
G4bool exist[MaxHisto];
G4String Label[MaxHisto];
G4String Title[MaxHisto];
G4int Nbins[MaxHisto];
G4double Vmin [MaxHisto];
G4double Vmax [MaxHisto];
G4double Unit [MaxHisto];
G4double Width[MaxHisto];
G4bool factoryOn;
HistoMessenger* histoMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: HistoMessenger.hh,v 1.1 2004/06/14 10:09:22 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HistoMessenger_h
#define HistoMessenger_h 1
#ifdef G4ANALYSIS_USE
#include "G4UImessenger.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoManager;
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoMessenger: public G4UImessenger
{
public:
HistoMessenger(HistoManager* );
~HistoMessenger();
void SetNewValue(G4UIcommand* ,G4String );
private:
HistoManager* histoManager;
G4UIdirectory* histoDir;
G4UIcmdWithAString* factoryCmd;
G4UIcommand* histoCmd;
G4UIcmdWithAnInteger* rmhistoCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: MuCrossSections.hh,v 1.1 2004/06/14 10:09:22 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef MuCrossSections_h
#define MuCrossSections_h 1
#include "globals.hh"
class G4Material;
class G4Element;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class MuCrossSections
{
public:
MuCrossSections();
~MuCrossSections();
public:
G4double CR_Macroscopic (G4String, G4Material*, G4double, G4double);
G4double CR_PerAtom (G4String, G4Element* , G4double, G4double);
private:
G4double CRB_Mephi (G4double, G4double, G4double, G4double);
G4double CRK_Mephi (G4double, G4double, G4double, G4double);
G4double CRN_Mephi (G4double, G4double, G4double, G4double);
G4double CRP_Mephi (G4double, G4double, G4double, G4double);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: PhysListEmG4v52.hh,v 1.1 2004/06/14 10:09:22 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysListEmG4v52_h
#define PhysListEmG4v52_h 1
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysListEmG4v52 : public G4VPhysicsConstructor
{
public:
PhysListEmG4v52(const G4String& name = "g4v52");
~PhysListEmG4v52();
public:
// This method is dummy for physics.
void ConstructParticle() {};
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
void ConstructProcess();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: PhysListEmStandard.hh,v 1.1 2004/06/14 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysListEmStandard_h
#define PhysListEmStandard_h 1
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysListEmStandard : public G4VPhysicsConstructor
{
public:
PhysListEmStandard(const G4String& name = "standard");
~PhysListEmStandard();
public:
// This method is dummy for physics
void ConstructParticle() {};
// This method will be invoked in the Construct() method.
// each physics process will be instantiated and
// registered to the process manager of each particle type
void ConstructProcess();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: PhysicsList.hh,v 1.1 2004/06/14 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysicsList_h
#define PhysicsList_h 1
#include "G4VModularPhysicsList.hh"
#include "globals.hh"
class PhysicsListMessenger;
class G4VPhysicsConstructor;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysicsList: public G4VModularPhysicsList
{
public:
PhysicsList();
~PhysicsList();
void ConstructParticle();
void ConstructProcess();
void AddPhysicsList(const G4String& name);
void SetCuts();
void SetCutForGamma(G4double);
void SetCutForElectron(G4double);
void SetCutForPositron(G4double);
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForPositron;
G4double currentDefaultCut;
G4VPhysicsConstructor* emPhysicsList;
G4String emName;
PhysicsListMessenger* pMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: PhysicsListMessenger.hh,v 1.1 2004/06/14 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PhysicsListMessenger_h
#define PhysicsListMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class PhysicsList;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PhysicsListMessenger: public G4UImessenger
{
public:
PhysicsListMessenger(PhysicsList* );
~PhysicsListMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
PhysicsList* pPhysicsList;
G4UIcmdWithADoubleAndUnit* gammaCutCmd;
G4UIcmdWithADoubleAndUnit* electCutCmd;
G4UIcmdWithADoubleAndUnit* protoCutCmd;
G4UIcmdWithADoubleAndUnit* allCutCmd;
G4UIcmdWithAString* pListCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: PrimaryGeneratorAction.hh,v 1.1 2004/06/14 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4ParticleGun.hh"
#include "globals.hh"
class G4Event;
class DetectorConstruction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event*);
G4ParticleGun* GetParticleGun() {return particleGun;};
private:
G4ParticleGun* particleGun;
DetectorConstruction* detector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: ProcessesCount.hh,v 1.1 2004/06/14 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ProcessesCount_HH
#define ProcessesCount_HH
#include "globals.hh"
#include <vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class OneProcessCount
{
public:
OneProcessCount(G4String name) {Name=name; Counter=0;};
~OneProcessCount() {};
public:
G4String GetName() {return Name;};
G4int GetCounter() {return Counter;};
void Count() {Counter++;};
private:
G4String Name; // process name
G4int Counter; // process counter
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
typedef std::vector<OneProcessCount*> ProcessesCount;
#endif
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: RunAction.hh,v 1.1 2004/06/14 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "ProcessesCount.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction;
class PrimaryGeneratorAction;
class HistoManager;
class G4Run;
class G4Material;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunAction : public G4UserRunAction
{
public:
RunAction(DetectorConstruction*, PrimaryGeneratorAction*, HistoManager*);
~RunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
void CountProcesses(G4String);
private:
G4double ComputeTheory (G4String, G4int);
G4double GetEnergyCut (G4Material*, G4int);
private:
DetectorConstruction* detector;
PrimaryGeneratorAction* primary;
ProcessesCount* ProcCounter;
HistoManager* histoManager;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: StackingAction.hh,v 1.1 2004/06/14 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef StackingAction_h
#define StackingAction_h 1
#include "G4UserStackingAction.hh"
#include "globals.hh"
class G4Track;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class StackingAction : public G4UserStackingAction
{
public:
StackingAction();
~StackingAction();
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* );
};
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: SteppingAction.hh,v 1.1 2004/06/14 10:09:23 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingAction_h
#define SteppingAction_h 1
#include "G4UserSteppingAction.hh"
#include "globals.hh"
class RunAction;
class HistoManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(RunAction*, HistoManager*);
~SteppingAction();
void UserSteppingAction(const G4Step*);
private:
RunAction* runAction;
HistoManager* histoManager;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: SteppingVerbose.hh,v 1.1 2004/06/14 10:09:24 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// This class manages the verbose outputs in G4SteppingManager.
// It inherits from G4SteppingVerbose.
// It shows how to extract informations during the tracking of a particle.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingVerbose_h
#define SteppingVerbose_h 1
#include "G4SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingVerbose : public G4SteppingVerbose {
public:
SteppingVerbose();
~SteppingVerbose();
void StepInfo();
void TrackingStarted();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,65 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: VisManager.hh,v 1.1 2004/06/14 10:09:24 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Example Visualization Manager implementing virtual function
// RegisterGraphicsSystems. Exploits C-pre-processor variables
// G4VIS_USE_DAWN, etc., which are set by the GNUmakefiles if
// environment variables of the same name are set.
// So all you have to do is set environment variables and compile and
// instantiate this in your main().
// Alternatively, you can implement an empty function here and just
// register the systems you want in your main(), e.g.:
// G4VisManager* myVisManager = new MyVisManager;
// myVisManager -> RegisterGraphicsSystem (new MyGraphicsSystem);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef VisManager_h
#define VisManager_h 1
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class VisManager: public G4VisManager {
public:
VisManager ();
private:
void RegisterGraphicsSystems ();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,176 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
//
// $Id: DetectorConstruction.cc,v 1.1 2004/06/14 10:09:25 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:pBox(0), lBox(0), aMaterial(0)
{
BoxSize = 1*m;
DefineMaterials();
SetMaterial("Iron");
detectorMessenger = new DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{ delete detectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructVolumes();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::DefineMaterials()
{
//
// define Elements
//
G4double z,a;
G4Element* C = new G4Element("Carbon" ,"C" , z= 6., a= 12.01*g/mole);
G4Element* N = new G4Element("Nitrogen" ,"N" , z= 7., a= 14.01*g/mole);
G4Element* O = new G4Element("Oxygen" ,"O" , z= 8., a= 16.00*g/mole);
G4Element* Ca = new G4Element("Calcium" ,"Ca", z=20., a= 40.08*g/mole);
//
// define materials
//
G4double density;
G4int ncomponents, natoms;
G4double fractionmass;
new G4Material("galactic", z=1., a= 1.01*g/mole, universe_mean_density,
kStateGas, 2.73*kelvin, 3.e-18*pascal);
G4Material* Air =
new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
Air->AddElement(N, fractionmass=70.*perCent);
Air->AddElement(O, fractionmass=30.*perCent);
G4Material* CaCO3 =
new G4Material("CaCO3", density= 2.80*g/cm3, ncomponents=3);
CaCO3->AddElement(Ca, natoms= 1);
CaCO3->AddElement(C , natoms= 1);
CaCO3->AddElement(O , natoms= 3);
new G4Material("Carbon", z= 6., a= 12.01*g/mole, density= 2.265*g/cm3);
new G4Material("Iron" , z=26., a= 55.85*g/mole, density= 7.870*g/cm3);
new G4Material("Tin" , z=50., a= 118.7*g/mole, density= 7.310*g/cm3);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
{
// Cleanup old geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
G4Box*
sBox = new G4Box("Container", //its name
BoxSize/2,BoxSize/2,BoxSize/2); //its dimensions
lBox = new G4LogicalVolume(sBox, //its shape
aMaterial, //its material
aMaterial->GetName()); //its name
pBox = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
lBox, //its logical volume
aMaterial->GetName(), //its name
0, //its mother volume
false, //no boolean operation
0); //copy number
PrintParameters();
//always return the root volume
//
return pBox;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::PrintParameters()
{
G4cout << "\n The Box is " << G4BestUnit(BoxSize,"Length")
<< " of " << aMaterial->GetName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial) aMaterial = pttoMaterial;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetSize(G4double value)
{
BoxSize = value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManager.hh"
void DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
//
// $Id: DetectorMessenger.cc,v 1.1 2004/06/14 10:09:26 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:Detector(Det)
{
testemDir = new G4UIdirectory("/testem/");
testemDir->SetGuidance("commands specific to this example");
detDir = new G4UIdirectory("/testem/det/");
detDir->SetGuidance("detector construction");
MaterCmd = new G4UIcmdWithAString("/testem/det/setMat",this);
MaterCmd->SetGuidance("Select material of the box.");
MaterCmd->SetParameterName("choice",false);
MaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SizeCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setSize",this);
SizeCmd->SetGuidance("Set size of the box");
SizeCmd->SetParameterName("Size",false);
SizeCmd->SetRange("Size>0.");
SizeCmd->SetUnitCategory("Length");
SizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this);
UpdateCmd->SetGuidance("Update calorimeter geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
{
delete MaterCmd;
delete SizeCmd;
delete UpdateCmd;
delete detDir;
delete testemDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == MaterCmd )
{ Detector->SetMaterial(newValue);}
if( command == SizeCmd )
{ Detector->SetSize(SizeCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ Detector->UpdateGeometry(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,83 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: EventAction.cc,v 1.1 2004/06/14 10:09:26 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventAction.hh"
#include "EventActionMessenger.hh"
#include "G4Event.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction()
:printModulo(10000),eventMessenger(0)
{
eventMessenger = new EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::~EventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
//printing survey
if (evtNb%printModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
}
//....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(1000);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: EventActionMessenger.cc,v 1.1 2004/06/14 10:09:26 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventActionMessenger.hh"
#include "EventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::EventActionMessenger(EventAction* EvAct)
:eventAction(EvAct)
{
eventDir = new G4UIdirectory("/testem/event/");
eventDir ->SetGuidance("physics list");
PrintCmd = new G4UIcmdWithAnInteger("/testem/event/printModulo",this);
PrintCmd->SetGuidance("Print events modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
PrintCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventActionMessenger::~EventActionMessenger()
{
delete PrintCmd;
delete eventDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,165 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: HistoManager.cc,v 1.1 2004/06/14 10:09:26 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef USE_AIDA
#include "HistoManager.hh"
#include "HistoMessenger.hh"
#include "G4UnitsTable.hh"
#include "AIDA/AIDA.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::HistoManager()
:tree(0),hf(0),factoryOn(false)
{
fileName = "muonprocesses.paw";
// histograms
for (G4int k=0; k<MaxHisto; k++) { histo[k] = 0; exist[k] = false;}
histoMessenger = new HistoMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::~HistoManager()
{
SaveFactory();
delete histoMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SetFactory()
{
if (factoryOn) {
G4cout << "\n--->HistoManager::SetFactory(): factory already exists"
<< G4endl;
SaveFactory();
}
// Creating the analysis factory
AIDA::IAnalysisFactory* af = AIDA_createAnalysisFactory();
// Creating the tree factory
AIDA::ITreeFactory* tf = af->createTreeFactory();
// Creating a tree mapped to an hbook file.
G4bool readOnly = false;
G4bool createNew = true;
tree = tf->create(fileName, "hbook", readOnly, createNew);
// Creating a histogram factory, whose histograms will be handled by the tree
hf = af->createHistogramFactory(*tree);
// create selected histograms
for (G4int k=0; k<MaxHisto; k++) {
if (exist[k]) histo[k] = hf->createHistogram1D( Label[k], Title[k],
Nbins[k], Vmin[k], Vmax[k]);
}
delete tf;
delete af;
factoryOn = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SaveFactory()
{
if (factoryOn) {
tree->commit(); // Writing the histograms to the file
tree->close(); // and closing the tree (and the file)
delete hf;
delete tree;
factoryOn = false;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::SetHisto(G4int ih,
G4int nbins, G4double valmin, G4double valmax, G4String unit)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::SetHisto() : histo " << ih
<< "does not exist" << G4endl;
return;
}
const G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8"};
const G4String title[] =
{ "dummy", //0
"log10(Etransfert/Emu) Ionization", //1
"log10(Etransfert/Emu) Pair", //2
"log10(Etransfert/Emu) Brems", //3
"log10(Etransfert/Emu) Nuclear" //4
};
G4String titl = title[ih];
G4double vmin = valmin, vmax = valmax;
Unit[ih] = 1.;
if (unit != "none") {
titl = title[ih] + " (" + unit + ")";
Unit[ih] = G4UnitDefinition::GetValueOf(unit);
vmin = valmin/Unit[ih]; vmax = valmax/Unit[ih];
}
exist[ih] = true;
Label[ih] = id[ih];
Title[ih] = titl;
Nbins[ih] = nbins;
Vmin[ih] = vmin;
Vmax[ih] = vmax;
Width[ih] = (valmax-valmin)/nbins;
G4cout << "----> SetHisto " << ih << ": " << titl << "; "
<< nbins << " bins from "
<< vmin << " " << unit << " to " << vmax << " " << unit << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::RemoveHisto(G4int ih)
{
if (ih > MaxHisto) {
G4cout << "---> warning from HistoManager::RemoveHisto() : histo " << ih
<< "does not exist" << G4endl;
return;
}
histo[ih] = 0; exist[ih] = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,118 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: HistoMessenger.cc,v 1.1 2004/06/14 10:09:26 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef G4ANALYSIS_USE
#include "HistoMessenger.hh"
#include "HistoManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::HistoMessenger(HistoManager* manager)
:histoManager (manager)
{
histoDir = new G4UIdirectory("/testem/histo/");
histoDir->SetGuidance("histograms control");
factoryCmd = new G4UIcmdWithAString("/testem/histo/setFileName",this);
factoryCmd->SetGuidance("set name for the histograms file");
histoCmd = new G4UIcommand("/testem/histo/setHisto",this);
histoCmd->SetGuidance("Set bining of the histo number ih :");
histoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
//
G4UIparameter* ih = new G4UIparameter("ih",'i',false);
ih->SetGuidance("histo number : from 1 to MaxHisto");
ih->SetParameterRange("ih>0");
histoCmd->SetParameter(ih);
//
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
nbBins->SetGuidance("number of bins");
nbBins->SetParameterRange("nbBins>0");
histoCmd->SetParameter(nbBins);
//
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
valMin->SetGuidance("valMin, expressed in unit");
histoCmd->SetParameter(valMin);
//
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
valMax->SetGuidance("valMax, expressed in unit");
histoCmd->SetParameter(valMax);
//
G4UIparameter* unit = new G4UIparameter("unit",'s',true);
unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
unit->SetDefaultValue("none");
histoCmd->SetParameter(unit);
rmhistoCmd = new G4UIcmdWithAnInteger("/testem/histo/removeHisto",this);
rmhistoCmd->SetGuidance("desactivate histo #id");
rmhistoCmd->SetParameterName("id",false);
rmhistoCmd->SetRange("id>0");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoMessenger::~HistoMessenger()
{
delete rmhistoCmd;
delete histoCmd;
delete factoryCmd;
delete histoDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if (command == factoryCmd)
histoManager->SetFileName(newValues);
if (command == histoCmd)
{ G4int ih,nbBins; G4double vmin,vmax; char unts[30];
const char* t = newValues;
std::istrstream is((char*)t);
is >> ih >> nbBins >> vmin >> vmax >> unts;
G4String unit = unts;
G4double vUnit = 1. ;
if (unit != "none") vUnit = G4UIcommand::ValueOf(unit);
histoManager->SetHisto (ih,nbBins,vmin*vUnit,vmax*vUnit,unit);
}
if (command == rmhistoCmd)
{ histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,392 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: MuCrossSections.cc,v 1.2 2004/06/15 16:33:50 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "MuCrossSections.hh"
#include "G4Material.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MuCrossSections::MuCrossSections()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
MuCrossSections::~MuCrossSections()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double MuCrossSections::CR_Macroscopic(G4String process, G4Material* material,
G4double tkin, G4double ep)
// return the macroscopic cross section (1/L) in GEANT4 internal units
{
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* NbOfAtomsPerVolume = material->GetVecNbOfAtomsPerVolume();
G4double SIGMA = 0 ;
for ( size_t i=0 ; i < material->GetNumberOfElements() ; i++ )
{
G4Element* element = (*theElementVector)[i];
SIGMA += NbOfAtomsPerVolume[i] * CR_PerAtom(process, element, tkin, ep);
}
return SIGMA;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double MuCrossSections::CR_PerAtom(G4String process, G4Element* element,
G4double tkin, G4double ep)
{
G4double z = element->GetZ();
G4double a = element->GetA();
G4double sigma = 0.;
if (process == "MuBrems")
sigma = CRB_Mephi(z,a/(g/mole),tkin/GeV,ep/GeV)*(cm2/(g*GeV))*a/Avogadro;
else if (process == "MuIoni")
sigma = CRK_Mephi(z,a/(g/mole),tkin/GeV,ep/GeV)*(cm2/(g*GeV))*a/Avogadro;
else if (process == "MuNucl")
sigma = CRN_Mephi(z,a/(g/mole),tkin/GeV,ep/GeV)*(cm2/(g*GeV))*a/Avogadro;
else if (process == "MuPairProd")
sigma = CRP_Mephi(z,a/(g/mole),tkin/GeV,ep/GeV)*(cm2/(g*GeV))*a/Avogadro;
return sigma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double MuCrossSections::CRB_Mephi(double z,double a,double tkin,double ep)
//***********************************************************************
//*** crb_g4_1.inc in comparison with crb_.inc, following
//*** changes are introduced (September 24th, 1998):
//*** 1) function crb_g4 (Z,A,Tkin,EP), Tkin is kinetic energy
//*** 2) special case of hidrogen (Z<1.5; b,b1,Dn_star)
//*** Numerical comparison: 5 decimal digits coincide.
//***
//*** Cross section for bremsstrahlung by fast muon
//*** By R.P.Kokoulin, September 1998
//*** Formulae from Kelner,Kokoulin,Petrukhin 1995, Preprint MEPhI
//*** (7,18,19,20,21,25,26); Dn (18) is modified to incorporate
//*** Bugaev's inelatic nuclear correction (28) for Z > 1.
//***********************************************************************
{
// double Z,A,Tkin,EP;
double crb_g4;
double e,v,delta,rab0,z_13,dn,b,b1,dn_star,rab1,fn,epmax1,fe,rab2;
//
double ame=0.51099907e-3; // GeV
double amu=0.105658389; // GeV
double re=2.81794092e-13; // cm
double avno=6.022137e23;
double alpha=1./137.036;
double rmass=amu/ame; // "207"
double coeff=16./3.*alpha*avno*(re/rmass)*(re/rmass); // cm^2
double sqrte=1.64872127; // sqrt(2.71828...)
double btf=183.;
double btf1=1429.;
double bh=202.4;
double bh1=446.;
//***
if(ep >= tkin)
{
crb_g4=0.;
return crb_g4;
}
e=tkin+amu;
v=ep/e;
delta=amu*amu*v/(2.*(e-ep)); // qmin
rab0=delta*sqrte;
z_13=pow(z,-0.3333333); //
//*** nuclear size and excitation, screening parameters
dn=1.54*pow(a,0.27);
if(z <= 1.5) // special case for hydrogen
{
b=bh;
b1=bh1;
dn_star=dn;
}
else
{
b=btf;
b1=btf1;
dn_star=pow(dn,(1.-1./z)); // with Bugaev's correction
}
//*** nucleus contribution logarithm
rab1=b*z_13;
fn=log(rab1/(dn_star*(ame+rab0*rab1))*(amu+delta*(dn_star*sqrte-2.)));
if(fn < 0.) fn=0.;
//*** electron contribution logarithm
epmax1=e/(1.+amu*rmass/(2.*e));
if(ep >= epmax1)
{
fe=0.;
goto label10;
}
rab2=b1*z_13*z_13;
fe=log(rab2*amu/((1.+delta*rmass/(ame*sqrte))*(ame+rab0*rab2)));
if(fe < 0.) fe=0.;
//***
label10:
crb_g4=coeff*(1.-v*(1.-0.75*v))*z*(z*fn+fe)/(a*ep);
return crb_g4;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double MuCrossSections::CRK_Mephi(double z,double a,double tkin,double ep)
//***********************************************************************
//*** Cross section for knock-on electron production by fast muons
//*** (including bremsstrahlung e-diagrams and rad. correction).
//*** Units: cm^2/(g*GeV); Tkin, ep - GeV.
//*** By R.P.Kokoulin, October 1998
//*** Formulae from Kelner,Kokoulin,Petrukhin, Phys.Atom.Nuclei, 1997
//*** (a bit simplified Kelner's version of Eq.30 - with 2 logarithms).
//***
{
// double Z,A,Tkin,EP;
double crk_g4;
double e,epmax,v,sigma0,a1,a3;
//
double ame=0.51099907e-3; // GeV
double amu=0.105658389; // GeV
double re=2.81794092e-13; // cm
double avno=6.022137e23;
double alpha=1./137.036;
double pi=3.141592654;
double bmu=amu*amu/(2.*ame);
double coeff0=avno*2.*pi*ame*re*re;
double coeff1=alpha/(2.*pi);
//***
e=tkin+amu;
epmax=e/(1.+bmu/e);
if(ep >= epmax)
{
crk_g4=0.;
return crk_g4;
}
v=ep/e;
sigma0=coeff0*(z/a)*(1.-ep/epmax+0.5*v*v)/(ep*ep);
a1=log(1.+2.*ep/ame);
a3=log(4.*e*(e-ep)/(amu*amu));
crk_g4=sigma0*(1.+coeff1*a1*(a3-a1));
return crk_g4;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double MuCrossSections::CRN_Mephi(double z,double a,double tkin,double ep)
//***********************************************************************
//*** Differential cross section for photonuclear muon interaction.
//*** Formulae from Borog & Petrukhin, 1975
//*** Real photon cross section: Caldwell e.a., 1979
//*** Nuclear shadowing: Brodsky e.a., 1972
//*** Units: cm^2 / g GeV.
//*** CRN_G4_1.inc January 31st, 1998 R.P.Kokoulin
//***********************************************************************
{
// double Z,A,Tkin,EP;
double crn_g4;
double dummy,e,aeff,sigph,v,v1,v2,amu2,up,down;
//***
double amu=0.105658389; // GeV
double avno=6.022137e23;
double amp=0.9382723; // GeV
double pi=3.14159265;
double alpha=1./137.036;
//***
double epmin_phn=0.20; // GeV
double alam2=0.400000; // GeV**2
double alam =0.632456; // sqrt(alam2)
double coeffn=alpha/pi*avno*1e-30; // cm^2/microbarn
//***
dummy=z; // Z is a formal parameter at the moment
e=tkin+amu;
crn_g4=0.;
if(ep >= e-0.5*amp) return crn_g4;
if(ep <= epmin_phn) return crn_g4;
aeff=0.22*a+0.78*pow(a,0.89); // shadowing
sigph=49.2+11.1*log(ep)+151.8/sqrt(ep); // microbarn
v=ep/e;
v1=1.-v;
v2=v*v;
amu2=amu*amu;
up=e*e*v1/amu2*(1.+amu2*v2/(alam2*v1));
down=1.+ep/alam*(1.+alam/(2.*amp)+ep/alam);
crn_g4=coeffn*aeff/a*sigph/ep*(-v1+(v1+0.5*v2*(1.+2.*amu2/alam2))*log(up/down));
if(crn_g4 < 0.) crn_g4=0.;
return crn_g4;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double MuCrossSections::CRP_Mephi(double z,double a,double tkin,double ep)
//**********************************************************************
//*** crp_g4_1.inc in comparison with crp_m.inc, following
//*** changes are introduced (January 16th, 1998):
//*** 1) Avno/A, cm^2/gram GeV
//*** 2) zeta_loss(E,Z) from Kelner 1997, Eqs.(53-54)
//*** 3) function crp_g4 (Z,A,Tkin,EP), Tkin is kinetic energy
//*** 4) bbb=183 (Thomas-Fermi)
//*** 5) special case of hidrogen (Z<1.5), bbb,g1,g2
//*** 6) expansions in 'xi' are simplified (Jan.17th,1998)
//***
//*** Cross section for electron pair production by fast muon
//*** By R.P.Kokoulin, December 1997
//*** Formulae from Kokoulin & Petrukhin 1971, Hobart, Eqs.(1,8,9,10)
{
// double Z,A,Tkin,EP;
double crp_g4;
double bbbtf,bbbh,g1tf,g2tf,g1h,g2h,e,z13,e1,alf,a3,bbb;
double g1,g2,zeta1,zeta2,zeta,z2,screen0,a0,a1,bet,xi0,del;
double tmn,sum,a4,a5,a6,a7,a9,xi,xii,xi1,screen,yeu,yed,ye1;
double ale,cre,be,fe,ymu,ymd,ym1,alm_crm,a10,bm,fm;
//
double ame=0.51099907e-3; // GeV
double amu=0.105658389; // GeV
double re=2.81794092e-13; // cm
double avno=6.022137e23;
double pi=3.14159265;
double alpha=1./137.036;
double rmass=amu/ame; // "207"
double coeff=4./(3.*pi)*(alpha*re)*(alpha*re)*avno; // cm^2
double sqrte=1.64872127; // sqrt(2.71828...)
double c3=3.*sqrte*amu/4.; // for limits
double c7=4.*ame; // -"-
double c8=6.*amu*amu; // -"-
double xgi[8]={.0199,.1017,.2372,.4083,.5917,.7628,.8983,.9801}; // Gauss, 8
double wgi[8]={.0506,.1112,.1569,.1813,.1813,.1569,.1112,.0506}; // Gauss, 8
bbbtf=183.; // for the moment...
bbbh=202.4; // for the moment...
g1tf=1.95e-5;
g2tf=5.3e-5;
g1h=4.4e-5;
g2h=4.8e-5;
e=tkin+amu;
z13=pow(z,0.3333333);
e1=e-ep;
crp_g4=0.;
if(e1 <= c3*z13) return crp_g4; // ep > max
alf=c7/ep; // 4m/ep
a3=1.-alf;
if(a3 <= 0.) return crp_g4; // ep < min
//*** zeta calculation
if(z <= 1.5) // special case of hidrogen
{
bbb=bbbh;
g1=g1h;
g2=g2h;
}
else
{
bbb=bbbtf;
g1=g1tf;
g2=g2tf;
}
zeta1=0.073*log(e/(amu+g1*z13*z13*e))-0.26;
if(zeta1 > 0.)
{
zeta2=0.058*log(e/(amu+g2*z13*e))-0.14;
zeta=zeta1/zeta2;
}
else
{
zeta=0.;
}
z2=z*(z+zeta); //
//*** just to check (for comparison with crp_m)
// z2=z*(z+1.)
// bbb=189.
//***
screen0=2.*ame*sqrte*bbb/(z13*ep); // be careful with "ame"
a0=e*e1;
a1=ep*ep/a0; // 2*beta
bet=0.5*a1; // beta
xi0=0.25*rmass*rmass*a1; // xi0
del=c8/a0; // 6mu^2/EE'
tmn=log((alf+2.*del*a3)/(1.+(1.-del)*sqrt(a3))); // log(1-rmax)
sum=0.;
for(int i=0; i<=7; i++) // integration
{
a4=exp(tmn*xgi[i]); // 1-r
a5=a4*(2.-a4); // 1-r2
a6=1.-a5; // r2
a7=1.+a6; // 1+r2
a9=3.+a6; // 3+r2
xi=xi0*a5;
xii=1./xi;
xi1=1.+xi;
screen=screen0*xi1/a5;
yeu=5.-a6+4.*bet*a7;
yed=2.*(1.+3.*bet)*log(3.+xii)-a6-a1*(2.-a6);
ye1=1.+yeu/yed;
ale=log(bbb/z13*sqrt(xi1*ye1)/(1.+screen*ye1));
cre=0.5*log(1.+(1.5/rmass*z13)*(1.5/rmass*z13)*xi1*ye1);
if(xi <= 1e3) //
{
be=((2.+a6)*(1.+bet)+xi*a9)*log(1.+xii)+(a5-bet)/xi1-a9;
}
else
{
be=(3.-a6+a1*a7)/(2.*xi); // -(6.-5.*a6+3.*bet*a6)/(6.*xi*xi);
}
fe=std::max(0.,(ale-cre)*be);
ymu=4.+a6+3.*bet*a7;
ymd=a7*(1.5+a1)*log(3.+xi)+1.-1.5*a6;
ym1=1.+ymu/ymd;
alm_crm=log(bbb*rmass/(1.5*z13*z13*(1.+screen*ym1)));
if(xi >= 1e-3) //
{
a10=(1.+a1)*a5; // (1+2b)(1-r2)
bm=(a7*(1.+1.5*bet)-a10*xii)*log(xi1)+xi*(a5-bet)/xi1+a10;
}
else
{
bm=(5.-a6+bet*a9)*(xi/2.); // -(11.-5.*a6+.5*bet*(5.+a6))*(xi*xi/6.)
}
fm=std::max(0.,(alm_crm)*bm);
//***
sum=sum+a4*(fe+fm/(rmass*rmass))*wgi[i];
}
crp_g4=-tmn*sum*(z2/a)*coeff*e1/(e*ep);
return crp_g4;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
//
// $Id: PhysListEmG4v52.cc,v 1.1 2004/06/14 10:09:26 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysListEmG4v52.hh"
#include "G4ParticleDefinition.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4ProcessManager.hh"
#include "G4MuIonisation52.hh"
#include "G4MuBremsstrahlung52.hh"
#include "G4MuPairProduction52.hh"
#include "G4MuNuclearInteraction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEmG4v52::PhysListEmG4v52(const G4String& name)
: G4VPhysicsConstructor(name)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEmG4v52::~PhysListEmG4v52()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEmG4v52::ConstructProcess()
{
// Add standard EM Processes for Muon
G4ParticleDefinition* particle = G4MuonPlus::MuonPlus();
G4ProcessManager* pmanager = particle->GetProcessManager();
pmanager->AddProcess(new G4MuIonisation52, -1, 1,1);
pmanager->AddProcess(new G4MuBremsstrahlung52, -1,-1,2);
pmanager->AddProcess(new G4MuPairProduction52, -1,-1,3);
/// pmanager->AddProcess(new G4MuNuclearInteraction,-1,-1,4);
particle = G4MuonMinus::MuonMinus();
pmanager = particle->GetProcessManager();
pmanager->AddProcess(new G4MuIonisation52, -1, 1,1);
pmanager->AddProcess(new G4MuBremsstrahlung52, -1,-1,2);
pmanager->AddProcess(new G4MuPairProduction52, -1,-1,3);
/// pmanager->AddProcess(new G4MuNuclearInteraction,-1,-1,4);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
//
// $Id: PhysListEmStandard.cc,v 1.1 2004/06/14 10:09:26 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysListEmStandard.hh"
#include "G4ParticleDefinition.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4ProcessManager.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4MuNuclearInteraction.hh"
#include "G4LossTableManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEmStandard::PhysListEmStandard(const G4String& name)
: G4VPhysicsConstructor(name)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysListEmStandard::~PhysListEmStandard()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysListEmStandard::ConstructProcess()
{
// Add standard EM Processes for Muon
G4ParticleDefinition* particle = G4MuonPlus::MuonPlus();
G4ProcessManager* pmanager = particle->GetProcessManager();
pmanager->AddProcess(new G4MuIonisation, -1, 1,1);
pmanager->AddProcess(new G4MuBremsstrahlung, -1, 2,2);
pmanager->AddProcess(new G4MuPairProduction, -1, 3,3);
/// pmanager->AddProcess(new G4MuNuclearInteraction,-1,-1,4);
particle = G4MuonMinus::MuonMinus();
pmanager = particle->GetProcessManager();
pmanager->AddProcess(new G4MuIonisation, -1, 1,1);
pmanager->AddProcess(new G4MuBremsstrahlung, -1, 2,2);
pmanager->AddProcess(new G4MuPairProduction, -1, 3,3);
/// pmanager->AddProcess(new G4MuNuclearInteraction,-1,-1,4);
//extend binning of PhysicsTables
//
G4LossTableManager::Instance()->SetMaxEnergy(1000.0*PeV);
G4LossTableManager::Instance()->SetDEDXBinning(220);
G4LossTableManager::Instance()->SetLambdaBinning(220);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,249 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
//
// $Id: PhysicsList.cc,v 1.1 2004/06/14 10:09:26 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysicsList.hh"
#include "PhysicsListMessenger.hh"
#include "PhysListEmStandard.hh"
#include "PhysListEmG4v52.hh"
#include "G4LossTableManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList() : G4VModularPhysicsList()
{
SetVerboseLevel(1);
pMessenger = new PhysicsListMessenger(this);
// cuts
currentDefaultCut = 1.0*mm;
cutForGamma = currentDefaultCut;
cutForElectron = currentDefaultCut;
cutForPositron = currentDefaultCut;
// EM physics
emName = G4String("standard");
emPhysicsList = new PhysListEmStandard(emName);
// instanciate EnergyLossTable
G4LossTableManager::Instance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::~PhysicsList()
{
delete pMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Bosons
#include "G4Geantino.hh"
#include "G4Gamma.hh"
// leptons
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4NeutrinoMu.hh"
#include "G4AntiNeutrinoMu.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"
// Mesons
#include "G4PionPlus.hh"
#include "G4PionMinus.hh"
#include "G4PionZero.hh"
#include "G4Eta.hh"
#include "G4EtaPrime.hh"
#include "G4KaonPlus.hh"
#include "G4KaonMinus.hh"
#include "G4KaonZero.hh"
#include "G4AntiKaonZero.hh"
#include "G4KaonZeroLong.hh"
#include "G4KaonZeroShort.hh"
// Baryons
#include "G4Proton.hh"
#include "G4AntiProton.hh"
#include "G4Neutron.hh"
#include "G4AntiNeutron.hh"
// Nuclei
#include "G4Alpha.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4GenericIon.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructParticle()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
// ions
G4Deuteron::DeuteronDefinition();
G4Triton::TritonDefinition();
G4He3::He3Definition();
G4Alpha::AlphaDefinition();
G4GenericIon::GenericIonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructProcess()
{
// transportation
//
AddTransportation();
// electromagnetic Physics List
//
emPhysicsList->ConstructProcess();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::AddPhysicsList(const G4String& name)
{
if (verboseLevel>1) {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">" << G4endl;
}
if (name == emName) return;
if (name == "standard") {
emName = name;
delete emPhysicsList;
emPhysicsList = new PhysListEmStandard(name);
} else if (name == "g4v52") {
emName = name;
delete emPhysicsList;
emPhysicsList = new PhysListEmG4v52(name);
} else {
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
<< " is not defined"
<< G4endl;
}
}
//....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+");
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
void PhysicsList::SetCutForGamma(G4double cut)
{
cutForGamma = cut;
SetParticleCuts(cutForGamma, G4Gamma::Gamma());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::SetCutForElectron(G4double cut)
{
cutForElectron = cut;
SetParticleCuts(cutForElectron, G4Electron::Electron());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::SetCutForPositron(G4double cut)
{
cutForPositron = cut;
SetParticleCuts(cutForPositron, G4Positron::Positron());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,111 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: PhysicsListMessenger.cc,v 1.1 2004/06/14 10:09:27 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PhysicsListMessenger.hh"
#include "PhysicsList.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
:pPhysicsList(pPhys)
{
gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setGCut",this);
gammaCutCmd->SetGuidance("Set gamma cut.");
gammaCutCmd->SetParameterName("Gcut",false);
gammaCutCmd->SetUnitCategory("Length");
gammaCutCmd->SetRange("Gcut>0.0");
gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
electCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setECut",this);
electCutCmd->SetGuidance("Set electron cut.");
electCutCmd->SetParameterName("Ecut",false);
electCutCmd->SetUnitCategory("Length");
electCutCmd->SetRange("Ecut>0.0");
electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
protoCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setPCut",this);
protoCutCmd->SetGuidance("Set positron cut.");
protoCutCmd->SetParameterName("Pcut",false);
protoCutCmd->SetUnitCategory("Length");
protoCutCmd->SetRange("Pcut>0.0");
protoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
allCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setCuts",this);
allCutCmd->SetGuidance("Set cut for all.");
allCutCmd->SetParameterName("cut",false);
allCutCmd->SetUnitCategory("Length");
allCutCmd->SetRange("cut>0.0");
allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
pListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics",this);
pListCmd->SetGuidance("Add modula physics list.");
pListCmd->SetParameterName("PList",false);
pListCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::~PhysicsListMessenger()
{
delete gammaCutCmd;
delete electCutCmd;
delete protoCutCmd;
delete allCutCmd;
delete pListCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsListMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if( command == gammaCutCmd )
{ pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));}
if( command == electCutCmd )
{ pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));}
if( command == protoCutCmd )
{ pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));}
if( command == allCutCmd )
{
G4double cut = allCutCmd->GetNewDoubleValue(newValue);
pPhysicsList->SetCutForGamma(cut);
pPhysicsList->SetCutForElectron(cut);
pPhysicsList->SetCutForPositron(cut);
}
if( command == pListCmd )
{ pPhysicsList->AddPhysicsList(newValue);}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: PrimaryGeneratorAction.cc,v 1.1 2004/06/14 10:09:27 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* det)
:detector(det)
{
particleGun = new G4ParticleGun(1);
G4ParticleDefinition* particle
= G4ParticleTable::GetParticleTable()->FindParticle("mu+");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleEnergy(10*TeV);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
G4double halfSize = 0.5*(detector->GetSize());
G4double x0 = - halfSize;
//randomize (y0,z0)
//
G4double beam = 0.8*halfSize;
G4double y0 = (2*G4UniformRand()-1.)*beam;
G4double z0 = (2*G4UniformRand()-1.)*beam;
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,265 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: RunAction.cc,v 1.1 2004/06/14 10:09:27 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "HistoManager.hh"
#include "MuCrossSections.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#ifdef USE_AIDA
#include "AIDA/AIDA.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim,
HistoManager* HistM)
: detector(det), primary(prim), ProcCounter(0), histoManager(HistM)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// save Rndm status
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
HepRandom::showEngineStatus();
ProcCounter = new ProcessesCount;
#ifdef G4ANALYSIS_USE
histoManager->SetFactory();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::CountProcesses(G4String procName)
{
//does the process already encounted ?
size_t nbProc = ProcCounter->size();
size_t i = 0;
while ((i<nbProc)&&((*ProcCounter)[i]->GetName()!=procName)) i++;
if (i == nbProc) ProcCounter->push_back( new OneProcessCount(procName));
(*ProcCounter)[i]->Count();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run* aRun)
{
G4int NbOfEvents = aRun->GetNumberOfEvent();
if (NbOfEvents == 0) return;
std::ios::fmtflags mode = G4cout.flags();
G4int prec = G4cout.precision(2);
G4Material* material = detector->GetMaterial();
G4double length = detector->GetSize();
G4double density = material->GetDensity();
G4String particle = primary->GetParticleGun()->GetParticleDefinition()
->GetParticleName();
G4double energy = primary->GetParticleGun()->GetParticleEnergy();
G4cout << "\n The run consists of " << NbOfEvents << " "<< particle << " of "
<< G4BestUnit(energy,"Energy") << " through "
<< G4BestUnit(length,"Length") << " of "
<< material->GetName() << " (density: "
<< G4BestUnit(density,"Volumic Mass") << ")" << G4endl;
//total number of process calls
G4double countTot = 0.;
G4cout << "\n Number of process calls --->";
for (size_t i=0; i< ProcCounter->size();i++) {
G4String procName = (*ProcCounter)[i]->GetName();
if (procName != "Transportation") {
G4int count = (*ProcCounter)[i]->GetCounter();
G4cout << "\t" << procName << " : " << count;
countTot += count;
}
}
G4cout << G4endl;
//compute totalCrossSection, meanFreePath and massicCrossSection
//
G4double totalCrossSection = countTot/(NbOfEvents*length);
G4double MeanFreePath = 1./totalCrossSection;
G4double massCrossSection =totalCrossSection/density;
G4cout.precision(5);
G4cout << "\n Simulation: "
<< "total CrossSection = " << totalCrossSection*cm << " /cm"
<< "\t MeanFreePath = " << G4BestUnit(MeanFreePath,"Length")
<< "\t massicCrossSection = " << massCrossSection*g/cm2 << " cm2/g"
<< G4endl;
//compute theoritical predictions
//
totalCrossSection = 0.;
for (size_t i=0; i< ProcCounter->size();i++) {
G4String procName = (*ProcCounter)[i]->GetName();
if (procName != "Transportation")
totalCrossSection += ComputeTheory(procName, NbOfEvents);
}
MeanFreePath = 1./totalCrossSection;
massCrossSection = totalCrossSection/density;
G4cout << " Theory: "
<< "total CrossSection = " << totalCrossSection*cm << " /cm"
<< "\t MeanFreePath = " << G4BestUnit(MeanFreePath,"Length")
<< "\t massicCrossSection = " << massCrossSection*g/cm2 << " cm2/g"
<< G4endl;
G4cout.setf(mode,std::ios::floatfield);
G4cout.precision(prec);
// delete and remove all contents in ProcCounter
while (ProcCounter->size()>0){
OneProcessCount* aProcCount=ProcCounter->back();
ProcCounter->pop_back();
delete aProcCount;
}
delete ProcCounter;
#ifdef G4ANALYSIS_USE
histoManager->SaveFactory();
#endif
// show Rndm status
HepRandom::showEngineStatus();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double RunAction::ComputeTheory(G4String process, G4int NbOfMu)
{
G4Material* material = detector->GetMaterial();
G4double length = detector->GetSize();
G4double ekin = primary->GetParticleGun()->GetParticleEnergy();
MuCrossSections crossSections;
G4int id = 0; G4double cut = 0.;
if (process == "MuIoni") { id = 1; cut = GetEnergyCut(material,1); }
if (process == "MuPairProd") { id = 2; cut = 2*GetEnergyCut(material,1); }
if (process == "MuBrems") { id = 3; cut = GetEnergyCut(material,0); }
if (process == "MuNucl") id = 4;
if (id == 0) return 0.;
G4int nbOfBins = 100;
G4double binMin = -10., binMax = 0., binWidth = (binMax-binMin)/nbOfBins;
#ifdef USE_AIDA
//create histo for theoritical crossSections, with same bining as simulation
//
const G4String label[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19"};
AIDA::IHistogram1D* histoMC = 0; AIDA::IHistogram1D* histoTh = 0;
if (histoManager->GetHisto(id)) {
histoMC = histoManager->GetHisto(id);
nbOfBins = (histoMC->axis()).bins();
binMin = (histoMC->axis()).lowerEdge();
binMax = (histoMC->axis()).upperEdge();
binWidth = (binMax-binMin)/nbOfBins;
G4String labelTh = label[MaxHisto + id];
G4String titleTh = histoMC->title() + " (Th)";
histoTh = histoManager->GetHistogramFactory()
->createHistogram1D(labelTh,titleTh,nbOfBins,binMin,binMax);
}
#endif
//compute and plot differential crossSection, as function of energy transfert.
//compute and return integrated crossSection for a given process.
//(note: to compare with simulation, the integrated crossSection is function
// of the energy cut.)
//
G4double lgeps, etransf, sigmaE, dsigma, NbProcess;
G4double sigmaTot = 0.;
const G4double ln10 = log(10);
for (G4int ibin=0; ibin<nbOfBins; ibin++) {
lgeps = binMin + (ibin+0.5)*binWidth;
etransf = ekin*pow(10,lgeps);
sigmaE = crossSections.CR_Macroscopic(process,material,ekin,etransf);
dsigma = sigmaE*etransf*binWidth*ln10;
if (etransf > cut) sigmaTot += dsigma;
NbProcess = NbOfMu*length*dsigma;
#ifdef USE_AIDA
if (histoTh) histoTh->fill(lgeps,NbProcess);
#endif
}
#ifdef USE_AIDA
//compare simulation and theory
//
if (histoMC && histoTh) histoManager->GetHistogramFactory()
->divide(label[2*MaxHisto+id], *histoMC, *histoTh);
#endif
//return integrated crossSection
//
return sigmaTot;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ProductionCutsTable.hh"
G4double RunAction::GetEnergyCut(G4Material* material, G4int idParticle)
{
G4ProductionCutsTable* table = G4ProductionCutsTable::GetProductionCutsTable();
size_t index = 0;
while ( (table->GetMaterialCutsCouple(index)->GetMaterial() != material) &&
(index < table->GetTableSize())) index++;
return (*(table->GetEnergyCutsVector(idParticle)))[index];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: StackingAction.cc,v 1.1 2004/06/14 10:09:27 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "StackingAction.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StackingAction::StackingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
StackingAction::~StackingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ClassificationOfNewTrack
StackingAction::ClassifyNewTrack(const G4Track* aTrack)
{
G4ClassificationOfNewTrack classification = fUrgent;
// kill all secondaries
if(aTrack->GetParentID() != 0) classification = fKill;
return classification;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: SteppingAction.cc,v 1.1 2004/06/14 10:09:27 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingAction.hh"
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4RunManager.hh"
#ifdef USE_AIDA
#include "AIDA/IHistogram1D.h"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(RunAction* RuAct, HistoManager* Hist)
:runAction(RuAct), histoManager(Hist)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::~SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4StepPoint* endPoint = aStep->GetPostStepPoint();
G4String procName = endPoint->GetProcessDefinedStep()->GetProcessName();
//count processes
//
runAction->CountProcesses(procName);
//plot energy transfered
//
G4StepPoint* startPoint = aStep->GetPreStepPoint();
G4double E0 = startPoint->GetKineticEnergy();
G4double edep = aStep->GetTotalEnergyDeposit();
G4double E1 = E0 - edep;
G4double E2 = endPoint->GetKineticEnergy();
G4double etrans = E1 - E2;
G4double lgepsE = 0.;
if (etrans > 0.) lgepsE = log10(etrans/E1);
#ifdef USE_AIDA
//
G4int id = 0;
if (procName == "MuIoni") id = 1;
if (procName == "MuPairProd") id = 2;
if (procName == "MuBrems") id = 3;
if (procName == "MuNucl") id = 4;
if ((id > 0) && (histoManager->GetHisto(id)))
histoManager->GetHisto(id)->fill(lgepsE);
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,177 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: SteppingVerbose.cc,v 1.1 2004/06/14 10:09:27 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.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) << "Volume" << " "
<< 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->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << " "
<< std::setw(10) << fStep->GetPostStepPoint()
->GetProcessDefinedStep()->GetProcessName();
} else {
G4cout << " UserLimit";
}
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);
}
//....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) << "Volume" << " "
<< 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->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
G4cout << " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,151 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * 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. *
// ********************************************************************
//
// $Id: VisManager.cc,v 1.1 2004/06/14 10:09:27 maire Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifdef G4VIS_USE
#include "VisManager.hh"
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh"
#include "G4DAWNFILE.hh"
#include "G4GAGTree.hh"
#include "G4HepRepFile.hh"
#include "G4HepRep.hh"
#include "G4RayTracer.hh"
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
// Needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.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_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
VisManager::VisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void VisManager::RegisterGraphicsSystems () {
// Graphics Systems not needing external packages or libraries...
RegisterGraphicsSystem (new G4ASCIITree);
RegisterGraphicsSystem (new G4DAWNFILE);
RegisterGraphicsSystem (new G4GAGTree);
RegisterGraphicsSystem (new G4HepRepFile);
RegisterGraphicsSystem (new G4HepRep);
RegisterGraphicsSystem (new G4RayTracer);
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
// Graphics systems needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#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_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,30 @@
#
# Macro file for the initialization phase of "TestEm1.cc"
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/run/verbose 2
#
/run/initialize
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Create a scene handler for a specific graphics system
# Edit the next line(s) to choose another graphic system
#
/vis/open OGLIX
#
#/vis/open DAWNFILE
#
# Draw scene
/vis/viewer/zoom 1.4
/vis/viewer/flush
#
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
/vis/scene/endOfEventAction accumulate