Import Geant4 8.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:36:02 +02:00
parent d93e1e39a9
commit 8a51e0bc40
5471 changed files with 99628 additions and 55248 deletions
@@ -1,9 +1,6 @@
$Id: 000README,v 1.4 2004/12/03 13:35:22 gcosmo Exp $
-------------------------------------------------------------------
ParGeant4: Geant4/TOP-C, a parallelization of Geant4
Version 0.9
(event-level parallelism only)
ParGeant4: Geant4/TOP-C, a parallelization of Geant4
(event-level parallelism)
Gene Cooperman
Northeastern University
@@ -16,11 +13,10 @@ Please write to gene@ccs.neu.edu for further information.
To port other applications to a parallel version, read the
files ../../info/PAR_INSTALL and ../../info/PAR_README.
See the beginning of GNUmakefile for reasonable `make' targets to run it.
To run it:
0. a. Follow the standard Geant4 installation procedure.
b. Download and install TOP-C.
b. Download and install TOP-C
The TOP-C home page is at http://www.ccs.neu.edu/home/gene/topc.html
cd <TOPC_INSTALL_DIR>
gzip -dc topc.tar.gz | tar -xvf -
@@ -29,10 +25,10 @@ To run it:
make
make test
[ Copy bin/topc-config to your path ]
c. Verify that the Geant4 example installs for you:
c. Verify that the Geant4 example installs:
cd $G4INSTALL/examples/extended/parallel/ParN04
make
$G4WORKDIR/bin/$G4SYSTEM/ParN04 ParN04.in
make
$G4WORKDIR/bin/$G4SYSTEM/ParN04 ParN04.in
2. make run
[ By default, the included `procgroup' file creates two slave processes
on localhost. ]
@@ -41,15 +37,16 @@ To run it:
[ To remove intermediate files and start over: make parclean ]
3. Try running it with slave processes on remote processes.
First, test that your local environment is set up correctly.
Try: ssh <REMOTE_HOSTNAME> $G4WORKDIR/bin/$G4SYSTEM/ParN04 `pwd`/ParN04.in
Try:
ssh <REMOTE_HOSTNAME> $G4WORKDIR/bin/$G4SYSTEM/ParN04 `pwd`/ParN04.in
The above command needs to work without asking for a password.
[ If you use dynamic libraries (*.so), make sure the LD_LIBRARY_PATH
in your shell startup file (e.g. ~.tcshrc) includes both:
$G4INSTALL/lib/$G4SYSTEM and $CLHEP_BASE_DIR/lib
If you use AFS, you may need to type 'klog' to renew your AFS token. ]
In `procgroup' file, replace `localhost' by desired remote hosts;
Add additional remote hosts (additional slaves) if you like.
Then: make run
Add additional remote hosts (additional slaves) if you like.
Then: make run
============================================================================
If you read ParGNUmakefile, you'll find other things that you can
@@ -74,14 +71,14 @@ make parclean - Start over with clean set of files.
============================================================================
New or modified files:
ParN04.cc - Adds one line: #include "ParN04.icc"
ParN04.cc - Adds one line: #include "ParN04.icc"
ParExample.icc inserts: #include "topc.h"
and causes main to calls TOPC_init, TOPC_finalize,
and to use: `new ParRunManager' instead of `new G4RunManager'
GNUmakefile - Adds one line at beginning: include ParGNUmakefile
ParGNUmakefile defines EXTRALIBS and CPPFLAGS so as to
modify behavior of config/binmake.gmk
in order to use TOP-C libraries and includes
modify behavior of config/binmake.gmk
in order to use TOP-C libraries and includes
procgroup - Specifies which slave hosts to use, and where to put output
For example: localhost 1 - > slave1.out
host=`localhost', executable=`same as master',
@@ -90,16 +87,13 @@ New or modified files:
src/ParRunManager.cc - ParRunManger derived from G4RunManager
replaces Gr4RunManager::DoEventLoop w/ TOP-C parallel loop,
Adds certain local vars of DoEventLoop as ParRunManager members
src/ParMarshaledObj.cc - run-time utilities for marshalling
src/ParExN04MarshaledHits.cc - marshals N04 hits (calorimeter & tracking hits)
include/Par*.hh - Currently just ParRunManager.hh
include/MarshaledObj.h - run-time utilities for marshalling
include/MarshaledEx*Hit.h - marshals N04 hits (calorimeter hits)
include/MarshaledG4*.h - marshaling routines for Geant4 data structures
~/slave*.out - Contains outputs of slave1, slave2, etc.
Generated each time parallel ParN04 is executed.
These files are specified in the file procgroup.
thwap - A script I inherited from our N.U. systems group
`thwap ParN04' will clobber all processes you own
whose command line includes `ParN04' as substring.
Handy for runaway processes when doing parallelism.
====================================================================
This version passes an event number to the slave and lets the
@@ -128,13 +122,15 @@ identical commands.
====================================================================
If you are curious about some of the layers, the following
stack trace [somewhat out of date now] gives some idea.
[ This stack trace is from a run based on ParN02.]
G4RunManager::BeamOn calls ParRunManager::DoEventLoop
(since G4RunManager::DoEventLoop is virtual)
ParRunManager::DoEventLoop calls TOPC_master_slave
TOPC_master_slave calls submit_task_input
submit_task_input eventually calls COMM_send_msg which calls MPI_Send
(COMM_send_msg is the communication layer of TOPC;
The exampleN02.cc was linked with the TOP-C MPI communication layer.
ParN04.cc was linked with the TOP-C MPI communication layer.
The same source could have been linked with a POSIX threads layer,
a communication layer, or some other communication layer.
)
@@ -158,4 +154,4 @@ stack trace [somewhat out of date now] gives some idea.
#11 0x416810a3 in G4UImanager::ApplyCommand () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4intercoms.so
#12 0x805db7e in G4UIterminal::ExecuteCommand () at /afs/cern.ch/sw/lhcxx/specific/redhat61/3.2.0/include/CLHEP/Random/Randomize.h:64
#13 0x805d42d in G4UIterminal::SessionStart () at /afs/cern.ch/sw/lhcxx/specific/redhat61/3.2.0/include/CLHEP/Random/Randomize.h:64
#14 0x8056a3d in main (argc=1, argv=0x80bfa00) at ParN04.cc:98
#14 0x8056a3d in main (argc=1, argv=0x80bfa00) at ParN02.cc:98
@@ -0,0 +1,47 @@
The files in this directory are the files that were used to build
../include/Marshaled*.hh . The files ../include/Marshaled*.hh contain
marshaling (serialization) routines that are used by Parallel Geantr4.
Marshalgen is a package that allows one to add a small number of annotations
to the original sequential code, in order to create marshalling or
serialization routines. Those marshalling routines are then used
by ParGeant4 to pass data between slave processes and the master process.
INPUT FILES:
1. G4*.hh : The files *.hh are taken from Geant4. They include annotations
(comments) that describe how to marshal individual fields of the
given classes. These files have additional annotations that describe
how to marshal individual fields of the given classes. For a new
application, you have to change any references to Ex* to your
own example/application include files. These files are then reused
in the new Geant4 parallel application.
2. ../include/Ex*Hit.hh : These files are the original sequential Geant4
application files that describe the application-defined hits.
They remain in the application include directory because they may
depend on other files in the include directory.
For most new parallel Geant4 applications, these files are sufficiently
simple, that one needs only to add Marshalgen begin and end comments
bracketing the class that needs to be marshalled, and a small number
of annotations specifying accessor functions to get and set fields
in the class. It may also be necessary to include marshalling
include files, if it is necessary to marshal other Geant4 data
structures.
Information on how to marshal the fields, etc., is in the Marshalgen
manual, along with the Marshalgen package:
http://www.ccs.neu.edu/home/gene/marshalgen
Marshalgen was then called on the above input files. One calls:
./marshalgen *.hh
./marshalgen ../include/Ex*Hit.hh
OUTPUT FILES:
3. *.msh : These files are intermediate files generated automatically
by marshalgen ( http://www.ccs.neu.edu/home/gene/marshalgen )
These files can be deleted if desired.
4. Marshaled*.h : These files are generated by Marshalgen. They
include of type both MarshaledEx*.h and MarshaledG4*.h .
(In addition, the file MarshaledObj.h is copied directly from
the Marshalgen distribution.) These files are all copied to
the include directory of the Geant4 parallel application.
They provide the marshalling functions that are then used by Geant4.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HCofThisEvent.hh,v 1.1 2004/11/22 17:51:00 cooperma Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4HCofThisEvent.hh,v 1.2 2005/11/26 09:47:01 cooperma Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
#ifndef G4HCofThisEvent_h
@@ -31,7 +31,7 @@
#include "globals.hh"
#include "G4Allocator.hh"
#include "G4VHitsCollection.hh"
#include "g4std/vector"
#include <vector>
// class description:
//
@@ -68,7 +68,7 @@ class G4HCofThisEvent
void AddHitsCollection(G4int HCID,G4VHitsCollection * aHC);
private:
G4std::vector<G4VHitsCollection*> * HC; /*MSH: ptr_as_array
std::vector<G4VHitsCollection*> * HC; /*MSH: ptr_as_array
[elementType: G4VHitsCollection*]
[elementCount: { $ELE_COUNT = $THIS->GetNumberOfCollections(); }]
[elementGet: { $ELEMENT = $THIS->GetHC($ELE_INDEX); }]
@@ -101,7 +101,11 @@ class G4HCofThisEvent
};
//MSH_END
extern G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
#endif
inline void* G4HCofThisEvent::operator new(size_t)
{
@@ -10,9 +10,12 @@
//MSH_include_end
%}
// This file is generated automatically from G4HCofThisEvent.hh . It is an
// intermediate file useful for debugging, but otherwise may be deleted.
marshaling class MarshaledG4HCofThisEvent (G4HCofThisEvent* param) {
G4std::vector<G4VHitsCollection*> * HC;
std::vector<G4VHitsCollection*> * HC;
//FIELDMARSHAL:
{
int copy_off = 0;
@@ -32,11 +32,12 @@
vietha 2003.05.08
*/
#ifndef G4String_h
#define G4String_h
#ifndef __G4String
#define __G4String
//MSH_BEGIN
class G4String{
class G4String : public std::string
{
int dummy; /*MSH: manual
{ memcpy($$, param->c_str(), param->size());
*($$+param->size()) = '\0';
@@ -3,6 +3,9 @@
%}
// This file is generated automatically from G4String.hh . It is an
// intermediate file useful for debugging, but otherwise may be deleted.
marshaling class MarshaledG4String (G4String* param) {
int dummy;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4THitsCollection.hh,v 1.1 2004/11/22 17:51:01 cooperma Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4THitsCollection.hh,v 1.2 2005/11/26 09:47:01 cooperma Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
#ifndef G4THitsCollection_h
@@ -96,7 +96,12 @@ class G4HitsCollection : public G4VHitsCollection
};
//MSH_END
extern G4Allocator<G4HitsCollection> anHCAllocator;
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HitsCollection> anHCAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4HitsCollection> anHCAllocator;
#endif
//MSH_BEGIN
template <class T> class G4THitsCollection : public G4HitsCollection
@@ -120,15 +125,15 @@ template <class T> class G4THitsCollection : public G4HitsCollection
public: // with description
inline T* operator[](size_t i) const
{ return (*((G4std::vector<T*>*)theCollection))[i]; }
{ return (*((std::vector<T*>*)theCollection))[i]; }
// Returns a pointer to a concrete hit object.
inline G4std::vector<T*>* GetVector() const
{ return (G4std::vector<T*>*)theCollection; }
inline std::vector<T*>* GetVector() const
{ return (std::vector<T*>*)theCollection; }
// Returns a collection vector.
inline G4int insert(T* aHit)
{
G4std::vector<T*>*theHitsCollection
= (G4std::vector<T*>*)theCollection;
std::vector<T*>*theHitsCollection
= (std::vector<T*>*)theCollection;
theHitsCollection->push_back(aHit);
return theHitsCollection->size();
}
@@ -136,17 +141,17 @@ template <class T> class G4THitsCollection : public G4HitsCollection
// collection is returned.
inline G4int entries() const
{
G4std::vector<T*>*theHitsCollection
= (G4std::vector<T*>*)theCollection;
std::vector<T*>*theHitsCollection
= (std::vector<T*>*)theCollection;
return theHitsCollection->size();
}
// Returns the number of hit objects stored in this collection
public:
virtual G4VHit* GetHit(size_t i) const
{ return (*((G4std::vector<T*>*)theCollection))[i]; }
{ return (*((std::vector<T*>*)theCollection))[i]; }
virtual size_t GetSize() const
{ return ((G4std::vector<T*>*)theCollection)->size(); }
{ return ((std::vector<T*>*)theCollection)->size(); }
// MSH_superclass : G4HitsCollection
@@ -167,23 +172,23 @@ template <class T> inline void G4THitsCollection<T>::operator delete(void* anHC)
template <class T> G4THitsCollection<T>::G4THitsCollection()
{
G4std::vector<T*> * theHitsCollection
= new G4std::vector<T*>;
std::vector<T*> * theHitsCollection
= new std::vector<T*>;
theCollection = (void*)theHitsCollection;
}
template <class T> G4THitsCollection<T>::G4THitsCollection(G4String detName,G4String colNam)
: G4HitsCollection(detName,colNam)
{
G4std::vector<T*> * theHitsCollection
= new G4std::vector<T*>;
std::vector<T*> * theHitsCollection
= new std::vector<T*>;
theCollection = (void*)theHitsCollection;
}
template <class T> G4THitsCollection<T>::~G4THitsCollection()
{
G4std::vector<T*> * theHitsCollection
= (G4std::vector<T*>*)theCollection;
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
//theHitsCollection->clearAndDestroy();
for(size_t i=0;i<theHitsCollection->size();i++)
{ delete (*theHitsCollection)[i]; }
@@ -196,8 +201,8 @@ template <class T> G4int G4THitsCollection<T>::operator==(const G4THitsCollectio
template <class T> void G4THitsCollection<T>::DrawAllHits()
{
G4std::vector<T*> * theHitsCollection
= (G4std::vector<T*>*)theCollection;
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
for(size_t i=0;i<n;i++)
{ (*theHitsCollection)[i]->Draw(); }
@@ -205,8 +210,8 @@ template <class T> void G4THitsCollection<T>::DrawAllHits()
template <class T> void G4THitsCollection<T>::PrintAllHits()
{
G4std::vector<T*> * theHitsCollection
= (G4std::vector<T*>*)theCollection;
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
for(size_t i=0;i<n;i++)
{ (*theHitsCollection)[i]->Print(); }
@@ -10,6 +10,9 @@
//MSH_include_end
%}
// This file is generated automatically from G4THitsCollection.hh . It is an
// intermediate file useful for debugging, but otherwise may be deleted.
marshaling class MarshaledG4HitsCollection (G4HitsCollection* param) {
void* theCollection;
@@ -150,7 +153,7 @@
}
template <class T> marshaling class MarshaledG4THitsCollection<T> (G4THitsCollection<T>* param) : public G4HitsCollection {
int __dummy208; // marshaling code for MSH_superclass
int __dummy812; // marshaling code for MSH_superclass
//FIELDMARSHAL:
{
MarshaledG4HitsCollection marParent($THIS);
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VHitsCollection.hh,v 1.1 2004/11/22 17:51:01 cooperma Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4VHitsCollection.hh,v 1.2 2005/11/26 09:47:01 cooperma Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
#ifndef G4VHitsCollection_h
@@ -55,9 +55,9 @@ class G4VHitsCollection
protected:
// Collection name
G4String collectionName; /*MSH: predefined
[elementGet: { $ELEMENT = $THIS->GetName(); }]
[elementSet: { Shadowed_param->collectionName=$ELEMENT; }]
G4String collectionName; /*MSH: predefined
[elementGet: { $ELEMENT = $THIS->GetName(); }]
[elementSet: { Shadowed_param->collectionName=$ELEMENT; }]
*/
G4String SDname; /* MSH: predefined
@@ -79,7 +79,7 @@ class G4VHitsCollection
// GetHit and GetSize are given a default implementation here so
// that the template G4THitsCollection can be used, but they
// are re-implemented G4THitsCollection.
virtual G4VHit* GetHit(size_t i) const { return 0; }
virtual G4VHit* GetHit(size_t) const { return 0; }
virtual size_t GetSize() const { return 0; };
};
@@ -3,9 +3,12 @@
%}
// This file is generated automatically from G4VHitsCollection.hh . It is an
// intermediate file useful for debugging, but otherwise may be deleted.
marshaling class MarshaledG4VHitsCollection (G4VHitsCollection* param) {
G4String collectionName;
G4String collectionName;
//FIELDMARSHAL:
{
G4String $ELEMENT;
@@ -52,29 +55,29 @@
// no need to declare size since $SIZE is already assigned in the MARSHAL field
}
int __dummy949; // marshaling code for MSH_derivedclass
int __dummy621; // marshaling code for MSH_derivedclass
//FIELDMARSHAL:
{
if(0){}
else if(($THIS->GetName() == "calCollection") ){
G4THitsCollection<ExN04CalorimeterHit> *aObj949 = (G4THitsCollection<ExN04CalorimeterHit>*)$THIS;
MarshaledG4THitsCollection<ExN04CalorimeterHit> marChild(aObj949);
G4THitsCollection<ExN04CalorimeterHit> *aObj621 = (G4THitsCollection<ExN04CalorimeterHit>*)$THIS;
MarshaledG4THitsCollection<ExN04CalorimeterHit> marChild(aObj621);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy($$,marChild.getBuffer(), marChild.getBufferSize());
$SIZE = marChild.getBufferSize();
$TYPE_CHOICE = 0;
}
else if( ($THIS->GetName() == "muonCollection") ){
G4THitsCollection<ExN04MuonHit> *aObj949 = (G4THitsCollection<ExN04MuonHit>*)$THIS;
MarshaledG4THitsCollection<ExN04MuonHit> marChild(aObj949);
G4THitsCollection<ExN04MuonHit> *aObj621 = (G4THitsCollection<ExN04MuonHit>*)$THIS;
MarshaledG4THitsCollection<ExN04MuonHit> marChild(aObj621);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy($$,marChild.getBuffer(), marChild.getBufferSize());
$SIZE = marChild.getBufferSize();
$TYPE_CHOICE = 1;
}
else if( true ){
G4THitsCollection<ExN04TrackerHit> *aObj949 = (G4THitsCollection<ExN04TrackerHit>*)$THIS;
MarshaledG4THitsCollection<ExN04TrackerHit> marChild(aObj949);
G4THitsCollection<ExN04TrackerHit> *aObj621 = (G4THitsCollection<ExN04TrackerHit>*)$THIS;
MarshaledG4THitsCollection<ExN04TrackerHit> marChild(aObj621);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy($$,marChild.getBuffer(), marChild.getBufferSize());
$SIZE = marChild.getBufferSize();
@@ -233,24 +233,24 @@ void marshal3() {
{
if(0){}
else if((param->GetName() == "calCollection") ){
G4THitsCollection<ExN04CalorimeterHit> *aObj949 = (G4THitsCollection<ExN04CalorimeterHit>*)param;
MarshaledG4THitsCollection<ExN04CalorimeterHit> marChild(aObj949);
G4THitsCollection<ExN04CalorimeterHit> *aObj621 = (G4THitsCollection<ExN04CalorimeterHit>*)param;
MarshaledG4THitsCollection<ExN04CalorimeterHit> marChild(aObj621);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
msh_currentSize = marChild.getBufferSize();
msh_typechoice = 0;
}
else if( (param->GetName() == "muonCollection") ){
G4THitsCollection<ExN04MuonHit> *aObj949 = (G4THitsCollection<ExN04MuonHit>*)param;
MarshaledG4THitsCollection<ExN04MuonHit> marChild(aObj949);
G4THitsCollection<ExN04MuonHit> *aObj621 = (G4THitsCollection<ExN04MuonHit>*)param;
MarshaledG4THitsCollection<ExN04MuonHit> marChild(aObj621);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
msh_currentSize = marChild.getBufferSize();
msh_typechoice = 1;
}
else if( true ){
G4THitsCollection<ExN04TrackerHit> *aObj949 = (G4THitsCollection<ExN04TrackerHit>*)param;
MarshaledG4THitsCollection<ExN04TrackerHit> marChild(aObj949);
G4THitsCollection<ExN04TrackerHit> *aObj621 = (G4THitsCollection<ExN04TrackerHit>*)param;
MarshaledG4THitsCollection<ExN04TrackerHit> marChild(aObj621);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
msh_currentSize = marChild.getBufferSize();
+11 -2
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.8 2005/05/03 10:05:49 allison Exp $
$Id: History,v 1.10 2005/11/28 11:30:48 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -15,7 +15,16 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
3rd May 2005 John Allison (examples-V07-00-03)
Nov 28th, 2005 G.Cooperman - ParN04-V07-01-01
---------------------------
- Updated in sync with the last kernel code.
Nov 15th, 2005 G.Cosmo - ParN04-V07-01-00
-----------------------
- Migration to <sstream> from deprecated <strstream>.
May 3rd, 2005 J.Allison
------------------------
- Replaced vis manager with G4VisExecutive.
Nov 22nd, 2004 G.Cooperman - ParN04-V07-00-00
@@ -1,11 +1,11 @@
# $Id: ParGNUmakefile,v 1.4 2002/06/06 17:27:25 cooperma Exp $
# $Id: ParGNUmakefile,v 1.6 2005/12/02 07:51:43 cooperma Exp $
# --------------------------------------------------------------
#This file should be included in GNUmakefile of local directory.
#Usage: make [ to compile parallel version ]
# make run [ to compile and run it ]
# make run-debug [ to compile and run in gdb ]
# make parclean [ remove intermediate and executable files ]
# make parclean [ remove intermediate and executable files ]
# See `run' target for parameters by which executable is called.
# This assumes Geant4 environment vars have been defined.
# See ../info/NEW_APP_INSTALL (number 10) for an example of setting up
@@ -60,7 +60,7 @@ TOPC_OPTIONS = --TOPC-verbose
EXTRALIBS=${TOPC_LIBS}
CPPFLAGS=${TOPC_CFLAGS}
TIMESTAMP=${G4BINDIR}/timestamp
TIMESTAMP=${G4BINDIR}/ParN04.timestamp
# Unfortunately, .../geant4.x.x/config/binmake.gmk has target:
# $(G4BINDIR)/$(G4TARGET)
@@ -72,11 +72,25 @@ compile:
@ if [ "$$G4SYSTEM" = "" ]; then \
echo '***' Environment variable G4SYSTEM not defined; \
echo '***' Make sure G4INSTALL and G4SYSTEM are set; \
exit 1; \
fi
${MAKE} G4BINDIR=${G4BINDIR} ${TIMESTAMP}
@ if which topc-config > /dev/null; then :; \
else \
echo '***' topc-config is not in your path; \
exit 1; \
fi
@ echo ""
@ echo 'To run, now type "make run"'
@ echo 'To remove built files, type "make parclean"'
${TIMESTAMP}: *.cc *.icc src/*.cc include/*.hh ParGNUmakefile
# Test for presence of topc-config
topc-config ${MEM_MODEL} --libs > /dev/null
@ if which topc-config > /dev/null; then :; \
else \
echo ''; \
echo '***' topc-config is not in your path; \
exit 1; \
fi
${MAKE} all
rm -f ${TIMESTAMP}
echo "" > ${TIMESTAMP}
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: ParN04.cc,v 1.4 2005/05/03 10:21:16 allison Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: ParTopC.icc,v 1.1 2002/03/09 06:25:10 cooperma Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// Parallel Library for Geant4
@@ -24,6 +24,12 @@
#ifndef ExN04CalorimeterHit_h
#define ExN04CalorimeterHit_h 1
//MSH_include_begin
#include "MarshaledG4String.h"
//MSH_include_end
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
@@ -32,6 +38,8 @@
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
//MSH_BEGIN
class ExN04CalorimeterHit : public G4VHit
{
public:
@@ -41,7 +49,7 @@ class ExN04CalorimeterHit : public G4VHit
~ExN04CalorimeterHit();
ExN04CalorimeterHit(const ExN04CalorimeterHit &right);
const ExN04CalorimeterHit& operator=(const ExN04CalorimeterHit &right);
G4int operator==(const ExN04CalorimeterHit &right) const;
int operator==(const ExN04CalorimeterHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
@@ -50,12 +58,28 @@ class ExN04CalorimeterHit : public G4VHit
void Print();
private:
G4int ZCellID;
G4int PhiCellID;
G4double edep;
G4ThreeVector pos;
G4RotationMatrix rot;
const G4LogicalVolume* pLogV;
G4int ZCellID; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetZ(); }]
[elementSet: { $THIS->SetCellID($ELEMENT, $THIS->GetPhi()); }] */
G4int PhiCellID; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetPhi(); }]
[elementSet: { $THIS->SetCellID($THIS->GetZ(), $ELEMENT); }] */
G4double edep; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetEdep(); }]
[elementSet: { $THIS->SetEdep($ELEMENT); }] */
G4ThreeVector pos; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetPos(); }]
[elementSet: { $THIS->SetPos($ELEMENT); }] */
G4RotationMatrix rot;
const G4LogicalVolume* pLogV;
public:
inline void SetCellID(G4int z,G4int phi)
@@ -83,6 +107,7 @@ class ExN04CalorimeterHit : public G4VHit
{ return pLogV; }
};
//MSH_END
typedef G4THitsCollection<ExN04CalorimeterHit> ExN04CalorimeterHitsCollection;
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04EMPhysics.hh,v 1.1 2002/03/05 15:22:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// ------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04GeneralPhysics.hh,v 1.1 2002/03/05 15:22:10 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// ------------------------------------------------------------
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: ExN04HadronPhysics.hh,v 1.3 2003/12/03 14:28:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04IonPhysics.hh,v 1.2 2003/12/03 14:28:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// ------------------------------------------------------------
@@ -24,11 +24,16 @@
#ifndef ExN04MuonHit_h
#define ExN04MuonHit_h 1
//MSH_include_begin
#include "MarshaledG4String.h"
//MSH_include_end
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
//MSH_BEGIN
class ExN04MuonHit : public G4VHit
{
public:
@@ -37,7 +42,7 @@ class ExN04MuonHit : public G4VHit
~ExN04MuonHit();
ExN04MuonHit(const ExN04MuonHit &right);
const ExN04MuonHit& operator=(const ExN04MuonHit &right);
G4int operator==(const ExN04MuonHit &right) const;
int operator==(const ExN04MuonHit &right) const;
inline void *operator new(size_t);
@@ -47,8 +52,18 @@ class ExN04MuonHit : public G4VHit
void Print();
private:
G4double edep;
G4ThreeVector pos;
G4double edep; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetEdep(); }]
[elementSet: { $THIS->SetEdep($ELEMENT); }]*/
G4ThreeVector pos; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetPos(); }]
[elementSet: { $THIS->SetPos($ELEMENT); }] */
public:
inline void SetEdep(G4double de)
@@ -63,6 +78,7 @@ class ExN04MuonHit : public G4VHit
{ return pos; }
};
//MSH_END
typedef G4THitsCollection<ExN04MuonHit> ExN04MuonHitsCollection;
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04MuonPhysics.hh,v 1.2 2003/12/03 14:28:03 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// ------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04RunAction.hh,v 1.1 2003/12/03 14:32:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04SteppingVerbose.hh,v 1.1 2003/12/03 14:32:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// This class manages the verbose outputs in G4SteppingManager.
// It inherits from G4SteppingVerbose.
@@ -20,61 +20,95 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// --------------------------------------------------------------
// GEANT 4 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
//
// TrackerHit header
// --------------------------------------------------------------
#ifndef ExN04TrackerHit_h
#define ExN04TrackerHit_h 1
//MSH_include_begin
#include "MarshaledG4String.h"
//MSH_include_end
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
class ExN04TrackerHit : public G4VHit
//MSH_BEGIN
class ExN04TrackerHit : public G4VHit
{
public:
ExN04TrackerHit();
~ExN04TrackerHit();
~ExN04TrackerHit();
ExN04TrackerHit(const ExN04TrackerHit &right);
const ExN04TrackerHit& operator=(const ExN04TrackerHit &right);
G4int operator==(const ExN04TrackerHit &right) const;
int operator==(const ExN04TrackerHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
inline void* operator new(size_t);
inline void operator delete(void* aHit);
void Draw();
void Print();
private:
G4double edep;
G4ThreeVector pos;
G4ThreeVector pos; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetPos(); }]
[elementSet: { $THIS->SetPos($ELEMENT); }] */
G4double edep; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetEdep(); }]
[elementSet: { $THIS->SetEdep($ELEMENT); }] */
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; }
inline void SetEdep(G4double de) {edep=de;};
inline void SetPos(G4ThreeVector xyz) {pos=xyz;};
inline G4double GetEdep() const {return edep;};
inline G4ThreeVector GetPos() const {return pos;};
};
//MSH_END
// vector collection of one type of hits
typedef G4THitsCollection<ExN04TrackerHit> ExN04TrackerHitsCollection;
extern G4Allocator<ExN04TrackerHit> ExN04TrackerHitAllocator;
inline void* ExN04TrackerHit::operator new(size_t)
{
void *aHit;
aHit = (void *) ExN04TrackerHitAllocator.MallocSingle();
inline void* ExN04TrackerHit::operator new(size_t) {
void* aHit;
aHit = (void*) ExN04TrackerHitAllocator.MallocSingle();
return aHit;
}
inline void ExN04TrackerHit::operator delete(void *aHit)
{
inline void ExN04TrackerHit::operator delete(void* aHit) {
ExN04TrackerHitAllocator.FreeSingle((ExN04TrackerHit*) aHit);
}
#endif
@@ -233,24 +233,24 @@ void marshal3() {
{
if(0){}
else if((param->GetName() == "calCollection") ){
G4THitsCollection<ExN04CalorimeterHit> *aObj949 = (G4THitsCollection<ExN04CalorimeterHit>*)param;
MarshaledG4THitsCollection<ExN04CalorimeterHit> marChild(aObj949);
G4THitsCollection<ExN04CalorimeterHit> *aObj749 = (G4THitsCollection<ExN04CalorimeterHit>*)param;
MarshaledG4THitsCollection<ExN04CalorimeterHit> marChild(aObj749);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
msh_currentSize = marChild.getBufferSize();
msh_typechoice = 0;
}
else if( (param->GetName() == "muonCollection") ){
G4THitsCollection<ExN04MuonHit> *aObj949 = (G4THitsCollection<ExN04MuonHit>*)param;
MarshaledG4THitsCollection<ExN04MuonHit> marChild(aObj949);
G4THitsCollection<ExN04MuonHit> *aObj749 = (G4THitsCollection<ExN04MuonHit>*)param;
MarshaledG4THitsCollection<ExN04MuonHit> marChild(aObj749);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
msh_currentSize = marChild.getBufferSize();
msh_typechoice = 1;
}
else if( true ){
G4THitsCollection<ExN04TrackerHit> *aObj949 = (G4THitsCollection<ExN04TrackerHit>*)param;
MarshaledG4THitsCollection<ExN04TrackerHit> marChild(aObj949);
G4THitsCollection<ExN04TrackerHit> *aObj749 = (G4THitsCollection<ExN04TrackerHit>*)param;
MarshaledG4THitsCollection<ExN04TrackerHit> marChild(aObj749);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
msh_currentSize = marChild.getBufferSize();
@@ -1,13 +1,26 @@
/**********************************************************************
* Parallel Library for Geant4 *
* Include file with Base Class of Marshalgen *
* Copyright (c) 2001 Gene Cooperman <gene@ccs.neu.edu> *
* *
* This library is free software distributed under the GNU *
* Lesser General Public License. See the file COPYING for details. *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library (see file COPYING); if not, write *
* to the Free Software Foundation, Inc., 59 Temple Place, Suite *
* 330, Boston, MA 02111-1307 USA, or contact Gene Cooperman *
* <gene@ccs.neu.edu>. *
**********************************************************************/
#ifndef PARMARSHALEDOBJ_H
#define PARMARSHALEDOBJ_H
#ifndef MARSHALEDOBJ_H
#define MARSHALEDOBJ_H
#include <stdio.h>
#include <stdlib.h>
@@ -111,14 +124,14 @@ class MarshaledObj {
char* msh_field_begin;
// msh_size contains the total size of msh_buffer. i.e.,
int msh_size;
size_t msh_size;
// msh_cursor points to the next field to be marshaled.
char *msh_cursor;
// msh_extent is the total allocated space for msh_buffer.
// msh_extent is always >= msh_size
int msh_extent;
size_t msh_extent;
bool msh_isUnmarshalDone; //Is unmarshaling done yet?
@@ -130,7 +143,7 @@ class MarshaledObj {
}
}
void resizeBuffer(int new_size ) {
void resizeBuffer(size_t new_size ) {
int msh_displacement = msh_cursor - msh_buffer;
int field_displacement = msh_field_begin - msh_buffer;
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: ParRunManager.hh,v 1.3 2004/11/22 17:51:13 cooperma Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// Parallel Library for Geant4
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04EMPhysics.cc,v 1.3 2003/12/03 14:28:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04GeneralPhysics.cc,v 1.2 2003/06/16 16:49:38 gunter Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04HadronPhysics.cc,v 1.3 2003/12/03 14:28:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
#include "ExN04HadronPhysics.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04IonPhysics.cc,v 1.3 2003/12/03 14:28:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04MuonPhysics.cc,v 1.3 2003/12/03 14:28:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04PhysicsList.cc,v 1.3 2003/12/03 14:28:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04RunAction.cc,v 1.1 2003/12/03 14:32:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -22,7 +22,7 @@
//
//
// $Id: ExN04SteppingVerbose.cc,v 1.1 2003/12/03 14:32:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,11 @@
#ifdef G4USE_TOPC
#include "G4Timer.hh"
#include "G4RunManager.hh"
#include "Randomize.hh"
#include "G4Run.hh"
#include "G4RunMessenger.hh"
@@ -45,12 +49,14 @@
#include "G4VVisManager.hh"
#include "ParRunManager.hh"
//vietha, include file for marshaling structures
//include file for marshaling structures
#include "MarshaledG4HCofThisEvent.h"
#include "G4ios.hh"
#include <strstream>
#include <sstream> // Geant4 8.x and beyond
using namespace CLHEP;
/*
* The TopC call backs are implemented by using the 5 static data members to store
@@ -77,6 +83,7 @@ TOPC_ACTION ParRunManager::MyCheckEventResult( void * input_buf, void *buf ) {
static void trace_event_input( void *input ) {
//G4cout << "Event " << *(G4int *)input << G4endl;
input = NULL; // Stop C++ from complaining about unused parameter
}
/*
@@ -95,17 +102,19 @@ void ParRunManager::DoEventLoop( G4int n_event, const char* macroFile, G4int n_s
return;
#endif
if ( verboseLevel > 0 ) { timer->Start(); }
if(verboseLevel>0)
{ timer->Start(); }
G4String msg;
if ( macroFile != 0 ) {
if ( n_select < 0 ) n_select = n_event;
if(macroFile!=0)
{
if(n_select<0) n_select = n_event;
msg = "/control/execute ";
msg += macroFile;
} else {
n_select = -1;
}
else
{ n_select = -1; }
// BeginOfEventAction() and EndOfEventAction() would normally be
// called inside G4EventManager::ProcessOneEvent() in ParRunManager::DoEvent
@@ -135,6 +144,7 @@ void ParRunManager::DoEventLoop( G4int n_event, const char* macroFile, G4int n_s
// This is where all the parallelism occurs
TOPC_raw_begin_master_slave(MyDoEvent, MyCheckEventResult, NULL);
if(TOPC_is_master()){
G4int i_event;
for( i_event=0; i_event<n_event; i_event++ )
@@ -170,25 +180,24 @@ TOPC_BUF ParRunManager::DoEvent( void *input_buf )
HepRandom::setTheSeed(g_Seeds[i_event]);
// removed for Geant4.6
//stateManager->SetNewState( G4State_EventProc );
// stateManager->SetNewState(G4State_EventProc);
currentEvent = GenerateEvent( i_event );
eventManager->ProcessOneEvent( currentEvent );
currentEvent = GenerateEvent(i_event);
eventManager->ProcessOneEvent(currentEvent);
G4HCofThisEvent* HCE = currentEvent->GetHCofThisEvent();
if(aMarshaledObj) delete aMarshaledObj;
aMarshaledObj = new MarshaledG4HCofThisEvent(HCE);
//stateManager->SetNewState( G4State_GeomClosed );
// removed for Geant4.6
//stateManager->SetNewState( G4State_GeomClosed );
StackPreviousEvent( currentEvent );
currentEvent = 0;
return TOPC_MSG( aMarshaledObj->getBuffer(), aMarshaledObj->getBufferSize());
}
TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf )
{
G4int i_event;
@@ -196,9 +205,9 @@ TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf
// removed for Geant4.6
//stateManager->SetNewState(G4State_EventProc);
// Geant4.6 requires the state to be G4State_GeomClosed
// Geant4 6.0 requires the state to be G4State_GeomClosed
// before calling EventManager::ProcessOneEvent(..)
if ( !userPrimaryGeneratorAction )
G4Exception("G4RunManager::BeamOn - G4VUserPrimaryGeneratorAction is not defined.");
@@ -218,7 +227,7 @@ TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf
MarshaledG4HCofThisEvent marshaledObj( output_buf );
G4HCofThisEvent* oldCE = currentEvent->GetHCofThisEvent();
G4HCofThisEvent* HCE = new G4HCofThisEvent(oldCE->GetNumberOfCollections());
marshaledObj.unmarshalTo(HCE);
if(oldCE) delete(oldCE);
@@ -232,11 +241,12 @@ TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf
if ( origUserEventAction )
origUserEventAction->EndOfEventAction( currentEvent );
AnalyzeEvent( currentEvent );
AnalyzeEvent(currentEvent);
if ( i_event < n_select ) G4UImanager::GetUIpointer()->ApplyCommand( msg );
if (i_event<n_select) G4UImanager::GetUIpointer()->ApplyCommand(msg);
// Geant4 6.0 requires the state to be G4State_GeomClosed
stateManager->SetNewState( G4State_GeomClosed );
StackPreviousEvent( currentEvent );
StackPreviousEvent(currentEvent);
currentEvent = 0;
return NO_ACTION;
}