Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
+25
@@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# $Id: GNUmakefile,v 1.4 1999/12/01 15:29:08 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 := PersistentEx02
|
||||
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,38 @@
|
||||
$Id: History,v 1.7 1999/12/05 22:28:52 morita Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
PersistentEx02 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 *
|
||||
----------------------------------------------------------
|
||||
|
||||
5th December 1999 Y.Morita (PersistentEx02-V00-01-03)
|
||||
- LD_LIBRARY_PATH change for Linux
|
||||
- readDB: added access to G4PPrimaryParticle.
|
||||
|
||||
3rd December 1999 Y.Morita (PersistentEx02-V00-01-02)
|
||||
- more bug fixes (TrackerSD)
|
||||
|
||||
1st December 1999 Y.Morita (PersistentEx02-V00-01-01)
|
||||
- Fix GNUmakefile to pick up right dependency files.
|
||||
- new PersistentEx01run script file for new config.
|
||||
|
||||
29th November 1999 Y.Morita
|
||||
- Bug fix for persistent hits collection based on PersistentEx01.
|
||||
(Requires persistency-V00-01-08)
|
||||
|
||||
10th November 1999 Y.Morita (PersistentEx02-V00-01-00)
|
||||
- tagged for release 4.1
|
||||
|
||||
Oct 18, 1999 Y. Morita
|
||||
- Example for persistent hits, started from exampleN02.
|
||||
|
||||
@@ -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: PersistentEx02.cc,v 1.2.2.1 1999/12/07 20:47:20 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT4 - PersistentEx02
|
||||
//
|
||||
// For information related to this code contact:
|
||||
// CERN, IT Division, ASD Group
|
||||
// --------------------------------------------------------------
|
||||
// Comments
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
|
||||
|
||||
#include "PersEx02DetectorConstruction.hh"
|
||||
#include "PersEx02PhysicsList.hh"
|
||||
#include "PersEx02RunAction.hh"
|
||||
#include "PersEx02PrimaryGeneratorAction.hh"
|
||||
#include "PersEx02EventAction.hh"
|
||||
#include "PersEx02StackingAction.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 PersEx02DetectorConstruction);
|
||||
runManager->SetUserInitialization(new PersEx02PhysicsList);
|
||||
|
||||
// UserAction classes.
|
||||
runManager->SetUserAction(new PersEx02RunAction);
|
||||
runManager->SetUserAction(new PersEx02PrimaryGeneratorAction);
|
||||
runManager->SetUserAction(new PersEx02EventAction);
|
||||
runManager->SetUserAction(new PersEx02StackingAction);
|
||||
|
||||
// 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 prerunPEx02.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 @@
|
||||
#
|
||||
# PersistentEx02.in
|
||||
#
|
||||
/control/verbose 2
|
||||
/db/verbose 2
|
||||
###/db/run NewRuns
|
||||
###/db/event NewEvents
|
||||
###/db/geometry NewGeometry
|
||||
/run/initialize
|
||||
#
|
||||
# 100 events
|
||||
#
|
||||
/run/beamOn 100
|
||||
#
|
||||
exit
|
||||
@@ -0,0 +1,805 @@
|
||||
Opening federated database OO_FD_BOOT.
|
||||
WARNING: g4example: Could not find naming root directory: Naming will be disabled.
|
||||
#
|
||||
# PersistentEx02.in
|
||||
#
|
||||
/db/verbose 2
|
||||
###/db/run NewRuns
|
||||
###/db/event NewEvents
|
||||
###/db/geometry NewGeometry
|
||||
/run/initialize
|
||||
-- Tracker type sensitive detector
|
||||
PersEx02PhysicsList::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.
|
||||
#
|
||||
# 100 events
|
||||
#
|
||||
/run/beamOn 100
|
||||
Transaction started for /Geometry/GeomContainer/ with non-sustained mode.
|
||||
-- Geometry stored in /Geometry/GeomContainer/
|
||||
Transaction is committed on /Geometry/GeomContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
>>> Event 0
|
||||
Event : 0
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 34.3698
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 18.4405
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 0 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 1
|
||||
Event : 1
|
||||
mySD/EvenCollection Number of hits 21
|
||||
Edep of the first Hit 99.9396
|
||||
mySD/OddCollection Number of hits 20
|
||||
Edep of the first Hit 25.443
|
||||
-- G4PEvent 1 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 2
|
||||
Event : 2
|
||||
mySD/EvenCollection Number of hits 21
|
||||
Edep of the first Hit 6.23362
|
||||
mySD/OddCollection Number of hits 19
|
||||
Edep of the first Hit 64.6385
|
||||
-- G4PEvent 2 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 3
|
||||
Event : 3
|
||||
mySD/EvenCollection Number of hits 13
|
||||
Edep of the first Hit 48.4612
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 14.5902
|
||||
-- G4PEvent 3 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 4
|
||||
Event : 4
|
||||
mySD/EvenCollection Number of hits 31
|
||||
Edep of the first Hit 50.5145
|
||||
mySD/OddCollection Number of hits 16
|
||||
Edep of the first Hit 57.8215
|
||||
-- G4PEvent 4 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 5
|
||||
Event : 5
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 139.802
|
||||
mySD/OddCollection Number of hits 34
|
||||
Edep of the first Hit 109.904
|
||||
-- G4PEvent 5 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 6
|
||||
Event : 6
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 21.8663
|
||||
mySD/OddCollection Number of hits 27
|
||||
Edep of the first Hit 14.2566
|
||||
-- G4PEvent 6 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 7
|
||||
Event : 7
|
||||
mySD/EvenCollection Number of hits 12
|
||||
Edep of the first Hit 2.93176
|
||||
mySD/OddCollection Number of hits 42
|
||||
Edep of the first Hit 3.13845
|
||||
-- G4PEvent 7 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 8
|
||||
Event : 8
|
||||
mySD/EvenCollection Number of hits 18
|
||||
Edep of the first Hit 13.787
|
||||
mySD/OddCollection Number of hits 34
|
||||
Edep of the first Hit 13.6233
|
||||
-- G4PEvent 8 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 9
|
||||
Event : 9
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 42.2712
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 21.0987
|
||||
-- G4PEvent 9 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 10
|
||||
Event : 10
|
||||
mySD/EvenCollection Number of hits 24
|
||||
Edep of the first Hit 14.0895
|
||||
mySD/OddCollection Number of hits 24
|
||||
Edep of the first Hit 7.74588
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 10 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 11
|
||||
Event : 11
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 106.832
|
||||
mySD/OddCollection Number of hits 35
|
||||
Edep of the first Hit 30.1659
|
||||
-- G4PEvent 11 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 12
|
||||
Event : 12
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 7.46186
|
||||
mySD/OddCollection Number of hits 36
|
||||
Edep of the first Hit 16.788
|
||||
-- G4PEvent 12 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 13
|
||||
Event : 13
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 16.4669
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 55.2629
|
||||
-- G4PEvent 13 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 14
|
||||
Event : 14
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 21.5352
|
||||
mySD/OddCollection Number of hits 36
|
||||
Edep of the first Hit 7.92271
|
||||
-- G4PEvent 14 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 15
|
||||
Event : 15
|
||||
mySD/EvenCollection Number of hits 12
|
||||
Edep of the first Hit 17.9607
|
||||
mySD/OddCollection Number of hits 43
|
||||
Edep of the first Hit 8.11967
|
||||
-- G4PEvent 15 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 16
|
||||
Event : 16
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 39.8096
|
||||
mySD/OddCollection Number of hits 37
|
||||
Edep of the first Hit 13.969
|
||||
-- G4PEvent 16 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 17
|
||||
Event : 17
|
||||
mySD/EvenCollection Number of hits 11
|
||||
Edep of the first Hit 29.4604
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 5.21882
|
||||
-- G4PEvent 17 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 18
|
||||
Event : 18
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 23.4087
|
||||
mySD/OddCollection Number of hits 37
|
||||
Edep of the first Hit 2.57686
|
||||
-- G4PEvent 18 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 19
|
||||
Event : 19
|
||||
mySD/EvenCollection Number of hits 28
|
||||
Edep of the first Hit 68.7516
|
||||
mySD/OddCollection Number of hits 14
|
||||
Edep of the first Hit 36.0667
|
||||
-- G4PEvent 19 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 20
|
||||
Event : 20
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 41.2316
|
||||
mySD/OddCollection Number of hits 36
|
||||
Edep of the first Hit 32.5255
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 20 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 21
|
||||
Event : 21
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 33.6799
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 2.63774
|
||||
-- G4PEvent 21 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 22
|
||||
Event : 22
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 15.6979
|
||||
mySD/OddCollection Number of hits 35
|
||||
Edep of the first Hit 82.3056
|
||||
-- G4PEvent 22 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 23
|
||||
Event : 23
|
||||
mySD/EvenCollection Number of hits 27
|
||||
Edep of the first Hit 23.5513
|
||||
mySD/OddCollection Number of hits 12
|
||||
Edep of the first Hit 27.8059
|
||||
-- G4PEvent 23 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 24
|
||||
Event : 24
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 43.1612
|
||||
mySD/OddCollection Number of hits 42
|
||||
Edep of the first Hit 5.25522
|
||||
-- G4PEvent 24 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 25
|
||||
Event : 25
|
||||
mySD/EvenCollection Number of hits 12
|
||||
Edep of the first Hit 52.9242
|
||||
mySD/OddCollection Number of hits 30
|
||||
Edep of the first Hit 14.3396
|
||||
-- G4PEvent 25 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 26
|
||||
Event : 26
|
||||
mySD/EvenCollection Number of hits 12
|
||||
Edep of the first Hit 18.0676
|
||||
mySD/OddCollection Number of hits 39
|
||||
Edep of the first Hit 66.0532
|
||||
-- G4PEvent 26 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 27
|
||||
Event : 27
|
||||
mySD/EvenCollection Number of hits 30
|
||||
Edep of the first Hit 1.07471
|
||||
mySD/OddCollection Number of hits 18
|
||||
Edep of the first Hit 2.81278
|
||||
-- G4PEvent 27 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 28
|
||||
Event : 28
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 71.478
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 38.2902
|
||||
-- G4PEvent 28 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 29
|
||||
Event : 29
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 18.7046
|
||||
mySD/OddCollection Number of hits 39
|
||||
Edep of the first Hit 24.2962
|
||||
-- G4PEvent 29 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 30
|
||||
Event : 30
|
||||
mySD/EvenCollection Number of hits 5
|
||||
Edep of the first Hit 17.7432
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 8.45743
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 30 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 31
|
||||
Event : 31
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 15.4573
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 5.60297
|
||||
-- G4PEvent 31 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 32
|
||||
Event : 32
|
||||
mySD/EvenCollection Number of hits 12
|
||||
Edep of the first Hit 49.3456
|
||||
mySD/OddCollection Number of hits 37
|
||||
Edep of the first Hit 4.42142
|
||||
-- G4PEvent 32 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 33
|
||||
Event : 33
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 39.7136
|
||||
mySD/OddCollection Number of hits 43
|
||||
Edep of the first Hit 40.911
|
||||
-- G4PEvent 33 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 34
|
||||
Event : 34
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 71.5197
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 49.5622
|
||||
-- G4PEvent 34 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 35
|
||||
Event : 35
|
||||
mySD/EvenCollection Number of hits 11
|
||||
Edep of the first Hit 38.1744
|
||||
mySD/OddCollection Number of hits 43
|
||||
Edep of the first Hit 3.09679
|
||||
-- G4PEvent 35 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 36
|
||||
Event : 36
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 52.4219
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 18.9069
|
||||
-- G4PEvent 36 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 37
|
||||
Event : 37
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 15.05
|
||||
mySD/OddCollection Number of hits 42
|
||||
Edep of the first Hit 6.99795
|
||||
-- G4PEvent 37 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 38
|
||||
Event : 38
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 11.2992
|
||||
mySD/OddCollection Number of hits 37
|
||||
Edep of the first Hit 63.4584
|
||||
-- G4PEvent 38 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 39
|
||||
Event : 39
|
||||
mySD/EvenCollection Number of hits 3
|
||||
Edep of the first Hit 143.19
|
||||
mySD/OddCollection Number of hits 42
|
||||
Edep of the first Hit 20.4067
|
||||
-- G4PEvent 39 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 40
|
||||
Event : 40
|
||||
mySD/EvenCollection Number of hits 5
|
||||
Edep of the first Hit 49.8201
|
||||
mySD/OddCollection Number of hits 39
|
||||
Edep of the first Hit 35.403
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 40 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 41
|
||||
Event : 41
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 56.283
|
||||
mySD/OddCollection Number of hits 42
|
||||
Edep of the first Hit 19.0004
|
||||
-- G4PEvent 41 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 42
|
||||
Event : 42
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 57.1055
|
||||
mySD/OddCollection Number of hits 37
|
||||
Edep of the first Hit 36.6327
|
||||
-- G4PEvent 42 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 43
|
||||
Event : 43
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 7.60171
|
||||
mySD/OddCollection Number of hits 44
|
||||
Edep of the first Hit 18.0399
|
||||
-- G4PEvent 43 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 44
|
||||
Event : 44
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 53.2389
|
||||
mySD/OddCollection Number of hits 34
|
||||
Edep of the first Hit 5.52172
|
||||
-- G4PEvent 44 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 45
|
||||
Event : 45
|
||||
mySD/EvenCollection Number of hits 11
|
||||
Edep of the first Hit 48.5526
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 25.8542
|
||||
-- G4PEvent 45 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 46
|
||||
Event : 46
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 29.785
|
||||
mySD/OddCollection Number of hits 39
|
||||
Edep of the first Hit 1.97563
|
||||
-- G4PEvent 46 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 47
|
||||
Event : 47
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 49.2885
|
||||
mySD/OddCollection Number of hits 37
|
||||
Edep of the first Hit 14.1009
|
||||
-- G4PEvent 47 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 48
|
||||
Event : 48
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 17.334
|
||||
mySD/OddCollection Number of hits 39
|
||||
Edep of the first Hit 28.9757
|
||||
-- G4PEvent 48 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 49
|
||||
Event : 49
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 30.2462
|
||||
mySD/OddCollection Number of hits 39
|
||||
Edep of the first Hit 41.7358
|
||||
-- G4PEvent 49 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 50
|
||||
Event : 50
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 7.09492
|
||||
mySD/OddCollection Number of hits 33
|
||||
Edep of the first Hit 129.963
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 50 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 51
|
||||
Event : 51
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 1.77473
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 1.6009
|
||||
-- G4PEvent 51 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 52
|
||||
Event : 52
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 22.1206
|
||||
mySD/OddCollection Number of hits 43
|
||||
Edep of the first Hit 5.21217
|
||||
-- G4PEvent 52 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 53
|
||||
Event : 53
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 13.318
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 71.7173
|
||||
-- G4PEvent 53 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 54
|
||||
Event : 54
|
||||
mySD/EvenCollection Number of hits 28
|
||||
Edep of the first Hit 10.4189
|
||||
mySD/OddCollection Number of hits 21
|
||||
Edep of the first Hit 34.7557
|
||||
-- G4PEvent 54 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 55
|
||||
Event : 55
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 14.7846
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 17.1474
|
||||
-- G4PEvent 55 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 56
|
||||
Event : 56
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 26.8971
|
||||
mySD/OddCollection Number of hits 39
|
||||
Edep of the first Hit 31.0888
|
||||
-- G4PEvent 56 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 57
|
||||
Event : 57
|
||||
mySD/EvenCollection Number of hits 5
|
||||
Edep of the first Hit 44.9334
|
||||
mySD/OddCollection Number of hits 35
|
||||
Edep of the first Hit 66.4154
|
||||
-- G4PEvent 57 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 58
|
||||
Event : 58
|
||||
mySD/EvenCollection Number of hits 12
|
||||
Edep of the first Hit 2.20857
|
||||
mySD/OddCollection Number of hits 33
|
||||
Edep of the first Hit 1.23394
|
||||
-- G4PEvent 58 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 59
|
||||
Event : 59
|
||||
mySD/EvenCollection Number of hits 22
|
||||
Edep of the first Hit 15.214
|
||||
mySD/OddCollection Number of hits 23
|
||||
Edep of the first Hit 3.83712
|
||||
-- G4PEvent 59 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 60
|
||||
Event : 60
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 16.8675
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 44.7627
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 60 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 61
|
||||
Event : 61
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 3.47969
|
||||
mySD/OddCollection Number of hits 43
|
||||
Edep of the first Hit 30.56
|
||||
-- G4PEvent 61 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 62
|
||||
Event : 62
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 15.0186
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 2.9719
|
||||
-- G4PEvent 62 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 63
|
||||
Event : 63
|
||||
mySD/EvenCollection Number of hits 12
|
||||
Edep of the first Hit 41.015
|
||||
mySD/OddCollection Number of hits 42
|
||||
Edep of the first Hit 5.60219
|
||||
-- G4PEvent 63 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 64
|
||||
Event : 64
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 19.799
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 16.2043
|
||||
-- G4PEvent 64 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 65
|
||||
Event : 65
|
||||
mySD/EvenCollection Number of hits 14
|
||||
Edep of the first Hit 15.7985
|
||||
mySD/OddCollection Number of hits 33
|
||||
Edep of the first Hit 9.14023
|
||||
-- G4PEvent 65 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 66
|
||||
Event : 66
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 14.5406
|
||||
mySD/OddCollection Number of hits 42
|
||||
Edep of the first Hit 67.0776
|
||||
-- G4PEvent 66 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 67
|
||||
Event : 67
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 53.7664
|
||||
mySD/OddCollection Number of hits 36
|
||||
Edep of the first Hit 53.2186
|
||||
-- G4PEvent 67 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 68
|
||||
Event : 68
|
||||
mySD/EvenCollection Number of hits 11
|
||||
Edep of the first Hit 0.0268595
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 13.2218
|
||||
-- G4PEvent 68 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 69
|
||||
Event : 69
|
||||
mySD/EvenCollection Number of hits 4
|
||||
Edep of the first Hit 28.0916
|
||||
mySD/OddCollection Number of hits 39
|
||||
Edep of the first Hit 8.14295
|
||||
-- G4PEvent 69 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 70
|
||||
Event : 70
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 46.4878
|
||||
mySD/OddCollection Number of hits 44
|
||||
Edep of the first Hit 0.310941
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 70 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 71
|
||||
Event : 71
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 11.3829
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 5.78213
|
||||
-- G4PEvent 71 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 72
|
||||
Event : 72
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 102.104
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 31.2024
|
||||
-- G4PEvent 72 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 73
|
||||
Event : 73
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 25.7397
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 13.4817
|
||||
-- G4PEvent 73 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 74
|
||||
Event : 74
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 4.22867
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 7.92935
|
||||
-- G4PEvent 74 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 75
|
||||
Event : 75
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 53.4164
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 61.7056
|
||||
-- G4PEvent 75 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 76
|
||||
Event : 76
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 9.39781
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 24.0445
|
||||
-- G4PEvent 76 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 77
|
||||
Event : 77
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 6.83122
|
||||
mySD/OddCollection Number of hits 38
|
||||
Edep of the first Hit 44.4089
|
||||
-- G4PEvent 77 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 78
|
||||
Event : 78
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 1.36272
|
||||
mySD/OddCollection Number of hits 45
|
||||
Edep of the first Hit 1.69722
|
||||
-- G4PEvent 78 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 79
|
||||
Event : 79
|
||||
mySD/EvenCollection Number of hits 29
|
||||
Edep of the first Hit 56.4575
|
||||
mySD/OddCollection Number of hits 13
|
||||
Edep of the first Hit 2.42198
|
||||
-- G4PEvent 79 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 80
|
||||
Event : 80
|
||||
mySD/EvenCollection Number of hits 32
|
||||
Edep of the first Hit 6.56751
|
||||
mySD/OddCollection Number of hits 16
|
||||
Edep of the first Hit 64.8193
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 80 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 81
|
||||
Event : 81
|
||||
mySD/EvenCollection Number of hits 23
|
||||
Edep of the first Hit 77.0987
|
||||
mySD/OddCollection Number of hits 20
|
||||
Edep of the first Hit 43.7444
|
||||
-- G4PEvent 81 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 82
|
||||
Event : 82
|
||||
mySD/EvenCollection Number of hits 29
|
||||
Edep of the first Hit 31.2056
|
||||
mySD/OddCollection Number of hits 11
|
||||
Edep of the first Hit 30.487
|
||||
-- G4PEvent 82 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 83
|
||||
Event : 83
|
||||
mySD/EvenCollection Number of hits 18
|
||||
Edep of the first Hit 8.34544
|
||||
mySD/OddCollection Number of hits 18
|
||||
Edep of the first Hit 18.5952
|
||||
-- G4PEvent 83 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 84
|
||||
Event : 84
|
||||
mySD/EvenCollection Number of hits 15
|
||||
Edep of the first Hit 1.30057
|
||||
mySD/OddCollection Number of hits 40
|
||||
Edep of the first Hit 11.4435
|
||||
-- G4PEvent 84 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 85
|
||||
Event : 85
|
||||
mySD/EvenCollection Number of hits 7
|
||||
Edep of the first Hit 38.8382
|
||||
mySD/OddCollection Number of hits 42
|
||||
Edep of the first Hit 14.691
|
||||
-- G4PEvent 85 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 86
|
||||
Event : 86
|
||||
mySD/EvenCollection Number of hits 11
|
||||
Edep of the first Hit 6.5076
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 103.732
|
||||
-- G4PEvent 86 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 87
|
||||
Event : 87
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 4.17298
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 70.4753
|
||||
-- G4PEvent 87 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 88
|
||||
Event : 88
|
||||
mySD/EvenCollection Number of hits 31
|
||||
Edep of the first Hit 17.119
|
||||
mySD/OddCollection Number of hits 22
|
||||
Edep of the first Hit 28.4859
|
||||
-- G4PEvent 88 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 89
|
||||
Event : 89
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 47.2302
|
||||
mySD/OddCollection Number of hits 43
|
||||
Edep of the first Hit 49.3412
|
||||
-- G4PEvent 89 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 90
|
||||
Event : 90
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 23.1413
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 18.5923
|
||||
Transaction is committed on /Events/EventContainer/
|
||||
Transaction started for /Events/EventContainer/ with sustained mode.
|
||||
-- G4PEvent 90 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 91
|
||||
Event : 91
|
||||
mySD/EvenCollection Number of hits 9
|
||||
Edep of the first Hit 27.6976
|
||||
mySD/OddCollection Number of hits 41
|
||||
Edep of the first Hit 28.5904
|
||||
-- G4PEvent 91 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 92
|
||||
Event : 92
|
||||
mySD/EvenCollection Number of hits 14
|
||||
Edep of the first Hit 7.49035
|
||||
mySD/OddCollection Number of hits 36
|
||||
Edep of the first Hit 85.1197
|
||||
-- G4PEvent 92 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 93
|
||||
Event : 93
|
||||
mySD/EvenCollection Number of hits 28
|
||||
Edep of the first Hit 30.053
|
||||
mySD/OddCollection Number of hits 25
|
||||
Edep of the first Hit 26.7725
|
||||
-- G4PEvent 93 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 94
|
||||
Event : 94
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 15.6043
|
||||
mySD/OddCollection Number of hits 43
|
||||
Edep of the first Hit 61.7972
|
||||
-- G4PEvent 94 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 95
|
||||
Event : 95
|
||||
mySD/EvenCollection Number of hits 25
|
||||
Edep of the first Hit 20.5769
|
||||
mySD/OddCollection Number of hits 21
|
||||
Edep of the first Hit 11.6616
|
||||
-- G4PEvent 95 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 96
|
||||
Event : 96
|
||||
mySD/EvenCollection Number of hits 6
|
||||
Edep of the first Hit 1.25488
|
||||
mySD/OddCollection Number of hits 36
|
||||
Edep of the first Hit 75.4839
|
||||
-- G4PEvent 96 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 97
|
||||
Event : 97
|
||||
mySD/EvenCollection Number of hits 8
|
||||
Edep of the first Hit 1.63689
|
||||
mySD/OddCollection Number of hits 31
|
||||
Edep of the first Hit 80.3105
|
||||
-- G4PEvent 97 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 98
|
||||
Event : 98
|
||||
mySD/EvenCollection Number of hits 10
|
||||
Edep of the first Hit 36.8743
|
||||
mySD/OddCollection Number of hits 37
|
||||
Edep of the first Hit 29.8302
|
||||
-- G4PEvent 98 stored in /Events/EventContainer/ (sustained)
|
||||
>>> Event 99
|
||||
Event : 99
|
||||
mySD/EvenCollection Number of hits 11
|
||||
Edep of the first Hit 8.25636
|
||||
mySD/OddCollection Number of hits 31
|
||||
Edep of the first Hit 24.0489
|
||||
-- G4PEvent 99 stored in /Events/EventContainer/ (sustained)
|
||||
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 = PersistentEx02
|
||||
|
||||
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,142 @@
|
||||
$Id: README,v 1.6 1999/12/05 22:27:05 morita Exp $
|
||||
------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Example PersistentEx02
|
||||
----------------------
|
||||
|
||||
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. For more detail description of the
|
||||
setup, see the README file of PersistentEx01.
|
||||
|
||||
============
|
||||
Introduction
|
||||
============
|
||||
PersistentEx02 demonstrates how to store persistent hits, in
|
||||
addition to other objects demonstrated in PersistentEx01.
|
||||
|
||||
To make persistent hits, schema definitions of PersEx02TrackerHit and
|
||||
PersEx02TrackerHitsCollection must inherit from Geant4 persistent
|
||||
hit classes G4PVHit and G4PVHitsCollection. Note that the data
|
||||
members in persistent hits must be persistent-capable types.
|
||||
|
||||
-------------------------
|
||||
In PersEx02TrackerHit.ddl
|
||||
-------------------------
|
||||
class PersEx02TrackerHit : public G4PVHit
|
||||
{
|
||||
public:
|
||||
:
|
||||
private:
|
||||
G4Pdouble edep;
|
||||
G4ThreeVector pos;
|
||||
:
|
||||
}
|
||||
|
||||
------------------------------------
|
||||
In PersEx02TrackerHitsCollection.ddl
|
||||
------------------------------------
|
||||
typedef d_Varray< d_Ref<PersEx02TrackerHit> > PersEx02TrackerHitsVArray;
|
||||
|
||||
class PersEx02TrackerHitsCollection : public G4PVHitsCollection
|
||||
{
|
||||
public:
|
||||
:
|
||||
private:
|
||||
PersEx02TrackerHitsVArray hitsCollection;
|
||||
:
|
||||
}
|
||||
|
||||
When persistent hits collections are made at runtime, each hit collection
|
||||
should be registered to the collection of hits collections
|
||||
(G4PHCofThisEvent) by the user SensitiveDetector (PersEx02TrackerSD).
|
||||
Each event object stored in the database has an association to this
|
||||
collection of the collections for the future reference.
|
||||
|
||||
====================
|
||||
Sustained Transation
|
||||
====================
|
||||
|
||||
There are two types of database transactions in the Geant4
|
||||
persistency. By default, Geant4 persistent objects are
|
||||
stored at the end of each event as an atmic database transaction.
|
||||
|
||||
In this example, user-defined persistent hits are created
|
||||
during the event. To enable this, user should explicitly call
|
||||
StartTransaction() and Commit() of G4PersistencyManager.
|
||||
These calls are implemented in BeginOfRunAction() and
|
||||
EndOfRunAction() of the RunAction class.
|
||||
|
||||
void PersEx02RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
....
|
||||
persM->StartTransaction(kEventDB, kUpdate, true);
|
||||
....
|
||||
}
|
||||
|
||||
void PersEx02RunAction::EndOfRunAction(const G4Run* )
|
||||
{
|
||||
....
|
||||
persM->Commit(kEventDB, true);
|
||||
....
|
||||
}
|
||||
|
||||
To make a "check point", a pair of Commit()/StartTransaction()
|
||||
is called at EndOfEventAction() in the EventAction class at
|
||||
every 10 events.
|
||||
|
||||
void PersEx02EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
....
|
||||
if( persM && (evt->GetEventID() % 10 == 0))
|
||||
{
|
||||
persM->Commit(kEventDB, true);
|
||||
persM->StartTransaction(kEventDB, kUpdate, true);
|
||||
}
|
||||
....
|
||||
}
|
||||
|
||||
=========================
|
||||
PersistentEx02 executable
|
||||
=========================
|
||||
PersistentEx02 executable can be made by simply typing "gmake" in this
|
||||
directory. Use PersistentEx02run csh-script for a simple test.
|
||||
|
||||
example:
|
||||
gmake # creates PersistentEx02 executable
|
||||
PersistentEx02run # run PersistentEx02
|
||||
|
||||
PersistentEx02run will copy the G4EXAMPLE_BOOT file into runtime
|
||||
federated database. Whenever PersistentEx02run is executed again,
|
||||
it will delete the old federeated database and start from the
|
||||
new copy of G4EXAMPLE_BOOT.
|
||||
|
||||
=================
|
||||
Persistent output
|
||||
=================
|
||||
When PersistentEx02 is run correctly, following database files will be
|
||||
created in your runtime federeated database directory.
|
||||
|
||||
Events.PersistentEx02.DB Geometry.PersistentEx02.DB
|
||||
PersistentEx02 PersistentEx02.FDDB
|
||||
Runs.PersistentEx02.DB System.PersistentEx02.DB
|
||||
|
||||
Hits are stored in "Events" database.
|
||||
|
||||
To browse the database contents, refer to the README file in
|
||||
PersistentEx01. Persistent hits are stored in the Events
|
||||
database.
|
||||
|
||||
======
|
||||
readDB
|
||||
======
|
||||
A simple standalone application readDB, provided in this directory,
|
||||
can also be used to access the event and hits objects.
|
||||
See PersistentEx02/readDB/README for more detail.
|
||||
|
||||
--
|
||||
@@ -0,0 +1,30 @@
|
||||
// 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: PersEx02DetectorConstruction.hh,v 1.3 1999/11/29 18:15:28 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#ifndef PersEx02DetectorConstruction_h
|
||||
#define PersEx02DetectorConstruction_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class PersEx02DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
PersEx02DetectorConstruction();
|
||||
~PersEx02DetectorConstruction();
|
||||
|
||||
public:
|
||||
G4VPhysicalVolume* Construct();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// 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: PersEx02EventAction.hh,v 1.3 1999/11/29 18:23:31 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
|
||||
#ifndef PersEx02EventAction_h
|
||||
#define PersEx02EventAction_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class PersEx02EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
PersEx02EventAction();
|
||||
virtual ~PersEx02EventAction();
|
||||
|
||||
public:
|
||||
virtual void BeginOfEventAction(const G4Event*);
|
||||
virtual void EndOfEventAction(const G4Event*);
|
||||
|
||||
private:
|
||||
G4int colID1;
|
||||
G4int colID2;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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: PersEx02PhysicsList.hh,v 1.3 1999/11/29 18:23:32 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#ifndef PersEx02PhysicsList_h
|
||||
#define PersEx02PhysicsList_h 1
|
||||
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class PersEx02PhysicsList: public G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
PersEx02PhysicsList();
|
||||
virtual ~PersEx02PhysicsList();
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
// 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: PersEx02PrimaryGeneratorAction.hh,v 1.3 1999/11/29 18:23:32 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#ifndef PersEx02PrimaryGeneratorAction_h
|
||||
#define PersEx02PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
|
||||
class PersEx02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PersEx02PrimaryGeneratorAction();
|
||||
~PersEx02PrimaryGeneratorAction();
|
||||
|
||||
public:
|
||||
void GeneratePrimaries(G4Event* anEvent);
|
||||
|
||||
private:
|
||||
G4ParticleGun* particleGun;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// 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: PersEx02RunAction.hh,v 1.3 1999/11/29 18:23:32 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#ifndef PersEx02RunAction_h
|
||||
#define PersEx02RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Run;
|
||||
|
||||
class PersEx02RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
PersEx02RunAction();
|
||||
virtual ~PersEx02RunAction();
|
||||
|
||||
public:
|
||||
virtual void BeginOfRunAction(const G4Run* aRun);
|
||||
virtual void EndOfRunAction(const G4Run* aRun);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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: PersEx02StackingAction.hh,v 1.2 1999/11/29 18:23:33 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#ifndef PersEx02StackingAction_H
|
||||
#define PersEx02StackingAction_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UserStackingAction.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4Track;
|
||||
|
||||
class PersEx02StackingAction : public G4UserStackingAction
|
||||
{
|
||||
public:
|
||||
PersEx02StackingAction();
|
||||
virtual ~PersEx02StackingAction();
|
||||
|
||||
public:
|
||||
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
|
||||
virtual void NewStage();
|
||||
virtual void PrepareNewEvent();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
// 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: PersEx02TrackerHit.ddl,v 1.4 1999/11/29 19:27:52 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#ifndef PersEx02TrackerHit_h
|
||||
#define PersEx02TrackerHit_h 1
|
||||
|
||||
#include "G4PVHit.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4PersistentTypes.hh"
|
||||
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
class PersEx02TrackerHit
|
||||
: public G4PVHit
|
||||
{
|
||||
public:
|
||||
|
||||
PersEx02TrackerHit();
|
||||
~PersEx02TrackerHit();
|
||||
PersEx02TrackerHit(const PersEx02TrackerHit &right);
|
||||
const PersEx02TrackerHit& operator=(const PersEx02TrackerHit &right);
|
||||
int operator==(const PersEx02TrackerHit &right) const;
|
||||
|
||||
void Draw();
|
||||
void Print();
|
||||
|
||||
private:
|
||||
G4Pdouble 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; };
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
// 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: PersEx02TrackerHitsCollection.ddl,v 1.3 1999/11/29 18:23:33 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#ifndef PersEx02TrackerHitsCollection_h
|
||||
#define PersEx02TrackerHitsCollection_h 1
|
||||
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
#include "HepODBMS/clustering/HepClusteringHint.h"
|
||||
|
||||
#include "G4PersistentTypes.hh"
|
||||
#include "G4PVHit.hh"
|
||||
#include "G4PVHitsCollection.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "PersEx02TrackerHit.hh"
|
||||
|
||||
typedef d_Varray< d_Ref<PersEx02TrackerHit> > PersEx02TrackerHitsVArray;
|
||||
|
||||
class PersEx02TrackerHitsCollection
|
||||
: public G4PVHitsCollection
|
||||
{
|
||||
public:
|
||||
PersEx02TrackerHitsCollection(G4String dName, G4String aName);
|
||||
~PersEx02TrackerHitsCollection();
|
||||
|
||||
void DrawAllHits();
|
||||
void PrintAllHits();
|
||||
|
||||
public:
|
||||
static HepClusteringHint clustering;
|
||||
|
||||
private:
|
||||
PersEx02TrackerHitsVArray hitsCollection;
|
||||
size_t elems;
|
||||
|
||||
public:
|
||||
inline void Insert(d_Ref<PersEx02TrackerHit> pHit)
|
||||
{
|
||||
size_t curSize = hitsCollection.size();
|
||||
if (elems >= curSize)
|
||||
hitsCollection.resize(curSize + 1024);
|
||||
hitsCollection[elems++] = pHit;
|
||||
};
|
||||
inline void ShrinkToFit()
|
||||
{ hitsCollection.resize(elems); };
|
||||
inline size_t size() const
|
||||
{ return hitsCollection.size(); }
|
||||
inline HepRef(PersEx02TrackerHit) element(const size_t i) const
|
||||
{ return hitsCollection[i]; }
|
||||
inline HepRef(PersEx02TrackerHit) operator[](const size_t i) const
|
||||
{ return hitsCollection[i]; }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// 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: PersEx02TrackerSD.hh,v 1.3 1999/11/29 18:23:33 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#ifndef PersEx02TrackerSD_h
|
||||
#define PersEx02TrackerSD_h 1
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "PersEx02TrackerHitsCollection.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
class G4PersistentHitMan;
|
||||
|
||||
class PersEx02TrackerSD : public G4VSensitiveDetector
|
||||
{
|
||||
|
||||
public:
|
||||
PersEx02TrackerSD(G4String name);
|
||||
~PersEx02TrackerSD();
|
||||
|
||||
void Initialize(G4HCofThisEvent*HCE);
|
||||
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
|
||||
void EndOfEvent(G4HCofThisEvent*HCE);
|
||||
void clear();
|
||||
void DrawAll();
|
||||
void PrintAll();
|
||||
|
||||
private:
|
||||
G4PersistentHitMan* f_hitMan;
|
||||
HepRef(PersEx02TrackerHitsCollection) EvenCollection;
|
||||
HepRef(PersEx02TrackerHitsCollection) OddCollection;
|
||||
HepContainerRef hitContainer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#
|
||||
# prerunPEx02.mac
|
||||
#
|
||||
/control/verbose 2
|
||||
/db/verbose 2
|
||||
/run/initialize
|
||||
@@ -0,0 +1,63 @@
|
||||
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$../include \
|
||||
-I$(G4TMP)/$(G4SYSTEM)/PersistentEx02 \
|
||||
-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$(G4TMP)/$(G4SYSTEM)/PersistentEx02 \
|
||||
-lPersistentEx02 \
|
||||
-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,18 @@
|
||||
$Id: README,v 1.2 1999/12/02 20:51:49 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 file PersistentEx02/README.
|
||||
|
||||
For the setup of readDB, see PersistentEx01/readDB/README.
|
||||
|
||||
The difference between PersistentEx01/readDB and this example
|
||||
is the additional capability to look into the user derived
|
||||
persistent hits.
|
||||
|
||||
--
|
||||
@@ -0,0 +1,125 @@
|
||||
#include "HepODBMS/clustering/HepDbApplication.h"
|
||||
|
||||
#include "G4PEvent.hh"
|
||||
#include "G4PPrimaryVertex.hh"
|
||||
#include "G4PPrimaryParticle.hh"
|
||||
#include "G4PHCofThisEvent.hh"
|
||||
#include "PersEx02TrackerHitsCollection.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(PersEx02TrackerHitsCollection) aHC =
|
||||
(HepRef(PersEx02TrackerHitsCollection)) hcte->GetHC(i);
|
||||
if( aHC != 0 )
|
||||
{
|
||||
cout << " Hit Collection[" << i << "]: Name: "
|
||||
<< aHC->GetName();
|
||||
cout << " Sensitive Detector: " << aHC->GetSDname() << endl;
|
||||
|
||||
HepRef(PersEx02TrackerHit) aHit = aHC->element(0);
|
||||
if( aHit != 0 )
|
||||
{
|
||||
cout << " Number of hits: " << aHC->size() << endl
|
||||
<< " Edep of the first hit: " << aHit->GetEdep() << 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/PersistentEx02
|
||||
source ../../PersistentEx01/setup_lhcxx.csh
|
||||
@@ -0,0 +1,2 @@
|
||||
OO_FD_BOOT=$G4WORKDIR/exampleFD/$G4SYSTEM/PersistentEx02; export OO_FD_BOOT
|
||||
. ../../PersistentEx01/setup_lhcxx.sh
|
||||
@@ -0,0 +1,128 @@
|
||||
// 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: PersEx02DetectorConstruction.cc,v 1.3 1999/11/29 18:33:27 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "PersEx02DetectorConstruction.hh"
|
||||
|
||||
#include "PersEx02TrackerSD.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"
|
||||
|
||||
PersEx02DetectorConstruction::PersEx02DetectorConstruction()
|
||||
{;}
|
||||
|
||||
PersEx02DetectorConstruction::~PersEx02DetectorConstruction()
|
||||
{;}
|
||||
|
||||
G4VPhysicalVolume* PersEx02DetectorConstruction::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";
|
||||
PersEx02TrackerSD* mySD = new PersEx02TrackerSD( sdName );
|
||||
myTargetLog->SetSensitiveDetector( mySD );
|
||||
|
||||
// "mySD" will be registrated
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
SDman->AddNewDetector( mySD );
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
return myWorldPhys;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// 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: PersEx02EventAction.cc,v 1.3 1999/11/29 18:33:28 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "PersEx02EventAction.hh"
|
||||
|
||||
#include "PersEx02TrackerHit.hh"
|
||||
#include "PersEx02TrackerHitsCollection.hh"
|
||||
|
||||
#include "G4PersistencyManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4PHCofThisEvent.hh"
|
||||
#include "G4PersistentHitMan.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "HepODBMS/odbms/HepODBMS.h"
|
||||
|
||||
PersEx02EventAction::PersEx02EventAction()
|
||||
{
|
||||
colID1 = -1;
|
||||
colID2 = -1;
|
||||
}
|
||||
|
||||
PersEx02EventAction::~PersEx02EventAction()
|
||||
{;}
|
||||
|
||||
void PersEx02EventAction::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 PersEx02EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4cout << ">>> Event " << evt->GetEventID() << endl;
|
||||
|
||||
G4PHCofThisEvent* pHCE = G4PersistentHitMan::GetPersistentHitMan()
|
||||
->GetCurrentPHCofThisEvent();
|
||||
HepRef(PersEx02TrackerHitsCollection) pTHC1
|
||||
= (HepRef(PersEx02TrackerHitsCollection))(pHCE->GetHC(colID1));
|
||||
HepRef(PersEx02TrackerHitsCollection) pTHC2
|
||||
= (HepRef(PersEx02TrackerHitsCollection))(pHCE->GetHC(colID2));
|
||||
|
||||
G4cout << "Event : " << evt->GetEventID() << endl
|
||||
<< pTHC1->GetSDname() << "/" << pTHC1->GetName() << " "
|
||||
<< "Number of hits " << pTHC1->size() << endl;
|
||||
if( pTHC1->size() > 0 )
|
||||
{
|
||||
HepRef(PersEx02TrackerHit) aHit = pTHC1->element(0);
|
||||
G4cout << " Edep of the first Hit " << aHit->GetEdep() << endl;
|
||||
}
|
||||
G4cout << pTHC2->GetSDname() << "/" << pTHC2->GetName() << " "
|
||||
<< "Number of hits " << pTHC2->size() << endl;
|
||||
if( pTHC2->size() > 0 )
|
||||
{
|
||||
HepRef(PersEx02TrackerHit) aHit = pTHC2->element(0);
|
||||
assert(aHit!=NULL);
|
||||
G4cout << " Edep of the first Hit " << aHit->GetEdep() << endl;
|
||||
}
|
||||
|
||||
G4PersistencyManager* persM
|
||||
= G4PersistencyManager::GetPersistencyManager();
|
||||
if( persM && (evt->GetEventID() % 10 == 0))
|
||||
{
|
||||
// commit and resume the sustained event DB transaction for every 10 events
|
||||
persM->Commit(kEventDB, true);
|
||||
persM->StartTransaction(kEventDB, kUpdate, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
// 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: PersEx02PhysicsList.cc,v 1.3 1999/11/29 18:33:28 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
#include "PersEx02PhysicsList.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>
|
||||
|
||||
|
||||
PersEx02PhysicsList::PersEx02PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
PersEx02PhysicsList::~PersEx02PhysicsList()
|
||||
{
|
||||
}
|
||||
|
||||
void PersEx02PhysicsList::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 PersEx02PhysicsList::ConstructBosons()
|
||||
{
|
||||
// Construct all bosons
|
||||
G4BosonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void PersEx02PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// Construct all leptons
|
||||
G4LeptonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void PersEx02PhysicsList::ConstructMesons()
|
||||
{
|
||||
// Construct all mesons
|
||||
G4MesonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void PersEx02PhysicsList::ConstructBaryons()
|
||||
{
|
||||
// Construct all baryons
|
||||
G4BaryonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
void PersEx02PhysicsList::ConstructIons()
|
||||
{
|
||||
// Construct light ions
|
||||
G4IonConstructor pConstructor;
|
||||
pConstructor.ConstructParticle();
|
||||
}
|
||||
|
||||
|
||||
void PersEx02PhysicsList::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 PersEx02PhysicsList::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 PersEx02PhysicsList::ConstructHad()
|
||||
{;}
|
||||
|
||||
void PersEx02PhysicsList::ConstructLeptHad()
|
||||
{;}
|
||||
|
||||
#include "G4Decay.hh"
|
||||
void PersEx02PhysicsList::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 PersEx02PhysicsList::SetCuts()
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PersEx02PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << defaultCutValue/mm << " (mm)" << endl;
|
||||
}
|
||||
|
||||
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
|
||||
// the default cut value for all particle types
|
||||
SetCutsWithDefault();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// 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: PersEx02PrimaryGeneratorAction.cc,v 1.3 1999/11/29 18:33:28 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "PersEx02PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
PersEx02PrimaryGeneratorAction::PersEx02PrimaryGeneratorAction()
|
||||
{
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
PersEx02PrimaryGeneratorAction::~PersEx02PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
void PersEx02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// 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: PersEx02RunAction.cc,v 1.3 1999/11/29 18:33:28 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "PersEx02RunAction.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4PersistencyManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
PersEx02RunAction::PersEx02RunAction()
|
||||
{
|
||||
}
|
||||
|
||||
PersEx02RunAction::~PersEx02RunAction()
|
||||
{
|
||||
}
|
||||
|
||||
void PersEx02RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4PersistencyManager* persM
|
||||
= G4PersistencyManager::GetPersistencyManager();
|
||||
|
||||
if(aRun->GetRunID()==0)
|
||||
{
|
||||
if(persM)
|
||||
{
|
||||
G4VPhysicalVolume* theWorld
|
||||
= G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()->GetWorldVolume();
|
||||
persM->Store(theWorld);
|
||||
}
|
||||
}
|
||||
|
||||
// start event DB transaction with sustained mode
|
||||
persM->StartTransaction(kEventDB, kUpdate, true);
|
||||
|
||||
}
|
||||
|
||||
void PersEx02RunAction::EndOfRunAction(const G4Run* )
|
||||
{
|
||||
G4PersistencyManager* persM
|
||||
= G4PersistencyManager::GetPersistencyManager();
|
||||
if(persM)
|
||||
{
|
||||
// commit the sustained event DB transaction
|
||||
persM->Commit(kEventDB, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// 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: PersEx02StackingAction.cc,v 1.2 1999/11/29 18:33:29 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "PersEx02StackingAction.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4TrackStatus.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
PersEx02StackingAction::PersEx02StackingAction()
|
||||
{;}
|
||||
|
||||
PersEx02StackingAction::~PersEx02StackingAction()
|
||||
{;}
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
PersEx02StackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
{
|
||||
G4ClassificationOfNewTrack classification = fKill;
|
||||
if(aTrack->GetParentID()==0)
|
||||
{ classification = fUrgent; }
|
||||
return classification;
|
||||
}
|
||||
|
||||
void PersEx02StackingAction::NewStage()
|
||||
{;}
|
||||
|
||||
void PersEx02StackingAction::PrepareNewEvent()
|
||||
{;}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
// 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: PersEx02TrackerHit.cc,v 1.3 1999/11/29 18:33:29 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "PersEx02TrackerHit.hh"
|
||||
|
||||
PersEx02TrackerHit::PersEx02TrackerHit()
|
||||
{;}
|
||||
|
||||
PersEx02TrackerHit::~PersEx02TrackerHit()
|
||||
{;}
|
||||
|
||||
PersEx02TrackerHit::PersEx02TrackerHit(const PersEx02TrackerHit &right)
|
||||
{
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
}
|
||||
|
||||
const PersEx02TrackerHit& PersEx02TrackerHit::operator=(const PersEx02TrackerHit &right)
|
||||
{
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int PersEx02TrackerHit::operator==(const PersEx02TrackerHit &right) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PersEx02TrackerHit::Draw()
|
||||
{
|
||||
}
|
||||
|
||||
void PersEx02TrackerHit::Print()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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: PersEx02TrackerHitsCollection.cc,v 1.3 1999/11/29 18:33:29 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "PersEx02TrackerHitsCollection.hh"
|
||||
|
||||
|
||||
PersEx02TrackerHitsCollection::PersEx02TrackerHitsCollection
|
||||
(G4String dName, G4String aName)
|
||||
: G4PVHitsCollection(dName, aName), elems(0)
|
||||
{;}
|
||||
|
||||
PersEx02TrackerHitsCollection::~PersEx02TrackerHitsCollection()
|
||||
{;}
|
||||
|
||||
void PersEx02TrackerHitsCollection::DrawAllHits()
|
||||
{;}
|
||||
|
||||
void PersEx02TrackerHitsCollection::PrintAllHits()
|
||||
{;}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
// 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: PersEx02TrackerSD.cc,v 1.4 1999/12/02 17:05:17 morita Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include <assert.h>
|
||||
#include "PersEx02TrackerSD.hh"
|
||||
#include "PersEx02TrackerHit.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4PersistentHitMan.hh"
|
||||
#include "G4PHCofThisEvent.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
PersEx02TrackerSD::PersEx02TrackerSD(G4String name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname;
|
||||
collectionName.insert(HCname="EvenCollection");
|
||||
collectionName.insert(HCname="OddCollection");
|
||||
|
||||
f_hitMan = G4PersistentHitMan::GetPersistentHitMan();
|
||||
hitContainer = f_hitMan->GetContainer();
|
||||
assert(hitContainer != NULL);
|
||||
}
|
||||
|
||||
PersEx02TrackerSD::~PersEx02TrackerSD(){;}
|
||||
|
||||
void PersEx02TrackerSD::Initialize(G4HCofThisEvent*HCE)
|
||||
{
|
||||
HepRef(G4PHCofThisEvent) aPHC = new( hitContainer ) G4PHCofThisEvent;
|
||||
f_hitMan->SetCurrentPHCofThisEvent(aPHC);
|
||||
|
||||
EvenCollection = new( hitContainer )
|
||||
PersEx02TrackerHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
OddCollection = new( hitContainer )
|
||||
PersEx02TrackerHitsCollection(SensitiveDetectorName,collectionName[1]);
|
||||
}
|
||||
|
||||
G4bool PersEx02TrackerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if( edep == 0. ) return true;
|
||||
|
||||
const G4VPhysicalVolume* physVol
|
||||
= aStep->GetPreStepPoint()->GetPhysicalVolume();
|
||||
|
||||
HepRef(PersEx02TrackerHit) newHit = new( hitContainer ) PersEx02TrackerHit();
|
||||
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 PersEx02TrackerSD::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]); }
|
||||
|
||||
// Shrink the array size to the actual hit entries
|
||||
EvenCollection->ShrinkToFit();
|
||||
OddCollection->ShrinkToFit();
|
||||
|
||||
// Register this HitCollection to Persistent HCofThisEvent
|
||||
G4PHCofThisEvent* aPHC = f_hitMan->GetCurrentPHCofThisEvent();
|
||||
aPHC->AddHitsCollection( IDe, EvenCollection );
|
||||
aPHC->AddHitsCollection( IDo, OddCollection );
|
||||
}
|
||||
|
||||
void PersEx02TrackerSD::clear()
|
||||
{
|
||||
}
|
||||
|
||||
void PersEx02TrackerSD::DrawAll()
|
||||
{
|
||||
}
|
||||
|
||||
void PersEx02TrackerSD::PrintAll()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user