Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
# $Id: GNUmakefile,v 1.1 1998/10/14 15:23:06 allison Exp $
# --------------------------------------------------------------
# GNUmakefile for tests module. Gabriele Cosmo, 27/06/98.
# --------------------------------------------------------------
# You must have unique G4EXAMPLE_FDID assigned by your local
# manager of Objectivity/DB lock server.
#
# G4EXAMPLE_BOOT is defined as $HOME/G4EXAMPLE by default.
name := exampleE02
G4ODBMS := true
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all cleandb
all: lib bin
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/binmake.gmk
CPPFLAGS += \
-Iinclude \
-I$(G4TMPDIR)
test:
@echo $(CPPFLAGS)
# --------------------------------------------------------------
# override the target all, and warn if G4ODBMS flag is not defined.
ifndef G4ODBMS
all:
@echo Error - Persistency requires G4ODBMS and related database setup.
exit 1
endif
cleandb:
ifndef G4EXAMPLE_FDID
@echo G4EXAMPLE_FDID is not defined. Stop.
exit 1
endif
@rm -f $(G4EXAMPLE_BOOT_DIR)/G4EXAMPLE
@rm -f $(G4EXAMPLE_BOOT_DIR)/G4EXAMPLE.FDDB
@rm -f $(G4EXAMPLE_BOOT_DIR)/*.G4EXAMPLE.DB
@echo Copying schema file to $(G4EXAMPLE_BOOT) for FDID $(G4EXAMPLE_FDID)
@$(HEP_ODBMS_DIR)/etc/getdb $(G4SCHEMA_DIR)/G4SCHEMA \
$(G4EXAMPLE_BOOT) $(G4EXAMPLE_FDID)
+52
View File
@@ -0,0 +1,52 @@
$Id: History,v 1.2 1998/11/14 13:39:47 morita Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Novice Example 07 History file
------------------------------
This file should be used by the test developer to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14th November 1998 Y.Morita
- Modified from N08 to E02 (exampleE02-00-03-01)
14th October 1998 John Allison
- Moved from N08.
25th August 1998 Y.Morita
- tagged (exampleN08-00-02-02)
24th August 1998 Y.Morita
- Fixed typo on exampleN08.cc
- script cleanup on exampleN08run
21st August 1998 John Allison
- Renamed file My* to ExN08*.
August 7th, 1998 John Allison
- Moved from test04.
July 15, 98 Y. Morita
- GNUmakefile cleandb target revised
- README new instructions
- g4odbms_setup.csh example setup
- test04.cc bug fix
July 14, 98 Y. Morita
- Geometry persistency incorporated.
July 8, 98 Y. Morita
- First skeleton version to demonstrate persistency capability
in Geant4.
June 27, 98 G. Cosmo
- Created.
+136
View File
@@ -0,0 +1,136 @@
$Id: README,v 1.3 1998/11/12 11:15:42 morita Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example E02
-----------
This program demonstrates how user can use object database using
HepODBMS interface. Please contact your local system manager for
the avaiability of HepODBMS and Objectivity/DB.
To use HepODBMS and underlying Objectivity/DB package, user needs
a deep knowledge of the object database and environmental set
procedures, which is lacking in this release. The code is provided
here to give just a brief idea of the persistency in using Geant4.
How to build:
- Setup:
In addition to Geant4 standard setup, HepODBMS, Objectivity/DB and
federated database variables should be defined.
For CERN AFS users, an example setup script "g4odbms_setup.csh" is
provided in this directory. Put a line such as
source ${G4INSTALL}/tests/exampleE02/g4odbms_setup.csh
in your .cshrc file, where ${G4INSTALL} is the actual location of
the Geant4 package.
- Objectivity/DB boot file and lock server
Boot file contains a database schema information of some basic
HepODBMS and Objectivity/DB classes. Each time you compile your
own persistent-capable class, a schema is compiled into your
local copy of boot file. User must compile the Geant4 persistent
capable schema into your local copy of the boot file.
Default location is $HOME/G4EXAMPLE. If you want to have it
to other location, define the following variables in your .cshrc.
example:
setenv G4EXAMPLE_BOOT_DIR ${HOME}/tmp/G4EXAMPLE
setenv G4EXAMPLE_BOOT ${G4EXAMPLE_BOOT_DIR}/G4EXAMPLE
For each boot file, user must have unique federated database ID (FDID).
This number can be obtained from your local manager of Objectivity
lock server. Define G4EXAMPLE_FDID in your .cshrc.
example:
setenv G4EXAMPLE_FDID 501
The system also have Objectivity/DB lock server running. For the
CERN AFS users, see the notes below, for other systems, contact your
local system manager for the lock server configuration.
Then type,
gmake cleandb
to create your own boot file.
___________________________________________________________________________
Note: On CERN AFS, user must run his/her own lock server process
due to a technical limitation on AFS and Objectivity.
oocheckls -notitle `hostname` || \
oolockserver -notitle -noauto `hostname`::${G4EXAMPLE_BOOT}
Then check the process with
ps -ef | grep ools
....
<user> 60156 1 0 06:36:40 pts/15 0:00 ools -OO_NO_AUTOREC
....
When you finish running this example, don't forget to kill
the lock server process by yourself.
ookillls
or
kill -9 <pid_of_ools>
User must have AFS ACL access enabled to HepODBMS and
Objectivity/DB directories.
___________________________________________________________________________
- libG4persistency.a
Persistency in Geant4 is provided as a separate sub category.
Geant4 installer must explictly go to ${G4INSTALL}/source/persistency
directory and type
cd ...where Geant4 is installed...
cd source/persistency
gmake cleandb
gmake
gmake global
to create libG4persistency.a. This process will also produce a base
schema file in the directory $(G4INSTALL)/schema/.
- exampleE02 executable
exampleE02 executable can be made by simply typing "gmake" in this directory.
Current example of Geant4 persistency requires the executable to be
run as the same directory as your local federated database.
Use exampleE02run csh-script for simple test.
example:
gmake cleandb # see above
gmake # creates exampleE02 executable
exampleE02run # run exampleE02
- Persistent output
When exampleE02 is run correctly, following database files will be created
in your federated database directory.
Events.G4EXAMPLE.DB G4EXAMPLE.FDDB System.G4EXAMPLE.DB
G4EXAMPLE Geometry.G4EXAMPLE.DB
To browse the contents, use "ootoolmgr".
cd ...your federated database directory...
setenv DISPLAY <your_x_terminal>:0.0
ootoolmgr -notitle G4EXAMPLE &
Make sure to terminate ootoolmgr when you finish browsing.
Otherwise lockserver will remember the browsing as a transaction,
and the further updates to the database will be blocked.
--
+64
View File
@@ -0,0 +1,64 @@
// This code implementation is the intellectual property of
// the RD44 GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: exampleE02.cc,v 1.3 1998/12/08 16:37:24 allison Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// --------------------------------------------------------------
// GEANT4 - exampleE02
//
// For information related to this code contact:
// CERN, IT Division, ASD Group
// --------------------------------------------------------------
// Comments
//
//
// --------------------------------------------------------------
#include "ExE02DetectorConstruction.hh"
#include "ExE02PhysicsList.hh"
#include "ExE02RunAction.hh"
#include "ExE02PrimaryGeneratorAction.hh"
#include "ExE02EventAction.hh"
#include "ExE02StackingAction.hh"
#include "G4ios.hh"
#include "G4RunManager.hh"
#include "G4PersistencyManager.hh"
int main()
{
// Persistency Manager
G4PersistencyManager * persistencyManager =
G4PersistencyManager::GetPersistencyManager();
// Run manager
G4RunManager * runManager = new G4RunManager;
// Detector geometry
runManager->SetUserInitialization(new ExE02DetectorConstruction);
runManager->SetUserInitialization(new ExE02PhysicsList);
// UserAction classes.
runManager->SetUserAction(new ExE02RunAction);
runManager->SetUserAction(new ExE02PrimaryGeneratorAction);
runManager->SetUserAction(new ExE02EventAction);
runManager->SetUserAction(new ExE02StackingAction);
runManager->Initialize();
// Event loop
G4int n_event = 10;
runManager->BeamOn(n_event);
delete runManager;
return 0;
}
+18
View File
@@ -0,0 +1,18 @@
#
# Macro file of "skeleton.cc"
# for tracking performance test
#
/control/verbose 2
/run/verbose 2
#
# SimpleBox geometry made by Pb
# Geantino 100 GeV to the direction (1.,0.,0.)
# 10 events
#
/mydet/switchDetector SimpleBox
/mydet/selectMaterial Pb
/gun/particle geantino
/gun/energy 100 GeV
/gun/direction 1 0 0
/run/initialize
/run/beamOn 10
+112
View File
@@ -0,0 +1,112 @@
Unit category <Time> is not defined.
Opening Federated Database G4EXAMPLE.
-- Tracker type sensitive detector
****************************************************************
****************************************************************
** **
** G4MuPairProduction : **
** cross section/energy loss is calculated using **
** the accurate cross section formula of R.Kokoulin, **
** ( building the tables takes a lot of time, **
** PLEASE BE PATIENT ! ) **
** sampling of the energy of the pair is generated **
** according to the sampling tables. **
** **
****************************************************************
****************************************************************
****************************************************************
****************************************************************
** **
** G4MuPairProduction : **
** cross section/energy loss is calculated using **
** the accurate cross section formula of R.Kokoulin, **
** ( building the tables takes a lot of time, **
** PLEASE BE PATIENT ! ) **
** sampling of the energy of the pair is generated **
** according to the sampling tables. **
** **
****************************************************************
****************************************************************
ExE02PhysicsList::setCuts:CutLength : 1 (mm)
>>> Event 0
Event : 0
mySD/EvenCollection
Number of hits 10
Edep of the first hit 70.7118
mySD/OddCollection
Number of hits 48
Edep of the first hit 44.5668
>>> Event 1
Event : 1
mySD/EvenCollection
Number of hits 36
Edep of the first hit 22.3181
mySD/OddCollection
Number of hits 25
Edep of the first hit 41.5939
>>> Event 2
Event : 2
mySD/EvenCollection
Number of hits 12
Edep of the first hit 28.0978
mySD/OddCollection
Number of hits 52
Edep of the first hit 3.52978
>>> Event 3
Event : 3
mySD/EvenCollection
Number of hits 14
Edep of the first hit 5.96415
mySD/OddCollection
Number of hits 43
Edep of the first hit 3.18537
>>> Event 4
Event : 4
mySD/EvenCollection
Number of hits 7
Edep of the first hit 19.4871
mySD/OddCollection
Number of hits 57
Edep of the first hit 7.21456
>>> Event 5
Event : 5
mySD/EvenCollection
Number of hits 6
Edep of the first hit 1.65209
mySD/OddCollection
Number of hits 51
Edep of the first hit 19.1148
>>> Event 6
Event : 6
mySD/EvenCollection
Number of hits 10
Edep of the first hit 13.4296
mySD/OddCollection
Number of hits 47
Edep of the first hit 62.0367
>>> Event 7
Event : 7
mySD/EvenCollection
Number of hits 6
Edep of the first hit 36.4453
mySD/OddCollection
Number of hits 50
Edep of the first hit 19.1307
>>> Event 8
Event : 8
mySD/EvenCollection
Number of hits 16
Edep of the first hit 2.38804
mySD/OddCollection
Number of hits 52
Edep of the first hit 48.9265
>>> Event 9
Event : 9
mySD/EvenCollection
Number of hits 12
Edep of the first hit 19.3121
mySD/OddCollection
Number of hits 52
Edep of the first hit 11.5742
+42
View File
@@ -0,0 +1,42 @@
#! /bin/csh -f
if ( ! $?G4EXAMPLE_FDID ) then
echo "G4EXAMPLE_FDID is not defined. Stop."
exit 2
endif
# setup some variables
set CWD = `pwd`
set G4SYSTEM = AIX-AFS
set G4BIN = ${CWD}/../../../bin/${G4SYSTEM}
set G4SCHEMA_DIR = ${CWD}/../../../schema
#### remove used database files
###
###set file = ${G4EXAMPLE_BOOT} ; if (-e $file) rm $file
###set file = ${G4EXAMPLE_BOOT}.FDDB ; if (-e $file) rm $file
###cd $G4EXAMPLE_BOOT_DIR
###rm -f Events.*.DB Geometry.*.DB System.*.DB core
###
###echo "Creating a federated database $G4EXAMPLE_BOOT"
###${HEP_ODBMS_DIR}/etc/getdb \
###${G4SCHEMA_DIR}/G4SCHEMA $G4EXAMPLE_BOOT $G4EXAMPLE_FDID
# Since the name of the federated database file G4EXAMPLE is hard
# coded into the executable for now, it is neccessary to run it in
# the same directory as $G4EXAMPLE_BOOT.
echo "cd $G4EXAMPLE_BOOT_DIR" ; cd $G4EXAMPLE_BOOT_DIR
if ( $?BACKGROUND ) then
if ( -e exampleE02.log.old ) rm -f exampleE02.log.old
if ( -e exampleE02.log ) mv -f exampleE02.log exampleE02.log.old
${G4BIN}/exampleE02 ${CWD}/exampleE02.in >& ${CWD}/exampleE02.log &
echo "Job exampleE02 submitted..."
sleep 2
echo "tail -f exampleE02.log"
tail -f ${CWD}/exampleE02.log
else
${G4BIN}/exampleE02 ${CWD}/exampleE02.in
endif
+22
View File
@@ -0,0 +1,22 @@
#
# G4ODBMS user example setup for CERN AFS
#
# Put a line in your .cshrc or .login to source this file.
#
# eg. source ...<path of this file>.../g4odbms_setup.csh
#
# Youhei Morita
#
# ----- Objectivity variables setup
setenv OBJY_VERS 4.0.2
if ( -r /afs/cern.ch/rd45/objectivity/objyenv.csh ) then
source /afs/cern.ch/rd45/objectivity/objyenv.csh
endif
# ----- HepODBMS variables setup
setenv HEP_ODBMS_DIR /afs/cern.ch/sw/lhcxx/specific/ibm/HepODBMS/0.0
setenv HEP_ODBMS_INCLUDES ${HEP_ODBMS_DIR}/include
@@ -0,0 +1,20 @@
#ifndef ExE02DetectorConstruction_h
#define ExE02DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class ExE02DetectorConstruction : public G4VUserDetectorConstruction
{
public:
ExE02DetectorConstruction();
~ExE02DetectorConstruction();
public:
G4VPhysicalVolume* Construct();
};
#endif
@@ -0,0 +1,25 @@
#ifndef ExE02EventAction_h
#define ExE02EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class ExE02EventAction : public G4UserEventAction
{
public:
ExE02EventAction();
~ExE02EventAction();
public:
void BeginOfEventAction();
void EndOfEventAction();
private:
G4int colID1;
G4int colID2;
};
#endif
@@ -0,0 +1,51 @@
// $Id: ExE02PhysicsList.hh,v 1.1 1998/10/14 15:25:44 allison Exp $
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This class is a class derived from G4VUserPhysicsList
// for constructing all particles and processes.
//
// History
// first version 10 Jan. 1998 by H.Kurashige
// ------------------------------------------------------------
#ifndef ExE02PhysicsList_h
#define ExE02PhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
class ExE02PhysicsList: public G4VUserPhysicsList
{
public:
ExE02PhysicsList();
virtual ~ExE02PhysicsList();
protected:
// Construct particle and physics
virtual void ConstructParticle();
virtual void ConstructProcess();
//
virtual void SetCuts(G4double aCut);
protected:
// these methods Construct particles
virtual void ConstructBosons();
virtual void ConstructLeptons();
virtual void ConstructMesons();
virtual void ConstructBarions();
virtual void ConstructIons();
protected:
// these methods Construct physics processes and register them
virtual void ConstructGeneral();
virtual void ConstructEM();
virtual void ConstructHad();
virtual void ConstructLeptHad();
};
#endif
@@ -0,0 +1,25 @@
#ifndef ExE02PrimaryGeneratorAction_h
#define ExE02PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4ParticleGun;
class G4Event;
class ExE02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
ExE02PrimaryGeneratorAction();
~ExE02PrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent);
private:
G4ParticleGun* particleGun;
};
#endif
@@ -0,0 +1,25 @@
#ifndef ExE02RunAction_h
#define ExE02RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
class ExE02RunAction : public G4UserRunAction
{
public:
ExE02RunAction();
~ExE02RunAction();
public:
void BeginOfRunAction(G4Run* aRun);
void EndOfRunAction(G4Run* aRun);
private:
G4int runIDcounter;
};
#endif
@@ -0,0 +1,26 @@
#ifndef ExE02StackingAction_H
#define ExE02StackingAction_H 1
#include "globals.hh"
#include "G4UserStackingAction.hh"
#include "G4ThreeVector.hh"
#include <rw/tpordvec.h>
class G4Track;
class ExE02StackingAction : public G4UserStackingAction
{
public:
ExE02StackingAction();
~ExE02StackingAction();
public:
G4ClassificationOfNewTrack ClassifyNewTrack(G4Track *const aTrack);
void NewStage();
void PrepareNewEvent();
};
#endif
@@ -0,0 +1,60 @@
#ifndef ExE02TrackerHit_h
#define ExE02TrackerHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
class ExE02TrackerHit : public G4VHit
{
public:
ExE02TrackerHit();
~ExE02TrackerHit();
ExE02TrackerHit(const ExE02TrackerHit &right);
const ExE02TrackerHit& operator=(const ExE02TrackerHit &right);
int operator==(const ExE02TrackerHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
void Draw();
void Print();
private:
G4double edep;
G4ThreeVector pos;
public:
inline void SetEdep(G4double de)
{ edep = de; };
inline G4double GetEdep()
{ return edep; };
inline void SetPos(G4ThreeVector xyz)
{ pos = xyz; };
inline G4ThreeVector GetPos()
{ return pos; };
};
typedef G4THitsCollection<ExE02TrackerHit> ExE02TrackerHitsCollection;
extern G4Allocator<ExE02TrackerHit> ExE02TrackerHitAllocator;
inline void* ExE02TrackerHit::operator new(size_t)
{
void *aHit;
aHit = (void *) ExE02TrackerHitAllocator.MallocSingle();
return aHit;
}
inline void ExE02TrackerHit::operator delete(void *aHit)
{
ExE02TrackerHitAllocator.FreeSingle((ExE02TrackerHit*) aHit);
}
#endif
@@ -0,0 +1,30 @@
#ifndef ExE02TrackerSD_h
#define ExE02TrackerSD_h 1
#include "G4VSensitiveDetector.hh"
#include "ExE02TrackerHit.hh"
#include "G4Step.hh"
class ExE02TrackerSD : public G4VSensitiveDetector
{
public:
ExE02TrackerSD(G4String name);
~ExE02TrackerSD();
void Initialize(G4HCofThisEvent*HCE);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
private:
ExE02TrackerHitsCollection *EvenCollection;
ExE02TrackerHitsCollection *OddCollection;
};
#endif
@@ -0,0 +1,118 @@
#include "ExE02DetectorConstruction.hh"
#include "ExE02TrackerSD.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4SDManager.hh"
ExE02DetectorConstruction::ExE02DetectorConstruction()
{;}
ExE02DetectorConstruction::~ExE02DetectorConstruction()
{;}
G4VPhysicalVolume* ExE02DetectorConstruction::Construct()
{
G4cout << " -- Tracker type sensitive detector" << endl;
//--------- Material definition ---------
G4double a, iz, z, density;
G4String name, symbol;
G4int nel;
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
a = 26.98*g/mole;
density = 2.7*g/cm3;
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
a = 207.19*g/mole;
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
density = 1.29e-03*g/cm3;
G4Material* Air = new G4Material(name="Air", density, nel=2);
Air->AddElement(elN, .7);
Air->AddElement(elO, .3);
//--------- G4VSolid, G4LogicalVolume, G4VPhysicalVolume ---------
G4double offset=22.5*cm, xTlate, yTlate;
G4int i,j,copyNo;
G4Box *myWorldBox= new G4Box("WBox",10000*cm, 10000*cm, 10000*cm);
G4Box *myCalBox = new G4Box("CBox",1500*cm, 1500*cm, 1000*cm);
G4Tubs *myTargetTube
= new G4Tubs("TTube",0*cm, 22.5*cm, 1000*cm, 0.*deg, 360.*deg);
G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,Air,
"WLog", 0, 0, 0);
G4LogicalVolume *myCalLog=new G4LogicalVolume(myCalBox,Al,
"CLog", 0, 0, 0);
G4LogicalVolume *myTargetLog=new G4LogicalVolume(myTargetTube,Pb,
"TLog", 0, 0, 0);
G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
"WPhys",
myWorldLog,
0,false,0);
G4PVPlacement *myCalPhys=new G4PVPlacement(0,G4ThreeVector(),
"CalPhys",
myCalLog,
myWorldPhys,false,0);
G4String tName1("TPhys1");
copyNo=1;
for (j=1;j<=25;j++)
{
yTlate = -1000.0*cm - 40.0*cm + j*80.0*cm;
for (i=1;i<=50;i++)
{
xTlate = -1000.0*cm - 20.0*cm + i*45.0*cm - offset;
G4PVPlacement *myTargetPhys
=new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0*cm),
tName1,myTargetLog,myCalPhys,false,copyNo++);
}
}
G4String tName2("TPhys2");
copyNo=1;
for (j=1;j<=26;j++)
{
yTlate = -1000.0*cm - 80.0*cm + j*80.0*cm;
for (i=1;i<=50;i++)
{
xTlate = -1000.0*cm - 20.0*cm + i*45.0*cm;
G4PVPlacement *myTargetPhys
=new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0*cm),
tName2,myTargetLog,myCalPhys,false,copyNo++);
}
}
//--------- Sensitive detector -------------------------------------
// A concrete object named "mySD", which corresponds to
// the G4LogicalVolume object "myTargetLog"
G4String sdName = "sample/tracker/mySD";
ExE02TrackerSD* mySD = new ExE02TrackerSD( sdName );
myTargetLog->SetSensitiveDetector( mySD );
// "mySD" will be registrated
G4SDManager* SDman = G4SDManager::GetSDMpointer();
SDman->AddNewDetector( mySD );
//------------------------------------------------------------------
return myWorldPhys;
}
@@ -0,0 +1,55 @@
#include "ExE02EventAction.hh"
#include "ExE02TrackerHit.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
ExE02EventAction::ExE02EventAction()
{
colID1 = -1;
colID2 = -1;
}
ExE02EventAction::~ExE02EventAction()
{;}
void ExE02EventAction::BeginOfEventAction()
{
if(colID1<0||colID2<0)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
G4String colNam;
colID1 = SDman->GetCollectionID(colNam="EvenCollection");
colID2 = SDman->GetCollectionID(colNam="OddCollection");
}
}
void ExE02EventAction::EndOfEventAction()
{
const G4Event* evt = fpEventManager->GetConstCurrentEvent();
G4cout << ">>> Event " << evt->GetEventID() << endl;
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
ExE02TrackerHitsCollection * pTHC1
= (ExE02TrackerHitsCollection*)(HCE->GetHC(colID1));
ExE02TrackerHitsCollection * pTHC2
= (ExE02TrackerHitsCollection*)(HCE->GetHC(colID2));
G4cout << "Event : " << evt->GetEventID() << endl;
G4cout << pTHC1->GetSDname() << "/" << pTHC1->GetName() << endl;
G4cout << "Number of hits " << pTHC1->entries() << endl;
G4cout << " Edep of the first Hit " << (*pTHC1)[0]->GetEdep() << endl;
G4cout << pTHC2->GetSDname() << "/" << pTHC2->GetName() << endl;
G4cout << "Number of hits " << pTHC2->entries() << endl;
G4cout << " Edep of the first Hit " << (*pTHC2)[0]->GetEdep() << endl;
}
@@ -0,0 +1,274 @@
// $Id: ExE02PhysicsList.cc,v 1.1 1998/10/14 15:26:10 allison Exp $
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This is a version for maximum particle set
// History
// first version 10 Jan. 1998 by H.Kurashige
// add decay at rest 26 Feb. 1998 by H.Kurashige
// ------------------------------------------------------------
#include "globals.hh"
#include "ExE02PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include <iomanip.h>
ExE02PhysicsList::ExE02PhysicsList(): G4VUserPhysicsList()
{
SetVerboseLevel(1);
}
ExE02PhysicsList::~ExE02PhysicsList()
{
}
void ExE02PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBarions();
}
void ExE02PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
void ExE02PhysicsList::ConstructLeptons()
{
// leptons
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4TauMinus::TauMinusDefinition();
G4TauPlus::TauPlusDefinition();
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4NeutrinoTau::NeutrinoTauDefinition();
G4AntiNeutrinoTau::AntiNeutrinoTauDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
}
void ExE02PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
G4DMesonPlus::DMesonPlusDefinition();
G4DMesonMinus::DMesonMinusDefinition();
G4DMesonZero::DMesonZeroDefinition();
G4AntiDMesonZero::AntiDMesonZeroDefinition();
G4DsMesonPlus::DsMesonPlusDefinition();
G4DsMesonMinus::DsMesonMinusDefinition();
G4JPsi::JPsiDefinition();
G4BMesonPlus::BMesonPlusDefinition();
G4BMesonMinus::BMesonMinusDefinition();
G4BMesonZero::BMesonZeroDefinition();
G4AntiBMesonZero::AntiBMesonZeroDefinition();
G4BsMesonZero::BsMesonZeroDefinition();
G4AntiBsMesonZero::AntiBsMesonZeroDefinition();
}
void ExE02PhysicsList::ConstructBarions()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
G4Lambda::LambdaDefinition();
G4AntiLambda::AntiLambdaDefinition();
G4SigmaZero::SigmaZeroDefinition();
G4AntiSigmaZero::AntiSigmaZeroDefinition();
G4SigmaPlus::SigmaPlusDefinition();
G4AntiSigmaPlus::AntiSigmaPlusDefinition();
G4SigmaMinus::SigmaMinusDefinition();
G4AntiSigmaMinus::AntiSigmaMinusDefinition();
G4XiZero::XiZeroDefinition();
G4AntiXiZero::AntiXiZeroDefinition();
G4XiMinus::XiMinusDefinition();
G4AntiXiMinus::AntiXiMinusDefinition();
G4OmegaMinus::OmegaMinusDefinition();
G4AntiOmegaMinus::AntiOmegaMinusDefinition();
G4LambdacPlus::LambdacPlusDefinition();
G4SigmacPlusPlus::SigmacPlusPlusDefinition();
G4SigmacPlus::SigmacPlusDefinition();
G4SigmacZero::SigmacZeroDefinition();
G4XicPlus::XicPlusDefinition();
G4XicZero::XicZeroDefinition();
G4OmegacZero::OmegacZeroDefinition();
G4AntiLambdacPlus::AntiLambdacPlusDefinition();
G4AntiSigmacPlusPlus::AntiSigmacPlusPlusDefinition();
G4AntiSigmacPlus::AntiSigmacPlusDefinition();
G4AntiSigmacZero::AntiSigmacZeroDefinition();
G4AntiXicPlus::AntiXicPlusDefinition();
G4AntiXicZero::AntiXicZeroDefinition();
G4AntiOmegacZero::AntiOmegacZeroDefinition();
}
void ExE02PhysicsList::ConstructIons()
{
// nuclei
G4Alpha::AlphaDefinition();
G4Deuteron::DeuteronDefinition();
G4Triton::TritonDefinition();
}
void ExE02PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructLeptHad();
ConstructHad();
ConstructGeneral();
}
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
void ExE02PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
// Construct processes for gamma
pmanager->AddDiscreteProcess(new G4GammaConversion());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
} else if (particleName == "e-") {
//electron
// Construct processes for electron
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4eIonisation(),-1,2,2);
pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
} else if (particleName == "e+") {
//positron
// Construct processes for positron
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4eIonisation(),-1,2,2);
pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation(),0,-1,4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
// Construct processes for muon+
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4MuIonisation(),-1,2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
} else {
if ((particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
// all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4hIonisation(),-1,2,2);
}
}
}
}
void ExE02PhysicsList::ConstructHad()
{;}
void ExE02PhysicsList::ConstructLeptHad()
{;}
#include "G4Decay.hh"
void ExE02PhysicsList::ConstructGeneral()
{
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager->AddProcess(theDecayProcess, INT_MAX, -1, INT_MAX);
}
}
}
void ExE02PhysicsList::SetCuts(G4double cut)
{
if (verboseLevel >0){
G4cout << "ExE02PhysicsList::SetCuts:";
G4cout << "CutLength : " << cut/mm << " (mm)" << endl;
}
// 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(cut, "gamma");
SetCutValue(cut, "e-");
SetCutValue(cut, "e+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
SetCutValue(cut, "proton");
SetCutValue(cut, "anti_proton");
SetCutValueForOthers(cut);
if (verboseLevel>1) {
DumpCutValuesTable();
}
}
@@ -0,0 +1,38 @@
#include "ExE02PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "globals.hh"
ExE02PrimaryGeneratorAction::ExE02PrimaryGeneratorAction()
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
// default particle
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="mu-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,1.,0.));
particleGun->SetParticleEnergy(1.*GeV);
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
}
ExE02PrimaryGeneratorAction::~ExE02PrimaryGeneratorAction()
{
delete particleGun;
}
void ExE02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,38 @@
#include "ExE02RunAction.hh"
#include "G4Run.hh"
#include "G4VPersistencyManager.hh"
#include "G4TransportationManager.hh"
#include "G4VPhysicalVolume.hh"
ExE02RunAction::ExE02RunAction()
{
runIDcounter = 0;
}
ExE02RunAction::~ExE02RunAction()
{
}
void ExE02RunAction::BeginOfRunAction(G4Run* aRun)
{
aRun->SetRunID(runIDcounter++);
if(runIDcounter==1)
{
G4VPersistencyManager* persM
= G4VPersistencyManager::GetPersistencyManager();
if(persM)
{
G4VPhysicalVolume* theWorld
= G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking()->GetWorldVolume();
persM->Store(theWorld);
}
}
}
void ExE02RunAction::EndOfRunAction(G4Run* aRun)
{
}
@@ -0,0 +1,30 @@
#include "ExE02StackingAction.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4ios.hh"
ExE02StackingAction::ExE02StackingAction()
{;}
ExE02StackingAction::~ExE02StackingAction()
{;}
G4ClassificationOfNewTrack
ExE02StackingAction::ClassifyNewTrack(G4Track *const aTrack)
{
G4ClassificationOfNewTrack classification = fKill;
if(aTrack->GetParentID()==0)
{ classification = fUrgent; }
return classification;
}
void ExE02StackingAction::NewStage()
{;}
void ExE02StackingAction::PrepareNewEvent()
{;}
@@ -0,0 +1,38 @@
#include "ExE02TrackerHit.hh"
G4Allocator<ExE02TrackerHit> ExE02TrackerHitAllocator;
ExE02TrackerHit::ExE02TrackerHit()
{;}
ExE02TrackerHit::~ExE02TrackerHit()
{;}
ExE02TrackerHit::ExE02TrackerHit(const ExE02TrackerHit &right)
{
edep = right.edep;
pos = right.pos;
}
const ExE02TrackerHit& ExE02TrackerHit::operator=(const ExE02TrackerHit &right)
{
edep = right.edep;
pos = right.pos;
return *this;
}
int ExE02TrackerHit::operator==(const ExE02TrackerHit &right) const
{
return 0;
}
void ExE02TrackerHit::Draw()
{
}
void ExE02TrackerHit::Print()
{
}
@@ -0,0 +1,68 @@
#include "ExE02TrackerSD.hh"
#include "ExE02TrackerHit.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4ParticleDefinition.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
ExE02TrackerSD::ExE02TrackerSD(G4String name)
:G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="EvenCollection");
collectionName.insert(HCname="OddCollection");
}
ExE02TrackerSD::~ExE02TrackerSD(){;}
void ExE02TrackerSD::Initialize(G4HCofThisEvent*HCE)
{
EvenCollection = new
ExE02TrackerHitsCollection(SensitiveDetectorName,collectionName[0]);
OddCollection = new
ExE02TrackerHitsCollection(SensitiveDetectorName,collectionName[1]);
}
G4bool ExE02TrackerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
{
const G4VPhysicalVolume* physVol
= aStep->GetPreStepPoint()->GetPhysicalVolume();
G4double edep = aStep->GetTotalEnergyDeposit();
ExE02TrackerHit* newHit = new ExE02TrackerHit();
newHit->SetEdep( edep );
newHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
if( physVol->GetName() == "TPhys1" )
{ EvenCollection->insert( newHit ); }
else if( physVol->GetName() == "TPhys2" )
{ OddCollection->insert( newHit ); }
return true;
}
void ExE02TrackerSD::EndOfEvent(G4HCofThisEvent*HCE)
{
static G4int IDe = -1;
static G4int IDo = -1;
if(IDe<0)
{ IDe = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
if(IDo<0)
{ IDo = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[1]); }
HCE->AddHitsCollection( IDe, EvenCollection );
HCE->AddHitsCollection( IDo, OddCollection );
}
void ExE02TrackerSD::clear()
{
}
void ExE02TrackerSD::DrawAll()
{
}
void ExE02TrackerSD::PrintAll()
{
}