Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
@@ -0,0 +1,34 @@
# $Id: GNUmakefile,v 1.4 1999/12/01 15:46:30 morita Exp $
# --------------------------------------------------------------
# GNUmakefile for tests module. Gabriele Cosmo, 27/06/98.
# --------------------------------------------------------------
# You must have unique G4EXAMPLE_FDID assigned by your local
# manager of Objectivity/DB lock server.
#
name := PersistentEx01
G4ODBMS := true
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
.PHONY: all doall
all: cleandb headers
@(G4ODBMS_DEPEND=1; export G4ODBMS_DEPEND; $(MAKE) doall)
doall: lib bin
include $(G4INSTALL)/config/architecture.gmk
G4OODDLX_BOOT := $(G4EXAMPLE_BOOT)
include $(G4INSTALL)/config/binmake.gmk
CPPFLAGS += \
-Iinclude \
-I$(G4TMPDIR)
@@ -0,0 +1,93 @@
$Id: History,v 1.8 1999/12/05 22:26:02 morita Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example PersistentEx01 History file
-----------------------------------
This file should be used by the test developer to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
5th December 1999 Y.Morita (PersistentEx01-V00-01-05)
- LD_LIBRARY_PATH change for Linux
- readDB: added access to G4PPrimaryParticle.
3rd December 1999 Y.Morita (PersistentEx01-V00-01-04)
- Added short example of using HepODBMS tag database
(createTag, readTag)
- Bug fixes
1st December 1999 Y.Morita (PersistentEx01-V00-01-03)
- Fix GNUmakefile to pick up right dependency files.
- new PersistentEx01run script file for new config.
23th November 1999 Y.Morita (PersistentEx01-V00-01-02)
- use interactive mode and batch mode
- bug fix in PersEx01EventAction.cc
- updated README, PersistentEx01.in, PersistentEx01.out
19th November 1999 Y.Morita (PersistentEx01-V00-01-01)
- coworks with persistency-V00-01-06 (STL version)
- fix for readDB
9th November 1999 Y.Morita (PersistentEx01-V00-01-00)
- coworks with persistency-V00-01-03
3rd November 1999 Y.Morita
- Renamed from examples/extended/E02
26th Octobre 1999 Y.Morita
- Created g4odbms_setup.sh
- Modified g4odbms_setup.csh for Objy 5.1 and HepODBMS 0.3.0.1
- Fixed typo in README
- Check LD_LIBRARY_PATH in exampleE02run
- Barion -> Baryon in ExE02PhysicsList.hh/.cc
17 Apr., 1999 H.Kurashige
- Modify SetCuts() and ConstructParticle() in ExE02PhysicsList
- Modify BeginOfRunAction() and EndOfRunAction() in ExE02RunAction
- Modify ClassifyNewTrack() in ExE02StackingAction
- Modify BeginOfEventAction() and EndOfEventAction() in ExN02EventAction
14th November 1998 Y.Morita
- Modified from N08 to E02 (exampleE02-00-03-01)
14th October 1998 John Allison
- Moved from N08.
25th August 1998 Y.Morita
- tagged (exampleN08-00-02-02)
24th August 1998 Y.Morita
- Fixed typo on exampleN08.cc
- script cleanup on exampleN08run
21st August 1998 John Allison
- Renamed file My* to ExN08*.
August 7th, 1998 John Allison
- Moved from test04.
July 15, 98 Y. Morita
- GNUmakefile cleandb target revised
- README new instructions
- g4odbms_setup.csh example setup
- test04.cc bug fix
July 14, 98 Y. Morita
- Geometry persistency incorporated.
July 8, 98 Y. Morita
- First skeleton version to demonstrate persistency capability
in Geant4.
June 27, 98 G. Cosmo
- Created.
@@ -0,0 +1,82 @@
// 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: PersistentEx01.cc,v 1.4.2.1 1999/12/07 20:47:20 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
// --------------------------------------------------------------
// GEANT4 - PersistentEx01
//
// For information related to this code contact:
// CERN, IT Division, ASD Group
// --------------------------------------------------------------
// Comments
//
//
// --------------------------------------------------------------
#include "PersEx01DetectorConstruction.hh"
#include "PersEx01PhysicsList.hh"
#include "PersEx01RunAction.hh"
#include "PersEx01PrimaryGeneratorAction.hh"
#include "PersEx01EventAction.hh"
#include "PersEx01StackingAction.hh"
#include "G4ios.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4PersistencyManager.hh"
int main(int argc, char** argv)
{
// Persistency Manager
G4PersistencyManager * persistencyManager =
G4PersistencyManager::GetPersistencyManager();
// Run manager
G4RunManager * runManager = new G4RunManager;
// Detector geometry
runManager->SetUserInitialization(new PersEx01DetectorConstruction);
runManager->SetUserInitialization(new PersEx01PhysicsList);
// UserAction classes.
runManager->SetUserAction(new PersEx01RunAction);
runManager->SetUserAction(new PersEx01PrimaryGeneratorAction);
runManager->SetUserAction(new PersEx01EventAction);
runManager->SetUserAction(new PersEx01StackingAction);
// get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
if(argc==1)
// Define (G)UI terminal for interactive mode
{
G4UIsession* session = new G4UIterminal;
UI->ApplyCommand("/control/execute prerunPEx01.mac");
session->SessionStart();
delete session;
}
else
// Batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
// job termination
delete runManager;
delete persistencyManager;
return 0;
}
@@ -0,0 +1,15 @@
#
# PersistentEx01.in
#
/control/verbose 2
/db/verbose 2
###/db/run NewRuns
###/db/event NewEvents
###/db/geometry NewGeometry
/run/initialize
#
# 10 events
#
/run/beamOn 10
#
exit
@@ -0,0 +1,173 @@
Opening federated database OO_FD_BOOT.
WARNING: g4example: Could not find naming root directory: Naming will be disabled.
#
# PersistentEx01.in
#
/db/verbose 2
###/db/run NewRuns
###/db/event NewEvents
###/db/geometry NewGeometry
/run/initialize
-- Tracker type sensitive detector
PersEx01PhysicsList::SetCuts:CutLength : 1 (mm)
conv: Total cross sections from a parametrisation. Good description from 1.5 MeV to 100 GeV for all Z.
e+e- energies according Bethe-Heitler
PhysicsTables from 1.022 MeV to 100 GeV in 100 bins.
compt: Total cross sections from a parametrisation. Good description from 10 KeV to (100/Z) GeV.
Scattered gamma energy according Klein-Nishina.
PhysicsTables from 10 keV to 100 GeV in 100 bins.
phot: Total cross sections from a parametrisation. Good description from 10 KeV to 50 MeV for all Z
Sandia crossSection below 50 KeV
PhysicsTables from 50 keV to 50 MeV in 100 bins.
msc: Tables of transport mean free paths.
New model of MSC , computes the lateral
displacement of the particle , too.
PhysicsTables from 100 eV to 100 TeV in 100 bins.
eIoni: delta cross sections from Moller+Bhabha. Good description from 1 KeV to 100 GeV.
delta ray energy sampled from differential Xsection.
PhysicsTables from 1 keV to 100 TeV in 100 bins.
eBrem: Total cross sections from a parametrisation. Good description from 1 KeV to 100 GeV.
log scale extrapolation above 100 GeV
Gamma energy sampled from a parametrised formula.
PhysicsTables from 1 keV to 100 TeV in 100 bins.
annihil: Total cross section from Heilter formula (annihilation into 2 photons).
gamma energies sampled according Heitler
PhysicsTables from 10 keV to 10 TeV in 100 bins.
msc: Tables of transport mean free paths.
New model of MSC , computes the lateral
displacement of the particle , too.
PhysicsTables from 100 eV to 100 TeV in 100 bins.
hIoni: Knock-on electron cross sections .
Good description above the mean excitation energy.
delta ray energy sampled from differential Xsection.
PhysicsTables from 1 keV to 100 TeV in 150 bins.
msc: Tables of transport mean free paths.
New model of MSC , computes the lateral
displacement of the particle , too.
PhysicsTables from 100 eV to 100 TeV in 100 bins.
MuIoni: knock-on electron cross sections .
Good description above the mean excitation energy.
delta ray energy sampled from differential Xsection.
PhysicsTables from 1 keV to 1000 PeV in 100 bins.
MuBrems: theoretical cross section
Good description up to 1000 TeV.
PhysicsTables from 1 GeV to 1000 PeV in 100 bins.
MuPairProd: theoretical cross sections
Good description up to 1000 TeV.
PhysicsTables from 1 GeV to 1000 PeV in 50 bins.
#
# 10 events
#
/run/beamOn 10
Transaction started for /Geometry/GeomContainer/ with non-sustained mode.
-- Geometry stored in /Geometry/GeomContainer/
Transaction is committed on /Geometry/GeomContainer/
>>> Event 0
Event : 0
mySD/EvenCollection Number of hits 9
Edep of the first Hit 34.3698
mySD/OddCollection Number of hits 39
Edep of the first Hit 18.4405
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 0 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 1
Event : 1
mySD/EvenCollection Number of hits 22
Edep of the first Hit 99.9396
mySD/OddCollection Number of hits 20
Edep of the first Hit 25.443
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 1 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 2
Event : 2
mySD/EvenCollection Number of hits 22
Edep of the first Hit 6.23362
mySD/OddCollection Number of hits 19
Edep of the first Hit 64.6385
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 2 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 3
Event : 3
mySD/EvenCollection Number of hits 13
Edep of the first Hit 48.4612
mySD/OddCollection Number of hits 39
Edep of the first Hit 14.5902
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 3 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 4
Event : 4
mySD/EvenCollection Number of hits 32
Edep of the first Hit 50.5145
mySD/OddCollection Number of hits 16
Edep of the first Hit 57.8215
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 4 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 5
Event : 5
mySD/EvenCollection Number of hits 6
Edep of the first Hit 139.802
mySD/OddCollection Number of hits 35
Edep of the first Hit 109.904
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 5 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 6
Event : 6
mySD/EvenCollection Number of hits 10
Edep of the first Hit 21.8663
mySD/OddCollection Number of hits 28
Edep of the first Hit 14.2566
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 6 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 7
Event : 7
mySD/EvenCollection Number of hits 12
Edep of the first Hit 2.93176
mySD/OddCollection Number of hits 43
Edep of the first Hit 3.13845
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 7 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 8
Event : 8
mySD/EvenCollection Number of hits 18
Edep of the first Hit 13.787
mySD/OddCollection Number of hits 35
Edep of the first Hit 13.6233
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 8 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
>>> Event 9
Event : 9
mySD/EvenCollection Number of hits 7
Edep of the first Hit 42.2712
mySD/OddCollection Number of hits 41
Edep of the first Hit 21.0987
Transaction started for /Events/EventContainer/ with non-sustained mode.
-- G4PEvent 9 stored in /Events/EventContainer/
Transaction is committed on /Events/EventContainer/
Transaction started for /Runs/RunContainer/ with non-sustained mode.
-- G4PRun 0 stored in /Runs/RunContainer/
Transaction is committed on /Runs/RunContainer/
#
exit
PersistencyManager is deleting.
@@ -0,0 +1,48 @@
#! /bin/csh -f
# check some configurations
if ( ! $?G4EXAMPLE_FDID ) then
echo "G4EXAMPLE_FDID is not defined. Stop."
exit 2
endif
# setup some variables
set name = PersistentEx01
set CWD = `pwd`
set G4ROOT = ${CWD}/../../../..
if ( $?G4WORKDIR ) then
set G4BIN = ${G4WORKDIR}/bin/${G4SYSTEM}
else
set G4BIN = ${G4ROOT}/bin/${G4SYSTEM}
endif
# check for LHC++ variables
source ${G4ROOT}/examples/extended/persistency/PersistentEx01/setup_lhcxx.csh
# install new runtime federated database
set G4EXAMPLE_FD = $G4WORKDIR/exampleFD/$G4SYSTEM/${name}
echo "Copying G4EXAMPLE_BOOT into runtime federated database..."
gmake newfd
setenv OO_FD_BOOT $G4EXAMPLE_FD
echo "OO_FD_BOOT is set to $OO_FD_BOOT"
echo ""
if ( $?BACKGROUND ) then
if ( -e ${name}.log.old ) rm -f ${name}.log.old
if ( -e ${name}.log ) mv -f ${name}.log ${name}.log.old
${G4BIN}/${name} ${name}.in >& ${name}.log &
echo "Job ${name} submitted..."
sleep 2
echo "tail -f ${name}.log"
tail -f ${name}.log
else
${G4BIN}/${name} ${name}.in
endif
@@ -0,0 +1,265 @@
$Id: README,v 1.7 1999/12/05 22:22:25 morita Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example PersistentEx01
----------------------
This example program demonstrates how users can use object database
with Geant4 Persistency Manager with HepODBMS and Objectivity/DB.
Ask your local system manager for the availability of these
products on your system.
Users of this example are assumed to have the knowledge of
HepODBMS and Objectivity/DB. Refer to the corresponding
documents and examples for detail usage and setups.
It is also recommended to read the Geant4 User's Guide:
"Object persistency" (in Chapter 3) and "Object-oriented database"
(in Appendix).
============
Introduction
============
PersistentEx01 demonstrates how to store event, run and geometry
objects into databases. Only some skelton associations and basic data
members are stored in this release.
Event:
Event ID and the informaion of the primary vertecies and particles
are stored. Hits are transient in this example, and therefore
they are not stored. See example PersistentEx02 to create
persistent hits,
Run:
Run ID and number of events are stored in this release.
Geometry:
Basic geometry types and volume informations are stored.
Note that the association to materials is not supported in
this release. Material names are stored instead.
There are two types of database transactions in the Geant4
persistency. Non-sustained transaction, which is used in this
example as a default, stores Geant4 persistent objects
at the end of each event as an atomic database transaction.
If user wants to create his/her own persitent objects in
the user event action class or in any other user classes,
he/she should explicitly use StartTransaction() and
Commit()/Abort() of the G4PersistentManager. See
PersistentEx02 for an example of the sustained transaction.
=====
Setup
=====
In addition to the standard Geant4 setup, additional setup for
LHC++, HepODBMS and Objectivity/DB are required.
Here are the required variables:
G4USE_HEPODBMS <"1" for compiling Geant4 persistent libraries>
HEP_ODBMS_DIR <root directory for HepODBMS>
HEP_ODBMS_INCLUDES <include file directory for HepODBMS>
OBJY_VERS <Objectivity version>
OBJY_DIR <root directory for Objectivity/DB>
OS <"Solaris", "Linux", "HP-UX" etc used by HepODBMS>
PATH <add "${OBJY_DIR}/bin" and "${OBJY_DIR}/doc">
MANPATH <add "${OBJY_DIR}/man">
LD_LIBRARY_PATH <add "${OBJY_DIR}/lib">
Following variables are optional (used by HepODBMS GNUmakefiles):
LHCXXTOP <root directory for LHC++>
PLATF <LHC++ architecture type on CERN AFS>
____________________________________________________________________________
For CERN AFS users, an example setup script "g4odbms_setup.csh" and
"g4odbms_setup.sh" is provided in this directory.
For csh users, copy "g4odbms_setup.csh" to your local directory, edit
the version numbers of HepODBMS and Objectivity if needed, and put a line
such as
source g4odbms_setup.csh
in your .cshrc file.
For zsh and alike, copy "g4odbms_setup.csh" to your local directory,
edit the version numbers, then put a line such as
. g4odbms_setup.sh
in your .zshrc etc...
____________________________________________________________________________
=======================
Objectivity Lock Server
=======================
Make sure that your system is running Objectivity/DB lock
server. Ask your local system administrator for the location of
the lock server.
If you own your machine, or if you know you are the only user of
Objectivity/DB on your system, you may start your own lock server by:
oocheckls -notitle `hostname` || oolockserver -notitle -noauto
See the note below for more detail about the lock server.
======================================
Installing Geant4 persistent libraries
======================================
Persistency in Geant4 is designed to be as an optional sub category.
If the installation of Geant4 has been made without the variable
G4USE_HEPODBMS defined, you must re-install it from the
source directory.
cd ${G4INSTALL}/source
setenv G4USE_HEPODBMS 1
gmake
This will generate persistent granular libraries such as
libG4pmanegement.a, libG4phits.a, etc, in the Geant4 library directory.
This process will also produce schema files in ${G4INSTALL}/schema.
Make sure that you have set up proper combination of HepODBMS and
Objectivity/DB versions before you build the persistency libraries.
Users of this installation must use the same versions of schema
for building their applications.
=========================================
Your boot file and federeated database ID
=========================================
Geant4 provids a base boot file which contains database schema
information of Geant4, HepODBMS and Objectivity/DB persistent
classes. When you compile your application with your own
persistent classes, you must copy the Geant4 schema boot file
to your local area and process your schema files into
your boot file. In this example, schema of the example files
are stored into G4EXAMPLE_BOOT, which is located at
${G4WORKDIR}/exampleSchema/${G4SYSTEM} by default.
When you run your application and populate the database,
copy the schema into runtime federated database G4EXAMPLE_FD.
This is located at ${G4WORKDIR}/exampleFD/${G4SYSTEM} by default.
To run the runtime federate database concorrently on the same
lock server, each copy of the boot file must have a unique
Federated Database ID (FDID). Ask your local system manager for
the unique FDID on your system, then assign it to
setenv G4EXAMPLE_FDID <your federeated database ID>
for example.
___________________________________________________________________________
Note: On CERN AFS, contact your group system administrator to obtain access
to your group lock server. Generally it is recommended to stay away
from the production lock server when you are building your own
application. Use development lock server or use your own
to avoid unintentional locks being left on the production lock
server.
To start your own lock server, type
oocheckls -notitle `hostname` || oolockserver -notitle -noauto
Check the lock server with
ps -ef | grep ools
....
<user> 60156 1 0 06:36:40 pts/15 0:00 ools -OO_NO_AUTOREC
....
To kill the lock server,
ookillls
or
kill -9 <pid_of_ools>
You must have AFS ACL access to HepODBMS and Objectivity/DB
directories.
At CERN, the FDID allocation table is given in this URL:
http://wwwinfo.cern.ch/asd/rd45/white-papers/9804/FDIDAllocation.html
___________________________________________________________________________
=========================
PersistentEx01 executable
=========================
PersistentEx01 executable can be made by simply typing "gmake" in this
directory. Use PersistentEx01run csh-script for a simple test.
example:
gmake # creates PersistentEx01 executable
PersistentEx01run # run PersistentEx01
=================
Persistent output
=================
When PersistentEx01 is run correctly, following database files will be
created in your federated database directory $G4EXAMPLE_FD_DIR.
Events.PersistentEx01.DB Geometry.PersistentEx01.DB
PersistentEx01 PersistentEx01.FDDB
Runs.PersistentEx01.DB System.PersistentEx01.DB
To browse the database contents, use tools such as "oodump" or "ootoolmgr".
oodump -notitle -db Events $G4EXAMPLE_FD
oodump -notitle -db Geometry $G4EXAMPLE_FD
oodump -notitle -db Runs $G4EXAMPLE_FD
setenv DISPLAY <your_x_terminal>:0.0
ootoolmgr -notitle $G4EXAMPLE_FD
Make sure to quit the ootoolmgr when you finish browsing.
Otherwise the transaction lock will remain in the lock server
and the further updates to the database will be blocked.
==========================
readDB, createTag, readTag
==========================
Simple HepODBMS example applications are provided in this directory.
These examples demonstrate how to access the stored Geant4 event objects.
See the corresponding README for more detail.
==========================
Changing the database name
==========================
To work on different set of federated database, change the
definition of OO_FD_BOOT variable defined in PersistentEx01run.
Use $HEP_ODBMS_DIR/etc/getdb to create a new federeated database.
To change the database name within the federation, and to
change the verbose level of G4PersistencyManager, following
runtime commands are supported.
/db/verbose * Set the verbose level of G4PersistencyManager.
/db/run * Set the name of Run Database.
/db/event * Set the name of Event Database.
/db/geometry * Set the name of Geometry Database.
Here is the example of changing database names in the macro
file PersistentEx01.in.
# -------------------------
#
# PersistentEx01.in
#
.....
/db/run NewRuns
/db/event NewEvents
/db/geometry NewGeometry
.....
# -------------------------
--
@@ -0,0 +1,59 @@
include $(HEP_ODBMS_DIR)/etc/HepODBMS.mk
# application name, source files on objects
APPL = createTag
SRCS = $(APPL).cpp
OBJS = $(OS)/$(APPL).$(OBJ_EXT)
LIBS = $(HEP_ODBMS_LIBS) $(OBJY_LIBS) $(OSPACE_LIBS)
G4INSTALL := ../../../../..
G4ODBMS := true
ifeq ($(OS),Solaris)
G4SYSTEM := SUN-CC
endif
ifeq ($(OS),HP-UX)
G4SYSTEM := HP-aCC
endif
CLHEPLIB := /afs/cern.ch/sw/geant4/dev/CLHEP/$(G4SYSTEM)/pro/lib/libCLHEP.a
include $(G4INSTALL)/config/architecture.gmk
.PHONY: cleanall
# CPPFLAGS is defined in Geant4 architecture.gmk
CPPFLAGS += \
-I$./ \
-I$(G4SCHEMA_INCLUDE) \
-I$(G4INSTALL)/source/global/management/include \
-I$(G4INSTALL)/source/persistency/global/include \
-I$(G4INSTALL)/source/persistency/management/include \
-I$(G4INSTALL)/source/persistency/events/include \
-I$(G4INSTALL)/source/persistency/digits+hits/hits/include \
-I$(G4INSTALL)/source/event/include \
-I$(G4INSTALL)/source/tracking/include \
-I$(G4INSTALL)/source/digits+hits/hits/include \
-I$(G4INSTALL)/source/digits+hits/digits/include
# C_FLAGS is the one used in the rules of HepODBMS.mk
C_FLAGS += $(CPPFLAGS)
# Add Geant4 Persistent Libraries
LIBS := -L$(G4LIB)/$(G4SYSTEM) \
-lG4pmanagement -lG4pgeomn -lG4pgeomBoolean -lG4pcsg \
-lG4pgeomGlobal -lG4prun -lG4pevents -lG4phits -lG4pglobal \
-lG4event -lG4partman -lG4hits -lG4digits \
-lG4materials \
-lG4intercoms -lG4globman -lG4hepnumerics \
$(LIBS) \
$(CLHEPLIB)
# make APPL the default target
all : $(APPL)
$(APPL): GNUmakefile $(OBJS)
$(C++) $(C_FLAGS) $(CPPFLAGS) -o $(APPL) $(OBJS) $(LIBS)
cleanall : clean
@rm -f $(APPL)
@@ -0,0 +1,35 @@
$Id: README,v 1.1 1999/12/03 11:20:26 morita Exp $
-------------------------------------------------------------------
createTag
---------
This short program demonstrates how to create a HepODBMS tag
based on attibutes stored in G4PEvent objects.
To create and populate the database, see the README file
of PersistentEx01.
=====
Setup
=====
In addition to the variables required by PersistentEx01,
set OO_FD_BOOT to your runtime federeate database boot file.
OO_FD_BOOT <path of your runtime federated database file>
See setup.sh/setup.csh for example setup.
====================
createTag executable
====================
createTag executable can be made by simply typing "gmake" in this
directory.
After gmake, type "createTab" to create a new selection of tags
in OO_FD_BOOT.
To access the tag attributes created by this example, see
readTag/README.
--
@@ -0,0 +1,80 @@
#include "HepODBMS/tagdb/HepTagDbApplication.h"
#include "HepODBMS/tagdb/HepAnalysis.h"
#include "G4PEvent.hh"
const char tagName[] = "geant4Events";
class dbAccessApp : public HepTagDbApplication {
// Application inherits session control from HepTagDbApplication
public:
// this application implements just one method: run the
dbAccessApp(const char *name) : HepTagDbApplication(name)
{};
int run()
{
// print an
message("about to initialise the db connection");
Init(); // initialise the db session
message("starting an update transaction");
startUpdate(); // start an update transaction
// create an iterator over all events in the container "Events" in db "Events"
db("Events");
ooItr(G4PEvent) pevent_iterator;
pevent_iterator.scan(container("EventContainer"));
#ifdef REMOVE_OLD_TAGS
// remove an existing tag collection with the name <tagName>
HepExplorable *cd = HepExplorable::findExplorable(tagName);
if (cd) {
cout << "removing old tag:" << tagName << endl;
cd->removeDescription();
delete cd;
}
#endif
HepExplorableGenericTags events; // create a tag collection ...
db("Tags"); // ... in db "Tags"
if (events.createDescription(tagName) == 0) // start creating a new tag field description
fatal("could not create new tag"); // print the message and stop the application
// define some attributes in the tag
TagAttribute<long> event_id(events,"eventID");
TagAttribute<long> n_pvertex(events,"NumberOfPrimaryVertex");
// Loop over all tag collection elements (= all events)
while(pevent_iterator.next())
{
HepRef(G4PEvent) evt = pevent_iterator;
// create a new tag entry and bind it to the current event
events.newTag(evt);
// fill the tag variables with data from the event
event_id = evt->GetEventID();
n_pvertex = evt->GetNumberOfPrimaryVertex();
}
message("End of loop over events.");
// finish this read transaction and return
commit();
return 0;
}
};
int main(int argc, const char *argv[])
{
dbAccessApp myApp(argv[0]); // create an application object
return myApp.run(); // call it's run method
}
@@ -0,0 +1,2 @@
setenv OO_FD_BOOT $G4WORKDIR/exampleFD/$G4SYSTEM/PersistentEx01
source ../setup_lhcxx.csh
@@ -0,0 +1,2 @@
OO_FD_BOOT=$G4WORKDIR/exampleFD/$G4SYSTEM/PersistentEx01; export OO_FD_BOOT
. ../setup_lhcxx.sh
@@ -0,0 +1,29 @@
#
# G4ODBMS user example setup for CERN AFS
#
# Put a line in your .cshrc or .login to source this file.
#
# eg. source ...<path of this file>.../g4odbms_setup.csh
#
# Youhei Morita
#
# ----- Use HepODBMS
setenv G4USE_HEPODBMS 1
# ----- Objectivity variables setup
if ( ! $?OBJY_VERS ) then
setenv OBJY_VERS 5.1
endif
if ( -r /afs/cern.ch/rd45/objectivity/objyenv.csh ) then
echo "Setting up OBJY_VERS $OBJY_VERS ..."
source /afs/cern.ch/rd45/objectivity/objyenv.csh
endif
# ----- HepODBMS variables setup
setenv HEP_ODBMS_DIR /afs/cern.ch/sw/lhcxx/specific/@sys/HepODBMS/0.3.0.1
setenv HEP_ODBMS_INCLUDES ${HEP_ODBMS_DIR}/include
@@ -0,0 +1,32 @@
#
# G4ODBMS user example setup for CERN AFS
#
# Put a line in your .zshrc to source this file.
#
# eg. . <path of this file>/g4odbms_setup.sh
#
# Youhei Morita
#
# ----- Use HepODBMS
G4USE_HEPODBMS=1; export G4USE_HEPODBMS
# ----- Objectivity variables setup
if [ -z "$OBJY_VERS" ] ; then
OBJY_VERS=5.1
export OBJY_VERS
fi
if [ -r /afs/cern.ch/rd45/objectivity/objyenv.sh ] ; then
echo "Setting up OBJY_VERS $OBJY_VERS ..."
. /afs/cern.ch/rd45/objectivity/objyenv.sh
fi
# ----- HepODBMS variables setup
HEP_ODBMS_DIR=/afs/cern.ch/sw/lhcxx/specific/@sys/HepODBMS/0.3.0.1
export HEP_ODBMS_DIR
HEP_ODBMS_INCLUDES=${HEP_ODBMS_DIR}/include
export HEP_ODBMS_INCLUDES
@@ -0,0 +1,20 @@
#ifndef PersEx01DetectorConstruction_h
#define PersEx01DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class PersEx01DetectorConstruction : public G4VUserDetectorConstruction
{
public:
PersEx01DetectorConstruction();
~PersEx01DetectorConstruction();
public:
G4VPhysicalVolume* Construct();
};
#endif
@@ -0,0 +1,25 @@
#ifndef PersEx01EventAction_h
#define PersEx01EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class PersEx01EventAction : public G4UserEventAction
{
public:
PersEx01EventAction();
virtual ~PersEx01EventAction();
public:
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
private:
G4int colID1;
G4int colID2;
};
#endif
@@ -0,0 +1,51 @@
// $Id: PersEx01PhysicsList.hh,v 1.2 1999/11/04 12:54:26 morita Exp $
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This class is a class derived from G4VUserPhysicsList
// for constructing all particles and processes.
//
// History
// first version 10 Jan. 1998 by H.Kurashige
// ------------------------------------------------------------
#ifndef PersEx01PhysicsList_h
#define PersEx01PhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
class PersEx01PhysicsList: public G4VUserPhysicsList
{
public:
PersEx01PhysicsList();
virtual ~PersEx01PhysicsList();
protected:
// Construct particle and physics
virtual void ConstructParticle();
virtual void ConstructProcess();
//
virtual void SetCuts();
protected:
// these methods Construct particles
virtual void ConstructBosons();
virtual void ConstructLeptons();
virtual void ConstructMesons();
virtual void ConstructBaryons();
virtual void ConstructIons();
protected:
// these methods Construct physics processes and register them
virtual void ConstructGeneral();
virtual void ConstructEM();
virtual void ConstructHad();
virtual void ConstructLeptHad();
};
#endif
@@ -0,0 +1,25 @@
#ifndef PersEx01PrimaryGeneratorAction_h
#define PersEx01PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4ParticleGun;
class G4Event;
class PersEx01PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PersEx01PrimaryGeneratorAction();
~PersEx01PrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent);
private:
G4ParticleGun* particleGun;
};
#endif
@@ -0,0 +1,24 @@
#ifndef PersEx01RunAction_h
#define PersEx01RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
class PersEx01RunAction : public G4UserRunAction
{
public:
PersEx01RunAction();
virtual ~PersEx01RunAction();
public:
virtual void BeginOfRunAction(const G4Run* aRun);
virtual void EndOfRunAction(const G4Run* aRun);
private:
};
#endif
@@ -0,0 +1,25 @@
#ifndef PersEx01StackingAction_H
#define PersEx01StackingAction_H 1
#include "globals.hh"
#include "G4UserStackingAction.hh"
#include "G4ThreeVector.hh"
class G4Track;
class PersEx01StackingAction : public G4UserStackingAction
{
public:
PersEx01StackingAction();
virtual ~PersEx01StackingAction();
public:
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
virtual void NewStage();
virtual void PrepareNewEvent();
};
#endif
@@ -0,0 +1,60 @@
#ifndef PersEx01TrackerHit_h
#define PersEx01TrackerHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
class PersEx01TrackerHit : public G4VHit
{
public:
PersEx01TrackerHit();
~PersEx01TrackerHit();
PersEx01TrackerHit(const PersEx01TrackerHit &right);
const PersEx01TrackerHit& operator=(const PersEx01TrackerHit &right);
int operator==(const PersEx01TrackerHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
void Draw();
void Print();
private:
G4double edep;
G4ThreeVector pos;
public:
inline void SetEdep(G4double de)
{ edep = de; };
inline G4double GetEdep()
{ return edep; };
inline void SetPos(G4ThreeVector xyz)
{ pos = xyz; };
inline G4ThreeVector GetPos()
{ return pos; };
};
typedef G4THitsCollection<PersEx01TrackerHit> PersEx01TrackerHitsCollection;
extern G4Allocator<PersEx01TrackerHit> PersEx01TrackerHitAllocator;
inline void* PersEx01TrackerHit::operator new(size_t)
{
void *aHit;
aHit = (void *) PersEx01TrackerHitAllocator.MallocSingle();
return aHit;
}
inline void PersEx01TrackerHit::operator delete(void *aHit)
{
PersEx01TrackerHitAllocator.FreeSingle((PersEx01TrackerHit*) aHit);
}
#endif
@@ -0,0 +1,30 @@
#ifndef PersEx01TrackerSD_h
#define PersEx01TrackerSD_h 1
#include "G4VSensitiveDetector.hh"
#include "PersEx01TrackerHit.hh"
#include "G4Step.hh"
class PersEx01TrackerSD : public G4VSensitiveDetector
{
public:
PersEx01TrackerSD(G4String name);
~PersEx01TrackerSD();
void Initialize(G4HCofThisEvent*HCE);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
private:
PersEx01TrackerHitsCollection *EvenCollection;
PersEx01TrackerHitsCollection *OddCollection;
};
#endif
@@ -0,0 +1,6 @@
#
# prerunPEx01.mac
#
/control/verbose 2
/db/verbose 2
/run/initialize
@@ -0,0 +1,59 @@
include $(HEP_ODBMS_DIR)/etc/HepODBMS.mk
# application name, source files on objects
APPL = readDB
SRCS = $(APPL).cpp
OBJS = $(OS)/$(APPL).$(OBJ_EXT)
LIBS = $(HEP_ODBMS_LIBS) $(OBJY_LIBS) $(OSPACE_LIBS)
G4INSTALL := ../../../../..
G4ODBMS := true
ifeq ($(OS),Solaris)
G4SYSTEM := SUN-CC
endif
ifeq ($(OS),HP-UX)
G4SYSTEM := HP-aCC
endif
CLHEPLIB := /afs/cern.ch/sw/geant4/dev/CLHEP/$(G4SYSTEM)/pro/lib/libCLHEP.a
include $(G4INSTALL)/config/architecture.gmk
.PHONY: cleanall
# CPPFLAGS is defined in Geant4 architecture.gmk
CPPFLAGS += \
-I$./ \
-I$(G4SCHEMA_INCLUDE) \
-I$(G4INSTALL)/source/global/management/include \
-I$(G4INSTALL)/source/persistency/global/include \
-I$(G4INSTALL)/source/persistency/management/include \
-I$(G4INSTALL)/source/persistency/events/include \
-I$(G4INSTALL)/source/persistency/digits+hits/hits/include \
-I$(G4INSTALL)/source/event/include \
-I$(G4INSTALL)/source/tracking/include \
-I$(G4INSTALL)/source/digits+hits/hits/include \
-I$(G4INSTALL)/source/digits+hits/digits/include
# C_FLAGS is the one used in the rules of HepODBMS.mk
C_FLAGS += $(CPPFLAGS)
# Add Geant4 Persistent Libraries
LIBS := -L$(G4LIB)/$(G4SYSTEM) \
-lG4pmanagement -lG4pgeomn -lG4pgeomBoolean -lG4pcsg \
-lG4pgeomGlobal -lG4prun -lG4pevents -lG4phits -lG4pglobal \
-lG4event -lG4partman -lG4hits -lG4digits \
-lG4materials \
-lG4intercoms -lG4globman -lG4hepnumerics \
$(LIBS) \
$(CLHEPLIB)
# make APPL the default target
all : $(APPL)
$(APPL): GNUmakefile $(OBJS)
$(C++) $(C_FLAGS) $(CPPFLAGS) -o $(APPL) $(OBJS) $(LIBS)
cleanall : clean
@rm -f $(APPL)
@@ -0,0 +1,32 @@
$Id: README,v 1.3 1999/12/03 11:20:58 morita Exp $
-------------------------------------------------------------------
readDB
------
This short program demonstrates how to access events and their
associations which are stored in the database.
To create and populate the database, see the README file
of PersistentEx01.
=====
Setup
=====
In addition to the variables required by PersistentEx01,
set OO_FD_BOOT to your runtime federeate database boot file.
OO_FD_BOOT <path of your runtime federated database file>
See setup.sh/setup.csh for example setup.
=================
readDB executable
=================
readDB executable can be made by simply typing "gmake" in this
directory.
After gmake, type "readDB" to access the database defined by
OO_FD_BOOT.
--
@@ -0,0 +1,117 @@
#include "HepODBMS/clustering/HepDbApplication.h"
#include "G4PEvent.hh"
#include "G4PPrimaryVertex.hh"
#include "G4PPrimaryParticle.hh"
#include "G4PHCofThisEvent.hh"
#include "G4PVHitsCollection.hh"
class dbAccessApp : public HepDbApplication {
// Application inherits session control from HepDbApplication
public:
// this application implements just one method: run the
dbAccessApp(const char *name) : HepDbApplication(name)
{};
int run()
{
// print an
message("about to initialise the db connection");
Init(); // initialise the db session
message("starting a read transaction");
startRead(); // start a read transaction
HepDatabaseRef myDb = db("Events");
// if the database ref is not valid:
// - print a message
// - exit the application with an error code
if (myDb == 0)
fatal("could not find Events DB");
// locates Events container in this database
HepContainerRef cont = container("EventContainer");
if (cont == 0 )
fatal("could not find Events Container");
// initialize iterator for G4PEvent in "Events" Container
ooItr(G4PEvent) pevent_iterator;
pevent_iterator.scan(cont);
// Loop for all G4PEvent in the "EventContainer"
while (pevent_iterator.next())
{
// access this G4PEvent
int evt_id = pevent_iterator->GetEventID();
int n_pvertex = pevent_iterator->GetNumberOfPrimaryVertex();
cout << endl << "Reading event #" << evt_id << ":" << endl;
cout << " No. of primary vertex: " << n_pvertex << endl;
// Loop for all primary vertex in this event
for ( int i = 0; i < n_pvertex; i++ )
{
HepRef(G4PPrimaryVertex) pvertex =
pevent_iterator->GetPrimaryVertex(i);
cout << " ObjectID of the primary vertex: "
<< pvertex.sprint() << endl;
cout << " No. of particle in the primary vertex: "
<< pvertex->GetNumberOfParticle() << endl;
for ( int j = 0; j < pvertex->GetNumberOfParticle() ; j++ )
{
HepRef(G4PPrimaryParticle) particle = pvertex->GetPrimary(j);
cout << " PDGcode: " << particle->GetPDGcode()
<< " Px = " << particle->GetPx()
<< " Py = " << particle->GetPy()
<< " Pz = " << particle->GetPz() << endl;
}
}
// HitCollections of this event
const HepRef(G4PHCofThisEvent) hcte = pevent_iterator->GetHCofThisEvent();
if( hcte != 0 )
{
cout << " ObjectID of the Hit Collections: " << hcte.sprint() << endl;
// Capacity of the Hit Collections VArray
// G4int numHC = hcte->GetCapacity();
// Actual number of Hit Collections in this event
G4int numHCact = hcte->GetNumberOfCollections();
cout << " No. of the Hit Collections: " << numHCact << endl;
for( G4int i = 0; i<numHCact; i++)
{
const HepRef(G4PVHitsCollection) aHC = hcte->GetHC(i);
if( aHC != 0 )
{
cout << " Hit Collection[" << i << "]: Name: "
<< aHC->GetName();
cout << " Sensitive Detector: " << aHC->GetSDname() << endl;
}
}
}
else
{ cout << " No Hit Collections for this event." << endl; }
}
message("End of loop over events.");
// finish this read transaction and return
commit();
return 0;
}
};
int main(int argc, const char *argv[])
{
dbAccessApp myApp(argv[0]); // create an application object
return myApp.run(); // call it's run method
}
@@ -0,0 +1,2 @@
setenv OO_FD_BOOT $G4WORKDIR/exampleFD/$G4SYSTEM/PersistentEx01
source ../setup_lhcxx.csh
@@ -0,0 +1,2 @@
OO_FD_BOOT=$G4WORKDIR/exampleFD/$G4SYSTEM/PersistentEx01; export OO_FD_BOOT
. ../setup_lhcxx.sh
@@ -0,0 +1,59 @@
include $(HEP_ODBMS_DIR)/etc/HepODBMS.mk
# application name, source files on objects
APPL = readTag
SRCS = $(APPL).cpp
OBJS = $(OS)/$(APPL).$(OBJ_EXT)
LIBS = $(HEP_ODBMS_LIBS) $(OBJY_LIBS) $(OSPACE_LIBS)
G4INSTALL := ../../../../..
G4ODBMS := true
ifeq ($(OS),Solaris)
G4SYSTEM := SUN-CC
endif
ifeq ($(OS),HP-UX)
G4SYSTEM := HP-aCC
endif
CLHEPLIB := /afs/cern.ch/sw/geant4/dev/CLHEP/$(G4SYSTEM)/pro/lib/libCLHEP.a
include $(G4INSTALL)/config/architecture.gmk
.PHONY: cleanall
# CPPFLAGS is defined in Geant4 architecture.gmk
CPPFLAGS += \
-I$./ \
-I$(G4SCHEMA_INCLUDE) \
-I$(G4INSTALL)/source/global/management/include \
-I$(G4INSTALL)/source/persistency/global/include \
-I$(G4INSTALL)/source/persistency/management/include \
-I$(G4INSTALL)/source/persistency/events/include \
-I$(G4INSTALL)/source/persistency/digits+hits/hits/include \
-I$(G4INSTALL)/source/event/include \
-I$(G4INSTALL)/source/tracking/include \
-I$(G4INSTALL)/source/digits+hits/hits/include \
-I$(G4INSTALL)/source/digits+hits/digits/include
# C_FLAGS is the one used in the rules of HepODBMS.mk
C_FLAGS += $(CPPFLAGS)
# Add Geant4 Persistent Libraries
LIBS := -L$(G4LIB)/$(G4SYSTEM) \
-lG4pmanagement -lG4pgeomn -lG4pgeomBoolean -lG4pcsg \
-lG4pgeomGlobal -lG4prun -lG4pevents -lG4phits -lG4pglobal \
-lG4event -lG4partman -lG4hits -lG4digits \
-lG4materials \
-lG4intercoms -lG4globman -lG4hepnumerics \
$(LIBS) \
$(CLHEPLIB)
# make APPL the default target
all : $(APPL)
$(APPL): GNUmakefile $(OBJS)
$(C++) $(C_FLAGS) $(CPPFLAGS) -o $(APPL) $(OBJS) $(LIBS)
cleanall : clean
@rm -f $(APPL)
@@ -0,0 +1,25 @@
$Id: README,v 1.1 1999/12/03 11:20:29 morita Exp $
-------------------------------------------------------------------
readTag
-------
This short program demonstrates how to access tag attributes
created by createTag example, and how to follow the association
of the original objects.
See the README file of createTag and create a new tag before
running this example.
=====
Setup
=====
See setup.sh/setup.csh for example setup.
==================
readTag executable
==================
readTag executable can be made by simply typing "gmake" in this
directory. After gmake, type "readTag".
--
@@ -0,0 +1,93 @@
#include "HepODBMS/tagdb/HepTagDbApplication.h"
#include "HepODBMS/tagdb/HepAnalysis.h"
#include "G4PEvent.hh"
const char tagName[] = "geant4Events";
class dbAccessApp : public HepTagDbApplication {
// Application inherits session control from HepTagDbApplication
public:
// this application implements just one method: run the
dbAccessApp(const char *name) : HepTagDbApplication(name)
{};
int run()
{
// print an
message("about to initialise the db connection");
Init(); // initialise the db session
message("starting a read transaction");
startRead(); // start a read transaction
// find the tag collection by name
HepExplorable *events =
HepExplorable::findExplorable(tagName);
if (events == 0)
fatal("could not find tag collection");
// define some attributes in the tag
TagAttribute<long> event_id(events,"eventID");
TagAttribute<long> n_pvertex(events,"NumberOfPrimaryVertex");
// also use G4PEvent directly...
HepRef(G4PEvent) g4evt;
// Loop over all tag collection elements (= all events)
for(events->start(); events->next() != 0; )
{
// use a tag attribute directly in a print statment
cout << "Reading event #" << event_id << ":" << endl;
cout << " number of primary vertex: " << n_pvertex << endl;
//
// [ could do some selection based on tag attributes here ... ]
//
// eg. if( n_pvertex < 20 )
// { ...do something... }
// else
// { ...do anything else... }
//
// retrieve the associated event object for the current tag
// and navigate to the associated objects/members which are
// not present in the tag (GetNumberOfParticle() in this example).
if (getEvent(g4evt, events) )
{
cout << " ObjectID of event: " << g4evt.sprint() << endl;
cout << " No. of the primary vertex (from G4PEvent): "
<< g4evt->GetNumberOfPrimaryVertex() << endl;
for ( int i = 0; i < n_pvertex; i++ )
{
HepRef(G4PPrimaryVertex) pvertex = g4evt->GetPrimaryVertex(i);
cout << " ObjectID of primary vertex: " << pvertex.sprint() << endl;
cout << " No. of particle in the primary vertex: "
<< pvertex->GetNumberOfParticle() << endl;
}
}
else
{ cout << " No event object found." << endl; }
}
message("End of loop over events.");
// finish this read transaction and return
commit();
return 0;
}
};
int main(int argc, const char *argv[])
{
dbAccessApp myApp(argv[0]); // create an application object
return myApp.run(); // call it's run method
}
@@ -0,0 +1,2 @@
setenv OO_FD_BOOT $G4WORKDIR/exampleFD/$G4SYSTEM/PersistentEx01
source ../setup_lhcxx.csh
@@ -0,0 +1,2 @@
OO_FD_BOOT=$G4WORKDIR/exampleFD/$G4SYSTEM/PersistentEx01; export OO_FD_BOOT
. ../setup_lhcxx.sh
@@ -0,0 +1,22 @@
#! /bin/csh -f
# check for LHC++ variables
if ( ! $?LHCXXTOP ) set LHCXXTOP = /afs/cern.ch/sw/lhcxx
if ( ! $?PLATF ) set PLATF = $OS
if ( ! $?OSPACE_DIR ) \
set OSPACE_DIR = $LHCXXTOP/specific/$PLATF/ObjectSpace/2.1/ToolKit
# check the LD_LIBRARY_PATH
if( $?LD_LIBRARY_PATH ) then
(echo $LD_LIBRARY_PATH | grep HepODBMS >& /dev/null) || \
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$HEP_ODBMS_DIR/lib
if ( $PLATF == "Linux" ) then
(echo $LD_LIBRARY_PATH | grep ObjectSpace >& /dev/null) || \
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:$OSPACE_DIR/lib
endif
echo LD_LIBRARY_PATH = $LD_LIBRARY_PATH
echo ""
endif
@@ -0,0 +1,23 @@
#! /bin/sh
# check for LHC++ variables
if [ -z "$LHCXXTOP" ] ; then LHCXXTOP=/afs/cern.ch/sw/lhcxx ; fi
if [ -z "$PLATF" ] ; then PLATF=$OS ; fi
if [ -z "$OSPACE_DIR" ] ; then
OSPACE_DIR=$LHCXXTOP/specific/$PLATF/ObjectSpace/2.1/ToolKit
fi
# check the LD_LIBRARY_PATH
if [ -n "$LD_LIBRARY_PATH" ] ; then
(echo $LD_LIBRARY_PATH | grep HepODBMS >& /dev/null) || \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$HEP_ODBMS_DIR/lib; export LD_LIBRARY_PATH
if [ $PLATF = "Linux" ] ; then
(echo $LD_LIBRARY_PATH | grep ObjectSpace >& /dev/null) || \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$OSPACE_DIR/lib; export LD_LIBRARY_PATH
fi
echo LD_LIBRARY_PATH = $LD_LIBRARY_PATH
echo ""
fi
@@ -0,0 +1,118 @@
#include "PersEx01DetectorConstruction.hh"
#include "PersEx01TrackerSD.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4SDManager.hh"
PersEx01DetectorConstruction::PersEx01DetectorConstruction()
{;}
PersEx01DetectorConstruction::~PersEx01DetectorConstruction()
{;}
G4VPhysicalVolume* PersEx01DetectorConstruction::Construct()
{
G4cout << " -- Tracker type sensitive detector" << endl;
//--------- Material definition ---------
G4double a, iz, z, density;
G4String name, symbol;
G4int nel;
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen", symbol="N", iz=7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxigen", symbol="O", iz=8., a);
a = 26.98*g/mole;
density = 2.7*g/cm3;
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
a = 207.19*g/mole;
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
density = 1.29e-03*g/cm3;
G4Material* Air = new G4Material(name="Air", density, nel=2);
Air->AddElement(elN, .7);
Air->AddElement(elO, .3);
//--------- G4VSolid, G4LogicalVolume, G4VPhysicalVolume ---------
G4double offset=22.5*cm, xTlate, yTlate;
G4int i,j,copyNo;
G4Box *myWorldBox= new G4Box("WBox",10000*cm, 10000*cm, 10000*cm);
G4Box *myCalBox = new G4Box("CBox",1500*cm, 1500*cm, 1000*cm);
G4Tubs *myTargetTube
= new G4Tubs("TTube",0*cm, 22.5*cm, 1000*cm, 0.*deg, 360.*deg);
G4LogicalVolume *myWorldLog=new G4LogicalVolume(myWorldBox,Air,
"WLog", 0, 0, 0);
G4LogicalVolume *myCalLog=new G4LogicalVolume(myCalBox,Al,
"CLog", 0, 0, 0);
G4LogicalVolume *myTargetLog=new G4LogicalVolume(myTargetTube,Pb,
"TLog", 0, 0, 0);
G4PVPlacement *myWorldPhys=new G4PVPlacement(0,G4ThreeVector(),
"WPhys",
myWorldLog,
0,false,0);
G4PVPlacement *myCalPhys=new G4PVPlacement(0,G4ThreeVector(),
"CalPhys",
myCalLog,
myWorldPhys,false,0);
G4String tName1("TPhys1");
copyNo=1;
for (j=1;j<=25;j++)
{
yTlate = -1000.0*cm - 40.0*cm + j*80.0*cm;
for (i=1;i<=50;i++)
{
xTlate = -1000.0*cm - 20.0*cm + i*45.0*cm - offset;
G4PVPlacement *myTargetPhys
=new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0*cm),
tName1,myTargetLog,myCalPhys,false,copyNo++);
}
}
G4String tName2("TPhys2");
copyNo=1;
for (j=1;j<=26;j++)
{
yTlate = -1000.0*cm - 80.0*cm + j*80.0*cm;
for (i=1;i<=50;i++)
{
xTlate = -1000.0*cm - 20.0*cm + i*45.0*cm;
G4PVPlacement *myTargetPhys
=new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0*cm),
tName2,myTargetLog,myCalPhys,false,copyNo++);
}
}
//--------- Sensitive detector -------------------------------------
// A concrete object named "mySD", which corresponds to
// the G4LogicalVolume object "myTargetLog"
G4String sdName = "sample/tracker/mySD";
PersEx01TrackerSD* mySD = new PersEx01TrackerSD( sdName );
myTargetLog->SetSensitiveDetector( mySD );
// "mySD" will be registrated
G4SDManager* SDman = G4SDManager::GetSDMpointer();
SDman->AddNewDetector( mySD );
//------------------------------------------------------------------
return myWorldPhys;
}
@@ -0,0 +1,53 @@
#include "PersEx01EventAction.hh"
#include "PersEx01TrackerHit.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
PersEx01EventAction::PersEx01EventAction()
{
colID1 = -1;
colID2 = -1;
}
PersEx01EventAction::~PersEx01EventAction()
{;}
void PersEx01EventAction::BeginOfEventAction(const G4Event* )
{
if(colID1<0||colID2<0)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
G4String colNam;
colID1 = SDman->GetCollectionID(colNam="EvenCollection");
colID2 = SDman->GetCollectionID(colNam="OddCollection");
}
}
void PersEx01EventAction::EndOfEventAction(const G4Event* evt)
{
G4cout << ">>> Event " << evt->GetEventID() << endl;
G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
PersEx01TrackerHitsCollection * pTHC1
= (PersEx01TrackerHitsCollection*)(HCE->GetHC(colID1));
PersEx01TrackerHitsCollection * pTHC2
= (PersEx01TrackerHitsCollection*)(HCE->GetHC(colID2));
G4cout << "Event : " << evt->GetEventID() << endl
<< pTHC1->GetSDname() << "/" << pTHC1->GetName() << " "
<< "Number of hits " << pTHC1->entries() << endl;
if( pTHC1->entries() > 0 )
G4cout << " Edep of the first Hit " << (*pTHC1)[0]->GetEdep() << endl;
G4cout << pTHC2->GetSDname() << "/" << pTHC2->GetName() << " "
<< "Number of hits " << pTHC2->entries() << endl;
if( pTHC2->entries() > 0 )
G4cout << " Edep of the first Hit " << (*pTHC2)[0]->GetEdep() << endl;
}
@@ -0,0 +1,195 @@
// $Id: PersEx01PhysicsList.cc,v 1.2 1999/11/04 12:55:02 morita Exp $
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This is a version for maximum particle set
// History
// first version 10 Jan. 1998 by H.Kurashige
// add decay at rest 26 Feb. 1998 by H.Kurashige
// ------------------------------------------------------------
#include "globals.hh"
#include "PersEx01PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4BosonConstructor.hh"
#include "G4LeptonConstructor.hh"
#include "G4MesonConstructor.hh"
#include "G4BaryonConstructor.hh"
#include "G4IonConstructor.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include <iomanip.h>
PersEx01PhysicsList::PersEx01PhysicsList(): G4VUserPhysicsList()
{
SetVerboseLevel(1);
}
PersEx01PhysicsList::~PersEx01PhysicsList()
{
}
void PersEx01PhysicsList::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();
}
void PersEx01PhysicsList::ConstructBosons()
{
// Construct all bosons
G4BosonConstructor pConstructor;
pConstructor.ConstructParticle();
}
void PersEx01PhysicsList::ConstructLeptons()
{
// Construct all leptons
G4LeptonConstructor pConstructor;
pConstructor.ConstructParticle();
}
void PersEx01PhysicsList::ConstructMesons()
{
// Construct all mesons
G4MesonConstructor pConstructor;
pConstructor.ConstructParticle();
}
void PersEx01PhysicsList::ConstructBaryons()
{
// Construct all baryons
G4BaryonConstructor pConstructor;
pConstructor.ConstructParticle();
}
void PersEx01PhysicsList::ConstructIons()
{
// Construct light ions
G4IonConstructor pConstructor;
pConstructor.ConstructParticle();
}
void PersEx01PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructLeptHad();
ConstructHad();
ConstructGeneral();
}
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
void PersEx01PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
// Construct processes for gamma
pmanager->AddDiscreteProcess(new G4GammaConversion());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
} else if (particleName == "e-") {
//electron
// Construct processes for electron
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4eIonisation(),-1,2,2);
pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
} else if (particleName == "e+") {
//positron
// Construct processes for positron
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4eIonisation(),-1,2,2);
pmanager->AddProcess(new G4eBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation(),0,-1,4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
// Construct processes for muon+
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4MuIonisation(),-1,2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
} else {
if ((particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
// all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4hIonisation(),-1,2,2);
}
}
}
}
void PersEx01PhysicsList::ConstructHad()
{;}
void PersEx01PhysicsList::ConstructLeptHad()
{;}
#include "G4Decay.hh"
void PersEx01PhysicsList::ConstructGeneral()
{
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager->AddProcess(theDecayProcess, INT_MAX, -1, INT_MAX);
}
}
}
void PersEx01PhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "PersEx01PhysicsList::SetCuts:";
G4cout << "CutLength : " << defaultCutValue/mm << " (mm)" << endl;
}
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
// the default cut value for all particle types
SetCutsWithDefault();
}
@@ -0,0 +1,38 @@
#include "PersEx01PrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "globals.hh"
PersEx01PrimaryGeneratorAction::PersEx01PrimaryGeneratorAction()
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
// default particle
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="mu-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,1.,0.));
particleGun->SetParticleEnergy(1.*GeV);
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
}
PersEx01PrimaryGeneratorAction::~PersEx01PrimaryGeneratorAction()
{
delete particleGun;
}
void PersEx01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,36 @@
#include "PersEx01RunAction.hh"
#include "G4Run.hh"
#include "G4VPersistencyManager.hh"
#include "G4TransportationManager.hh"
#include "G4VPhysicalVolume.hh"
PersEx01RunAction::PersEx01RunAction()
{
}
PersEx01RunAction::~PersEx01RunAction()
{
}
void PersEx01RunAction::BeginOfRunAction(const G4Run* aRun)
{
if(aRun->GetRunID()==0)
{
G4VPersistencyManager* persM
= G4VPersistencyManager::GetPersistencyManager();
if(persM)
{
G4VPhysicalVolume* theWorld
= G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking()->GetWorldVolume();
persM->Store(theWorld);
}
}
}
void PersEx01RunAction::EndOfRunAction(const G4Run* )
{
}
@@ -0,0 +1,30 @@
#include "PersEx01StackingAction.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4ios.hh"
PersEx01StackingAction::PersEx01StackingAction()
{;}
PersEx01StackingAction::~PersEx01StackingAction()
{;}
G4ClassificationOfNewTrack
PersEx01StackingAction::ClassifyNewTrack(const G4Track * aTrack)
{
G4ClassificationOfNewTrack classification = fKill;
if(aTrack->GetParentID()==0)
{ classification = fUrgent; }
return classification;
}
void PersEx01StackingAction::NewStage()
{;}
void PersEx01StackingAction::PrepareNewEvent()
{;}
@@ -0,0 +1,38 @@
#include "PersEx01TrackerHit.hh"
G4Allocator<PersEx01TrackerHit> PersEx01TrackerHitAllocator;
PersEx01TrackerHit::PersEx01TrackerHit()
{;}
PersEx01TrackerHit::~PersEx01TrackerHit()
{;}
PersEx01TrackerHit::PersEx01TrackerHit(const PersEx01TrackerHit &right)
{
edep = right.edep;
pos = right.pos;
}
const PersEx01TrackerHit& PersEx01TrackerHit::operator=(const PersEx01TrackerHit &right)
{
edep = right.edep;
pos = right.pos;
return *this;
}
int PersEx01TrackerHit::operator==(const PersEx01TrackerHit &right) const
{
return 0;
}
void PersEx01TrackerHit::Draw()
{
}
void PersEx01TrackerHit::Print()
{
}
@@ -0,0 +1,68 @@
#include "PersEx01TrackerSD.hh"
#include "PersEx01TrackerHit.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4ParticleDefinition.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
PersEx01TrackerSD::PersEx01TrackerSD(G4String name)
:G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="EvenCollection");
collectionName.insert(HCname="OddCollection");
}
PersEx01TrackerSD::~PersEx01TrackerSD(){;}
void PersEx01TrackerSD::Initialize(G4HCofThisEvent*HCE)
{
EvenCollection = new
PersEx01TrackerHitsCollection(SensitiveDetectorName,collectionName[0]);
OddCollection = new
PersEx01TrackerHitsCollection(SensitiveDetectorName,collectionName[1]);
}
G4bool PersEx01TrackerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
{
const G4VPhysicalVolume* physVol
= aStep->GetPreStepPoint()->GetPhysicalVolume();
G4double edep = aStep->GetTotalEnergyDeposit();
PersEx01TrackerHit* newHit = new PersEx01TrackerHit();
newHit->SetEdep( edep );
newHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
if( physVol->GetName() == "TPhys1" )
{ EvenCollection->insert( newHit ); }
else if( physVol->GetName() == "TPhys2" )
{ OddCollection->insert( newHit ); }
return true;
}
void PersEx01TrackerSD::EndOfEvent(G4HCofThisEvent*HCE)
{
static G4int IDe = -1;
static G4int IDo = -1;
if(IDe<0)
{ IDe = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
if(IDo<0)
{ IDo = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[1]); }
HCE->AddHitsCollection( IDe, EvenCollection );
HCE->AddHitsCollection( IDo, OddCollection );
}
void PersEx01TrackerSD::clear()
{
}
void PersEx01TrackerSD::DrawAll()
{
}
void PersEx01TrackerSD::PrintAll()
{
}