Import Geant4 4.1.0 source tree
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# $Id: GNUmakefile,v 1.1 2002/03/05 15:21:51 gcosmo Exp $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
include ParGNUmakefile
|
||||
|
||||
name := ParN02
|
||||
G4TARGET := $(name)
|
||||
G4EXLIB := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: lib bin
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
@@ -0,0 +1,22 @@
|
||||
$Id: History,v 1.1 2002/03/05 15:21:52 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Example ParN02 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 *
|
||||
----------------------------------------------------------
|
||||
|
||||
March 5th, 2002 G.Cosmo - ParN02-V04-00-00
|
||||
------------------------
|
||||
- Created from original version of Gene Cooperman.
|
||||
Parallel version of example/novice/N02.
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# $Id: ParGNUmakefile,v 1.3 2002/03/09 09:49:55 cooperma Exp $
|
||||
# --------------------------------------------------------------
|
||||
#This file should be included in GNUmakefile of local directory.
|
||||
|
||||
#Usage: make [ to compile parallel version ]
|
||||
# make run [ to compile and run it ]
|
||||
# make run-debug [ to compile and run in gdb ]
|
||||
# make parclean [ remove intermediate and executable files ]
|
||||
# See `run' target for parameters by which executable is called.
|
||||
# This assumes Geant4 environment vars have been defined.
|
||||
# See ../info/NEW_APP_INSTALL (number 10) for an example of setting up
|
||||
# the Geant4 environment variables.
|
||||
|
||||
# MEM_MODEL can be --seq, --mpi, or --pthread in current version of TOP-C.
|
||||
MEM_MODEL=--seq
|
||||
MEM_MODEL=--mpi
|
||||
|
||||
ifndef REMOTE_SHELL
|
||||
REMOTE_SHELL=ssh
|
||||
endif
|
||||
|
||||
MACROFILE=ParN02.in
|
||||
|
||||
# DATAFILE=pythia_event.data
|
||||
DATAFILE=
|
||||
|
||||
# Everything below here should be set automatically based on
|
||||
# your environment variables, the G4TARGET of GNUmakefile, etc.
|
||||
# G4TARGET set in the makefile that includes this one.
|
||||
|
||||
ifndef PARTARGET
|
||||
PARTARGET = ${G4TARGET}
|
||||
endif
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = _Environment_variable_G4INSTALL_must_be_defined_
|
||||
endif
|
||||
|
||||
ifndef G4WORKDIR
|
||||
G4WORKDIR = ${G4INSTALL}
|
||||
endif
|
||||
|
||||
ifndef G4BIN
|
||||
G4BIN = $$G4WORKDIR/bin
|
||||
endif
|
||||
ifndef G4BINDIR
|
||||
G4BINDIR = ${G4BIN}/$$G4SYSTEM
|
||||
endif
|
||||
|
||||
EXECUTABLE=${G4BIN}/$$G4SYSTEM/${PARTARGET}
|
||||
|
||||
G4DEBUG = 1
|
||||
|
||||
TOPC_LIBS = `topc-config ${MEM_MODEL} --libs`
|
||||
TOPC_CFLAGS = -DG4USE_TOPC `topc-config ${MEM_MODEL} --cflags`
|
||||
# optionally add: -DTOPC_DEBUG to TOPC_CFLAGS for debugging details.
|
||||
TOPC_OPTIONS = --TOPC-verbose
|
||||
|
||||
EXTRALIBS=${TOPC_LIBS}
|
||||
CPPFLAGS=${TOPC_CFLAGS}
|
||||
|
||||
TIMESTAMP=${G4BINDIR}/timestamp
|
||||
|
||||
# Unfortunately, .../geant4.x.x/config/binmake.gmk has target:
|
||||
# $(G4BINDIR)/$(G4TARGET)
|
||||
# (for example: ${G4BIN}/$$G4SYSTEM/ParN02)
|
||||
# And that rule always triggers due to dependency on .../exe/obj.last
|
||||
# Also, G4BINDIR uses shell variables, that are guaranteed to expand
|
||||
# only after recursive make.
|
||||
compile:
|
||||
@ if [ "$$G4SYSTEM" = "" ]; then \
|
||||
echo '***' Environment variable G4SYSTEM not defined; \
|
||||
echo '***' Make sure G4INSTALL and G4SYSTEM are set; \
|
||||
fi
|
||||
${MAKE} G4BINDIR=${G4BINDIR} ${TIMESTAMP}
|
||||
${TIMESTAMP}: *.cc *.icc src/*.cc include/*.hh ParGNUmakefile
|
||||
# Test for presence of topc-config
|
||||
topc-config ${MEM_MODEL} --libs > /dev/null
|
||||
${MAKE} all
|
||||
rm -f ${TIMESTAMP}
|
||||
echo "" > ${TIMESTAMP}
|
||||
make -t ${EXECUTABLE}
|
||||
|
||||
run: compile
|
||||
pwd
|
||||
echo ${EXECUTABLE}
|
||||
cp -f ${MACROFILE} ${DATAFILE} procgroup `dirname ${EXECUTABLE}`/
|
||||
# ${EXECUTABLE} will use procgroup file in current directory.
|
||||
( cd `dirname ${EXECUTABLE}`; RSH=${REMOTE_SHELL}; export RSH; \
|
||||
${EXECUTABLE} ${TOPC_OPTIONS} ${MACROFILE} )
|
||||
|
||||
run-debug: compile
|
||||
@ if [ "$$G4DEBUG" = "" ]; then \
|
||||
echo '***' Environment variable G4DEBUG not defined; \
|
||||
echo '***' Set it, make parclean, and re-compile using GDEBUG; \
|
||||
fi
|
||||
# exit 1; \
|
||||
echo ${EXECUTABLE}
|
||||
cp -f ${MACROFILE} ${DATAFILE} procgroup `dirname ${EXECUTABLE}`/
|
||||
rm -f `dirname ${EXECUTABLE}`/tmp.gdb
|
||||
echo 'set args ${TOPC_OPTIONS} ${MACROFILE}' \
|
||||
> `dirname ${EXECUTABLE}`/tmp.gdb
|
||||
echo 'break main' >> `dirname ${EXECUTABLE}`/tmp.gdb
|
||||
echo 'run' >> `dirname ${EXECUTABLE}`/tmp.gdb
|
||||
# ${EXECUTABLE} will use procgroup file in current directory.
|
||||
( cd `dirname ${EXECUTABLE}`; RSH=${REMOTE_SHELL}; export RSH; \
|
||||
gdb -x tmp.gdb ${EXECUTABLE} )
|
||||
parclean:
|
||||
rm -f ${TIMESTAMP}
|
||||
${MAKE} clean
|
||||
pardist: parclean
|
||||
( dir=`basename $$PWD`; cd ..; tar cvf $$dir.tar ./$$dir; \
|
||||
gzip $$dir.tar && (cd $$dir; ls -l ../$$dir.tar.gz) )
|
||||
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParN02.cc,v 1.2 2002/03/09 06:21:18 cooperma Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02DetectorConstruction.hh"
|
||||
#include "ExN02PhysicsList.hh"
|
||||
#include "ExN02PrimaryGeneratorAction.hh"
|
||||
#include "ExN02RunAction.hh"
|
||||
#include "ExN02EventAction.hh"
|
||||
#include "ExN02SteppingAction.hh"
|
||||
#include "ExN02SteppingVerbose.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIterminal.hh"
|
||||
#include "G4UItcsh.hh"
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
#include "ExN02VisManager.hh"
|
||||
#endif
|
||||
|
||||
#include "ParTopC.icc"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv) {
|
||||
|
||||
//my Verbose output class
|
||||
G4VSteppingVerbose::SetInstance(new ExN02SteppingVerbose);
|
||||
|
||||
// Run manager
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
|
||||
// UserInitialization classes (mandatory)
|
||||
ExN02DetectorConstruction* ExN02detector = new ExN02DetectorConstruction;
|
||||
runManager->SetUserInitialization(ExN02detector);
|
||||
runManager->SetUserInitialization(new ExN02PhysicsList);
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
// Visualization, if you choose to have it!
|
||||
G4VisManager* visManager = new ExN02VisManager;
|
||||
visManager->Initialize();
|
||||
#endif
|
||||
|
||||
// UserAction classes
|
||||
runManager->SetUserAction(new ExN02PrimaryGeneratorAction(ExN02detector));
|
||||
runManager->SetUserAction(new ExN02RunAction);
|
||||
runManager->SetUserAction(new ExN02EventAction);
|
||||
runManager->SetUserAction(new ExN02SteppingAction);
|
||||
|
||||
//Initialize G4 kernel
|
||||
runManager->Initialize();
|
||||
|
||||
//get the pointer to the User Interface manager
|
||||
G4UImanager * UI = G4UImanager::GetUIpointer();
|
||||
|
||||
if(argc==1)
|
||||
// Define (G)UI terminal for interactive mode
|
||||
{
|
||||
// G4UIterminal is a (dumb) terminal.
|
||||
G4UIsession * session = 0;
|
||||
#ifdef G4UI_USE_TCSH
|
||||
session = new G4UIterminal(new G4UItcsh);
|
||||
#else
|
||||
session = new G4UIterminal();
|
||||
#endif
|
||||
|
||||
UI->ApplyCommand("/control/execute vis.mac");
|
||||
session->SessionStart();
|
||||
delete session;
|
||||
}
|
||||
else
|
||||
// Batch mode
|
||||
{
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UI->ApplyCommand(command+fileName);
|
||||
}
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
delete visManager;
|
||||
#endif
|
||||
delete runManager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/tracking/verbose 1
|
||||
|
||||
/gun/energy 200 MeV
|
||||
/gun/particle e+
|
||||
/run/beamOn 1
|
||||
|
||||
/gun/energy 1 TeV
|
||||
/gun/particle mu+
|
||||
/run/beamOn 1
|
||||
|
||||
/tracking/verbose 0
|
||||
|
||||
/gun/energy 200 MeV
|
||||
/gun/particle e+
|
||||
/run/beamOn 100
|
||||
|
||||
/gun/energy 1 TeV
|
||||
/gun/particle mu+
|
||||
/run/beamOn 100
|
||||
|
||||
exit
|
||||
@@ -0,0 +1,21 @@
|
||||
/tracking/verbose 1
|
||||
|
||||
/gun/energy 200 MeV
|
||||
/gun/particle e+
|
||||
/run/beamOn 1
|
||||
|
||||
/gun/energy 1 TeV
|
||||
/gun/particle mu+
|
||||
/run/beamOn 1
|
||||
|
||||
/tracking/verbose 0
|
||||
|
||||
/gun/energy 200 MeV
|
||||
/gun/particle e+
|
||||
/run/beamOn 10000
|
||||
|
||||
/gun/energy 1 TeV
|
||||
/gun/particle mu+
|
||||
/run/beamOn 1000
|
||||
|
||||
exit
|
||||
@@ -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: ParTopC.icc,v 1.1 2002/03/09 06:25:03 cooperma Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifdef G4USE_TOPC
|
||||
# include "ParRunManager.hh"
|
||||
#endif
|
||||
|
||||
static int G4_main(int argc, char **argv);
|
||||
|
||||
int main(int argc,char** argv) {
|
||||
# ifdef G4USE_TOPC
|
||||
TOPC_OPT_safety = 15; // Needed until a certain TOP-C bug is diagnosed.
|
||||
TOPC_init(&argc, &argv);
|
||||
# endif
|
||||
int ret_val = G4_main(argc, argv);
|
||||
# ifdef G4USE_TOPC
|
||||
TOPC_finalize();
|
||||
# endif
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
#ifdef G4USE_TOPC
|
||||
# define G4RunManager ParRunManager
|
||||
#endif
|
||||
|
||||
#define main G4_main
|
||||
@@ -0,0 +1,162 @@
|
||||
$Id: 000README,v 1.3 2002/03/09 09:47:58 cooperma Exp $
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
ParGeant4: Geant4/TOP-C, a parallelization of Geant4
|
||||
Version 0.9
|
||||
(event-level parallelism only)
|
||||
|
||||
Gene Cooperman
|
||||
Northeastern University
|
||||
gene@ccs.neu.edu,
|
||||
|
||||
For the latest information on ParGeant4, see:
|
||||
http://www.ccs.neu.edu/home/gene/pargeant4.html
|
||||
Note that a version now exists that runs Geant4 over the Grid.
|
||||
Please write to gene@ccs.neu.edu for further information.
|
||||
To port other applications to a parallel version, read the
|
||||
files ../../info/PAR_INSTALL and ../../info/PAR_README.
|
||||
|
||||
This parallelization was done using a precompiled library for Geant4 4.0
|
||||
See the beginning of GNUmakefile for reasonable `make' targets to run it.
|
||||
To run it:
|
||||
0. a. Follow the standard Geant4 installation procedure.
|
||||
b. Verify that the Geant4 sequential examples work for you:
|
||||
cd $G4INSTALL/examples/novice/exampleN02
|
||||
make
|
||||
$G4WORKDIR/bin/$G4SYSTEM/ParN02 ParN02.in
|
||||
c. Download and install TOP-C
|
||||
The TOP-C home page is at http://www.ccs.neu.edu/home/gene/topc.html
|
||||
cd <TOPC_INSTALL_DIR>
|
||||
gzip -dc topc.tar.gz | tar -xvf -
|
||||
cd topc
|
||||
./configure
|
||||
make
|
||||
make test
|
||||
[ Copy bin/topc-config to your path ]
|
||||
2. make run
|
||||
[ By default, the included `procgroup' file creates two slave processes
|
||||
on localhost. ]
|
||||
[ Note that in addition to output on master,
|
||||
$G4WORKDIR/bin/$G4SYSTEM/slave*.out contains slave output. ]
|
||||
[ To remove intermediate files and start over: make parclean ]
|
||||
3. Try running it with slave processes on remote processes.
|
||||
First, test that your local environment is set up correctly.
|
||||
Try:
|
||||
ssh <REMOTE_HOSTNAME> $G4WORKDIR/bin/$G4SYSTEM/ParN02 `pwd`/ParN02.in
|
||||
The above command needs to work without asking for a password.
|
||||
[ If you use dynamic libraries (*.so), make sure the LD_LIBRARY_PATH
|
||||
in your shell startup file (e.g. ~.tcshrc) includes both:
|
||||
$G4INSTALL/lib/$G4SYSTEM and $CLHEP_BASE_DIR/lib
|
||||
If you use AFS, you may need to type 'klog' to renew your AFS token. ]
|
||||
In `procgroup' file, replace `localhost' by desired remote hosts;
|
||||
Add additional remote hosts (additional slaves) if you like.
|
||||
Then: make run
|
||||
|
||||
============================================================================
|
||||
If you read ParGNUmakefile, you'll find other things that you can
|
||||
modify. For example, all TOP-C additions are in conditionals:
|
||||
remove -DG4USE_TOPC from ParGNUmakefile and:
|
||||
make parclean; make run
|
||||
in order to re-compile and rerun without TOP-C.
|
||||
Define REMOTE_SHELL differently if you don't use `ssh' for a remote shell.
|
||||
(If undefined, ParGNUmakefile defines it to be `ssh')
|
||||
Define MACROFILE diferently to use a different set of input commands.
|
||||
Define MEM_MODEL=--seq
|
||||
to run with TOP-C, but using a single (sequential) process, suitable
|
||||
for easy debugging (via gdb, for example).
|
||||
Try: pushd $G4WORKDIR/bin/$G4SYSTEM/; ./ParN02 --TOPC-help
|
||||
to see TOP-C run-time options that can be invoked, such as
|
||||
pushd $G4WORKDIR/bin/$G4SYSTEM/; ./ParN02 --TOPC-num-slaves=5 ParN02.in
|
||||
Alternatively, modify TOPC_OPTIONS in ParGNUmakefile for the same effect.
|
||||
|
||||
You can also try other targets: make run-debug
|
||||
This will run it under gdb, so you can single step to see what happens.
|
||||
make parclean - Start over with clean set of files.
|
||||
|
||||
============================================================================
|
||||
New or modified files:
|
||||
ParN02.cc - Adds one line: #include "ParN02.icc"
|
||||
ParExample.icc inserts: #include "topc.h"
|
||||
and causes main to calls TOPC_init, TOPC_finalize,
|
||||
and to use: `new ParRunManager' instead of `new G4RunManager'
|
||||
GNUmakefile - Adds one line at beginning: include ParGNUmakefile
|
||||
ParGNUmakefile defines EXTRALIBS and CPPFLAGS so as to
|
||||
modify behavior of config/binmake.gmk
|
||||
in order to use TOP-C libraries and includes
|
||||
procgroup - Specifies which slave hosts to use, and where to put output
|
||||
For example: localhost 1 - > slave1.out
|
||||
host=`localhost', executable=`same as master',
|
||||
params of slave=`> slave1.out' (redirect output)
|
||||
If output not redirected, it goes to stdout on master.
|
||||
src/ParRunManager.cc - ParRunManger derived from G4RunManager
|
||||
replaces Gr4RunManager::DoEventLoop w/ TOP-C parallel loop,
|
||||
Adds certain local vars of DoEventLoop as ParRunManager members
|
||||
src/ParMarshaledObj.cc - run-time utilities for marshalling
|
||||
src/ParExN02MarshaledHits.cc - marshals N02 hits (calorimeter hits)
|
||||
include/Par*.hh - Currently just ParRunManager.hh
|
||||
~/slave*.out - Contains outputs of slave1, slave2, etc.
|
||||
Generated each time parallel ParN02 is executed.
|
||||
These files are specified in the file procgroup.
|
||||
thwap - A script I inherited from our N.U. systems group
|
||||
`thwap ParN02' will clobber all processes you own
|
||||
whose command line includes `ParN02' as substring.
|
||||
Handy for runaway processes when doing parallelism.
|
||||
|
||||
====================================================================
|
||||
This version passes an event number to the slave and lets the
|
||||
slave generate the event. The slave passes back marshaled hits to
|
||||
the master.
|
||||
|
||||
I will integrate the track level parallelism into this scenario at
|
||||
a later date. For the track level, I will generate several
|
||||
secondary tracks on the master, and then convert the secondary tracks
|
||||
to new events that can be passed to slaves. I will do this only if
|
||||
I detect that there are not enough initial events to fully occupy all
|
||||
the slaves. This scheme has the drawback that we are splitting an event
|
||||
into many events, which may make the summarization, histogram, and so
|
||||
on more difficult. However, track level parallelism will be triggered
|
||||
only when a very small number of events are generated.
|
||||
|
||||
I also want to support postponing
|
||||
a track to the next event ( G4ClassificationOfNewTrack::fPostpone .
|
||||
To do this, each slave will wait to retire an event until it knows that
|
||||
the previous event has been retired.
|
||||
|
||||
In addition, I plan to have only the master read commands and pass
|
||||
them to the slaves. Currently, the master and slaves each read
|
||||
identical commands.
|
||||
|
||||
====================================================================
|
||||
If you are curious about some of the layers, the following
|
||||
stack trace [somewhat out of date now] gives some idea.
|
||||
G4RunManager::BeamOn calls ParRunManager::DoEventLoop
|
||||
(since G4RunManager::DoEventLoop is virtual)
|
||||
ParRunManager::DoEventLoop calls TOPC_master_slave
|
||||
TOPC_master_slave calls submit_task_input
|
||||
submit_task_input eventually calls COMM_send_msg which calls MPI_Send
|
||||
(COMM_send_msg is the communication layer of TOPC;
|
||||
ParN02.cc was linked with the TOP-C MPI communication layer.
|
||||
The same source could have been linked with a POSIX threads layer,
|
||||
a communication layer, or some other communication layer.
|
||||
)
|
||||
MPI_send calls send
|
||||
(where send is the socket system call of libc.so)
|
||||
|
||||
(gdb) where
|
||||
#0 0x41946c62 in send () from /lib/libc.so.6
|
||||
#1 0x400839c1 in send () at wrapsyscall.c:186
|
||||
#2 0x805c547 in MPI_Send (buf=0x82690fc, count=4, datatype=3, dest=2, tag=1, comm=0) at sendrecv.c:236
|
||||
#3 0x805a0b5 in COMM_send_msg (msg=0x82690fc, msg_size=4, dst=2, tag=TASK_INPUT_TAG) at comm-mpi.c:224
|
||||
#4 0x805774e in send_task_input (slave=2, input={data = 0x82690fc, data_size = 4}, tag=TASK_INPUT_TAG) at topc.c:560
|
||||
#5 0x8057aa8 in submit_task_input (input={data = 0x82690fc, data_size = 4}) at topc.c:659
|
||||
#6 0x805813c in TOPC_master_slave (generate_task_input_=0x4003d2e4 <ParRunManager::GenerateEventInput(void)>,
|
||||
do_task_=0x4003d350 <ParRunManager::DoEvent(int *)>, check_task_result_=0x4003d420 <ParRunManager::CheckEventResult(int *, void *)>,
|
||||
update_shared_data_=0) at topc.c:922
|
||||
#7 0x4003d18c in ParRunManager::DoEventLoop (this=0x80c0bf0, n_event=1, macroFile=0x0, n_select=-1) at src/ParRunManager.cc:51
|
||||
#8 0x400b14d1 in G4RunManager::BeamOn () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4run.so
|
||||
#9 0x400b870a in G4RunMessenger::SetNewValue () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4run.so
|
||||
#10 0x4167157b in G4UIcommand::DoIt () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4intercoms.so
|
||||
#11 0x416810a3 in G4UImanager::ApplyCommand () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4intercoms.so
|
||||
#12 0x805db7e in G4UIterminal::ExecuteCommand () at /afs/cern.ch/sw/lhcxx/specific/redhat61/3.2.0/include/CLHEP/Random/Randomize.h:64
|
||||
#13 0x805d42d in G4UIterminal::SessionStart () at /afs/cern.ch/sw/lhcxx/specific/redhat61/3.2.0/include/CLHEP/Random/Randomize.h:64
|
||||
#14 0x8056a3d in main (argc=1, argv=0x80bfa00) at ParN02.cc:98
|
||||
@@ -0,0 +1,25 @@
|
||||
/**********************************************************************
|
||||
* Parallel Library for Geant4
|
||||
* Copyright (c) 2001 Gene Cooperman <gene@ccs.neu.edu> *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Lesser General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2.1 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library (see file COPYING); if not, write *
|
||||
* to the Free Software Foundation, Inc., 59 Temple Place, Suite *
|
||||
* 330, Boston, MA 02111-1307 USA, or contact Gene Cooperman *
|
||||
* <gene@ccs.neu.edu>. *
|
||||
**********************************************************************/
|
||||
|
||||
My intention is to make this software freely available as part of
|
||||
the Geant4 collaboration. I believe that the liberal GNU Lesser General
|
||||
Public License should not be a barrier to reasonable usage. If you find
|
||||
that it is, please write to me.
|
||||
@@ -0,0 +1,124 @@
|
||||
$Id: README,v 1.1 2002/03/05 15:21:55 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
ParN02
|
||||
------
|
||||
|
||||
|
||||
This example simulates a simplified fixe target experiment.
|
||||
Read 000README for a description of how to run it in parallel.
|
||||
|
||||
1- GEOMETRY DEFINITION
|
||||
|
||||
The setup consists of a target followed by six chambers of increasing
|
||||
transverse size. These chambers are located in a region called Tracker
|
||||
region. Their shape are boxes, constructed as parametrised volumes
|
||||
(ChamberParametrisation class).
|
||||
|
||||
The default geometry is constructed in DetectorConstruction class.
|
||||
One can change the material of the target and of the chambers
|
||||
interactively via the commands defined in the DetectorMessenger class.
|
||||
|
||||
In addition a transverse uniform magnetic field can be applied (see
|
||||
N02MagneticField and DetectorMessenger classes).
|
||||
|
||||
|
||||
2- PHYSICS LIST
|
||||
|
||||
The particle's type and the physic processes which will be available
|
||||
in this example are set in PhysicsList class.
|
||||
|
||||
In this example, all the so called 'electromagnetic processes' are
|
||||
introduced for gamma, charged leptons, and charged hadrons (see the
|
||||
method PhysicsList::ConstructEM()).
|
||||
|
||||
An important data member of this class is the defaultCutValue which
|
||||
defines the production threshold of secondary particles
|
||||
(mainly Ionisation and Bremsstrahlung processes are concerned by this
|
||||
CutValue).
|
||||
Notice that the CutValue must be given in unit of length, corresponding
|
||||
to the stopping range of the particle. It is automatically converted
|
||||
in energy for each material, and a table is printed in the method
|
||||
PhysicsList::SetCuts()
|
||||
|
||||
In addition the build-in interactive command:
|
||||
/process/(in)activate processName
|
||||
allows to activate/inactivate the processes one by one.
|
||||
|
||||
|
||||
3- RUNS and EVENTS
|
||||
|
||||
The primary kinematic consists of a single particle which hits the
|
||||
target perpendicular to the input face. The type of the particle
|
||||
and its energy are set in the PrimaryGeneratorAction class, and can
|
||||
be changed via the G4 build-in commands of ParticleGun class.
|
||||
|
||||
A RUN is a set of events.
|
||||
|
||||
The user has control:
|
||||
-at Begin and End of each run (class RunAction)
|
||||
-at Begin and End of each event (class EventAction)
|
||||
-at Begin and End of each track (class TrackingAction, not used here)
|
||||
-at End of each step (class SteppingAction)
|
||||
|
||||
The class SteppingVerbose prints some informations step per step,
|
||||
under the control of the command: /tracking/verbose 1
|
||||
It inherits from G4SteppingVerbose, and has been setup here in order
|
||||
to illustrate how to extract informations from the G4 kernel during
|
||||
the tracking of a particle.
|
||||
|
||||
|
||||
4- DETECTOR RESPONSE
|
||||
|
||||
A HIT is a record, track per track (even step per step), of all the
|
||||
informations needed to simulate and analyse the detector response.
|
||||
|
||||
In this example the Tracker chambers are considered as the detector.
|
||||
Therefore the chambers are declared 'sensitive detectors' (SD) in
|
||||
the DetectorConstruction class.
|
||||
|
||||
Then, a Hit is defined as a set of 4 informations per step, inside
|
||||
the chambers, namely:
|
||||
- the track identifier (an integer),
|
||||
- the chamber number,
|
||||
- the total energy deposit in this step,
|
||||
- the position of the deposit.
|
||||
|
||||
A given hit is an instance of the class TrackerHit which is created
|
||||
during the tracking of a particle, step by step, in the method
|
||||
TrackerSD::ProcessHits(). This hit is inserted in a HitsCollection.
|
||||
|
||||
The HitsCollection is printed at the end of event (via the method
|
||||
TrackerSD::EndOfEvent()), under the control of the command: /hits/verbose 1
|
||||
|
||||
|
||||
5- VISUALIZATION
|
||||
|
||||
The Visualization Manager is set in the main().
|
||||
The initialisation of the drawing is done via a set of /vis/ commands
|
||||
in the macro vis.mac. This macro is automatically read from
|
||||
the main when running in interactive mode.
|
||||
|
||||
The tracks are automatically drawn at the end of event and erased at
|
||||
the beginning of the next run.
|
||||
|
||||
The visualization (with OpenGL driver) assumes two things:
|
||||
1- the visualisation & interfaces categories have been compiled
|
||||
with the environment variable G4VIS_BUILD_OPENGLX_DRIVER.
|
||||
2- ParN02.cc has been compiled with G4VIS_USE_OPENGLX.
|
||||
|
||||
(The same with DAWNFILE instead of OPENGLX)
|
||||
|
||||
|
||||
6- USER INTERFACES
|
||||
|
||||
The default command interface, called G4UIterminal, is done via
|
||||
standart cin/G4cout.
|
||||
On Linux and Sun-cc on can use a smarter command interface G4UItcsh.
|
||||
It is enough to set the environment variable G4UI_USE_TCSH before
|
||||
compiling ParN02.cc
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02ChamberParameterisation.hh,v 1.1 2002/03/05 15:21:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// A parameterisation that describes a series of boxes along Z
|
||||
// The boxes have equal width, & their lengths are a linear equation.
|
||||
// They are spaced an equal distance apart, starting from given location.
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02ChamberParameterisation_H
|
||||
#define ExN02ChamberParameterisation_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4Box;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02ChamberParameterisation : public G4VPVParameterisation
|
||||
{
|
||||
public:
|
||||
|
||||
ExN02ChamberParameterisation(G4int NoChambers,
|
||||
G4double startZ,
|
||||
G4double spacing,
|
||||
G4double widthChamber,
|
||||
G4double lengthInitial,
|
||||
G4double lengthFinal );
|
||||
|
||||
virtual
|
||||
~ExN02ChamberParameterisation();
|
||||
|
||||
void ComputeTransformation (const G4int copyNo,
|
||||
G4VPhysicalVolume* physVol) const;
|
||||
|
||||
void ComputeDimensions (G4Box & trackerLayer, const G4int copyNo,
|
||||
const G4VPhysicalVolume* physVol) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
G4int fNoChambers;
|
||||
G4double fStartZ;
|
||||
G4double fHalfWidth; // The half-width of each tracker chamber
|
||||
G4double fSpacing; // The distance between the chambers' center
|
||||
G4double fHalfLengthFirst; // The first half-length
|
||||
G4double fHalfLengthIncr; // The Increment for the half-length
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02DetectorConstruction.hh,v 1.1 2002/03/05 15:21:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02DetectorConstruction_h
|
||||
#define ExN02DetectorConstruction_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "ExN02MagneticField.hh"
|
||||
|
||||
class G4Box;
|
||||
class G4LogicalVolume;
|
||||
class G4VPhysicalVolume;
|
||||
class G4Material;
|
||||
class ExN02DetectorMessenger;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
|
||||
ExN02DetectorConstruction();
|
||||
~ExN02DetectorConstruction();
|
||||
|
||||
public:
|
||||
|
||||
G4VPhysicalVolume* Construct();
|
||||
|
||||
const
|
||||
G4VPhysicalVolume* GetTracker() {return physiTracker;};
|
||||
G4double GetTrackerFullLength() {return fTrackerLength;};
|
||||
G4double GetTargetFullLength() {return fTargetLength;};
|
||||
G4double GetWorldFullLength() {return fWorldLength;};
|
||||
|
||||
void setTargetMaterial (G4String);
|
||||
void setChamberMaterial(G4String);
|
||||
void SetMagField(G4double);
|
||||
|
||||
private:
|
||||
|
||||
G4Box* solidWorld; // pointer to the solid envelope
|
||||
G4LogicalVolume* logicWorld; // pointer to the logical envelope
|
||||
G4VPhysicalVolume* physiWorld; // pointer to the physical envelope
|
||||
|
||||
G4Box* solidTarget; // pointer to the solid Target
|
||||
G4LogicalVolume* logicTarget; // pointer to the logical Target
|
||||
G4VPhysicalVolume* physiTarget; // pointer to the physical Target
|
||||
|
||||
G4Box* solidTracker; // pointer to the solid Tracker
|
||||
G4LogicalVolume* logicTracker; // pointer to the logical Tracker
|
||||
G4VPhysicalVolume* physiTracker; // pointer to the physical Tracker
|
||||
|
||||
G4Box* solidChamber; // pointer to the solid Chamber
|
||||
G4LogicalVolume* logicChamber; // pointer to the logical Chamber
|
||||
G4VPhysicalVolume* physiChamber; // pointer to the physical Chamber
|
||||
|
||||
G4Material* TargetMater; // pointer to the target material
|
||||
G4Material* ChamberMater; // pointer to the chamber material
|
||||
ExN02MagneticField* fpMagField; // pointer to the magnetic field
|
||||
|
||||
ExN02DetectorMessenger* detectorMessenger; // pointer to the Messenger
|
||||
|
||||
G4double fWorldLength; // Full length of the world volume
|
||||
G4double fTargetLength; // Full length of Target
|
||||
G4double fTrackerLength; // Full length of Tracker
|
||||
G4int NbOfChambers; // Nb of chambers in the tracker region
|
||||
G4double ChamberWidth; // width of the chambers
|
||||
G4double ChamberSpacing; // distance between chambers
|
||||
};
|
||||
|
||||
//....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: ExN02DetectorMessenger.hh,v 1.1 2002/03/05 15:21:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02DetectorMessenger_h
|
||||
#define ExN02DetectorMessenger_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class ExN02DetectorConstruction;
|
||||
class G4UIdirectory;
|
||||
class G4UIcmdWithAString;
|
||||
class G4UIcmdWithADoubleAndUnit;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02DetectorMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
ExN02DetectorMessenger(ExN02DetectorConstruction*);
|
||||
~ExN02DetectorMessenger();
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
ExN02DetectorConstruction* myDetector;
|
||||
|
||||
G4UIdirectory* mydetDir;
|
||||
G4UIcmdWithAString* TargMatCmd;
|
||||
G4UIcmdWithAString* ChamMatCmd;
|
||||
G4UIcmdWithADoubleAndUnit* FieldCmd;
|
||||
};
|
||||
|
||||
//....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: ExN02EventAction.hh,v 1.1 2002/03/05 15:21:56 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02EventAction_h
|
||||
#define ExN02EventAction_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
|
||||
class G4Event;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
ExN02EventAction();
|
||||
~ExN02EventAction();
|
||||
|
||||
public:
|
||||
void BeginOfEventAction(const G4Event*);
|
||||
void EndOfEventAction(const G4Event*);
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02MagneticField.hh,v 1.1 2002/03/05 15:21:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// A class for control of the Magnetic Field of the detector.
|
||||
// The field is assumed to be uniform.
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02MagneticField_H
|
||||
#define ExN02MagneticField_H
|
||||
|
||||
#include "G4UniformMagField.hh"
|
||||
|
||||
class G4FieldManager;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
class ExN02MagneticField: public G4UniformMagField
|
||||
{
|
||||
public:
|
||||
|
||||
ExN02MagneticField(G4ThreeVector); // The value of the field
|
||||
ExN02MagneticField(); // A zero field
|
||||
~ExN02MagneticField();
|
||||
|
||||
//Set the field (fieldValue,0,0)
|
||||
void SetFieldValue(G4double fieldValue);
|
||||
void SetFieldValue(G4ThreeVector fieldVector);
|
||||
|
||||
G4ThreeVector GetConstantFieldValue();
|
||||
|
||||
protected:
|
||||
|
||||
// Find the global Field Manager
|
||||
G4FieldManager* GetGlobalFieldManager(); // static
|
||||
};
|
||||
|
||||
//....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: ExN02PhysicsList.hh,v 1.1 2002/03/05 15:21:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02PhysicsList_h
|
||||
#define ExN02PhysicsList_h 1
|
||||
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02PhysicsList: public G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
ExN02PhysicsList();
|
||||
~ExN02PhysicsList();
|
||||
|
||||
protected:
|
||||
// Construct particle and physics
|
||||
void ConstructParticle();
|
||||
void ConstructProcess();
|
||||
|
||||
void SetCuts();
|
||||
|
||||
|
||||
protected:
|
||||
// these methods Construct particles
|
||||
void ConstructBosons();
|
||||
void ConstructLeptons();
|
||||
void ConstructMesons();
|
||||
void ConstructBaryons();
|
||||
|
||||
protected:
|
||||
// these methods Construct physics processes and register them
|
||||
void ConstructGeneral();
|
||||
void ConstructEM();
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02PrimaryGeneratorAction.hh,v 1.1 2002/03/05 15:21:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02PrimaryGeneratorAction_h
|
||||
#define ExN02PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
class ExN02DetectorConstruction;
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
ExN02PrimaryGeneratorAction(ExN02DetectorConstruction*);
|
||||
~ExN02PrimaryGeneratorAction();
|
||||
|
||||
public:
|
||||
void GeneratePrimaries(G4Event*);
|
||||
|
||||
private:
|
||||
G4ParticleGun* particleGun;
|
||||
ExN02DetectorConstruction* myDetector;
|
||||
};
|
||||
|
||||
//....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: ExN02RunAction.hh,v 1.1 2002/03/05 15:21:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02RunAction_h
|
||||
#define ExN02RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class G4Run;
|
||||
|
||||
class ExN02RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
ExN02RunAction();
|
||||
~ExN02RunAction();
|
||||
|
||||
public:
|
||||
void BeginOfRunAction(const G4Run*);
|
||||
void EndOfRunAction(const G4Run*);
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02SteppingAction.hh,v 1.1 2002/03/05 15:21:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02SteppingAction_h
|
||||
#define ExN02SteppingAction_h 1
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02SteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
ExN02SteppingAction();
|
||||
~ExN02SteppingAction(){};
|
||||
|
||||
void UserSteppingAction(const G4Step*);
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02SteppingVerbose.hh,v 1.1 2002/03/05 15:21:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// 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......
|
||||
|
||||
class ExN02SteppingVerbose;
|
||||
|
||||
#ifndef ExN02SteppingVerbose_h
|
||||
#define ExN02SteppingVerbose_h 1
|
||||
|
||||
#include "G4SteppingVerbose.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02SteppingVerbose : public G4SteppingVerbose
|
||||
{
|
||||
public:
|
||||
|
||||
ExN02SteppingVerbose();
|
||||
~ExN02SteppingVerbose();
|
||||
|
||||
void StepInfo();
|
||||
void TrackingStarted();
|
||||
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02TrackerHit.hh,v 1.1 2002/03/05 15:21:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02TrackerHit_h
|
||||
#define ExN02TrackerHit_h 1
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02TrackerHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
|
||||
ExN02TrackerHit();
|
||||
~ExN02TrackerHit();
|
||||
ExN02TrackerHit(const ExN02TrackerHit&);
|
||||
const ExN02TrackerHit& operator=(const ExN02TrackerHit&);
|
||||
int operator==(const ExN02TrackerHit&) const;
|
||||
|
||||
inline void* operator new(size_t);
|
||||
inline void operator delete(void*);
|
||||
|
||||
void Draw();
|
||||
void Print();
|
||||
|
||||
public:
|
||||
|
||||
void SetTrackID (G4int track) { trackID = track; };
|
||||
void SetChamberNb(G4int chamb) { chamberNb = chamb; };
|
||||
void SetEdep (G4double de) { edep = de; };
|
||||
void SetPos (G4ThreeVector xyz){ pos = xyz; };
|
||||
|
||||
G4int GetTrackID() { return trackID; };
|
||||
G4int GetChamberNb() { return chamberNb; };
|
||||
G4double GetEdep() { return edep; };
|
||||
G4ThreeVector GetPos(){ return pos; };
|
||||
|
||||
private:
|
||||
|
||||
G4int trackID;
|
||||
G4int chamberNb;
|
||||
G4double edep;
|
||||
G4ThreeVector pos;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
typedef G4THitsCollection<ExN02TrackerHit> ExN02TrackerHitsCollection;
|
||||
|
||||
extern G4Allocator<ExN02TrackerHit> ExN02TrackerHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
inline void* ExN02TrackerHit::operator new(size_t)
|
||||
{
|
||||
void *aHit;
|
||||
aHit = (void *) ExN02TrackerHitAllocator.MallocSingle();
|
||||
return aHit;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
inline void ExN02TrackerHit::operator delete(void *aHit)
|
||||
{
|
||||
ExN02TrackerHitAllocator.FreeSingle((ExN02TrackerHit*) aHit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02TrackerSD.hh,v 1.1 2002/03/05 15:21:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef ExN02TrackerSD_h
|
||||
#define ExN02TrackerSD_h 1
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "ExN02TrackerHit.hh"
|
||||
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02TrackerSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
ExN02TrackerSD(G4String);
|
||||
~ExN02TrackerSD();
|
||||
|
||||
void Initialize(G4HCofThisEvent*);
|
||||
G4bool ProcessHits(G4Step*, G4TouchableHistory*);
|
||||
void EndOfEvent(G4HCofThisEvent*);
|
||||
|
||||
private:
|
||||
ExN02TrackerHitsCollection* trackerCollection;
|
||||
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02VisManager.hh,v 1.1 2002/03/05 15:21:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
|
||||
//....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 ExN02VisManager_h
|
||||
#define ExN02VisManager_h 1
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
|
||||
#include "G4VisManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class ExN02VisManager: public G4VisManager {
|
||||
|
||||
public:
|
||||
|
||||
ExN02VisManager ();
|
||||
|
||||
private:
|
||||
|
||||
void RegisterGraphicsSystems ();
|
||||
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,149 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParExMarshaledHits.hh,v 1.1 2002/03/05 15:21:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef ParExMarshaledHits_h
|
||||
#define ParExMarshaledHits_h 1
|
||||
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "ParMarshaledObj.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
// Calling sequence:
|
||||
// MarshaledHCofThisEvent::MarshaledHCofThisEvent()
|
||||
// -> MarshaledHCofThisEvent::MarshalHitsCollection
|
||||
// (G4VHitsCollection * aBaseHC, G4String HCname)
|
||||
// -> TMarshaledHitsCollection<T>::Marshal(G4VHitsCollection * aBaseHC)
|
||||
// -> TMarshaledHitsCollection<T>::MarshalHit(T *aHit)
|
||||
// MarshaledHCofThisEvent::UnmarshalSlaveHCofThisEvent()
|
||||
// -> TMarshaledHitsCollection<T>::UnmarshalSlaveHitsCollection
|
||||
// (G4String HCname, G4String SDname)
|
||||
// -> TMarshaledHitsCollection<T>::Unmarshal(G4THitsCollection<T> * aHC)
|
||||
// -> TMarshaledHitsCollection<T>::UnmarshalHit(T * aHit)
|
||||
|
||||
// class T derived from G4VHit
|
||||
template <class T> class TMarshaledHitsCollection
|
||||
: public MarshaledObj
|
||||
{
|
||||
public:
|
||||
inline void Marshal(G4VHitsCollection * aBaseHC); // Marshal hits of aBaseHC
|
||||
|
||||
inline void UnmarshalSlaveHitsCollection(G4String & HCname, G4String & SDname);
|
||||
inline void Unmarshal(G4THitsCollection<T> * aHC);
|
||||
|
||||
// By default, we a hit of type T as a void pointer
|
||||
inline void MarshalHit( T *aHit )
|
||||
{ MarshaledObj::Marshal((void *)aHit, sizeof(*aHit)); }
|
||||
|
||||
// Unmarshal hits into HC for T. By default assume it was marshaled
|
||||
// as a void pointer (ObjPtr)
|
||||
inline void UnmarshalHit(T * aHit)
|
||||
{
|
||||
if (isNewHitsCollection)
|
||||
*aHit = *(T *)MarshaledObj::UnmarshalAsSharedObjPtr();
|
||||
else
|
||||
G4Exception(
|
||||
"Event Level Parallelism: Every hit collection sent to master"
|
||||
" should be new.\n Current hit collection, "
|
||||
+ collectionName + ", is not new.\n"
|
||||
);
|
||||
}
|
||||
|
||||
protected:
|
||||
static G4bool isNewHitsCollection;
|
||||
static G4String collectionName;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
G4bool TMarshaledHitsCollection<T>::isNewHitsCollection = true;
|
||||
|
||||
template <class T>
|
||||
G4String TMarshaledHitsCollection<T>::collectionName = "<not initialized>";
|
||||
|
||||
template <class T>
|
||||
inline void TMarshaledHitsCollection<T>::Marshal(G4VHitsCollection * aBaseHC)
|
||||
{ G4THitsCollection<T> *aHC = (G4THitsCollection<T> *)aBaseHC;
|
||||
G4int numHits = aHC->entries();
|
||||
MarshaledObj::Marshal( numHits );
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "Marshaled numHits: " << numHits << G4endl;
|
||||
#endif
|
||||
for (int j = 0; j < numHits; j++) {
|
||||
T *aHit = (*aHC)[j];
|
||||
MarshalHit( aHit );
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TMarshaledHitsCollection<T>::Unmarshal
|
||||
(G4THitsCollection<T> * aHC)
|
||||
{
|
||||
G4int numHits;
|
||||
MarshaledObj::Unmarshal( numHits );
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "numHits: " << numHits << G4endl;
|
||||
#endif
|
||||
for (int j = 0; j < numHits; j++) {
|
||||
T *aHit = new T;
|
||||
UnmarshalHit( aHit );
|
||||
aHC->insert( aHit );
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void TMarshaledHitsCollection<T>::UnmarshalSlaveHitsCollection
|
||||
(G4String & HCname, G4String & SDname)
|
||||
{
|
||||
G4HCofThisEvent *HCE = G4RunManager::GetRunManager()->
|
||||
GetCurrentEvent()->
|
||||
GetHCofThisEvent();
|
||||
// Find or create HitsCollection, aHC, with name HCname
|
||||
G4THitsCollection<T> *aHC;
|
||||
// HCname is unique.
|
||||
collectionName = HCname;
|
||||
G4int HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname);
|
||||
if (HCID < 0)
|
||||
{ aHC = new G4THitsCollection<T>(SDname, HCname);
|
||||
HCID = G4SDManager::GetSDMpointer()->GetCollectionID(HCname);
|
||||
HCE->AddHitsCollection( HCID, aHC );
|
||||
isNewHitsCollection = true;
|
||||
}
|
||||
else {
|
||||
aHC = (G4THitsCollection<T> *)HCE->GetHC(HCID);
|
||||
isNewHitsCollection = ( aHC->entries() == 0 ? true : false );
|
||||
}
|
||||
|
||||
Unmarshal(aHC);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParMarshaledObj.hh,v 1.1 2002/03/05 15:21:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef ParMarshaledObj_h
|
||||
#define ParMarshaledObj_h 1
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
// Geant4 types; Which of these is the official one? G4types.hh or globals.hh
|
||||
// G4types.hh included from G4ios.hh
|
||||
#include "G4Event.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
// A MarshaledObj is conceptually a
|
||||
// dynamically resizable buffer, size, and cursor.
|
||||
// Data structure of buffer: <field1, field2, ...>
|
||||
// Note that buffer has no internal construct to determine size of buffer
|
||||
// It is the responsibility of the user to know types of field1, ...
|
||||
// There are two types of MarshaledObj, depending on whether
|
||||
// IsUnmarshaling() is true or false.
|
||||
// I use malloc/free because I can also use realloc to extend the buffer.
|
||||
|
||||
class MarshaledObj {
|
||||
private:
|
||||
// Make sure all marshaled objects are word aligned.
|
||||
static const int WORD_SIZE = sizeof(long);
|
||||
static inline int ROUND_UP( int x )
|
||||
{ return (((x)+(WORD_SIZE-1)) / WORD_SIZE) * WORD_SIZE; }
|
||||
|
||||
public:
|
||||
inline MarshaledObj(int total_size)
|
||||
:extent(ROUND_UP(total_size)),size(0)
|
||||
{ if (extent > 0)
|
||||
buffer = (char *)malloc(extent);
|
||||
else
|
||||
buffer = NULL;
|
||||
cursor = buffer + size;
|
||||
}
|
||||
inline MarshaledObj()
|
||||
:extent(128),size(0)
|
||||
{ buffer = (char *)malloc(extent);
|
||||
cursor = buffer + size;
|
||||
}
|
||||
// this is for an arbitrary buffer; we specify the size explicitly
|
||||
// if buf_len == 0, then we'll be unmarshaling
|
||||
inline MarshaledObj(void *buf, int buf_len = 0)
|
||||
:extent(ROUND_UP(buf_len+sizeof(int))),
|
||||
size(ROUND_UP(buf_len+sizeof(buf_len)))
|
||||
{ if ( buf_len <= 0 ) {
|
||||
extent = size = 0; // IMPLIES: IsUnmarshaling() => true
|
||||
buffer = (char *)buf;
|
||||
cursor = buffer;
|
||||
} else {
|
||||
buffer = (char *)malloc(extent);
|
||||
*(int *)buffer = buf_len;
|
||||
memcpy( buffer+sizeof(int), (char *)buf, extent );
|
||||
cursor = buffer + size;
|
||||
}
|
||||
}
|
||||
inline ~MarshaledObj()
|
||||
{ if ( ! IsUnmarshaling() )
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
inline bool IsUnmarshaling() { return (extent <= 0); }
|
||||
|
||||
private:
|
||||
// Don't use copy constructor
|
||||
const MarshaledObj& operator=(const MarshaledObj& right);
|
||||
|
||||
protected:
|
||||
char *buffer; /* First entry is size of buffer */
|
||||
private:
|
||||
int extent; /* extent is number of bytes allocated, extent >= size */
|
||||
int size; /* Initially, buffer has entry for size */
|
||||
char *cursor;
|
||||
|
||||
inline void ResizeBuffer( size_t new_size )
|
||||
{ int displacement = cursor - buffer;
|
||||
extent = new_size;
|
||||
buffer = (char *)realloc( buffer, extent );
|
||||
cursor = buffer + displacement;
|
||||
}
|
||||
|
||||
public:
|
||||
inline int BufferSize()
|
||||
{ return cursor - buffer; }
|
||||
inline void *GetBuffer() {
|
||||
return buffer;
|
||||
}
|
||||
// inline void SetNewBuffer(void *buf) {
|
||||
// free(buffer);
|
||||
// buffer = (char *)buf;
|
||||
// size = 0; /* unknown size */
|
||||
// cursor = buffer;
|
||||
// }
|
||||
|
||||
#define MarshalDefinition(TYPE) \
|
||||
inline void Marshal(TYPE a##TYPE) { \
|
||||
if (IsUnmarshaling()) \
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true"; \
|
||||
size += ROUND_UP(sizeof(a##TYPE)); \
|
||||
while ( size > extent ) \
|
||||
ResizeBuffer( 2 * extent ); \
|
||||
*(TYPE *)cursor = a##TYPE; \
|
||||
cursor = buffer + size; \
|
||||
} \
|
||||
inline void Unmarshal(TYPE & a##TYPE) { \
|
||||
a##TYPE = *(TYPE *)cursor; \
|
||||
cursor += ROUND_UP(sizeof(a##TYPE)); \
|
||||
} \
|
||||
inline TYPE UnmarshalAs##TYPE() { \
|
||||
TYPE a##TYPE = *(TYPE *)cursor; \
|
||||
cursor += ROUND_UP(sizeof(a##TYPE)); \
|
||||
return a##TYPE; \
|
||||
}
|
||||
|
||||
// This works for any inline objects (no embedded pointers)
|
||||
MarshalDefinition(G4int)
|
||||
MarshalDefinition(G4double)
|
||||
MarshalDefinition(G4ThreeVector)
|
||||
// MarshalDefinition(int)
|
||||
// MarshalDefinition(double)
|
||||
|
||||
|
||||
// These cannot follow the pattern, since the data is not inline.
|
||||
inline void MarshalG4String(G4String& aG4String) {
|
||||
if (IsUnmarshaling())
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true";
|
||||
size += ROUND_UP( aG4String.length() + 1 ); // 1 for final NULL char
|
||||
while ( size > extent )
|
||||
ResizeBuffer( 2 * extent );
|
||||
strcpy( (char *)cursor, aG4String );
|
||||
cursor = buffer + size;
|
||||
}
|
||||
inline void Marshal(G4String& aG4String)
|
||||
{ MarshalG4String( aG4String ); }
|
||||
inline void Unmarshal(G4String& aG4String) {
|
||||
aG4String = (char *)cursor;
|
||||
cursor += ROUND_UP( aG4String.length() + 1 ); // 1 for final NULL char
|
||||
}
|
||||
// INEFFICIENT? (copies return value)
|
||||
inline G4String UnmarshalAsG4String() {
|
||||
G4String aG4String = (char *)cursor;
|
||||
cursor += ROUND_UP( aG4String.length() + 1 ); // 1 for final NULL char
|
||||
return aG4String;
|
||||
}
|
||||
|
||||
// USAGE: MarshalObjPtr( &aG4obj, sizeof(aG4obj) );
|
||||
// USAGE: MarshaledObj tmp;
|
||||
// G4Obj *aObjPtr = tmp.UnmarshalObjPtr();
|
||||
// ...
|
||||
// delete aObjPtr;
|
||||
inline void MarshalObjPtr(const void * aObjPtr, int obj_size)
|
||||
{
|
||||
if (IsUnmarshaling())
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true";
|
||||
size += ROUND_UP( obj_size + sizeof(int) );
|
||||
while ( size > extent )
|
||||
ResizeBuffer( 2 * extent );
|
||||
*(int *)cursor = obj_size;
|
||||
memcpy( cursor+sizeof(int), aObjPtr, obj_size );
|
||||
cursor = buffer + size;
|
||||
}
|
||||
inline void Marshal(const void * aObjPtr, int obj_size)
|
||||
{ MarshalObjPtr(aObjPtr,obj_size); }
|
||||
inline void Unmarshal(void * & aObjPtr)
|
||||
{
|
||||
int obj_size = *(int *)cursor;
|
||||
aObjPtr = malloc( obj_size );
|
||||
memcpy( aObjPtr, cursor+sizeof(int), obj_size );
|
||||
cursor += ROUND_UP( obj_size + sizeof(int) );
|
||||
}
|
||||
inline void * UnmarshalAsObjPtr()
|
||||
{
|
||||
void *aObjPtr;
|
||||
Unmarshal(aObjPtr);
|
||||
return aObjPtr;
|
||||
}
|
||||
inline void * UnmarshalAsSharedObjPtr()
|
||||
{
|
||||
int obj_size = *(int *)cursor;
|
||||
void *aObjPtr;
|
||||
aObjPtr = cursor+sizeof(int);
|
||||
cursor += ROUND_UP( obj_size + sizeof(int) );
|
||||
return aObjPtr;
|
||||
}
|
||||
// UnmarshalAsSharedObjPtr: return value points into buffer of curr. obj.
|
||||
|
||||
inline void MarshalMarshaledObj(MarshaledObj& aMarshaledObj) {
|
||||
if (IsUnmarshaling())
|
||||
throw "Tried to marshal in object marked isUnmarshaling = true";
|
||||
MarshalObjPtr( aMarshaledObj.GetBuffer(), aMarshaledObj.BufferSize() );
|
||||
}
|
||||
// INEFFICIENT? (copies return value)
|
||||
inline MarshaledObj UnmarshalAsMarshaledObj() {
|
||||
MarshaledObj aMarshaledObj( ((char *)cursor)+sizeof(int), *(int *)cursor );
|
||||
cursor += ROUND_UP( aMarshaledObj.BufferSize()+sizeof(int) );
|
||||
return aMarshaledObj;
|
||||
}
|
||||
};
|
||||
|
||||
class MarshaledHCofThisEvent : public MarshaledObj
|
||||
{
|
||||
public:
|
||||
inline MarshaledHCofThisEvent(int size) : MarshaledObj(size) { }
|
||||
// Trivial constructor. MarshaledHCofThisEvent(0) creates nothing.
|
||||
MarshaledHCofThisEvent();
|
||||
// Constructor copies hits from HCE of master in this marshaled object
|
||||
MarshaledHCofThisEvent(G4Event *anEvent);
|
||||
// Constructor copies hits from HCE of anEvent in this marshaled object
|
||||
inline MarshaledHCofThisEvent(void *buf)
|
||||
: MarshaledObj(buf) // Object will be set for IsUnmarshaling
|
||||
{ }
|
||||
|
||||
void UnmarshalSlaveHCofThisEvent();
|
||||
// Unmarshal copies hits from slave in HCE of master
|
||||
// We inherit destructor of ParMarshaledObj
|
||||
// It does so by calling UnmarshalSlaveHitsCollection for dispatching
|
||||
void UnmarshalSlaveHitsCollection(G4String & HCname, G4String & SDname);
|
||||
|
||||
void MarshalHitsCollection(G4VHitsCollection * aBaseHC, G4String HCname);
|
||||
// To be defined in ParExN02MarshaledHits.cc or other
|
||||
// application-specific file.
|
||||
|
||||
private:
|
||||
// Don't use copy constructor
|
||||
const MarshaledHCofThisEvent& operator=(const MarshaledHCofThisEvent& right);
|
||||
void MarshalHitsCollection(const G4Event *anEvent);
|
||||
};
|
||||
|
||||
/*
|
||||
main() {
|
||||
MarshaledObj tmp = MarshaledObj();
|
||||
tmp.Marshal(5);
|
||||
tmp.Marshal(5.3);
|
||||
tmp.Marshal(7);
|
||||
|
||||
MarshaledObj tmp2;
|
||||
tmp2.MarshalMarshaledObj(tmp);
|
||||
cout << tmp2.UnmarshalAsG4int() << "\n";
|
||||
cout << tmp2.UnmarshalAsG4double() << "\n";
|
||||
cout << tmp2.UnmarshalAsG4int() << "\n";
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParRandomState.hh,v 1.1 2002/03/05 15:21:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
// Each of the three members below must be modified for the application.
|
||||
// This default version simply sets the random seed on the slave using
|
||||
// the eventID.
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef ParMarshaledRandomState_h
|
||||
#define ParMarshaledRandomState_h 1
|
||||
|
||||
#include "ParMarshaledObj.hh"
|
||||
|
||||
class ParMarshaledRandomState : public MarshaledObj
|
||||
{
|
||||
public:
|
||||
// If 0, GetNextRandomStateForSlave not called.
|
||||
static const int RANDOM_STATE_SIZE = sizeof(long);
|
||||
|
||||
// Called on master
|
||||
inline void *GetNextRandomStateForSlave()
|
||||
{ static long * nextSeed = new long;
|
||||
*nextSeed = (long) (100000000L * HepRandom::getTheGenerator()->flat());
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "GET SEED: " << *nextSeed << G4endl;
|
||||
#endif
|
||||
return nextSeed;
|
||||
}
|
||||
|
||||
// Called on slave at beginning of new event.
|
||||
inline void SetNextRandomStateForSlave( G4int eventID, void *randomState )
|
||||
{ HepRandom::setTheSeed( *(long *)randomState );
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "SET SEED: " << *(long *)randomState << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
// The constructors do not need to be modified.
|
||||
inline ParMarshaledRandomState( G4int eventID )
|
||||
: MarshaledObj(RANDOM_STATE_SIZE+sizeof(int)+sizeof(G4int))
|
||||
{ Marshal(eventID);
|
||||
Marshal( GetNextRandomStateForSlave(), RANDOM_STATE_SIZE );
|
||||
}
|
||||
inline ParMarshaledRandomState( void *buf )
|
||||
: MarshaledObj(buf)
|
||||
// MarshaledObj() called with buf and 0 size, creates object for unmarshaling
|
||||
{ }
|
||||
|
||||
inline void unmarshalEventIDandSetState( G4int & eventID )
|
||||
{ Unmarshal(eventID);
|
||||
// SharedObjPtr is pointer to random state.
|
||||
SetNextRandomStateForSlave( eventID, UnmarshalAsSharedObjPtr() );
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParRunManager.hh,v 1.2 2002/06/06 17:05:02 cooperma Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef ParRunManager_h
|
||||
#define ParRunManager_h 1
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "topc.h"
|
||||
|
||||
class ParRunManager : public G4RunManager
|
||||
{
|
||||
|
||||
protected:
|
||||
virtual void DoEventLoop(G4int n_event,
|
||||
const char* macroFile=0,
|
||||
G4int n_select=-1);
|
||||
|
||||
private: // TOP-C callbacks
|
||||
TOPC_BUF GenerateEventInput();
|
||||
TOPC_BUF DoEvent( void * input_buf );
|
||||
TOPC_ACTION CheckEventResult( void * input_buf, void * ignore );
|
||||
|
||||
static ParRunManager* myRunManager;
|
||||
static TOPC_BUF MyGenerateEventInput();
|
||||
static TOPC_BUF MyDoEvent( void * input_buf );
|
||||
static TOPC_ACTION MyCheckEventResult( void * input_buf, void * ignore );
|
||||
|
||||
// Copies of local variables of G4RunManager::DoEventLoop()
|
||||
static G4StateManager* stateManager;
|
||||
static G4int n_event;
|
||||
static G4int n_select;
|
||||
static G4String msg;
|
||||
|
||||
G4int i_event; // Used in lieu of i_event in RunManager::DoEventLoop()
|
||||
|
||||
inline void ImportDoEventLoopLocals(
|
||||
G4StateManager* stateManager, G4int n_event,
|
||||
G4int n_select, G4String msg )
|
||||
{
|
||||
ParRunManager::stateManager = stateManager;
|
||||
ParRunManager::n_event = n_event;
|
||||
ParRunManager::n_select = n_select;
|
||||
ParRunManager::msg = msg;
|
||||
ParRunManager::myRunManager = this;
|
||||
}
|
||||
|
||||
// Copy of userEventAction: see ParRunManager.cc for further comments
|
||||
G4UserEventAction * origUserEventAction;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#
|
||||
# Macro file for the initialization phase of "ParN02.cc"
|
||||
# when runing in interactive mode
|
||||
#
|
||||
# Sets some default verbose
|
||||
#
|
||||
/control/verbose 2
|
||||
/run/verbose 2
|
||||
#
|
||||
# create empty scene
|
||||
#
|
||||
/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/camera/zoom 1.4
|
||||
/vis/camera/viewpoint 90 180
|
||||
/vis/drawVolume
|
||||
#
|
||||
# for drawing the tracks
|
||||
# (if too many tracks cause core dump => storeTrajectory 0)
|
||||
/tracking/storeTrajectory 1
|
||||
/vis/scene/add/trajectories
|
||||
@@ -0,0 +1,62 @@
|
||||
# NOTE: '#' in column 0 is a comment.
|
||||
|
||||
local 0
|
||||
localhost 1 - >slave1.out
|
||||
localhost 1 - >slave2.out
|
||||
|
||||
# lxplus015.cern.ch 1 - >slave1.out
|
||||
# lxplus016.cern.ch 1 - >slave2.out
|
||||
# xplus017.cern.ch 1 - >slave2.out
|
||||
|
||||
# The general format is that "local 0" (required) implies creation of a master.
|
||||
# Otherwise there is one line per slave.
|
||||
# The first field is the hostname or localhost (in a form valid for "rsh")
|
||||
# If you prefer ssh over rsh, then (e.g. in csh): setenv RSH ssh
|
||||
# The second field, 1, is obligatory.
|
||||
# The third field is an absolute or relative pathname (e.g.: ./XXX or ../XXX)
|
||||
# of the binary. A relative pathname is appended to path of the binary
|
||||
# on master. The slave process will execute in the same directory
|
||||
# as the current working directory of the master, if possible.
|
||||
# Otherwise, the slave will execute in the home directory.
|
||||
# If the third field is `-', then the command line (including arguments)
|
||||
# for that slave will be the same as on the master.
|
||||
# Any additional fields (fourth and beyond) are appended to the
|
||||
# command line for that slave only.
|
||||
# Note that '>slave1.out' works, redirecting standard output. However,
|
||||
# the output file, slave1.out, will be placed in the home directory.
|
||||
# Currently, `localhost' implies the Bourne shell, and any other
|
||||
# name implies the default user shell for that machine.
|
||||
# By default, standard output and error are sent to user tty (a la rsh).
|
||||
#
|
||||
# The format is inherited from MPICH, which grew from P4.
|
||||
|
||||
#=========================================================================
|
||||
#EXAMPLE:
|
||||
# # Master process
|
||||
# local 0
|
||||
# # One slave process on local computer, using same binary and same arguments
|
||||
# localhost 1 -
|
||||
# # One remote slave process, with absolute path to binary and no arguments
|
||||
# regulus.ccs.neu.edu 1 /ccs/tmp/gene/a.out
|
||||
# # One slave using alpha architecture,
|
||||
# # with path of alpha binary relative to binary of this master process.
|
||||
# # Output placed in slave-alpha-1.out in user's home directory.
|
||||
# alpha.ccs.neu.edu 1 ../alpha/a.out > slave-alpha-1.out
|
||||
|
||||
#=========================================================================
|
||||
#IF YOU HAVE PROBLEMS:
|
||||
# MPINU uses "rsh" to start a slave process. Diagnose it via:
|
||||
# rsh REMOTE_SLAVE_HOST hostname
|
||||
# If it doesn't work or if it asks you for a password, try:
|
||||
# 1. Add a .rhosts file on the remote host and specify your local host.
|
||||
# 2. Sometimes adding .localhost to your .rhosts helps.
|
||||
# 3. Specify an alternative to "rsh" in your shell. For example:
|
||||
# RSH=ssh; export RSH # in Bourne shell, bash, etc.
|
||||
# setenv RSH ssh # in csh, tcsh, etc.
|
||||
# 4. If you use "ssh", you may also need to copy keys to allow
|
||||
# login to the remote host without a password.
|
||||
# It's also possible that mpinu guessed badly the hostname of your local host.
|
||||
# If you suspect this, on the master try (in csh, tcsh):
|
||||
# setenv CALLBACK_HOST LOCAL_MASTER_HOST
|
||||
# where LOCAL_MASTER_HOST is the correct hostname of the local master.
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
# This procgroup file is designed for the lxplus cluster at CERN.
|
||||
# It assumes that 50 slaves, lxplus002 to lxplus051, are all available via
|
||||
# rsh without a password (assuming the master process is on lxplus001.
|
||||
# The 50 slave files are placed in your home directory
|
||||
# (and in the next version, in your current directory).
|
||||
# Make sure that your run-time files are all in afs directories
|
||||
# so that the files are also visible to slaves.
|
||||
# Remember that other users may be using this cluster.
|
||||
# Use this only for a short demonstration.
|
||||
|
||||
# When running, consider adding --TOPC-num-slaves=10
|
||||
# or something similarly moderate at first.
|
||||
# There can be long delays in starting many slaves at once.
|
||||
|
||||
local 0
|
||||
lxplus001 1 - > slave001.out
|
||||
lxplus002 1 - > slave002.out
|
||||
lxplus003 1 - > slave003.out
|
||||
lxplus004 1 - > slave004.out
|
||||
lxplus005 1 - > slave005.out
|
||||
lxplus006 1 - > slave006.out
|
||||
lxplus007 1 - > slave007.out
|
||||
lxplus008 1 - > slave008.out
|
||||
lxplus009 1 - > slave009.out
|
||||
lxplus011 1 - > slave011.out
|
||||
lxplus012 1 - > slave012.out
|
||||
lxplus013 1 - > slave013.out
|
||||
lxplus014 1 - > slave014.out
|
||||
lxplus015 1 - > slave015.out
|
||||
lxplus016 1 - > slave016.out
|
||||
lxplus017 1 - > slave017.out
|
||||
lxplus018 1 - > slave018.out
|
||||
lxplus019 1 - > slave019.out
|
||||
lxplus021 1 - > slave021.out
|
||||
lxplus022 1 - > slave022.out
|
||||
lxplus023 1 - > slave023.out
|
||||
lxplus024 1 - > slave024.out
|
||||
lxplus025 1 - > slave025.out
|
||||
lxplus026 1 - > slave026.out
|
||||
lxplus027 1 - > slave027.out
|
||||
lxplus028 1 - > slave028.out
|
||||
lxplus029 1 - > slave029.out
|
||||
lxplus031 1 - > slave031.out
|
||||
lxplus032 1 - > slave032.out
|
||||
lxplus033 1 - > slave033.out
|
||||
lxplus034 1 - > slave034.out
|
||||
lxplus035 1 - > slave035.out
|
||||
lxplus036 1 - > slave036.out
|
||||
lxplus037 1 - > slave037.out
|
||||
lxplus038 1 - > slave038.out
|
||||
lxplus039 1 - > slave039.out
|
||||
lxplus041 1 - > slave041.out
|
||||
lxplus042 1 - > slave042.out
|
||||
lxplus043 1 - > slave043.out
|
||||
lxplus044 1 - > slave044.out
|
||||
lxplus045 1 - > slave045.out
|
||||
lxplus046 1 - > slave046.out
|
||||
lxplus047 1 - > slave047.out
|
||||
lxplus048 1 - > slave048.out
|
||||
lxplus049 1 - > slave049.out
|
||||
lxplus041 1 - > slave041.out
|
||||
lxplus042 1 - > slave042.out
|
||||
lxplus043 1 - > slave043.out
|
||||
lxplus044 1 - > slave044.out
|
||||
lxplus045 1 - > slave045.out
|
||||
lxplus046 1 - > slave046.out
|
||||
lxplus047 1 - > slave047.out
|
||||
lxplus048 1 - > slave048.out
|
||||
lxplus049 1 - > slave049.out
|
||||
lxplus050 1 - > slave050.out
|
||||
lxplus051 1 - > slave051.out
|
||||
@@ -0,0 +1,23 @@
|
||||
# $Id: run1.mac,v 1.1 2002/03/05 15:21:54 gcosmo Exp $
|
||||
#
|
||||
# Macro file for "ParN02.cc"
|
||||
#
|
||||
# can be run in batch, without graphic
|
||||
# or interactively: Idle> /control/execute run1.mac
|
||||
#
|
||||
/run/verbose 2
|
||||
/event/verbose 0
|
||||
#
|
||||
# proton 3 GeV to the direction (0.,0.,1.) (default kinematic)
|
||||
# 1 event with detailled printing
|
||||
#
|
||||
/tracking/verbose 1
|
||||
/run/beamOn 1
|
||||
#
|
||||
# muon 300 MeV to the direction (0.,0.,1.)
|
||||
# 3 events (no printing)
|
||||
#
|
||||
/gun/particle mu-
|
||||
/gun/energy 300 MeV
|
||||
/tracking/verbose 0
|
||||
/run/beamOn 3
|
||||
@@ -0,0 +1,23 @@
|
||||
# $Id: run2.mac,v 1.1 2002/03/05 15:21:54 gcosmo Exp $
|
||||
#
|
||||
# Macro file for "ParN02.cc"
|
||||
#
|
||||
# can be run in batch, without graphic
|
||||
# or interactively: Idle> /control/execute run2.mac
|
||||
#
|
||||
/run/verbose 2
|
||||
/event/verbose 0
|
||||
#
|
||||
# proton 3 GeV to the direction (0.,0.,1.) (default kinematic)
|
||||
# 1 event with detailled printing
|
||||
#
|
||||
/tracking/verbose 1
|
||||
/run/beamOn 1
|
||||
#
|
||||
# set a magnetic field
|
||||
# 1 events; print the hits
|
||||
#
|
||||
/mydet/setField 2 tesla
|
||||
/tracking/verbose 0
|
||||
/hits/verbose 1
|
||||
/run/beamOn 1
|
||||
@@ -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: ExN02ChamberParameterisation.cc,v 1.1 2002/03/05 15:21:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02ChamberParameterisation.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Box.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02ChamberParameterisation::ExN02ChamberParameterisation(
|
||||
G4int NoChambers,
|
||||
G4double startZ, // Z of center of first
|
||||
G4double spacingZ, // Z spacing of centers
|
||||
G4double widthChamber,
|
||||
G4double lengthInitial,
|
||||
G4double lengthFinal )
|
||||
{
|
||||
fNoChambers = NoChambers;
|
||||
fStartZ = startZ;
|
||||
fHalfWidth = widthChamber*0.5;
|
||||
fSpacing = spacingZ;
|
||||
fHalfLengthFirst = 0.5 * lengthInitial;
|
||||
// fHalfLengthLast = lengthFinal;
|
||||
if( NoChambers > 0 ){
|
||||
fHalfLengthIncr = 0.5 * (lengthFinal-lengthInitial)/NoChambers;
|
||||
if (spacingZ < widthChamber) {
|
||||
G4Exception("ExN02ChamberParameterisation construction: Width>Spacing");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02ChamberParameterisation::~ExN02ChamberParameterisation()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02ChamberParameterisation::ComputeTransformation
|
||||
(const G4int copyNo, G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
G4double Zposition= fStartZ + (copyNo+1) * fSpacing;
|
||||
G4ThreeVector origin(0,0,Zposition);
|
||||
physVol->SetTranslation(origin);
|
||||
physVol->SetRotation(0);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02ChamberParameterisation::ComputeDimensions
|
||||
(G4Box& trackerChamber, const G4int copyNo,
|
||||
const G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
G4double halfLength= fHalfLengthFirst + copyNo * fHalfLengthIncr;
|
||||
trackerChamber.SetXHalfLength(halfLength);
|
||||
trackerChamber.SetYHalfLength(halfLength);
|
||||
trackerChamber.SetZHalfLength(fHalfWidth);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,291 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02DetectorConstruction.cc,v 1.1 2002/03/05 15:22:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02DetectorConstruction.hh"
|
||||
#include "ExN02DetectorMessenger.hh"
|
||||
#include "ExN02ChamberParameterisation.hh"
|
||||
#include "ExN02MagneticField.hh"
|
||||
#include "ExN02TrackerSD.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4UserLimits.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02DetectorConstruction::ExN02DetectorConstruction()
|
||||
:solidWorld(0), logicWorld(0), physiWorld(0),
|
||||
solidTarget(0), logicTarget(0), physiTarget(0),
|
||||
solidTracker(0),logicTracker(0),physiTracker(0),
|
||||
solidChamber(0),logicChamber(0),physiChamber(0),
|
||||
TargetMater(0), ChamberMater(0),fpMagField(0),
|
||||
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
|
||||
NbOfChambers(0) , ChamberWidth(0.), ChamberSpacing(0.)
|
||||
{
|
||||
fpMagField = new ExN02MagneticField();
|
||||
detectorMessenger = new ExN02DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02DetectorConstruction::~ExN02DetectorConstruction()
|
||||
{
|
||||
delete fpMagField;
|
||||
delete detectorMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
|
||||
{
|
||||
//--------- Material definition ---------
|
||||
|
||||
G4double a, iz, z, density;
|
||||
G4String name, symbol;
|
||||
G4double temperature, pressure;
|
||||
G4int nel;
|
||||
|
||||
//Air
|
||||
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);
|
||||
density = 1.29*mg/cm3;
|
||||
G4Material* Air = new G4Material(name="Air", density, nel=2);
|
||||
Air->AddElement(elN, .7);
|
||||
Air->AddElement(elO, .3);
|
||||
|
||||
//Pb
|
||||
a = 207.19*g/mole;
|
||||
density = 11.35*g/cm3;
|
||||
G4Material* Pb = new G4Material(name="Pb", z=82., a, density);
|
||||
|
||||
//Xenon gas
|
||||
density = 5.458*mg/cm3;
|
||||
pressure = 1*atmosphere;
|
||||
temperature = 293.15*kelvin;
|
||||
G4Material* Xenon = new G4Material(name="XenonGas", z=54., a=131.29*g/mole,
|
||||
density, kStateGas,temperature,pressure);
|
||||
|
||||
// Print all the materials defined.
|
||||
//
|
||||
G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//--------- Sizes of the principal geometrical components (solids) ---------
|
||||
|
||||
NbOfChambers = 5;
|
||||
ChamberWidth = 20*cm;
|
||||
ChamberSpacing = 80*cm;
|
||||
|
||||
fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker
|
||||
fTargetLength = 5.0 * cm; // Full length of Target
|
||||
|
||||
TargetMater = Pb;
|
||||
ChamberMater = Xenon;
|
||||
|
||||
fWorldLength= 1.2 *(fTargetLength+fTrackerLength);
|
||||
|
||||
G4double targetSize = 0.5*fTargetLength; // Half length of the Target
|
||||
G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker
|
||||
|
||||
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
|
||||
|
||||
//------------------------------
|
||||
// World
|
||||
//------------------------------
|
||||
|
||||
G4double HalfWorldLength = 0.5*fWorldLength;
|
||||
|
||||
solidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength);
|
||||
logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0);
|
||||
|
||||
// Must place the World Physical volume unrotated at (0,0,0).
|
||||
//
|
||||
physiWorld = new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
"World", // its name
|
||||
logicWorld, // its logical volume
|
||||
0, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // no field specific to volume
|
||||
|
||||
//------------------------------
|
||||
// Target
|
||||
//------------------------------
|
||||
|
||||
G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetSize+trackerSize));
|
||||
|
||||
solidTarget = new G4Box("target",targetSize,targetSize,targetSize);
|
||||
logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"Target",0,0,0);
|
||||
physiTarget = new G4PVPlacement(0, // no rotation
|
||||
positionTarget, // at (x,y,z)
|
||||
"Target", // its name
|
||||
logicTarget, // its logical volume
|
||||
physiWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // no particular field
|
||||
|
||||
G4cout << "Target is " << fTargetLength/cm << " cm of "
|
||||
<< TargetMater->GetName() << G4endl;
|
||||
|
||||
//------------------------------
|
||||
// Tracker
|
||||
//------------------------------
|
||||
|
||||
G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
|
||||
|
||||
solidTracker = new G4Box("tracker",trackerSize,trackerSize,trackerSize);
|
||||
logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
|
||||
physiTracker = new G4PVPlacement(0, // no rotation
|
||||
positionTracker, // at (x,y,z)
|
||||
"Tracker", // its name
|
||||
logicTracker, // its logical volume
|
||||
physiWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // no particular field
|
||||
|
||||
//------------------------------
|
||||
// Tracker segments
|
||||
//------------------------------
|
||||
//
|
||||
// An example of Parameterised volumes
|
||||
// dummy values for G4Box -- modified by parameterised volume
|
||||
|
||||
solidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm);
|
||||
logicChamber = new G4LogicalVolume(solidChamber,ChamberMater,"Chamber",0,0,0);
|
||||
|
||||
G4double firstPosition = -trackerSize + 0.5*ChamberWidth;
|
||||
G4double firstLength = fTrackerLength/10;
|
||||
G4double lastLength = fTrackerLength;
|
||||
|
||||
G4VPVParameterisation* chamberParam = new ExN02ChamberParameterisation(
|
||||
NbOfChambers, // NoChambers
|
||||
firstPosition, // Z of center of first
|
||||
ChamberSpacing, // Z spacing of centers
|
||||
ChamberWidth, // Width Chamber
|
||||
firstLength, // lengthInitial
|
||||
lastLength); // lengthFinal
|
||||
|
||||
// dummy value : kZAxis -- modified by parameterised volume
|
||||
//
|
||||
physiChamber = new G4PVParameterised(
|
||||
"Chamber", // their name
|
||||
logicChamber, // their logical volume
|
||||
physiTracker, // Mother physical volume
|
||||
kZAxis, // Are placed along this axis
|
||||
NbOfChambers, // Number of chambers
|
||||
chamberParam); // The parametrisation
|
||||
|
||||
G4cout << "There are " << NbOfChambers << " chambers in the tracker region. "
|
||||
<< "The chambers are " << ChamberWidth/mm << " mm of "
|
||||
<< ChamberMater->GetName() << "\n The distance between chamber is "
|
||||
<< ChamberSpacing/cm << " cm" << G4endl;
|
||||
|
||||
//------------------------------------------------
|
||||
// Sensitive detectors
|
||||
//------------------------------------------------
|
||||
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
G4String trackerChamberSDname = "ExN02/TrackerChamberSD";
|
||||
ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname );
|
||||
SDman->AddNewDetector( aTrackerSD );
|
||||
logicChamber->SetSensitiveDetector( aTrackerSD );
|
||||
|
||||
//--------- Visualization attributes -------------------------------
|
||||
|
||||
G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
logicWorld ->SetVisAttributes(BoxVisAtt);
|
||||
logicTarget ->SetVisAttributes(BoxVisAtt);
|
||||
logicTracker->SetVisAttributes(BoxVisAtt);
|
||||
|
||||
G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
|
||||
logicChamber->SetVisAttributes(ChamberVisAtt);
|
||||
|
||||
//--------- example of User Limits -------------------------------
|
||||
|
||||
// below is an example of how to set tracking constraints in a given
|
||||
// logical volume(see also in N02PhysicsList how to setup the process
|
||||
// G4UserSpecialCuts).
|
||||
// Sets a max Step length in the tracker region
|
||||
// G4double maxStep = 0.5*ChamberWidth, maxLength = 2*fTrackerLength;
|
||||
// G4double maxTime = 0.1*ns, minEkin = 10*MeV;
|
||||
// logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
|
||||
// minEkin));
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorConstruction::setTargetMaterial(G4String materialName)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
|
||||
if (pttoMaterial)
|
||||
{TargetMater = pttoMaterial;
|
||||
logicTarget->SetMaterial(pttoMaterial);
|
||||
G4cout << "\n----> The target is " << fTargetLength/cm << " cm of "
|
||||
<< materialName << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorConstruction::setChamberMaterial(G4String materialName)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
|
||||
if (pttoMaterial)
|
||||
{ChamberMater = pttoMaterial;
|
||||
logicChamber->SetMaterial(pttoMaterial);
|
||||
G4cout << "\n----> The chambers are " << ChamberWidth/cm << " cm of "
|
||||
<< materialName << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorConstruction::SetMagField(G4double fieldValue)
|
||||
{
|
||||
fpMagField->SetFieldValue(fieldValue);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02DetectorMessenger.cc,v 1.1 2002/03/05 15:22:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02DetectorMessenger.hh"
|
||||
|
||||
#include "ExN02DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02DetectorMessenger::ExN02DetectorMessenger(ExN02DetectorConstruction* myDet)
|
||||
:myDetector(myDet)
|
||||
{
|
||||
|
||||
mydetDir = new G4UIdirectory("/mydet/");
|
||||
mydetDir->SetGuidance("ExN02 detector control.");
|
||||
|
||||
TargMatCmd = new G4UIcmdWithAString("/mydet/setTargetMate",this);
|
||||
TargMatCmd->SetGuidance("Select Material of the Target.");
|
||||
TargMatCmd->SetParameterName("choice",false);
|
||||
TargMatCmd->AvailableForStates(PreInit,Idle);
|
||||
|
||||
ChamMatCmd = new G4UIcmdWithAString("/mydet/setChamberMate",this);
|
||||
ChamMatCmd->SetGuidance("Select Material of the Target.");
|
||||
ChamMatCmd->SetParameterName("choice",false);
|
||||
ChamMatCmd->AvailableForStates(PreInit,Idle);
|
||||
|
||||
FieldCmd = new G4UIcmdWithADoubleAndUnit("/mydet/setField",this);
|
||||
FieldCmd->SetGuidance("Define magnetic field.");
|
||||
FieldCmd->SetGuidance("Magnetic field will be in X direction.");
|
||||
FieldCmd->SetParameterName("Bx",false);
|
||||
FieldCmd->SetDefaultUnit("tesla");
|
||||
FieldCmd->SetUnitCategory("Magnetic flux density");
|
||||
FieldCmd->AvailableForStates(PreInit,Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02DetectorMessenger::~ExN02DetectorMessenger()
|
||||
{
|
||||
delete TargMatCmd;
|
||||
delete ChamMatCmd;
|
||||
delete FieldCmd;
|
||||
delete mydetDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == TargMatCmd )
|
||||
{ myDetector->setTargetMaterial(newValue);}
|
||||
|
||||
if( command == ChamMatCmd )
|
||||
{ myDetector->setChamberMaterial(newValue);}
|
||||
|
||||
if( command == FieldCmd )
|
||||
{ myDetector->SetMagField(FieldCmd->GetNewDoubleValue(newValue));}
|
||||
}
|
||||
|
||||
//....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: ExN02EventAction.cc,v 1.1 2002/03/05 15:22:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02EventAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02EventAction::ExN02EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02EventAction::~ExN02EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02EventAction::BeginOfEventAction(const G4Event*)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int event_id = evt->GetEventID();
|
||||
|
||||
// get number of stored trajectories
|
||||
//
|
||||
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
G4int n_trajectories = 0;
|
||||
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
|
||||
|
||||
// periodic printing
|
||||
//
|
||||
if (event_id < 100 || event_id%100 == 0) {
|
||||
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
|
||||
G4cout << " " << n_trajectories
|
||||
<< " trajectories stored in this event." << G4endl;
|
||||
}
|
||||
|
||||
// extract the trajectories and draw them
|
||||
//
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
for (G4int i=0; i<n_trajectories; i++)
|
||||
{ G4Trajectory* trj = (G4Trajectory*)
|
||||
((*(evt->GetTrajectoryContainer()))[i]);
|
||||
trj->DrawTrajectory(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02MagneticField.cc,v 1.1 2002/03/05 15:22:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// User Field class implementation.
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02MagneticField.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02MagneticField::ExN02MagneticField()
|
||||
: G4UniformMagField(G4ThreeVector())
|
||||
{
|
||||
GetGlobalFieldManager()->SetDetectorField(this);
|
||||
GetGlobalFieldManager()->CreateChordFinder(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02MagneticField::ExN02MagneticField(G4ThreeVector fieldVector)
|
||||
: G4UniformMagField(fieldVector)
|
||||
{
|
||||
GetGlobalFieldManager()->SetDetectorField(this);
|
||||
GetGlobalFieldManager()->CreateChordFinder(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Set the value of the Global Field to fieldValue along X
|
||||
//
|
||||
void ExN02MagneticField::SetFieldValue(G4double fieldValue)
|
||||
{
|
||||
G4UniformMagField::SetFieldValue(G4ThreeVector(fieldValue,0,0));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Set the value of the Global Field
|
||||
//
|
||||
void ExN02MagneticField::SetFieldValue(G4ThreeVector fieldVector)
|
||||
{
|
||||
// Find the Field Manager for the global field
|
||||
G4FieldManager* fieldMgr= GetGlobalFieldManager();
|
||||
|
||||
if(fieldVector!=G4ThreeVector(0.,0.,0.))
|
||||
{
|
||||
G4UniformMagField::SetFieldValue(fieldVector);
|
||||
fieldMgr->SetDetectorField(this);
|
||||
} else {
|
||||
// If the new field's value is Zero, then it is best to
|
||||
// insure that it is not used for propagation.
|
||||
G4MagneticField* magField = NULL;
|
||||
fieldMgr->SetDetectorField(magField);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02MagneticField::~ExN02MagneticField()
|
||||
{
|
||||
// GetGlobalFieldManager()->SetDetectorField(0);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
G4FieldManager* ExN02MagneticField::GetGlobalFieldManager()
|
||||
{
|
||||
return G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,310 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02PhysicsList.cc,v 1.1 2002/03/05 15:22:00 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "globals.hh"
|
||||
#include "ExN02PhysicsList.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ProcessVector.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "g4std/iomanip"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02PhysicsList::ExN02PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
defaultCutValue = 1.0*cm;
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02PhysicsList::~ExN02PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::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();
|
||||
ConstructBaryons();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructBosons()
|
||||
{
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
// e+/-
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
// mu+/-
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
// nu_e
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
// nu_mu
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructMesons()
|
||||
{
|
||||
// mesons
|
||||
// light mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4Eta::EtaDefinition();
|
||||
G4EtaPrime::EtaPrimeDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
G4KaonZero::KaonZeroDefinition();
|
||||
G4AntiKaonZero::AntiKaonZeroDefinition();
|
||||
G4KaonZeroLong::KaonZeroLongDefinition();
|
||||
G4KaonZeroShort::KaonZeroShortDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructBaryons()
|
||||
{
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4AntiNeutron::AntiNeutronDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#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"
|
||||
|
||||
#include "G4UserSpecialCuts.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
// gamma
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion());
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering());
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
|
||||
G4VProcess* theeminusIonisation = new G4eIonisation();
|
||||
G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
|
||||
//
|
||||
// add processes
|
||||
pmanager->AddProcess(theeminusMultipleScattering);
|
||||
pmanager->AddProcess(theeminusIonisation);
|
||||
pmanager->AddProcess(theeminusBremsstrahlung);
|
||||
//
|
||||
// set ordering for AlongStepDoIt
|
||||
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,1);
|
||||
pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,2);
|
||||
//
|
||||
// set ordering for PostStepDoIt
|
||||
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1);
|
||||
pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep,2);
|
||||
pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep,3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
|
||||
G4VProcess* theeplusIonisation = new G4eIonisation();
|
||||
G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
|
||||
G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
|
||||
//
|
||||
// add processes
|
||||
pmanager->AddProcess(theeplusMultipleScattering);
|
||||
pmanager->AddProcess(theeplusIonisation);
|
||||
pmanager->AddProcess(theeplusBremsstrahlung);
|
||||
pmanager->AddProcess(theeplusAnnihilation);
|
||||
//
|
||||
// set ordering for AtRestDoIt
|
||||
pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
|
||||
//
|
||||
// set ordering for AlongStepDoIt
|
||||
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1);
|
||||
pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,2);
|
||||
//
|
||||
// set ordering for PostStepDoIt
|
||||
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1);
|
||||
pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep,2);
|
||||
pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep,3);
|
||||
pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep,4);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
//muon
|
||||
G4VProcess* aMultipleScattering = new G4MultipleScattering();
|
||||
G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
|
||||
G4VProcess* aPairProduction = new G4MuPairProduction();
|
||||
G4VProcess* anIonisation = new G4MuIonisation();
|
||||
//
|
||||
// add processes
|
||||
pmanager->AddProcess(anIonisation);
|
||||
pmanager->AddProcess(aMultipleScattering);
|
||||
pmanager->AddProcess(aBremsstrahlung);
|
||||
pmanager->AddProcess(aPairProduction);
|
||||
//
|
||||
// set ordering for AlongStepDoIt
|
||||
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
|
||||
pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
|
||||
//
|
||||
// set ordering for PostStepDoIt
|
||||
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
|
||||
pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
|
||||
pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,3);
|
||||
pmanager->SetProcessOrdering(aPairProduction, idxPostStep,4);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
// all others charged particles except geantino
|
||||
G4VProcess* aMultipleScattering = new G4MultipleScattering();
|
||||
G4VProcess* anIonisation = new G4hIonisation();
|
||||
////G4VProcess* theUserCuts = new G4UserSpecialCuts();
|
||||
|
||||
//
|
||||
// add processes
|
||||
pmanager->AddProcess(anIonisation);
|
||||
pmanager->AddProcess(aMultipleScattering);
|
||||
////pmanager->AddProcess(theUserCuts);
|
||||
|
||||
//
|
||||
// set ordering for AlongStepDoIt
|
||||
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
|
||||
pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
|
||||
|
||||
//
|
||||
// set ordering for PostStepDoIt
|
||||
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
|
||||
pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
|
||||
////pmanager->SetProcessOrdering(theUserCuts, idxPostStep,3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Decay.hh"
|
||||
void ExN02PhysicsList::ConstructGeneral()
|
||||
{
|
||||
// Add Decay Process
|
||||
G4Decay* theDecayProcess = new G4Decay();
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
if (theDecayProcess->IsApplicable(*particle)) {
|
||||
pmanager ->AddProcess(theDecayProcess);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::SetCuts()
|
||||
{
|
||||
//G4VUserPhysicsList::SetCutsWithDefault method sets
|
||||
//the default cut value for all particle types
|
||||
//
|
||||
SetCutsWithDefault();
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....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: ExN02PrimaryGeneratorAction.cc,v 1.1 2002/03/05 15:22:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02PrimaryGeneratorAction.hh"
|
||||
#include "ExN02DetectorConstruction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02PrimaryGeneratorAction::ExN02PrimaryGeneratorAction(
|
||||
ExN02DetectorConstruction* myDC)
|
||||
:myDetector(myDC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("proton");
|
||||
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
particleGun->SetParticleEnergy(3.0*GeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02PrimaryGeneratorAction::~ExN02PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4double position = -0.5*(myDetector->GetWorldFullLength());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -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: ExN02RunAction.cc,v 1.1 2002/03/05 15:22:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02RunAction.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02RunAction::ExN02RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02RunAction::~ExN02RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
UI->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02RunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
{
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02SteppingAction.cc,v 1.1 2002/03/05 15:22:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02SteppingAction.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02SteppingAction::ExN02SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02SteppingAction::UserSteppingAction(const G4Step*)
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -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: ExN02SteppingVerbose.cc,v 1.1 2002/03/05 15:22:01 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02SteppingVerbose.hh"
|
||||
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02SteppingVerbose::ExN02SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02SteppingVerbose::~ExN02SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02SteppingVerbose::StepInfo()
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
if( verboseLevel >= 4 ) VerboseTrack();
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << G4std::setw( 5) << "#Step#" << " "
|
||||
<< G4std::setw( 6) << "X" << " "
|
||||
<< G4std::setw( 6) << "Y" << " "
|
||||
<< G4std::setw( 6) << "Z" << " "
|
||||
<< G4std::setw( 9) << "KineE" << " "
|
||||
<< G4std::setw( 9) << "dEStep" << " "
|
||||
<< G4std::setw(10) << "StepLeng"
|
||||
<< G4std::setw(10) << "TrakLeng"
|
||||
<< G4std::setw(10) << "Volume" << " "
|
||||
<< G4std::setw(10) << "Process" << G4endl;
|
||||
}
|
||||
|
||||
G4cout << G4std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< G4std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< G4std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
// if( fStepStatus != fWorldBoundary){
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
G4cout << G4std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
} else {
|
||||
G4cout << G4std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
G4cout << " "
|
||||
<< G4std::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=" << G4std::setw(3) << tN2ndariesTot
|
||||
<< "(Rest=" << G4std::setw(2) << fN2ndariesAtRestDoIt
|
||||
<< ",Along=" << G4std::setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << G4std::setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << G4std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " : "
|
||||
<< G4std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< G4std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< G4std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< G4std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< G4std::setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02SteppingVerbose::TrackingStarted()
|
||||
{
|
||||
|
||||
CopyState();
|
||||
G4int prec = G4cout.precision(3);
|
||||
if( verboseLevel > 0 ){
|
||||
|
||||
G4cout << G4std::setw( 5) << "Step#" << " "
|
||||
<< G4std::setw( 6) << "X" << " "
|
||||
<< G4std::setw( 6) << "Y" << " "
|
||||
<< G4std::setw( 6) << "Z" << " "
|
||||
<< G4std::setw( 9) << "KineE" << " "
|
||||
<< G4std::setw( 9) << "dEStep" << " "
|
||||
<< G4std::setw(10) << "StepLeng"
|
||||
<< G4std::setw(10) << "TrakLeng"
|
||||
<< G4std::setw(10) << "Volume" << " "
|
||||
<< G4std::setw(10) << "Process" << G4endl;
|
||||
|
||||
G4cout << G4std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< G4std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< G4std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< G4std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << G4std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
} else {
|
||||
G4cout << G4std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
G4cout << " initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02TrackerHit.cc,v 1.1 2002/03/05 15:22:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02TrackerHit.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
G4Allocator<ExN02TrackerHit> ExN02TrackerHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerHit::ExN02TrackerHit() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerHit::~ExN02TrackerHit() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerHit::ExN02TrackerHit(const ExN02TrackerHit& right)
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const ExN02TrackerHit& ExN02TrackerHit::operator=(const ExN02TrackerHit& right)
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int ExN02TrackerHit::operator==(const ExN02TrackerHit& right) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02TrackerHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(pos);
|
||||
circle.SetScreenSize(0.04);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1.,0.,0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02TrackerHit::Print()
|
||||
{
|
||||
G4cout << " trackID: " << trackID << " chamberNb: " << chamberNb
|
||||
<< " energy deposit: " << G4BestUnit(edep,"Energy")
|
||||
<< " position: " << G4BestUnit(pos,"Length") << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02TrackerSD.cc,v 1.1 2002/03/05 15:22:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02TrackerSD.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerSD::ExN02TrackerSD(G4String name)
|
||||
:G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname;
|
||||
collectionName.insert(HCname="trackerCollection");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerSD::~ExN02TrackerSD(){ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02TrackerSD::Initialize(G4HCofThisEvent* HCE)
|
||||
{
|
||||
trackerCollection = new ExN02TrackerHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
static G4int HCID = -1;
|
||||
if(HCID<0)
|
||||
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
|
||||
HCE->AddHitsCollection( HCID, trackerCollection );
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool ExN02TrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
if(edep==0.) return false;
|
||||
|
||||
ExN02TrackerHit* newHit = new ExN02TrackerHit();
|
||||
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
|
||||
newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchable()
|
||||
->GetReplicaNumber());
|
||||
newHit->SetEdep (edep);
|
||||
newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
|
||||
trackerCollection->insert( newHit );
|
||||
|
||||
//newHit->Print();
|
||||
//newHit->Draw();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02TrackerSD::EndOfEvent(G4HCofThisEvent* HCE)
|
||||
{
|
||||
if (verboseLevel>0) {
|
||||
G4int NbHits = trackerCollection->entries();
|
||||
G4cout << "\n-------->Hits Collection: in this event they are " << NbHits
|
||||
<< " hits in the tracker chambers: " << G4endl;
|
||||
for (G4int i=0;i<NbHits;i++) (*trackerCollection)[i]->Print();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ExN02VisManager.cc,v 1.1 2002/03/05 15:22:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
//
|
||||
// John Allison 24th January 1998.
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
|
||||
#include "ExN02VisManager.hh"
|
||||
|
||||
// Supported drivers...
|
||||
|
||||
// Not needing external packages or libraries...
|
||||
#include "G4ASCIITree.hh"
|
||||
#include "G4DAWNFILE.hh"
|
||||
#include "G4GAGTree.hh"
|
||||
#include "G4HepRepFile.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......
|
||||
|
||||
ExN02VisManager::ExN02VisManager () {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02VisManager::RegisterGraphicsSystems () {
|
||||
|
||||
// Graphics Systems not needing external packages or libraries...
|
||||
RegisterGraphicsSystem (new G4ASCIITree);
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
RegisterGraphicsSystem (new G4GAGTree);
|
||||
RegisterGraphicsSystem (new G4HepRepFile);
|
||||
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,80 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParExN02MarshaledHits.cc,v 1.1 2002/03/05 15:22:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
// Customize this file for your application.
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "ParExMarshaledHits.hh"
|
||||
#include "ParMarshaledObj.hh"
|
||||
#include "ExN02TrackerHit.hh"
|
||||
|
||||
// =====================================================================
|
||||
// Must define MarshalHit and UnmarshalHit for each derived class of G4VHit
|
||||
|
||||
// MarshalHit() and UnmarshalHit() have defaults given by the member
|
||||
// function of TMarshaledHitsCollection<T>.
|
||||
// The default copies the entire class into a single buffer. If your
|
||||
// hit class includes pointers, and if you use those pointer in your
|
||||
// analysis (AnalyzeEvent), then you will need to override the default
|
||||
// with an explicit specialization that marshals the pointers.
|
||||
// You may also wish to override the default in order to write
|
||||
// more efficient marshaling code.
|
||||
|
||||
// See ParExMarshaledHits.cc-N04-efficient for an example of overriding
|
||||
// the default.
|
||||
|
||||
// =====================================================================
|
||||
// Dispatch marshaling and unmarshaling of HC's according to type of G4VHit
|
||||
// When unmarshaling, we will see the "G4String HCname", and have
|
||||
// to create a HC of the correct type.
|
||||
// So, You must include an "if" or "else if" for each type of hit.
|
||||
|
||||
// NOTE TO MYSELF: Is there a cleaner way to do this?
|
||||
// If types were objects, we'd just set up a table here:
|
||||
// { {"trackerCollection", TMarshaledHitsCollection<ExN02TrackerHit>},
|
||||
// ... }
|
||||
// and then write general code to use the table.
|
||||
|
||||
void MarshaledHCofThisEvent::MarshalHitsCollection
|
||||
(G4VHitsCollection * aBaseHC, G4String HCname)
|
||||
{ if (HCname == "trackerCollection")
|
||||
((TMarshaledHitsCollection<ExN02TrackerHit> *)this)
|
||||
-> Marshal( aBaseHC );
|
||||
else G4Exception( "TMarshaledHitsCollection<T>::MarshaledHCofThisEvent :"
|
||||
" HCname, " + HCname + ", not found." );
|
||||
}
|
||||
|
||||
void MarshaledHCofThisEvent::UnmarshalSlaveHitsCollection(G4String & HCname, G4String & SDname)
|
||||
{ if (HCname == "trackerCollection")
|
||||
((TMarshaledHitsCollection<ExN02TrackerHit> *)this)
|
||||
-> UnmarshalSlaveHitsCollection( HCname, SDname );
|
||||
else G4Exception( "TMarshaledHitsCollection<T>::UnmarshalSlaveHitsCollection"
|
||||
" : HCname, " + HCname + ", not found." );
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParMarshaledObj.cc,v 1.1 2002/03/05 15:22:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
// When we implement track level parallelism, we will use G4PrimaryTransformer.
|
||||
// We will also need to merge hits from several slaves. To do so, we will need
|
||||
// the following:
|
||||
// - MarshaledHCofThisEvent must also have a private const member:
|
||||
// const G4bool canMergeHits = false;
|
||||
// and a virtual method (not pure)
|
||||
// virtual void insertOrMerge(ExN02TrackerHit *);
|
||||
// - Then can create a derived class with constructor:
|
||||
// inline DerivedClassConstructor()
|
||||
// : canMergeHits(true),MarshaledHCofThisEventWithTemplate() {}
|
||||
// - And insertOrMerge() should be defined in the derived class
|
||||
// The logic for insertOrMerge() can usually be copied from
|
||||
// (for example) ExN02TrackerSD::ProcessHits
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "ParMarshaledObj.hh"
|
||||
|
||||
MarshaledHCofThisEvent::MarshaledHCofThisEvent(G4Event *anEvent)
|
||||
{ MarshalHitsCollection(anEvent); }
|
||||
|
||||
MarshaledHCofThisEvent::MarshaledHCofThisEvent()
|
||||
{ MarshalHitsCollection( G4RunManager::GetRunManager()-> GetCurrentEvent() ); }
|
||||
|
||||
void MarshaledHCofThisEvent::MarshalHitsCollection(const G4Event *anEvent)
|
||||
{
|
||||
// MarshaledHCofThisEvent() can be in class ParMarshaledObj
|
||||
// It can then be dispatched based on HCname to submarshaling
|
||||
// for correct class.
|
||||
|
||||
G4HCofThisEvent *HCE = anEvent->GetHCofThisEvent();
|
||||
G4int numHitsColl = HCE->GetNumberOfCollections();
|
||||
Marshal( numHitsColl );
|
||||
for (int i = 0; i < numHitsColl; i++) {
|
||||
// Use base class to find HCname.
|
||||
G4VHitsCollection *aBaseHC = HCE->GetHC(i);
|
||||
G4String SDname = aBaseHC->GetSDname();
|
||||
G4String HCname = aBaseHC->GetName();
|
||||
Marshal( SDname );
|
||||
Marshal( HCname );
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "Marshaled HCname: " << HCname << G4endl;
|
||||
G4cout << "Marshaled SDname: " << SDname << G4endl;
|
||||
#endif
|
||||
|
||||
MarshalHitsCollection(aBaseHC, HCname);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTES TO MYSELF:
|
||||
// G4SDManager::GetSDMpointer()->FindSensitiveDetector(SDname);
|
||||
|
||||
// IMPORTANT: all calls to Unmarshal must be in same order as
|
||||
// the calls to Marshal in the constructor.
|
||||
void MarshaledHCofThisEvent::UnmarshalSlaveHCofThisEvent()
|
||||
{
|
||||
/*
|
||||
G4HCofThisEvent *HCE = G4RunManager::GetRunManager()->
|
||||
GetCurrentEvent()->
|
||||
GetHCofThisEvent();
|
||||
*/
|
||||
G4int numHitsColl;
|
||||
Unmarshal( numHitsColl );
|
||||
for (int i = 0; i < numHitsColl; i++) {
|
||||
G4String SDname;
|
||||
G4String HCname;
|
||||
Unmarshal( SDname );
|
||||
Unmarshal( HCname );
|
||||
#ifdef TOPC_DEBUG
|
||||
G4cout << "HCname: " << HCname << G4endl;
|
||||
G4cout << "SDname: " << SDname << G4endl;
|
||||
#endif
|
||||
|
||||
UnmarshalSlaveHitsCollection(HCname, SDname);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParRunManager.cc,v 1.3 2002/06/06 17:04:40 cooperma Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// Parallel Library for Geant4
|
||||
//
|
||||
// Gene Cooperman <gene@ccs.neu.edu>, 2001
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifdef G4USE_TOPC
|
||||
|
||||
// G4Timer.hh has to be loaded *before* globals.hh...
|
||||
//
|
||||
#include "G4Timer.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunMessenger.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4VPersistencyManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ProcessTable.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
|
||||
#include "ParRunManager.hh"
|
||||
#include "ParMarshaledObj.hh"
|
||||
#include "ParRandomState.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
// Define static data members of ParRunManager
|
||||
// They are set by ImportDoEventLoopLocals
|
||||
G4StateManager* ParRunManager::stateManager;
|
||||
G4int ParRunManager::n_event;
|
||||
G4int ParRunManager::n_select;
|
||||
G4String ParRunManager::msg;
|
||||
ParRunManager* ParRunManager::myRunManager = NULL;
|
||||
|
||||
// TOP-C callbacks (static functions)
|
||||
// If this->*(&ParRunManager::GenerateEventInput), created a thunk,
|
||||
// it would be ideal here.
|
||||
TOPC_BUF ParRunManager::MyGenerateEventInput()
|
||||
{ return myRunManager->GenerateEventInput(); }
|
||||
TOPC_BUF ParRunManager::MyDoEvent( void *input_buf )
|
||||
{ return myRunManager->DoEvent(input_buf); }
|
||||
TOPC_ACTION ParRunManager::MyCheckEventResult( void * input_buf, void *buf )
|
||||
{ return myRunManager->CheckEventResult(input_buf, buf); }
|
||||
|
||||
static void trace_event_input( void *input )
|
||||
{ G4cout << "Event " << *(G4int *)input << G4endl; }
|
||||
|
||||
void ParRunManager::DoEventLoop(G4int n_event,const char* macroFile,G4int n_select)
|
||||
{
|
||||
TOPC_OPT_trace_input = trace_event_input;
|
||||
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
|
||||
#ifdef G4_ORIGINAL
|
||||
cout << "ParRunManager::DoEventLoop" << endl;
|
||||
G4RunManager::DoEventLoop(n_event, macroFile, n_select);
|
||||
return;
|
||||
#endif
|
||||
|
||||
if(verboseLevel>0)
|
||||
{ timer->Start(); }
|
||||
|
||||
G4String msg;
|
||||
if(macroFile!=NULL)
|
||||
{
|
||||
if(n_select<0) n_select = n_event;
|
||||
msg = "/control/execute ";
|
||||
msg += macroFile;
|
||||
}
|
||||
else
|
||||
{ n_select = -1; }
|
||||
|
||||
// BeginOfEventAction() and EndOfEventAction() would normally be
|
||||
// called inside G4EventManager::ProcessOneEvent() in ParRunManager::DoEvent
|
||||
// on slave. Since this is often where hits are collected and where
|
||||
// histogram data is first stored, must do it
|
||||
// on master instead, to process hits. So, set user event action to NULL.
|
||||
// Keep private copy, and execute it in CheckTaskResult().
|
||||
// If user later does: SetUserAction( (G4UserEventAction *)NULL );
|
||||
// we won't notice and copy it to origUserEventAction.
|
||||
// How paranoid do we want to be? Should we create trvialUserEventAction?
|
||||
if ( eventManager->GetUserEventAction() )
|
||||
{
|
||||
origUserEventAction = eventManager->GetUserEventAction();
|
||||
SetUserAction( (G4UserEventAction *)NULL );
|
||||
}
|
||||
|
||||
// Make these variables accessible to TOP-C callback functions
|
||||
ImportDoEventLoopLocals( stateManager, n_event, n_select, msg );
|
||||
|
||||
// This is where all the parallelism occurs
|
||||
i_event = -1; // ParRunManager::GenerateEventInput() will increment this.
|
||||
TOPC_master_slave(MyGenerateEventInput, MyDoEvent, MyCheckEventResult, NULL);
|
||||
|
||||
if(verboseLevel>0)
|
||||
{
|
||||
timer->Stop();
|
||||
G4cout << "Run terminated." << G4endl;
|
||||
G4cout << "Run Summary" << G4endl;
|
||||
if(runAborted)
|
||||
/*
|
||||
{ G4cout << " Run Aborted after " << i_event << " events processed." << G4endl; }
|
||||
*/
|
||||
{ G4cout << " Run Aborted." << G4endl; }
|
||||
else
|
||||
{ G4cout << " Number of events processed : " << n_event << G4endl; }
|
||||
G4cout << " " << *timer << G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TOPC_BUF ParRunManager::GenerateEventInput()
|
||||
{
|
||||
if(runAborted) return NOTASK;
|
||||
|
||||
i_event++;
|
||||
if (i_event >= n_event) return NOTASK;
|
||||
else
|
||||
{ ParMarshaledRandomState buf = ParMarshaledRandomState( i_event );
|
||||
return TOPC_MSG( buf.GetBuffer(), buf.BufferSize() );
|
||||
}
|
||||
// else return TOPC_MSG( &i_event, sizeof(i_event) );
|
||||
}
|
||||
|
||||
TOPC_BUF ParRunManager::DoEvent( void *input_buf )
|
||||
{
|
||||
G4int i_event;
|
||||
ParMarshaledRandomState buf = ParMarshaledRandomState( input_buf );
|
||||
buf.unmarshalEventIDandSetState( i_event );
|
||||
|
||||
stateManager->SetNewState(EventProc);
|
||||
|
||||
currentEvent = GenerateEvent(i_event);
|
||||
|
||||
eventManager->ProcessOneEvent(currentEvent);
|
||||
|
||||
MarshaledObj *aMarshaledObj = new MarshaledHCofThisEvent(currentEvent);
|
||||
return TOPC_MSG(aMarshaledObj->GetBuffer(), aMarshaledObj->BufferSize());
|
||||
}
|
||||
|
||||
TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf )
|
||||
{
|
||||
G4int i_event;
|
||||
MarshaledObj buf = MarshaledObj(input_buf);
|
||||
buf.Unmarshal(i_event);
|
||||
|
||||
stateManager->SetNewState(EventProc);
|
||||
if(!userPrimaryGeneratorAction)
|
||||
{
|
||||
G4Exception
|
||||
("G4RunManager::BeamOn - G4VUserPrimaryGeneratorAction is not defined.");
|
||||
}
|
||||
|
||||
// This creates a trivial event in lieu of GenerateEvent(i_event);
|
||||
currentEvent = new G4Event(i_event);
|
||||
|
||||
// Original UserEventAction was saved and set to NULL. Do it now on master.
|
||||
if (origUserEventAction)
|
||||
origUserEventAction->BeginOfEventAction( currentEvent );
|
||||
|
||||
// When Geant4 4.0 sees empty event, it still calls userStackingAction.
|
||||
// On master, only trivial events exist, so we delete userStackingAction
|
||||
SetUserAction( (G4UserStackingAction*)NULL );
|
||||
eventManager->ProcessOneEvent(currentEvent); // Processing the trivial event
|
||||
|
||||
// Called with output_buf and no size, creates object for unmarshaling
|
||||
MarshaledHCofThisEvent marshaledObj(output_buf);
|
||||
marshaledObj.UnmarshalSlaveHCofThisEvent();
|
||||
// UnmarshalSlaveHCofThisEvent placed slave Hits in ParRunManager::currentEvent
|
||||
|
||||
// Original UserEventAction was saved and set to NULL. Do it now on master.
|
||||
if (origUserEventAction)
|
||||
origUserEventAction->EndOfEventAction( currentEvent );
|
||||
|
||||
AnalyzeEvent(currentEvent);
|
||||
|
||||
if(i_event<n_select) G4UImanager::GetUIpointer()->ApplyCommand(msg);
|
||||
stateManager->SetNewState(GeomClosed);
|
||||
StackPreviousEvent(currentEvent);
|
||||
currentEvent = NULL;
|
||||
// Move this to GenerateEventInput:
|
||||
// if(runAborted) break;
|
||||
return NO_ACTION;
|
||||
}
|
||||
|
||||
#endif
|
||||
Executable
+142
@@ -0,0 +1,142 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
#
|
||||
# Rat's thwap script, rewritten in perl and diffed a lot.
|
||||
#
|
||||
# django@ccs.neu.edu
|
||||
# July 24, 1993
|
||||
#
|
||||
# 1/19/94 v2.01 - bdowling
|
||||
# Added: Interactive prompting (-i)
|
||||
# Whuggled option handling
|
||||
# -Allows numeric signals
|
||||
# -Allows varied ordering
|
||||
# Changed finding processes slightly
|
||||
# Added sysV support ??
|
||||
# 1997.08.05 jay
|
||||
# added Solaris support
|
||||
|
||||
$0 =~ s#.*/##;
|
||||
$| = 1;
|
||||
|
||||
$fakeit = 0;
|
||||
$iprompt = 0;
|
||||
|
||||
# gdc - /usr/bin/kill -> /bin/kill, Redhat Linux 4.2 had only /bin/kill
|
||||
@valid_signals = split(/[ \t\n]+/, `/bin/kill -l`);
|
||||
die "$0: error running 'kill' to gather signals!: $!\n" if $?;
|
||||
|
||||
$signal = "KILL";
|
||||
|
||||
while ($ARGV[0] =~ /^-/) {
|
||||
$_ = shift(@ARGV);
|
||||
if (/^-n$/) {
|
||||
$fakeit = 1; $iprompt = 0;
|
||||
} elsif (/^-i$/) {
|
||||
$iprompt = 1; $fakeit = 0;
|
||||
} elsif (/^-(\w+)/) {
|
||||
$signal = $1;
|
||||
$signal =~ tr/[a-z]/[A-Z]/;
|
||||
$signal =~ s/^SIG//;
|
||||
die "$1: $signal is not a valid signal\n"
|
||||
if (! grep(/^$signal$/,
|
||||
(@valid_signals, (1..$#valid_signals+1) ) ) );
|
||||
}
|
||||
}
|
||||
#warn "> $signal\n";
|
||||
# we don't need to do this, since Perl can handle named signals just as well
|
||||
# as numberic ones. In fact, this causes us grief because kill -l does not
|
||||
# return the same thing on all systems
|
||||
#if (! ($signal =~ /^[0-9]+$/)) { # We want to work with a numeric signal
|
||||
# for($x=0;$x<=$#valid_signals;$x++) {
|
||||
# do { $numsignal = ++$x; last; } if @valid_signals[$x] eq $signal;
|
||||
# }
|
||||
#}
|
||||
#warn "> $signal\n";
|
||||
|
||||
&usage if ($#ARGV < 0);
|
||||
|
||||
foreach $uname ('/bin/uname', '/usr/bin/uname', '/sbin/uname') {
|
||||
next unless (-x $uname);
|
||||
chop($rev = `$uname -r`);
|
||||
($OSMAJOR = $rev) =~ s/\..*//;
|
||||
last;
|
||||
}
|
||||
|
||||
if ($OSMAJOR == 5) { # System V
|
||||
$ps_flags = " -f ";
|
||||
$ps_flags .= " -e " if ($> == 0);
|
||||
$ps_flags .= " -u $>" if ($> != 0); # Do we need this? Could we just do
|
||||
# ps -f above? It gets some root procs
|
||||
# such as rlogin etc. (which is cool!)
|
||||
} else { # Assume BSD system, what others could we check for?
|
||||
$ps_flags = "uxww";
|
||||
$ps_flags .= "a" if ($> == 0); # Only need this if we're root
|
||||
}
|
||||
|
||||
# Don't want a leading "-" on the flags, so it works on both Alphas and Suns:
|
||||
$ps_pid = open(PS, "ps $ps_flags |"), "\n";
|
||||
$header = <PS>;
|
||||
$seen_header = 0;
|
||||
$thwapped = 0;
|
||||
|
||||
while (<PS>) {
|
||||
($foo = $_) =~ s/^\s*//;
|
||||
($user, $pid, @rest) = split(' ',$foo);
|
||||
next if ($pid == $$ || $pid == $ps_pid); # Don't thwap this process!
|
||||
next if (/thwap/); # Hackish attempt to avoid
|
||||
# thwapping this process
|
||||
# when invoked via rsh
|
||||
|
||||
testit: foreach $expr (@ARGV) {
|
||||
if ($expr =~ /^[0-9]+$/) { # make numbers only match pids
|
||||
next testit if ($pid != $expr);
|
||||
}
|
||||
if (grep(/$expr/, $_)) {
|
||||
# warn "expr = $expr; user = $user; pid = $pid; rest = @rest\n";
|
||||
warn $header if (! $seen_header);
|
||||
warn "\n" if ($seen_header && $iprompt);
|
||||
$seen_header = 1;
|
||||
warn $_;
|
||||
if (! $iprompt || &AskYN() ) {
|
||||
# warn "-> kill $signal $pid\n" if (! $fakeit);
|
||||
if (! $fakeit ) {
|
||||
# quotes needed around $signal so Perl will interpret both
|
||||
# numeric and non-numberic signals properly -- dNb
|
||||
$killed = kill("$signal", $pid);
|
||||
warn "kill: $!\n" if ! $killed;
|
||||
$thwapped += $killed;
|
||||
} else {
|
||||
$thwapped++;
|
||||
}
|
||||
}
|
||||
last testit; # Okay it's dead jim, we're done this loop.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(PS);
|
||||
|
||||
warn "$0: ", ( $fakeit ? "would have " : "" ),
|
||||
"sent SIG${signal} to $thwapped process",
|
||||
($thwapped == 1 ? "" : "es"), "\n";
|
||||
|
||||
sub usage {
|
||||
warn <<"EOT";
|
||||
Usage: $0 [options] <user | pid | progname | perlregexp> ...
|
||||
Options:
|
||||
-n fake mode - only display processes that would be selected
|
||||
-i interactive mode - prompt on each suspect process
|
||||
-<signal> any valid literal or numeric signal (see kill -l)
|
||||
|
||||
EOT
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sub AskYN {
|
||||
print STDERR "Send SIG", @valid_signals[$numsignal-1], " to this process? (y/n/a)? ";
|
||||
$ans = <STDIN>;
|
||||
$iprompt = ! ($ans =~ /^a/i);
|
||||
return( $ans =~ /^[ay]/i );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user