Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -0,0 +1,200 @@
//$Id$
///\file "parallel/TopC/ParN02/.README"
///\brief Example ParN02 README page
/*! \page ExampleParN02 Example ParN02
ParGeant4: Geant4/TOP-C, a parallelization of Geant4
(event-level parallelism)
\author Gene Cooperman,
Northeastern University,
gene@ccs.neu.edu
For the latest information on ParGeant4, see: \n
http://www.ccs.neu.edu/home/gene/pargeant4.html
Note that a version now exists that runs Geant4 over the Grid.
Please write to gene@ccs.neu.edu for further information.
To port other applications to a parallel version, read the
files ../../info/PAR_INSTALL and ../../info/PAR_README.
<hr>
See the beginning of GNUmakefile for reasonable `make' targets to run it.
To run it: \n
-#
- a. Follow the standard Geant4 installation procedure.
- b. Download and install TOP-C. \n
The TOP-C home page is at http://www.ccs.neu.edu/home/gene/topc.html
\verbatim
cd <TOPC_INSTALL_DIR>
gzip -dc topc.tar.gz | tar -xvf -
cd topc
./configure
make
make check
[ Copy bin/topc-config to your path ]
\endverbatim
- c. Verify that the Geant4 example installs:
\verbatim
cd $G4INSTALL/examples/extended/parallel/ParN02
make
$G4WORKDIR/bin/$G4SYSTEM/ParN02 ParN02.in
\endverbatim
\n
-#
\verbatim
make run
\endverbatim
[ By default, the included `procgroup' file creates two slave processes
on localhost. ] \n
[ Note that in addition to output on master,
$G4WORKDIR/bin/$G4SYSTEM/slave*.out contains slave output. ]\n
[ To remove intermediate files and start over: make parclean ]
\n
-#
\n
Try running it with slave processes on remote processes.
First, test that your local environment is set up correctly.
Try:
\verbatim
ssh <REMOTE_HOSTNAME> $G4WORKDIR/bin/$G4SYSTEM/ParN02 `pwd`/ParN02.in
\endverbatim
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:
\verbatim
make run
\endverbatim
<hr>
If you read ParGNUmakefile, you'll find other things that you can
modify.
- For example, all TOP-C additions are in conditionals:
remove -DG4USE_TOPC from ParGNUmakefile and:
\verbatim
make parclean; make run
\endverbatim
in order to re-compile and rerun without TOP-C.
- Define REMOTE_SHELL differently if you don't use `ssh' for a remote shell.
(If undefined, ParGNUmakefile defines it to be `ssh')
- Define MACROFILE diferently to use a different set of input commands.
- Define MEM_MODEL=--seq
to run with TOP-C, but using a single (sequential) process, suitable
for easy debugging (via gdb, for example).
- Try: pushd $G4WORKDIR/bin/$G4SYSTEM/; ./ParN02 --TOPC-help
to see TOP-C run-time options that can be invoked, such as
pushd $G4WORKDIR/bin/$G4SYSTEM/; ./ParN02 --TOPC-num-slaves=5 ParN02.in
- Alternatively, modify TOPC_OPTIONS in ParGNUmakefile for the same effect.
You can also try other targets: make run-debug
This will run it under gdb, so you can single step to see what happens.
make parclean - Start over with clean set of files.
<hr>
New or modified files:
- ParN02.cc - Adds one line: #include "ParN02.icc"
ParExample.icc inserts: #include "topc.h"
and causes main to calls TOPC_init, TOPC_finalize,
and to use: `new ParRunManager' instead of `new G4RunManager'
- GNUmakefile - Adds one line at beginning: include ParGNUmakefile
ParGNUmakefile defines EXTRALIBS and CPPFLAGS so as to
modify behavior of config/binmake.gmk
in order to use TOP-C libraries and includes
- procgroup - Specifies which slave hosts to use, and where to put output
For example: localhost 1 - > slave1.out
host=`localhost', executable=`same as master',
params of slave=`> slave1.out' (redirect output)
If output not redirected, it goes to stdout on master.
- src/ParRunManager.cc - ParRunManger derived from G4RunManager
replaces Gr4RunManager::DoEventLoop w/ TOP-C parallel loop,
Adds certain local vars of DoEventLoop as ParRunManager members
- include/MarshaledObj.h - run-time utilities for marshalling
- include/MarshaledEx*Hit.h - marshals N02 hits (calorimeter hits)
- include/MarshaledG4*.h - marshaling routines for Geant4 data structures
- ~/slave*.out - Contains outputs of slave1, slave2, etc.
Generated each time parallel ParN02 is executed.
These files are specified in the file procgroup.
<hr>
This version passes an event number to the slave and lets the
slave generate the event. The slave passes back marshaled hits to
the master.
I will integrate the track level parallelism into this scenario at
a later date. For the track level, I will generate several
secondary tracks on the master, and then convert the secondary tracks
to new events that can be passed to slaves. I will do this only if
I detect that there are not enough initial events to fully occupy all
the slaves. This scheme has the drawback that we are splitting an event
into many events, which may make the summarization, histogram, and so
on more difficult. However, track level parallelism will be triggered
only when a very small number of events are generated.
I also want to support postponing
a track to the next event ( G4ClassificationOfNewTrack::fPostpone .
To do this, each slave will wait to retire an event until it knows that
the previous event has been retired.
In addition, I plan to have only the master read commands and pass
them to the slaves. Currently, the master and slaves each read
identical commands.
<hr>
If you are curious about some of the layers, the following
stack trace [somewhat out of date now] gives some idea.
- G4RunManager::BeamOn calls ParRunManager::DoEventLoop
(since G4RunManager::DoEventLoop is virtual)
- ParRunManager::DoEventLoop calls TOPC_master_slave
- TOPC_master_slave calls submit_task_input
- submit_task_input eventually calls COMM_send_msg which calls MPI_Send
(COMM_send_msg is the communication layer of TOPC;
ParN02.cc was linked with the TOP-C MPI communication layer.
The same source could have been linked with a POSIX threads layer,
a communication layer, or some other communication layer.
)
- MPI_send calls send
(where send is the socket system call of libc.so)
<pre>
(gdb) where
#0 0x41946c62 in send () from /lib/libc.so.6
#1 0x400839c1 in send () at wrapsyscall.c:186
#2 0x805c547 in MPI_Send (buf=0x82690fc, count=4, datatype=3, dest=2, tag=1, comm=0) at sendrecv.c:236
#3 0x805a0b5 in COMM_send_msg (msg=0x82690fc, msg_size=4, dst=2, tag=TASK_INPUT_TAG) at comm-mpi.c:224
#4 0x805774e in send_task_input (slave=2, input={data = 0x82690fc, data_size = 4}, tag=TASK_INPUT_TAG) at topc.c:560
#5 0x8057aa8 in submit_task_input (input={data = 0x82690fc, data_size = 4}) at topc.c:659
#6 0x805813c in TOPC_master_slave (generate_task_input_=0x4003d2e4 <ParRunManager::GenerateEventInput(void)>,
do_task_=0x4003d350 <ParRunManager::DoEvent(int *)>, check_task_result_=0x4003d420 <ParRunManager::CheckEventResult(int *, void *)>,
update_shared_data_=0) at topc.c:922
#7 0x4003d18c in ParRunManager::DoEventLoop (this=0x80c0bf0, n_event=1, macroFile=0x0, n_select=-1) at src/ParRunManager.cc:51
#8 0x400b14d1 in G4RunManager::BeamOn () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4run.so
#9 0x400b870a in G4RunMessenger::SetNewValue () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4run.so
#10 0x4167157b in G4UIcommand::DoIt () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4intercoms.so
#11 0x416810a3 in G4UImanager::ApplyCommand () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4intercoms.so
#12 0x805db7e in G4UIterminal::ExecuteCommand () at /afs/cern.ch/sw/lhcxx/specific/redhat61/3.2.0/include/CLHEP/Random/Randomize.h:64
#13 0x805d42d in G4UIterminal::SessionStart () at /afs/cern.ch/sw/lhcxx/specific/redhat61/3.2.0/include/CLHEP/Random/Randomize.h:64
#14 0x8056a3d in main (argc=1, argv=0x80bfa00) at ParN02.cc:98
</pre>
*/
@@ -0,0 +1,125 @@
//$Id$
///\file "parallel/TopC/ParN02/.README.N02"
///\brief Example N02 (in ParN02) README page
/*! \page ExampleN02InParN02 Example N02 in ParN02
This example simulates a simplified fixe target experiment.
Read \link ExampleParN02 Example ParN02 \endlink for a description
of how to run it in parallel.
\section ExampleN02InParN02_s1 GEOMETRY DEFINITION
The setup consists of a target followed by six chambers of increasing
transverse size. These chambers are located in a region called Tracker
region. Their shape are boxes, constructed as parametrised volumes
(ChamberParametrisation class).
The default geometry is constructed in DetectorConstruction class.
One can change the material of the target and of the chambers
interactively via the commands defined in the DetectorMessenger class.
In addition a transverse uniform magnetic field can be applied (see
N02MagneticField and DetectorMessenger classes).
\section ExampleN02InParN02_s2 PHYSICS LIST
The particle's type and the physic processes which will be available
in this example are set in PhysicsList class.
In this example, all the so called 'electromagnetic processes' are
introduced for gamma, charged leptons, and charged hadrons (see the
method PhysicsList::ConstructEM()).
An important data member of this class is the defaultCutValue which
defines the production threshold of secondary particles
(mainly Ionisation and Bremsstrahlung processes are concerned by this
CutValue).
Notice that the CutValue must be given in unit of length, corresponding
to the stopping range of the particle. It is automatically converted
in energy for each material, and a table is printed in the method
PhysicsList::SetCuts()
In addition the build-in interactive command:
\verbatim
/process/(in)activate processName
\endverbatim
allows to activate/inactivate the processes one by one.
\section ExampleN02InParN02_s3 RUNS and EVENTS
The primary kinematic consists of a single particle which hits the
target perpendicular to the input face. The type of the particle
and its energy are set in the PrimaryGeneratorAction class, and can
be changed via the G4 build-in commands of ParticleGun class.
A RUN is a set of events.
The user has control:
-at Begin and End of each run (class RunAction)
-at Begin and End of each event (class EventAction)
-at Begin and End of each track (class TrackingAction, not used here)
-at End of each step (class SteppingAction)
The class SteppingVerbose prints some informations step per step,
under the control of the command: /tracking/verbose 1
It inherits from G4SteppingVerbose, and has been setup here in order
to illustrate how to extract informations from the G4 kernel during
the tracking of a particle.
\section ExampleN02InParN02_s4 DETECTOR RESPONSE
A HIT is a record, track per track (even step per step), of all the
informations needed to simulate and analyse the detector response.
In this example the Tracker chambers are considered as the detector.
Therefore the chambers are declared 'sensitive detectors' (SD) in
the DetectorConstruction class.
Then, a Hit is defined as a set of 4 informations per step, inside
the chambers, namely:
- the track identifier (an integer),
- the chamber number,
- the total energy deposit in this step,
- the position of the deposit.
A given hit is an instance of the class TrackerHit which is created
during the tracking of a particle, step by step, in the method
TrackerSD::ProcessHits(). This hit is inserted in a HitsCollection.
The HitsCollection is printed at the end of event (via the method
TrackerSD::EndOfEvent()), under the control of the command: /hits/verbose 1
\section ExampleN02InParN02_s5 VISUALIZATION
The Visualization Manager is set in the main () (see exampleN02.cc).
The initialisation of the drawing is done via a set of /vis/ commands
in the macro vis.mac. This macro is automatically read from
the main when running in interactive mode.
The tracks are automatically drawn at the end of event and erased at
the beginning of the next run.
The visualization (with OpenGL driver) assumes two things:
1- the visualisation & interfaces categories have been compiled
with the environment variable G4VIS_BUILD_OPENGLX_DRIVER.
2- ParN02.cc has been compiled with G4VIS_USE_OPENGLX.
(The same with DAWNFILE instead of OPENGLX)
\section ExampleN02InParN02_s6 USER INTERFACES
The default command interface, called G4UIterminal, is done via
standart cin/G4cout.
On Linux and Sun-cc on can use a smarter command interface G4UItcsh.
It is enough to set the environment variable G4UI_USE_TCSH before
compiling ParN02.cc
*/
@@ -0,0 +1,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.
@@ -0,0 +1,129 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/AnnotatedFiles/G4HCofThisEvent.hh
/// \brief Definition of the G4HCofThisEvent class
//
//
// $Id: G4HCofThisEvent.hh 66241 2012-12-13 18:34:42Z gunter $
//
#ifndef G4HCofThisEvent_h
#define G4HCofThisEvent_h 1
#include "globals.hh"
#include "G4Allocator.hh"
#include "G4VHitsCollection.hh"
#include <vector>
// class description:
//
// This is a class which stores hits collections generated at one event.
// This class is exclusively constructed by G4SDManager when the first
// hits collection of an event is passed to the manager, and this class
// object is deleted by G4RunManager when a G4Event class object is deleted.
// Almost all public methods must be used by Geant4 kernel classes and
// the user should not invoke them. The user can use two const methods,
// GetHC() and GetNumberOfCollections() for accessing to the stored hits
// collection(s).
//vietha 2003/04/26 , include files needed to copy to the beginning of MarshaledG4HCofThisEvent.h
// in order to compile
//MSH_include_begin
#include "G4SDManager.hh"
#include "G4THitsCollection.hh"
#include "ExN02TrackerHit.hh"
#include "MarshaledExN02TrackerHit.h"
#include "MarshaledG4THitsCollection.h"
#include "MarshaledG4VHitsCollection.h"
//MSH_include_end
//MSH_BEGIN
class G4HCofThisEvent
{
public:
G4HCofThisEvent();
G4HCofThisEvent(G4int cap);
~G4HCofThisEvent();
inline void *operator new(size_t);
inline void operator delete(void* anHCoTE);
void AddHitsCollection(G4int HCID,G4VHitsCollection * aHC);
private:
std::vector<G4VHitsCollection*> * HC; /*MSH: ptr_as_array
[elementType: G4VHitsCollection*]
[elementCount: { $ELE_COUNT = $THIS->GetNumberOfCollections(); }]
[elementGet: { $ELEMENT = $THIS->GetHC($ELE_INDEX); }]
[elementSet: { $THIS->AddHitsCollection($ELE_INDEX, $ELEMENT); }] */
public: // with description
inline G4VHitsCollection* GetHC(G4int i)
{ return (*HC)[i]; }
// Returns a pointer to a hits collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4SDManager
// and the number can be obtained by G4SDManager::GetHitsCollectionID()
// method.
inline G4int GetNumberOfCollections()
{
G4int n = 0;
for(size_t i=0;i<HC->size();i++)
{
if((*HC)[i]) n++;
}
return n;
}
// Returns the number of hits collections which are stored in this class
// object.
public:
inline G4int GetCapacity()
{
return HC->size();
}
};
//MSH_END
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
#endif
inline void* G4HCofThisEvent::operator new(size_t)
{
void* anHCoTH;
anHCoTH = (void*)anHCoTHAllocator.MallocSingle();
return anHCoTH;
}
inline void G4HCofThisEvent::operator delete(void* anHCoTH)
{
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*)anHCoTH);
}
#endif
@@ -0,0 +1,59 @@
%{
#include <G4HCofThisEvent.hh>
//MSH_include_begin
#include "G4SDManager.hh"
#include "G4THitsCollection.hh"
#include "ExN02TrackerHit.hh"
#include "MarshaledExN02TrackerHit.h"
#include "MarshaledG4THitsCollection.h"
#include "MarshaledG4VHitsCollection.h"
//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) {
std::vector<G4VHitsCollection*> * HC;
//FIELDMARSHAL:
{
int copy_off = 0;
int $ELE_COUNT;
$ELE_COUNT = $THIS->GetNumberOfCollections();
memcpy( $$+copy_off, &$ELE_COUNT,sizeof(int));
copy_off += sizeof(int);
for(int $ELE_INDEX=0;$ELE_INDEX<$ELE_COUNT;$ELE_INDEX++){
G4VHitsCollection* $ELEMENT;
$ELEMENT = $THIS->GetHC($ELE_INDEX);
MarshaledG4VHitsCollection marEle($ELEMENT);
EXTEND_BUFFER(marEle.getBufferSize());
memcpy($$+copy_off, marEle.getBuffer(), marEle.getBufferSize());
copy_off += marEle.getBufferSize();
}
$SIZE = copy_off;
}
//FIELDUNMARSHAL:
{
int copy_off = 0;
int $ELE_COUNT;
memcpy(&$ELE_COUNT, $$+copy_off, sizeof(int));
copy_off += sizeof(int);
for(int $ELE_INDEX=0;$ELE_INDEX<$ELE_COUNT;$ELE_INDEX++){
MarshaledG4VHitsCollection marEle($$+copy_off);
G4VHitsCollection* $ELEMENT = (G4VHitsCollection*)marEle.unmarshal();
copy_off += marEle.getBufferSize();
$THIS->AddHitsCollection($ELE_INDEX, $ELEMENT);
}
}
//FIELDSIZE:
{
}
unmarshaling constructor {
$THIS = new G4HCofThisEvent();
}
}
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/AnnotatedFiles/G4String.hh
/// \brief Definition of the place-holder for the G4String class
//
/*
This file only serves as a place-holder for the annotations of G4String class,
which is a type alias in Geant4.
Only the marshaling code (MarshaledG4String.hh) generated from this file
should be used in your code. Please make sure that this G4String.hh
itself is NOT included in your code. Otherwise, it will override Geant4's
valid G4String class and bad things would happen.
vietha 2003.05.08
*/
#ifndef __G4String
#define __G4String
//MSH_BEGIN
class G4String : public std::string
{
int dummy; /*MSH: manual
{ memcpy($$, param->c_str(), param->size());
*($$+param->size()) = '\0';
}
{ G4String* s = new G4String($$);
memcpy(param, s, sizeof(G4String));
}
{ int size = param->size()+1;
while(size%8) size++;
$SIZE = size; } */
};
//MSH_END
#endif
@@ -0,0 +1,34 @@
%{
#include <G4String.hh>
%}
// 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;
//FIELDMARSHAL:
{
memcpy($$, param->c_str(), param->size());
*($$+param->size()) = '\0';
}
//FIELDUNMARSHAL:
{
G4String* s = new G4String($$);
memcpy(param, s, sizeof(G4String));
}
//FIELDSIZE:
{
int size = param->size()+1;
while(size%8) size++;
$SIZE = size;
}
unmarshaling constructor {
$THIS = new G4String();
}
}
@@ -0,0 +1,193 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/AnnotatedFiles/G4THitsCollection.hh
/// \brief Definition of the G4THitsCollection class
//
//
// $Id: G4THitsCollection.hh 66241 2012-12-13 18:34:42Z gunter $
//
#ifndef G4THitsCollection_h
#define G4THitsCollection_h 1
#include "G4VHitsCollection.hh"
#include "G4Allocator.hh"
#include "globals.hh"
//#include "g4rw/tpordvec.h"
#include <vector>
// class description:
//
// This is a template class of hits collection and parametrized by
// The concrete class of G4VHit. This is a uniform collection for
// a particular concrete hit class objects.
// An intermediate layer class G4HitsCollection appeared in this
// header file is used just for G4Allocator, because G4Allocator
// cannot be instansiated with a template class. Thus G4HitsCollection
// class MUST NOT be directly used by the user.
//MSH_BEGIN
class G4HitsCollection : public G4VHitsCollection
{
public:
G4HitsCollection();
G4HitsCollection(G4String detName,G4String colNam);
virtual ~G4HitsCollection();
G4int operator==(const G4HitsCollection &right) const;
protected:
void* theCollection; /*MSH: ptr_as_array
[elementType: ExN02TrackerHit* ]
[elementCount: { $ELE_COUNT = ((G4THitsCollection<ExN02TrackerHit>*)$THIS)->entries(); }]
[elementGet: { $ELEMENT = (*((G4THitsCollection<ExN02TrackerHit>*)$THIS))[$ELE_INDEX]; }]
[elementSet: { ((G4THitsCollection<ExN02TrackerHit>*)$THIS)->insert((ExN02TrackerHit*)$ELEMENT); }]
*/
};
//MSH_END
#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
{
public:
G4THitsCollection();
public: // with description
G4THitsCollection(G4String detName,G4String colNam);
// constructor.
public:
virtual ~G4THitsCollection();
G4int operator==(const G4THitsCollection<T> &right) const;
inline void *operator new(size_t);
inline void operator delete(void* anHC);
public: // with description
virtual void DrawAllHits();
virtual void PrintAllHits();
// These two methods invokes Draw() and Print() methods of all of
// hit objects stored in this collection, respectively.
public: // with description
inline T* operator[](size_t i) const
{ return (*((std::vector<T*>*)theCollection))[i]; }
// Returns a pointer to a concrete hit object.
inline std::vector<T*>* GetVector() const
{ return (std::vector<T*>*)theCollection; }
// Returns a collection vector.
inline G4int insert(T* aHit)
{
std::vector<T*>*theHitsCollection
= (std::vector<T*>*)theCollection;
theHitsCollection->push_back(aHit);
return theHitsCollection->size();
}
// Insert a hit object. Total number of hit objects stored in this
// collection is returned.
inline G4int entries() const
{
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 (*((std::vector<T*>*)theCollection))[i]; }
virtual size_t GetSize() const
{ return ((std::vector<T*>*)theCollection)->size(); }
// MSH_superclass : G4HitsCollection
};
//MSH_END
template <class T> inline void* G4THitsCollection<T>::operator new(size_t)
{
void* anHC;
anHC = (void*)anHCAllocator.MallocSingle();
return anHC;
}
template <class T> inline void G4THitsCollection<T>::operator delete(void* anHC)
{
anHCAllocator.FreeSingle((G4HitsCollection*)anHC);
}
template <class T> G4THitsCollection<T>::G4THitsCollection()
{
std::vector<T*> * theHitsCollection
= new std::vector<T*>;
theCollection = (void*)theHitsCollection;
}
template <class T> G4THitsCollection<T>::G4THitsCollection(G4String detName,G4String colNam)
: G4HitsCollection(detName,colNam)
{
std::vector<T*> * theHitsCollection
= new std::vector<T*>;
theCollection = (void*)theHitsCollection;
}
template <class T> G4THitsCollection<T>::~G4THitsCollection()
{
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
//theHitsCollection->clearAndDestroy();
for(size_t i=0;i<theHitsCollection->size();i++)
{ delete (*theHitsCollection)[i]; }
theHitsCollection->clear();
delete theHitsCollection;
}
template <class T> G4int G4THitsCollection<T>::operator==(const G4THitsCollection<T> &right) const
{ return (collectionName==right.collectionName); }
template <class T> void G4THitsCollection<T>::DrawAllHits()
{
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
for(size_t i=0;i<n;i++)
{ (*theHitsCollection)[i]->Draw(); }
}
template <class T> void G4THitsCollection<T>::PrintAllHits()
{
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
for(size_t i=0;i<n;i++)
{ (*theHitsCollection)[i]->Print(); }
}
#endif
@@ -0,0 +1,78 @@
%{
#include <G4THitsCollection.hh>
%}
// 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;
//FIELDMARSHAL:
{
int copy_off = 0;
int $ELE_COUNT;
$ELE_COUNT = ((G4THitsCollection<ExN02TrackerHit>*)$THIS)->entries();
memcpy( $$+copy_off, &$ELE_COUNT,sizeof(int));
copy_off += sizeof(int);
for(int $ELE_INDEX=0;$ELE_INDEX<$ELE_COUNT;$ELE_INDEX++){
ExN02TrackerHit* $ELEMENT;
$ELEMENT = (*((G4THitsCollection<ExN02TrackerHit>*)$THIS))[$ELE_INDEX];
MarshaledExN02TrackerHit marEle($ELEMENT);
EXTEND_BUFFER(marEle.getBufferSize());
memcpy($$+copy_off, marEle.getBuffer(), marEle.getBufferSize());
copy_off += marEle.getBufferSize();
}
$SIZE = copy_off;
}
//FIELDUNMARSHAL:
{
int copy_off = 0;
int $ELE_COUNT;
memcpy(&$ELE_COUNT, $$+copy_off, sizeof(int));
copy_off += sizeof(int);
for(int $ELE_INDEX=0;$ELE_INDEX<$ELE_COUNT;$ELE_INDEX++){
MarshaledExN02TrackerHit marEle($$+copy_off);
ExN02TrackerHit* $ELEMENT = (ExN02TrackerHit* )marEle.unmarshal();
copy_off += marEle.getBufferSize();
((G4THitsCollection<ExN02TrackerHit>*)$THIS)->insert((ExN02TrackerHit*)$ELEMENT);
}
}
//FIELDSIZE:
{
}
unmarshaling constructor {
$THIS = new G4HitsCollection();
}
}
template <class T> marshaling class MarshaledG4THitsCollection<T> (G4THitsCollection<T>* param) : public G4HitsCollection {
int __dummy569; // marshaling code for MSH_superclass
//FIELDMARSHAL:
{
MarshaledG4HitsCollection marParent($THIS);
EXTEND_BUFFER(marParent.getBufferSize());
memcpy($$,marParent.getBuffer(), marParent.getBufferSize());
$SIZE = marParent.getBufferSize();
}
//FIELD UNMARSHAL:
{
MarshaledG4HitsCollection marObj($$);
marObj.unmarshalTo($THIS);
}
//FIELD SIZE :
{
//code for size, just dummy code because the size will be set correctly at the end of marshaling code
}
unmarshaling constructor {
$THIS = new G4THitsCollection<T>();
}
}
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/AnnotatedFiles/G4VHitsCollection.hh
/// \brief Definition of the G4VHitsCollection class
//
//
// $Id: G4VHitsCollection.hh 66241 2012-12-13 18:34:42Z gunter $
//
#ifndef G4VHitsCollection_h
#define G4VHitsCollection_h 1
class G4VHit;
#include "globals.hh"
// class description:
//
// This is the base class of hits collection. The user is advised to
// use G4THitsCollection template class in case his/her collection is
// transient. While, in case the collection is persistent with ODBMS,
// the concrete collection class can be directly derived from this
// class.
// Geant4 kernel will use this class methods.
//MSH_BEGIN
class G4VHitsCollection
{
public:
G4VHitsCollection();
G4VHitsCollection(G4String detName,G4String colNam);
virtual ~G4VHitsCollection();
G4int operator==(const G4VHitsCollection &right) const;
virtual void DrawAllHits();
virtual void PrintAllHits();
protected:
// Collection name
G4String collectionName; /*MSH: predefined
[elementGet: { $ELEMENT = $THIS->GetName(); }]
[elementSet: { Shadowed_param->collectionName=$ELEMENT; }]
*/
G4String SDname; /* MSH: predefined
[elementGet: { $ELEMENT = $THIS->GetSDname(); }]
[elementSet: { Shadowed_param->SDname=$ELEMENT; }]
*/
/* MSH_derivedclass: G4THitsCollection<ExN02TrackerHit>("","") */
public:
inline G4String GetName()
{ return collectionName; }
inline G4String GetSDname()
{ return SDname; }
public:
// 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) const { return 0; }
virtual size_t GetSize() const { return 0; };
};
//MSH_END
#endif
@@ -0,0 +1,84 @@
%{
#include <G4VHitsCollection.hh>
%}
// 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;
//FIELDMARSHAL:
{
G4String $ELEMENT;
$ELEMENT = $THIS->GetName();
MarshaledG4String var(&$ELEMENT);
EXTEND_BUFFER(var.getBufferSize());
$SIZE = var.getBufferSize();
memcpy($$, var.getBuffer(), var.getBufferSize());
}
//FIELDUNMARSHAL:
{
MarshaledG4String var($$, 'u');
G4String $ELEMENT;
var.unmarshalTo(&$ELEMENT);
Shadowed_param->collectionName=$ELEMENT;
}
//FIELDSIZE:
{
// no need to declare size since $SIZE is already assigned in the MARSHAL field
}
G4String SDname;
//FIELDMARSHAL:
{
G4String $ELEMENT;
$ELEMENT = $THIS->GetSDname();
MarshaledG4String var(&$ELEMENT);
EXTEND_BUFFER(var.getBufferSize());
$SIZE = var.getBufferSize();
memcpy($$, var.getBuffer(), var.getBufferSize());
}
//FIELDUNMARSHAL:
{
MarshaledG4String var($$, 'u');
G4String $ELEMENT;
var.unmarshalTo(&$ELEMENT);
Shadowed_param->SDname=$ELEMENT;
}
//FIELDSIZE:
{
// no need to declare size since $SIZE is already assigned in the MARSHAL field
}
int __dummy630; // marshaling code for MSH_derivedclass
//FIELDMARSHAL:
{
G4THitsCollection<ExN02TrackerHit> *aObj630 = (G4THitsCollection<ExN02TrackerHit>*)$THIS;
MarshaledG4THitsCollection<ExN02TrackerHit> marChild(aObj630);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy($$,marChild.getBuffer(), marChild.getBufferSize());
$SIZE = marChild.getBufferSize();
$TYPE_CHOICE = 0;
}
//FIELD UNMARSHAL:
{
MarshaledG4THitsCollection<ExN02TrackerHit> marObj($$);
marObj.unmarshalTo((G4THitsCollection<ExN02TrackerHit>*)$THIS);
}
//FIELD SIZE :
{
//code for size, just dummy code because the size will be set correctly at the end of marshaling code
}
unmarshaling constructor {
$THIS = new G4THitsCollection<ExN02TrackerHit>("","");
}
}
@@ -0,0 +1,165 @@
// This file was generated automatically by marshalgen.
//
/// \file parallel/ParN02/AnnotatedFiles/MarshaledG4HCofThisEvent.h
/// \brief Definition of the MaraledG4HCofisEvent class
#ifndef MarshaledG4HCofThisEvent_H
#define MarshaledG4HCofThisEvent_H
#include <G4HCofThisEvent.hh>
//MSH_include_begin
#include "G4SDManager.hh"
#include "G4THitsCollection.hh"
#include "ExN02TrackerHit.hh"
#include "MarshaledExN02TrackerHit.h"
#include "MarshaledG4THitsCollection.h"
#include "MarshaledG4VHitsCollection.h"
//MSH_include_end
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledG4HCofThisEvent;
class ShadowedMarshaledG4HCofThisEvent : public G4HCofThisEvent{
friend class MarshaledG4HCofThisEvent;
};
class MarshaledG4HCofThisEvent : public MarshaledObj {
public:
G4HCofThisEvent* param;
ShadowedMarshaledG4HCofThisEvent* Shadowed_param;
public:
// Function implementations
MarshaledG4HCofThisEvent(G4HCofThisEvent* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
if (objptr == NULL)
return;
marshal1();
}
MarshaledG4HCofThisEvent(void *buf, char isUnmarshaling = 'u')
: MarshaledObj(buf, isUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4HCofThisEvent() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4HCofThisEvent* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4HCofThisEvent();
}
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
return this->param;
}
}
void unmarshalTo(G4HCofThisEvent* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
int copy_off = 0;
int elementNum;
elementNum = param->GetNumberOfCollections();
memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
copy_off += sizeof(int);
for(int index=0;index<elementNum;index++){
G4VHitsCollection* anElement;
anElement = param->GetHC(index);
MarshaledG4VHitsCollection marEle(anElement);
EXTEND_BUFFER(marEle.getBufferSize());
memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
copy_off += marEle.getBufferSize();
}
msh_currentSize = copy_off;
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
int copy_off = 0;
int elementNum;
memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
copy_off += sizeof(int);
for(int index=0;index<elementNum;index++){
MarshaledG4VHitsCollection marEle(msh_cursor+copy_off);
G4VHitsCollection* anElement = (G4VHitsCollection*)marEle.unmarshal();
copy_off += marEle.getBufferSize();
param->AddHitsCollection(index, anElement);
}
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,140 @@
// This file was generated automatically by marshalgen.
//
/// \file parallel/ParN02/AnnotatedFiles/MarshaledG4String.h
/// \brief Definition of the MaraledG4String class
#ifndef MarshaledG4String_H
#define MarshaledG4String_H
#include <G4String.hh>
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledG4String;
class ShadowedMarshaledG4String : public G4String{
friend class MarshaledG4String;
};
class MarshaledG4String : public MarshaledObj {
public:
G4String* param;
ShadowedMarshaledG4String* Shadowed_param;
public:
// Function implementations
MarshaledG4String(G4String* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
if (objptr == NULL)
return;
marshal1();
}
MarshaledG4String(void *buf, char isUnmarshaling = 'u')
: MarshaledObj(buf, isUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4String() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4String* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4String();
}
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
return this->param;
}
}
void unmarshalTo(G4String* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
int size = param->size()+1;
while(size%8) size++;
msh_currentSize = size;
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
memcpy(msh_cursor, param->c_str(), param->size());
*(msh_cursor+param->size()) = '\0';
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
G4String* s = new G4String(msh_cursor);
memcpy(param, s, sizeof(G4String));
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,282 @@
// This file was generated automatically by marshalgen.
//
/// \file parallel/ParN02/AnnotatedFiles/MarshaledG4THitsCollection.h
/// \brief Definition of the MaraledG4THitsCollection class
#ifndef MarshaledG4HitsCollection_H
#define MarshaledG4HitsCollection_H
#include <G4THitsCollection.hh>
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledG4HitsCollection;
class ShadowedMarshaledG4HitsCollection : public G4HitsCollection{
friend class MarshaledG4HitsCollection;
};
template <class T> class MarshaledG4THitsCollection;
template <class T> class ShadowedMarshaledG4THitsCollection : public G4THitsCollection<T>{
friend class MarshaledG4THitsCollection<T>;
};
class MarshaledG4HitsCollection : public MarshaledObj {
public:
G4HitsCollection* param;
ShadowedMarshaledG4HitsCollection* Shadowed_param;
public:
// Function implementations
MarshaledG4HitsCollection(G4HitsCollection* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
if (objptr == NULL)
return;
marshal1();
}
MarshaledG4HitsCollection(void *buf, char isUnmarshaling = 'u')
: MarshaledObj(buf, isUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4HitsCollection() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4HitsCollection* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4HitsCollection();
}
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
return this->param;
}
}
void unmarshalTo(G4HitsCollection* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
int copy_off = 0;
int elementNum;
elementNum = ((G4THitsCollection<ExN02TrackerHit>*)param)->entries();
memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
copy_off += sizeof(int);
for(int index=0;index<elementNum;index++){
ExN02TrackerHit* anElement;
anElement = (*((G4THitsCollection<ExN02TrackerHit>*)param))[index];
MarshaledExN02TrackerHit marEle(anElement);
EXTEND_BUFFER(marEle.getBufferSize());
memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
copy_off += marEle.getBufferSize();
}
msh_currentSize = copy_off;
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
int copy_off = 0;
int elementNum;
memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
copy_off += sizeof(int);
for(int index=0;index<elementNum;index++){
MarshaledExN02TrackerHit marEle(msh_cursor+copy_off);
ExN02TrackerHit* anElement = (ExN02TrackerHit* )marEle.unmarshal();
copy_off += marEle.getBufferSize();
((G4THitsCollection<ExN02TrackerHit>*)param)->insert((ExN02TrackerHit*)anElement);
}
}
msh_cursor += msh_currentSize;
}
};
template <class T> class MarshaledG4THitsCollection : public MarshaledObj {
public:
G4THitsCollection<T>* param;
ShadowedMarshaledG4THitsCollection<T>* Shadowed_param;
public:
// Function implementations
MarshaledG4THitsCollection(G4THitsCollection<T>* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
if (objptr == NULL)
return;
marshal1();
}
MarshaledG4THitsCollection(void *buf, char isUnmarshaling = 'u')
: MarshaledObj(buf, isUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4THitsCollection() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4THitsCollection<T>* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4THitsCollection<T>();
}
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
return this->param;
}
}
void unmarshalTo(G4THitsCollection<T>* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
//code for size, just dummy code because the size will be set correctly at the end of marshaling code
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
MarshaledG4HitsCollection marParent(param);
EXTEND_BUFFER(marParent.getBufferSize());
memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
msh_currentSize = marParent.getBufferSize();
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
MarshaledG4HitsCollection marObj(msh_cursor);
marObj.unmarshalTo(param);
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,265 @@
// This file was generated automatically by marshalgen.
//
/// \file parallel/ParN02/AnnotatedFiles/MarshaledG4VHitsCollection.h
/// \brief Definition of the MaraledG4VHitsCollection class
#ifndef MarshaledG4VHitsCollection_H
#define MarshaledG4VHitsCollection_H
#include <G4VHitsCollection.hh>
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledG4VHitsCollection;
class ShadowedMarshaledG4VHitsCollection : public G4VHitsCollection{
friend class MarshaledG4VHitsCollection;
};
class MarshaledG4VHitsCollection : public MarshaledObj {
public:
G4VHitsCollection* param;
ShadowedMarshaledG4VHitsCollection* Shadowed_param;
public:
// Function implementations
MarshaledG4VHitsCollection(G4VHitsCollection* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
if (objptr == NULL)
return;
marshal1();
marshal2();
marshal3();
}
MarshaledG4VHitsCollection(void *buf, char isUnmarshaling = 'u')
: MarshaledObj(buf, isUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4VHitsCollection() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4VHitsCollection* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4THitsCollection<ExN02TrackerHit>("","");
}
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
unmarshal2();
unmarshal3();
return this->param;
}
}
void unmarshalTo(G4VHitsCollection* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
unmarshal2();
unmarshal3();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
// no need to declare size since msh_currentSize is already assigned in the MARSHAL field
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4String anElement;
anElement = param->GetName();
MarshaledG4String var(&anElement);
EXTEND_BUFFER(var.getBufferSize());
msh_currentSize = var.getBufferSize();
memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
MarshaledG4String var(msh_cursor, 'u');
G4String anElement;
var.unmarshalTo(&anElement);
Shadowed_param->collectionName=anElement;
}
msh_cursor += msh_currentSize;
}
void marshal2() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
// no need to declare size since msh_currentSize is already assigned in the MARSHAL field
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4String anElement;
anElement = param->GetSDname();
MarshaledG4String var(&anElement);
EXTEND_BUFFER(var.getBufferSize());
msh_currentSize = var.getBufferSize();
memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal2() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
MarshaledG4String var(msh_cursor, 'u');
G4String anElement;
var.unmarshalTo(&anElement);
Shadowed_param->SDname=anElement;
}
msh_cursor += msh_currentSize;
}
void marshal3() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
//code for size, just dummy code because the size will be set correctly at the end of marshaling code
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int)); // 4 bytes for the total size of field, 4 bytes for the number of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4THitsCollection<ExN02TrackerHit> *aObj630 = (G4THitsCollection<ExN02TrackerHit>*)param;
MarshaledG4THitsCollection<ExN02TrackerHit> marChild(aObj630);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
msh_currentSize = marChild.getBufferSize();
msh_typechoice = 0;
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal3() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
MarshaledG4THitsCollection<ExN02TrackerHit> marObj(msh_cursor);
marObj.unmarshalTo((G4THitsCollection<ExN02TrackerHit>*)param);
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,19 @@
# $Id: GNUmakefile 66241 2012-12-13 18:34:42Z gunter $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := ParN02
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
include ParGNUmakefile
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
@@ -0,0 +1,97 @@
$Id: History 78112 2013-12-03 15:01:19Z gcosmo $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example ParN02 History file
---------------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
December 3rd, 2013 I.Hrivnacova - ParN02-V09-06-01
-------------------------
- Fixed .README.N02
August 27th, 2013 G.Cosmo - ParN02-V09-06-00
-------------------------
- Added G4Ellipsoid among solids enabled for parameterisation.
August 30th, 2012 G.Cosmo - ParN02-V09-05-01
-------------------------
- Simplified GNUmake scripts.
August 24th, 2012 I.Hrivnacova - ParN02-V09-05-00
------------------------------
- Migration to "new" G4Exception
- Fixing ParGNUmakefile to get the example compiled with standard
Geant4 environment setting
- Renaming documentation files to README, README.N02 (to be consistent
with all examples)
- Adding .README files for Doxygen
April 13, 2011 - G.Cosmo - ParN02-V09-04-00
------------------------
- Synchronised with current version of novice example N02.
Includes fixes and missing migrations...
November 5, 2010 - J.Allison - ParN02-V09-03-01
----------------------------
- Introduced G4UIExecutive.
June 2, 2010 - J.Perl - ParN02-V09-03-00
-------------------------
- Updated vis usage
Jul 5th, 2006 G.Cosmo - ParN02-V08-01-00
----------------------
- Brought up to date with latest fixes introduced in exampleN02.
Nov 28th, 2005 G.Cooperman - ParN02-V07-01-01
---------------------------
- Updated in sync with the last kernel code.
Nov 15th, 2005 G.Cosmo - ParN02-V07-01-00
-----------------------
- Migration to <sstream> from deprecated <strstream>.
May 3rd, 2005 J.Allison
------------------------
- Replaced vis manager with G4VisExecutive.
Nov 22nd, 2004 G.Cooperman - ParN02-V07-00-00
---------------------------
- Added annotated files.
Nov 22nd, 2004 G.Cooperman and V.H.Nguyen - ParN02-V06-02-00
------------------------------------------
- New version of marshaling/unmarshaling code, generated from
annotations using Marshalgen.
June 20th, 2004 G.Cooperman
----------------------------
- Fixed bug in ParRunManager class, showing up with Geant4 6.1.
Dec 2nd, 2003 G.Cosmo
----------------------
- Brought up-to-date classes from exampleN02.
Nov 13th, 2003 J.Allison
-------------------------
- Removed OPACS from Vis Manager.
July 4th, 2003 G.Cosmo
-----------------------
- Cleared pedantic compilation warnings ...
March 5th, 2002 G.Cosmo - ParN02-V04-00-00
------------------------
- Created from original version of Gene Cooperman.
Parallel version of example/novice/N02.
@@ -0,0 +1,112 @@
# $Id: ParGNUmakefile 66241 2012-12-13 18:34:42Z gunter $
# --------------------------------------------------------------
#This file should be included in GNUmakefile of local directory.
#Usage: make [ to compile parallel version ]
# make run [ to compile and run it ]
# make run-debug [ to compile and run in gdb ]
# make parclean [ remove intermediate and executable files ]
# See `run' target for parameters by which executable is called.
# This assumes Geant4 environment vars have been defined.
# See ../info/NEW_APP_INSTALL (number 10) for an example of setting up
# the Geant4 environment variables.
# MEM_MODEL can be --seq, --mpi, or --pthread in current version of TOP-C.
MEM_MODEL=--seq
MEM_MODEL=--mpi
ifndef REMOTE_SHELL
REMOTE_SHELL=ssh
endif
MACROFILE=ParN02.in
# DATAFILE=pythia_event.data
DATAFILE=
# Everything below here should be set automatically based on
# your environment variables, the G4TARGET of GNUmakefile, etc.
# G4TARGET set in the makefile that includes this one.
ifndef PARTARGET
PARTARGET = ${G4TARGET}
endif
include $(G4INSTALL)/config/architecture.gmk
EXECUTABLE=${G4BIN}/${G4SYSTEM}/${PARTARGET}
TOPC_LIBS = $(shell topc-config ${MEM_MODEL} --libs)
TOPC_CFLAGS = -DG4USE_TOPC $(shell topc-config ${MEM_MODEL} --cflags)
# optionally add: -DTOPC_DEBUG to TOPC_CFLAGS for debugging details.
TOPC_OPTIONS = --TOPC-verbose
EXTRALIBS=${TOPC_LIBS}
CPPFLAGS=${TOPC_CFLAGS}
TIMESTAMP=${G4BINDIR}/ParN02.timestamp
# Unfortunately, .../geant4.x.x/config/binmake.gmk has target:
# $(G4BINDIR)/$(G4TARGET)
# (for example: ${G4BIN}/$$G4SYSTEM/ParN02)
# And that rule always triggers due to dependency on .../exe/obj.last
# Also, G4BINDIR uses shell variables, that are guaranteed to expand
# only after recursive make.
compile:
@ if [ "$$G4SYSTEM" = "" ]; then \
echo '***' Environment variable G4SYSTEM not defined; \
echo '***' Make sure G4INSTALL and G4SYSTEM are set; \
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
@ 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}
make -t ${EXECUTABLE}
run: compile
pwd
echo ${EXECUTABLE}
cp -f ${MACROFILE} ${DATAFILE} procgroup `dirname ${EXECUTABLE}`/
# ${EXECUTABLE} will use procgroup file in current directory.
( cd `dirname ${EXECUTABLE}`; RSH=${REMOTE_SHELL}; export RSH; \
${EXECUTABLE} ${TOPC_OPTIONS} ${MACROFILE} )
run-debug: compile
@ if [ "$$G4DEBUG" = "" ]; then \
echo '***' Environment variable G4DEBUG not defined; \
echo '***' Set it, make parclean, and re-compile using GDEBUG; \
fi
# exit 1; \
echo ${EXECUTABLE}
cp -f ${MACROFILE} ${DATAFILE} procgroup `dirname ${EXECUTABLE}`/
rm -f `dirname ${EXECUTABLE}`/tmp.gdb
echo 'set args ${TOPC_OPTIONS} ${MACROFILE}' \
> `dirname ${EXECUTABLE}`/tmp.gdb
echo 'break main' >> `dirname ${EXECUTABLE}`/tmp.gdb
echo 'run' >> `dirname ${EXECUTABLE}`/tmp.gdb
# ${EXECUTABLE} will use procgroup file in current directory.
( cd `dirname ${EXECUTABLE}`; RSH=${REMOTE_SHELL}; export RSH; \
gdb -x tmp.gdb ${EXECUTABLE} )
parclean:
rm -f ${TIMESTAMP}
${MAKE} clean
pardist: parclean
( dir=`basename $$PWD`; cd ..; tar cvf $$dir.tar ./$$dir; \
gzip $$dir.tar && (cd $$dir; ls -l ../$$dir.tar.gz) )
@@ -0,0 +1,137 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/ParN02.cc
/// \brief The user main program of the parallel/ParN02 example
//
//
// $Id: ParN02.cc 66241 2012-12-13 18:34:42Z gunter $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02DetectorConstruction.hh"
#include "ExN02PhysicsList.hh"
#include "ExN02PrimaryGeneratorAction.hh"
#include "ExN02RunAction.hh"
#include "ExN02EventAction.hh"
#include "ExN02SteppingAction.hh"
#include "ExN02SteppingVerbose.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
#ifdef G4UI_USE
#include "G4UIExecutive.hh"
#endif
#include "ParTopC.icc"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
// User Verbose output class
//
G4VSteppingVerbose* verbosity = new ExN02SteppingVerbose;
G4VSteppingVerbose::SetInstance(verbosity);
// Run manager
//
G4RunManager * runManager = new G4RunManager;
// User Initialization classes (mandatory)
//
ExN02DetectorConstruction* detector = new ExN02DetectorConstruction;
runManager->SetUserInitialization(detector);
//
G4VUserPhysicsList* physics = new ExN02PhysicsList;
runManager->SetUserInitialization(physics);
#ifdef G4VIS_USE
// Visualization, if you choose to have it!
//
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
#endif
// User Action classes
//
G4VUserPrimaryGeneratorAction* gen_action = new ExN02PrimaryGeneratorAction(detector);
runManager->SetUserAction(gen_action);
//
G4UserRunAction* run_action = new ExN02RunAction;
runManager->SetUserAction(run_action);
//
G4UserEventAction* event_action = new ExN02EventAction;
runManager->SetUserAction(event_action);
//
G4UserSteppingAction* stepping_action = new ExN02SteppingAction;
runManager->SetUserAction(stepping_action);
// Initialize G4 kernel
//
runManager->Initialize();
// Get the pointer to the User Interface manager
//
G4UImanager * UImanager = G4UImanager::GetUIpointer();
if(argc==1) // Define (G)UI terminal for interactive mode
{
#ifdef G4UI_USE
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
UImanager->ApplyCommand("/run/beamOn 10");
ui->SessionStart();
delete ui;
#endif
}
else // Batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not
// be deleted in the main() program !
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
delete verbosity;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,21 @@
/tracking/verbose 1
/gun/energy 200 MeV
/gun/particle e+
/run/beamOn 1
/gun/energy 1 TeV
/gun/particle mu+
/run/beamOn 1
/tracking/verbose 0
/gun/energy 200 MeV
/gun/particle e+
/run/beamOn 100
/gun/energy 1 TeV
/gun/particle mu+
/run/beamOn 100
exit
@@ -0,0 +1,21 @@
/tracking/verbose 1
/gun/energy 200 MeV
/gun/particle e+
/run/beamOn 1
/gun/energy 1 TeV
/gun/particle mu+
/run/beamOn 1
/tracking/verbose 0
/gun/energy 200 MeV
/gun/particle e+
/run/beamOn 10000
/gun/energy 1 TeV
/gun/particle mu+
/run/beamOn 1000
exit
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/ParTopC.icc
/// \brief The real main program of the parallel/ParN02 example
//
// $Id: ParTopC.icc 66241 2012-12-13 18:34:42Z gunter $
//
// --------------------------------------------------------------------
// Parallel Library for Geant4
//
// Gene Cooperman <gene@ccs.neu.edu>, 2001
// --------------------------------------------------------------------
#ifdef G4USE_TOPC
# include "ParRunManager.hh"
#endif
static int G4_main(int argc, char **argv);
int main(int argc,char** argv) {
# ifdef G4USE_TOPC
TOPC_OPT_safety = 15; // Needed until a certain TOP-C bug is diagnosed.
TOPC_init(&argc, &argv);
# endif
int ret_val = G4_main(argc, argv);
# ifdef G4USE_TOPC
TOPC_finalize();
# endif
return ret_val;
}
#ifdef G4USE_TOPC
# define G4RunManager ParRunManager
#endif
#define main G4_main
@@ -0,0 +1,155 @@
ParGeant4: Geant4/TOP-C, a parallelization of Geant4
(event-level parallelism)
Gene Cooperman
Northeastern University
gene@ccs.neu.edu,
For the latest information on ParGeant4, see:
http://www.ccs.neu.edu/home/gene/pargeant4.html
Note that a version now exists that runs Geant4 over the Grid.
Please write to gene@ccs.neu.edu for further information.
To port other applications to a parallel version, read the
files ../../info/PAR_INSTALL and ../../info/PAR_README.
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
The TOP-C home page is at http://www.ccs.neu.edu/home/gene/topc.html
cd <TOPC_INSTALL_DIR>
gzip -dc topc.tar.gz | tar -xvf -
cd topc
./configure
make
make check
[ Copy bin/topc-config to your path ]
c. Verify that the Geant4 example installs:
cd $G4INSTALL/examples/extended/parallel/ParN02
make
$G4WORKDIR/bin/$G4SYSTEM/ParN02 ParN02.in
2. make run
[ By default, the included `procgroup' file creates two slave processes
on localhost. ]
[ Note that in addition to output on master,
$G4WORKDIR/bin/$G4SYSTEM/slave*.out contains slave output. ]
[ To remove intermediate files and start over: make parclean ]
3. Try running it with slave processes on remote processes.
First, test that your local environment is set up correctly.
Try:
ssh <REMOTE_HOSTNAME> $G4WORKDIR/bin/$G4SYSTEM/ParN02 `pwd`/ParN02.in
The above command needs to work without asking for a password.
[ If you use dynamic libraries (*.so), make sure the LD_LIBRARY_PATH
in your shell startup file (e.g. ~.tcshrc) includes both:
$G4INSTALL/lib/$G4SYSTEM and $CLHEP_BASE_DIR/lib
If you use AFS, you may need to type 'klog' to renew your AFS token. ]
In `procgroup' file, replace `localhost' by desired remote hosts;
Add additional remote hosts (additional slaves) if you like.
Then: make run
============================================================================
If you read ParGNUmakefile, you'll find other things that you can
modify. For example, all TOP-C additions are in conditionals:
remove -DG4USE_TOPC from ParGNUmakefile and:
make parclean; make run
in order to re-compile and rerun without TOP-C.
Define REMOTE_SHELL differently if you don't use `ssh' for a remote shell.
(If undefined, ParGNUmakefile defines it to be `ssh')
Define MACROFILE diferently to use a different set of input commands.
Define MEM_MODEL=--seq
to run with TOP-C, but using a single (sequential) process, suitable
for easy debugging (via gdb, for example).
Try: pushd $G4WORKDIR/bin/$G4SYSTEM/; ./ParN02 --TOPC-help
to see TOP-C run-time options that can be invoked, such as
pushd $G4WORKDIR/bin/$G4SYSTEM/; ./ParN02 --TOPC-num-slaves=5 ParN02.in
Alternatively, modify TOPC_OPTIONS in ParGNUmakefile for the same effect.
You can also try other targets: make run-debug
This will run it under gdb, so you can single step to see what happens.
make parclean - Start over with clean set of files.
============================================================================
New or modified files:
ParN02.cc - Adds one line: #include "ParN02.icc"
ParExample.icc inserts: #include "topc.h"
and causes main to calls TOPC_init, TOPC_finalize,
and to use: `new ParRunManager' instead of `new G4RunManager'
GNUmakefile - Adds one line at beginning: include ParGNUmakefile
ParGNUmakefile defines EXTRALIBS and CPPFLAGS so as to
modify behavior of config/binmake.gmk
in order to use TOP-C libraries and includes
procgroup - Specifies which slave hosts to use, and where to put output
For example: localhost 1 - > slave1.out
host=`localhost', executable=`same as master',
params of slave=`> slave1.out' (redirect output)
If output not redirected, it goes to stdout on master.
src/ParRunManager.cc - ParRunManger derived from G4RunManager
replaces Gr4RunManager::DoEventLoop w/ TOP-C parallel loop,
Adds certain local vars of DoEventLoop as ParRunManager members
include/MarshaledObj.h - run-time utilities for marshalling
include/MarshaledEx*Hit.h - marshals N02 hits (calorimeter hits)
include/MarshaledG4*.h - marshaling routines for Geant4 data structures
~/slave*.out - Contains outputs of slave1, slave2, etc.
Generated each time parallel ParN02 is executed.
These files are specified in the file procgroup.
====================================================================
This version passes an event number to the slave and lets the
slave generate the event. The slave passes back marshaled hits to
the master.
I will integrate the track level parallelism into this scenario at
a later date. For the track level, I will generate several
secondary tracks on the master, and then convert the secondary tracks
to new events that can be passed to slaves. I will do this only if
I detect that there are not enough initial events to fully occupy all
the slaves. This scheme has the drawback that we are splitting an event
into many events, which may make the summarization, histogram, and so
on more difficult. However, track level parallelism will be triggered
only when a very small number of events are generated.
I also want to support postponing
a track to the next event ( G4ClassificationOfNewTrack::fPostpone .
To do this, each slave will wait to retire an event until it knows that
the previous event has been retired.
In addition, I plan to have only the master read commands and pass
them to the slaves. Currently, the master and slaves each read
identical commands.
====================================================================
If you are curious about some of the layers, the following
stack trace [somewhat out of date now] gives some idea.
G4RunManager::BeamOn calls ParRunManager::DoEventLoop
(since G4RunManager::DoEventLoop is virtual)
ParRunManager::DoEventLoop calls TOPC_master_slave
TOPC_master_slave calls submit_task_input
submit_task_input eventually calls COMM_send_msg which calls MPI_Send
(COMM_send_msg is the communication layer of TOPC;
ParN02.cc was linked with the TOP-C MPI communication layer.
The same source could have been linked with a POSIX threads layer,
a communication layer, or some other communication layer.
)
MPI_send calls send
(where send is the socket system call of libc.so)
(gdb) where
#0 0x41946c62 in send () from /lib/libc.so.6
#1 0x400839c1 in send () at wrapsyscall.c:186
#2 0x805c547 in MPI_Send (buf=0x82690fc, count=4, datatype=3, dest=2, tag=1, comm=0) at sendrecv.c:236
#3 0x805a0b5 in COMM_send_msg (msg=0x82690fc, msg_size=4, dst=2, tag=TASK_INPUT_TAG) at comm-mpi.c:224
#4 0x805774e in send_task_input (slave=2, input={data = 0x82690fc, data_size = 4}, tag=TASK_INPUT_TAG) at topc.c:560
#5 0x8057aa8 in submit_task_input (input={data = 0x82690fc, data_size = 4}) at topc.c:659
#6 0x805813c in TOPC_master_slave (generate_task_input_=0x4003d2e4 <ParRunManager::GenerateEventInput(void)>,
do_task_=0x4003d350 <ParRunManager::DoEvent(int *)>, check_task_result_=0x4003d420 <ParRunManager::CheckEventResult(int *, void *)>,
update_shared_data_=0) at topc.c:922
#7 0x4003d18c in ParRunManager::DoEventLoop (this=0x80c0bf0, n_event=1, macroFile=0x0, n_select=-1) at src/ParRunManager.cc:51
#8 0x400b14d1 in G4RunManager::BeamOn () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4run.so
#9 0x400b870a in G4RunMessenger::SetNewValue () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4run.so
#10 0x4167157b in G4UIcommand::DoIt () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4intercoms.so
#11 0x416810a3 in G4UImanager::ApplyCommand () from /afs/cern.ch/user/c/cooperma/scratch-pcitapi07/geant4/lib/libG4intercoms.so
#12 0x805db7e in G4UIterminal::ExecuteCommand () at /afs/cern.ch/sw/lhcxx/specific/redhat61/3.2.0/include/CLHEP/Random/Randomize.h:64
#13 0x805d42d in G4UIterminal::SessionStart () at /afs/cern.ch/sw/lhcxx/specific/redhat61/3.2.0/include/CLHEP/Random/Randomize.h:64
#14 0x8056a3d in main (argc=1, argv=0x80bfa00) at ParN02.cc:98
@@ -0,0 +1,124 @@
$Id: README,v 1.1 2002-03-05 15:21:55 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
ParN02
------
This example simulates a simplified fixe target experiment.
Read README for a description of how to run it in parallel.
1- GEOMETRY DEFINITION
The setup consists of a target followed by six chambers of increasing
transverse size. These chambers are located in a region called Tracker
region. Their shape are boxes, constructed as parametrised volumes
(ChamberParametrisation class).
The default geometry is constructed in DetectorConstruction class.
One can change the material of the target and of the chambers
interactively via the commands defined in the DetectorMessenger class.
In addition a transverse uniform magnetic field can be applied (see
N02MagneticField and DetectorMessenger classes).
2- PHYSICS LIST
The particle's type and the physic processes which will be available
in this example are set in PhysicsList class.
In this example, all the so called 'electromagnetic processes' are
introduced for gamma, charged leptons, and charged hadrons (see the
method PhysicsList::ConstructEM()).
An important data member of this class is the defaultCutValue which
defines the production threshold of secondary particles
(mainly Ionisation and Bremsstrahlung processes are concerned by this
CutValue).
Notice that the CutValue must be given in unit of length, corresponding
to the stopping range of the particle. It is automatically converted
in energy for each material, and a table is printed in the method
PhysicsList::SetCuts()
In addition the build-in interactive command:
/process/(in)activate processName
allows to activate/inactivate the processes one by one.
3- RUNS and EVENTS
The primary kinematic consists of a single particle which hits the
target perpendicular to the input face. The type of the particle
and its energy are set in the PrimaryGeneratorAction class, and can
be changed via the G4 build-in commands of ParticleGun class.
A RUN is a set of events.
The user has control:
-at Begin and End of each run (class RunAction)
-at Begin and End of each event (class EventAction)
-at Begin and End of each track (class TrackingAction, not used here)
-at End of each step (class SteppingAction)
The class SteppingVerbose prints some informations step per step,
under the control of the command: /tracking/verbose 1
It inherits from G4SteppingVerbose, and has been setup here in order
to illustrate how to extract informations from the G4 kernel during
the tracking of a particle.
4- DETECTOR RESPONSE
A HIT is a record, track per track (even step per step), of all the
informations needed to simulate and analyse the detector response.
In this example the Tracker chambers are considered as the detector.
Therefore the chambers are declared 'sensitive detectors' (SD) in
the DetectorConstruction class.
Then, a Hit is defined as a set of 4 informations per step, inside
the chambers, namely:
- the track identifier (an integer),
- the chamber number,
- the total energy deposit in this step,
- the position of the deposit.
A given hit is an instance of the class TrackerHit which is created
during the tracking of a particle, step by step, in the method
TrackerSD::ProcessHits(). This hit is inserted in a HitsCollection.
The HitsCollection is printed at the end of event (via the method
TrackerSD::EndOfEvent()), under the control of the command: /hits/verbose 1
5- VISUALIZATION
The Visualization Manager is set in the main().
The initialisation of the drawing is done via a set of /vis/ commands
in the macro vis.mac. This macro is automatically read from
the main when running in interactive mode.
The tracks are automatically drawn at the end of event and erased at
the beginning of the next run.
The visualization (with OpenGL driver) assumes two things:
1- the visualisation & interfaces categories have been compiled
with the environment variable G4VIS_BUILD_OPENGLX_DRIVER.
2- ParN02.cc has been compiled with G4VIS_USE_OPENGLX.
(The same with DAWNFILE instead of OPENGLX)
6- USER INTERFACES
The default command interface, called G4UIterminal, is done via
standart cin/G4cout.
On Linux and Sun-cc on can use a smarter command interface G4UItcsh.
It is enough to set the environment variable G4UI_USE_TCSH before
compiling ParN02.cc
@@ -0,0 +1,113 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02ChamberParameterisation.hh
/// \brief Definition of the ExN02ChamberParameterisation class
//
//
// $Id: ExN02ChamberParameterisation.hh 73400 2013-08-27 09:52:57Z gcosmo $
//
//
// A parameterisation that describes a series of boxes along Z
// The boxes have equal width, & their lengths are a linear equation.
// They are spaced an equal distance apart, starting from given location.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02ChamberParameterisation_H
#define ExN02ChamberParameterisation_H 1
#include "globals.hh"
#include "G4VPVParameterisation.hh"
class G4VPhysicalVolume;
class G4Box;
// Dummy declarations to get rid of warnings ...
class G4Trd;
class G4Trap;
class G4Cons;
class G4Orb;
class G4Sphere;
class G4Ellipsoid;
class G4Torus;
class G4Para;
class G4Hype;
class G4Tubs;
class G4Polycone;
class G4Polyhedra;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02ChamberParameterisation : public G4VPVParameterisation
{
public:
ExN02ChamberParameterisation(G4int NoChambers,
G4double startZ,
G4double spacing,
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal );
virtual
~ExN02ChamberParameterisation();
void ComputeTransformation (const G4int copyNo,
G4VPhysicalVolume* physVol) const;
void ComputeDimensions (G4Box & trackerLayer, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions (G4Trd&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Trap&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Cons&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Sphere&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Orb&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Ellipsoid&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Torus&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Para&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Hype&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Tubs&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polycone&,const G4int,const G4VPhysicalVolume*) const {}
void ComputeDimensions (G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const {}
private:
G4int fNoChambers;
G4double fStartZ;
G4double fHalfWidth; // The half-width of each tracker chamber
G4double fSpacing; // The distance between the chambers' center
G4double fHalfLengthFirst; // The first half-length
G4double fHalfLengthIncr; // The Increment for the half-length
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02DetectorConstruction.hh
/// \brief Definition of the ExN02DetectorConstruction class
//
//
// $Id: ExN02DetectorConstruction.hh 78055 2013-12-03 08:27:48Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02DetectorConstruction_h
#define ExN02DetectorConstruction_h 1
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "ExN02MagneticField.hh"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4VPVParameterisation;
class G4UserLimits;
class ExN02DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02DetectorConstruction : public G4VUserDetectorConstruction
{
public:
ExN02DetectorConstruction();
~ExN02DetectorConstruction();
public:
G4VPhysicalVolume* Construct();
const
G4VPhysicalVolume* GetTracker() {return physiTracker;};
G4double GetTrackerFullLength() {return fTrackerLength;};
G4double GetTargetFullLength() {return fTargetLength;};
G4double GetWorldFullLength() {return fWorldLength;};
void setTargetMaterial (G4String);
void setChamberMaterial(G4String);
void SetMagField(G4double);
void SetMaxStep (G4double);
private:
G4Box* solidWorld; // pointer to the solid envelope
G4LogicalVolume* logicWorld; // pointer to the logical envelope
G4VPhysicalVolume* physiWorld; // pointer to the physical envelope
G4Box* solidTarget; // pointer to the solid Target
G4LogicalVolume* logicTarget; // pointer to the logical Target
G4VPhysicalVolume* physiTarget; // pointer to the physical Target
G4Box* solidTracker; // pointer to the solid Tracker
G4LogicalVolume* logicTracker; // pointer to the logical Tracker
G4VPhysicalVolume* physiTracker; // pointer to the physical Tracker
G4Box* solidChamber; // pointer to the solid Chamber
G4LogicalVolume* logicChamber; // pointer to the logical Chamber
G4VPhysicalVolume* physiChamber; // pointer to the physical Chamber
G4Material* TargetMater; // pointer to the target material
G4Material* ChamberMater; // pointer to the chamber material
G4VPVParameterisation* chamberParam; // pointer to chamber parameterisation
G4UserLimits* stepLimit; // pointer to user step limits
ExN02MagneticField* fpMagField; // pointer to the magnetic field
ExN02DetectorMessenger* detectorMessenger; // pointer to the Messenger
G4double fWorldLength; // Full length of the world volume
G4double fTargetLength; // Full length of Target
G4double fTrackerLength; // Full length of Tracker
G4int NbOfChambers; // Nb of chambers in the tracker region
G4double ChamberWidth; // width of the chambers
G4double ChamberSpacing; // distance between chambers
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02DetectorMessenger.hh
/// \brief Definition of the ExN02DetectorMessenger class
//
//
// $Id: ExN02DetectorMessenger.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02DetectorMessenger_h
#define ExN02DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class ExN02DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02DetectorMessenger: public G4UImessenger
{
public:
ExN02DetectorMessenger(ExN02DetectorConstruction*);
~ExN02DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
ExN02DetectorConstruction* myDetector;
G4UIdirectory* N02Dir;
G4UIdirectory* detDir;
G4UIcmdWithAString* TargMatCmd;
G4UIcmdWithAString* ChamMatCmd;
G4UIcmdWithADoubleAndUnit* FieldCmd;
G4UIcmdWithADoubleAndUnit* StepMaxCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02EventAction.hh
/// \brief Definition of the ExN02EventAction class
//
//
// $Id: ExN02EventAction.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02EventAction_h
#define ExN02EventAction_h 1
#include "G4UserEventAction.hh"
class G4Event;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02EventAction : public G4UserEventAction
{
public:
ExN02EventAction();
~ExN02EventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,71 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02MagneticField.hh
/// \brief Definition of the ExN02MagneticField class
//
//
// $Id: ExN02MagneticField.hh 66241 2012-12-13 18:34:42Z gunter $
//
//
// A class for control of the Magnetic Field of the detector.
// The field is assumed to be uniform.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02MagneticField_H
#define ExN02MagneticField_H
#include "G4UniformMagField.hh"
class G4FieldManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02MagneticField: public G4UniformMagField
{
public:
ExN02MagneticField(G4ThreeVector); // The value of the field
ExN02MagneticField(); // A zero field
~ExN02MagneticField();
//Set the field (fieldValue,0,0)
void SetMagFieldValue(G4double fieldValue);
void SetMagFieldValue(G4ThreeVector fieldVector);
G4ThreeVector GetConstantFieldValue();
protected:
// Find the global Field Manager
G4FieldManager* GetGlobalFieldManager(); // static
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02PhysicsList.hh
/// \brief Definition of the ExN02PhysicsList class
//
//
// $Id: ExN02PhysicsList.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02PhysicsList_h
#define ExN02PhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02PhysicsList: public G4VUserPhysicsList
{
public:
ExN02PhysicsList();
~ExN02PhysicsList();
protected:
// Construct particle and physics
void ConstructParticle();
void ConstructProcess();
void SetCuts();
protected:
// these methods Construct particles
void ConstructBosons();
void ConstructLeptons();
void ConstructMesons();
void ConstructBaryons();
protected:
// these methods Construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
void AddStepMax();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02PrimaryGeneratorAction.hh
/// \brief Definition of the ExN02PrimaryGeneratorAction class
//
//
// $Id: ExN02PrimaryGeneratorAction.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02PrimaryGeneratorAction_h
#define ExN02PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class ExN02DetectorConstruction;
class G4ParticleGun;
class G4Event;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
ExN02PrimaryGeneratorAction(ExN02DetectorConstruction*);
~ExN02PrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event*);
private:
G4ParticleGun* particleGun;
ExN02DetectorConstruction* myDetector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02RunAction.hh
/// \brief Definition of the ExN02RunAction class
//
//
// $Id: ExN02RunAction.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02RunAction_h
#define ExN02RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4Run;
class ExN02RunAction : public G4UserRunAction
{
public:
ExN02RunAction();
~ExN02RunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02SteppingAction.hh
/// \brief Definition of the ExN02SteppingAction class
//
//
// $Id: ExN02SteppingAction.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02SteppingAction_h
#define ExN02SteppingAction_h 1
#include "G4UserSteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02SteppingAction : public G4UserSteppingAction
{
public:
ExN02SteppingAction();
~ExN02SteppingAction(){};
void UserSteppingAction(const G4Step*);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,62 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02SteppingVerbose.hh
/// \brief Definition of the ExN02SteppingVerbose class
//
//
// $Id: ExN02SteppingVerbose.hh 66241 2012-12-13 18:34:42Z gunter $
//
// This class manages the verbose outputs in G4SteppingManager.
// It inherits from G4SteppingVerbose.
// It shows how to extract informations during the tracking of a particle.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02SteppingVerbose;
#ifndef ExN02SteppingVerbose_h
#define ExN02SteppingVerbose_h 1
#include "G4SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02SteppingVerbose : public G4SteppingVerbose
{
public:
ExN02SteppingVerbose();
~ExN02SteppingVerbose();
void StepInfo();
void TrackingStarted();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02TrackerHit.hh
/// \brief Definition of the ExN02TrackerHit class
//
//
// $Id: ExN02TrackerHit.hh 66241 2012-12-13 18:34:42Z gunter $
//
// --------------------------------------------------------------
#ifndef ExN02TrackerHit_h
#define ExN02TrackerHit_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 ExN02TrackerHit : public G4VHit
{
public:
ExN02TrackerHit();
~ExN02TrackerHit();
ExN02TrackerHit(const ExN02TrackerHit&);
const ExN02TrackerHit& operator=(const ExN02TrackerHit&);
G4int operator==(const ExN02TrackerHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
void Draw();
void Print();
private:
G4ThreeVector pos; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetPos(); }]
[elementSet: { $THIS->SetPos($ELEMENT); }] */
G4double edep; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetEdep(); }]
[elementSet: { $THIS->SetEdep($ELEMENT); }] */
G4int trackID; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetTrackID(); }]
[elementSet: { $THIS->SetTrackID($ELEMENT); }] */
G4int chamberNb; /*MSH: primitive
[elementGet: { $ELEMENT = $THIS->GetChamberNb(); }]
[elementSet: { $THIS->SetChamberNb($ELEMENT); }] */
public:
inline void SetTrackID (G4int track) {trackID = track; }
inline void SetChamberNb(G4int chamb) {chamberNb = chamb; }
inline void SetEdep(G4double de) {edep=de;}
inline void SetPos(G4ThreeVector xyz) {pos=xyz;}
inline G4int GetTrackID() const {return trackID; }
inline G4int GetChamberNb() const {return chamberNb; }
inline G4double GetEdep() const {return edep;}
inline G4ThreeVector GetPos() const {return pos;}
};
//MSH_END
// vector collection of one type of hits
typedef G4THitsCollection<ExN02TrackerHit> ExN02TrackerHitsCollection;
extern G4Allocator<ExN02TrackerHit> ExN02TrackerHitAllocator;
inline void* ExN02TrackerHit::operator new(size_t)
{
void* aHit;
aHit = (void*) ExN02TrackerHitAllocator.MallocSingle();
return aHit;
}
inline void ExN02TrackerHit::operator delete(void* aHit)
{
ExN02TrackerHitAllocator.FreeSingle((ExN02TrackerHit*) aHit);
}
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ExN02TrackerSD.hh
/// \brief Definition of the ExN02TrackerSD class
//
//
// $Id: ExN02TrackerSD.hh 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef ExN02TrackerSD_h
#define ExN02TrackerSD_h 1
#include "G4VSensitiveDetector.hh"
#include "ExN02TrackerHit.hh"
class G4Step;
class G4HCofThisEvent;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ExN02TrackerSD : public G4VSensitiveDetector
{
public:
ExN02TrackerSD(G4String);
~ExN02TrackerSD();
void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step*, G4TouchableHistory*);
void EndOfEvent(G4HCofThisEvent*);
private:
ExN02TrackerHitsCollection* trackerCollection;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -0,0 +1,26 @@
MARSHALGEN_PATH = /afs/cern.ch/user/c/cooperma/vietha/Marshalgen
MARSHAL=$(MARSHALGEN_PATH)/marshalgen
default: all
all: G4String G4THits G4VHits ExN02TrackerHit G4HCofThisEvent
(cp -p ../AnnotatedFiles/Marshaled* .; cp -p $(MARSHALGEN_PATH)/MarshaledObj.h .)
ExN02TrackerHit: ExN02TrackerHit.hh
$(MARSHAL) $?
G4String: ../AnnotatedFiles/G4String.hh
$(MARSHAL) $?
G4HCofThisEvent: ../AnnotatedFiles/G4HCofThisEvent.hh
$(MARSHAL) $?
G4THits: ../AnnotatedFiles/G4THitsCollection.hh
$(MARSHAL) $?
G4VHits: ../AnnotatedFiles/G4VHitsCollection.hh
$(MARSHAL) $?
clean:
rm *.msh Marshaled* ../AnnotatedFiles/*.msh ../AnnotatedFiles/Marshaled*
@@ -0,0 +1,322 @@
// This file was generated automatically by marshalgen.
#ifndef MarshaledExN02TrackerHit_H
#define MarshaledExN02TrackerHit_H
#include <ExN02TrackerHit.hh>
//MSH_include_begin
#include "MarshaledG4String.h"
//MSH_include_end
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledExN02TrackerHit;
class ShadowedMarshaledExN02TrackerHit : public ExN02TrackerHit{
friend class MarshaledExN02TrackerHit;
};
class MarshaledExN02TrackerHit : public MarshaledObj {
public:
ExN02TrackerHit* param;
ShadowedMarshaledExN02TrackerHit* Shadowed_param;
public:
// Function implementations
MarshaledExN02TrackerHit(ExN02TrackerHit* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledExN02TrackerHit*)this->param;
if (objptr == NULL)
return;
marshal1();
marshal2();
marshal3();
marshal4();
}
MarshaledExN02TrackerHit(void *buf, char chIsUnmarshaling = 'u')
: MarshaledObj(buf, chIsUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledExN02TrackerHit() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
ExN02TrackerHit* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new ExN02TrackerHit();
}
this->Shadowed_param = (ShadowedMarshaledExN02TrackerHit*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
unmarshal2();
unmarshal3();
unmarshal4();
return this->param;
}
}
void unmarshalTo(ExN02TrackerHit* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledExN02TrackerHit*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
unmarshal2();
unmarshal3();
unmarshal4();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
msh_currentSize = sizeof(G4ThreeVector);
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
// size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4ThreeVector anElement;
anElement = param->GetPos();
memcpy(msh_cursor, &anElement, sizeof(G4ThreeVector));
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
G4ThreeVector anElement;
memcpy(&anElement, msh_cursor, sizeof(G4ThreeVector));
param->SetPos(anElement);
}
msh_cursor += msh_currentSize;
}
void marshal2() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
msh_currentSize = sizeof(G4double);
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number of
// elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total size
//of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4double anElement;
anElement = param->GetEdep();
memcpy(msh_cursor, &anElement, sizeof(G4double));
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal2() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
G4double anElement;
memcpy(&anElement, msh_cursor, sizeof(G4double));
param->SetEdep(anElement);
}
msh_cursor += msh_currentSize;
}
void marshal3() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
msh_currentSize = sizeof(G4int );
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
//size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4int anElement;
anElement = param->GetTrackID();
memcpy(msh_cursor, &anElement, sizeof(G4int ));
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal3() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
G4int anElement;
memcpy(&anElement, msh_cursor, sizeof(G4int ));
param->SetTrackID(anElement);
}
msh_cursor += msh_currentSize;
}
void marshal4() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
msh_currentSize = sizeof(G4int );
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
//size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4int anElement;
anElement = param->GetChamberNb();
memcpy(msh_cursor, &anElement, sizeof(G4int ));
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal4() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
G4int anElement;
memcpy(&anElement, msh_cursor, sizeof(G4int ));
param->SetChamberNb(anElement);
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,165 @@
// This file was generated automatically by marshalgen.
#ifndef MarshaledG4HCofThisEvent_H
#define MarshaledG4HCofThisEvent_H
#include <G4HCofThisEvent.hh>
//MSH_include_begin
#include "G4SDManager.hh"
#include "G4THitsCollection.hh"
#include "ExN02TrackerHit.hh"
#include "MarshaledExN02TrackerHit.h"
#include "MarshaledG4THitsCollection.h"
#include "MarshaledG4VHitsCollection.h"
//MSH_include_end
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledG4HCofThisEvent;
class ShadowedMarshaledG4HCofThisEvent : public G4HCofThisEvent{
friend class MarshaledG4HCofThisEvent;
};
class MarshaledG4HCofThisEvent : public MarshaledObj {
public:
G4HCofThisEvent* param;
ShadowedMarshaledG4HCofThisEvent* Shadowed_param;
public:
// Function implementations
MarshaledG4HCofThisEvent(G4HCofThisEvent* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
if (objptr == NULL)
return;
marshal1();
}
MarshaledG4HCofThisEvent(void *buf, char chIsUnmarshaling = 'u')
: MarshaledObj(buf, chIsUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4HCofThisEvent() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4HCofThisEvent* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4HCofThisEvent();
}
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
return this->param;
}
}
void unmarshalTo(G4HCofThisEvent* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4HCofThisEvent*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
//size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
int copy_off = 0;
int elementNum;
elementNum = param->GetNumberOfCollections();
memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
copy_off += sizeof(int);
for(int index=0;index<elementNum;index++){
G4VHitsCollection* anElement;
anElement = param->GetHC(index);
MarshaledG4VHitsCollection marEle(anElement);
EXTEND_BUFFER(marEle.getBufferSize());
memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
copy_off += marEle.getBufferSize();
}
msh_currentSize = copy_off;
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
int copy_off = 0;
int elementNum;
memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
copy_off += sizeof(int);
for(int index=0;index<elementNum;index++){
MarshaledG4VHitsCollection marEle(msh_cursor+copy_off);
G4VHitsCollection* anElement = (G4VHitsCollection*)marEle.unmarshal();
copy_off += marEle.getBufferSize();
param->AddHitsCollection(index, anElement);
}
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,141 @@
// This file was generated automatically by marshalgen.
#ifndef MarshaledG4String_H
#define MarshaledG4String_H
#include <G4String.hh>
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledG4String;
class ShadowedMarshaledG4String : public G4String{
friend class MarshaledG4String;
};
class MarshaledG4String : public MarshaledObj {
public:
G4String* param;
ShadowedMarshaledG4String* Shadowed_param;
public:
// Function implementations
MarshaledG4String(G4String* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
if (objptr == NULL)
return;
marshal1();
}
MarshaledG4String(void *buf, char chIsUnmarshaling = 'u')
: MarshaledObj(buf, chIsUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4String() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4String* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4String();
}
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
return this->param;
}
}
void unmarshalTo(G4String* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4String*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
int size = param->size()+1;
while(size%8) size++;
msh_currentSize = size;
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
//size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
memcpy(msh_cursor, param->c_str(), param->size());
*(msh_cursor+param->size()) = '\0';
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
G4String* s = new G4String(msh_cursor);
memcpy(param, s, sizeof(G4String));
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,287 @@
// This file was generated automatically by marshalgen.
#ifndef MarshaledG4HitsCollection_H
#define MarshaledG4HitsCollection_H
#include <G4THitsCollection.hh>
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledG4HitsCollection;
class ShadowedMarshaledG4HitsCollection : public G4HitsCollection{
friend class MarshaledG4HitsCollection;
};
template <class T> class MarshaledG4THitsCollection;
template <class T>
class ShadowedMarshaledG4THitsCollection : public G4THitsCollection<T>{
friend class MarshaledG4THitsCollection<T>;
};
class MarshaledG4HitsCollection : public MarshaledObj {
public:
G4HitsCollection* param;
ShadowedMarshaledG4HitsCollection* Shadowed_param;
public:
// Function implementations
MarshaledG4HitsCollection(G4HitsCollection* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
if (objptr == NULL)
return;
marshal1();
}
MarshaledG4HitsCollection(void *buf, char chIsUnmarshaling = 'u')
: MarshaledObj(buf, chIsUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4HitsCollection() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4HitsCollection* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4HitsCollection();
}
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
return this->param;
}
}
void unmarshalTo(G4HitsCollection* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4HitsCollection*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
// size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
int copy_off = 0;
int elementNum;
elementNum = ((G4THitsCollection<ExN02TrackerHit>*)param)->entries();
memcpy( msh_cursor+copy_off, &elementNum,sizeof(int));
copy_off += sizeof(int);
for(int index=0;index<elementNum;index++){
ExN02TrackerHit* anElement;
anElement = (*((G4THitsCollection<ExN02TrackerHit>*)param))[index];
MarshaledExN02TrackerHit marEle(anElement);
EXTEND_BUFFER(marEle.getBufferSize());
memcpy(msh_cursor+copy_off, marEle.getBuffer(), marEle.getBufferSize());
copy_off += marEle.getBufferSize();
}
msh_currentSize = copy_off;
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
int copy_off = 0;
int elementNum;
memcpy(&elementNum, msh_cursor+copy_off, sizeof(int));
copy_off += sizeof(int);
for(int index=0;index<elementNum;index++){
MarshaledExN02TrackerHit marEle(msh_cursor+copy_off);
ExN02TrackerHit* anElement = (ExN02TrackerHit* )marEle.unmarshal();
copy_off += marEle.getBufferSize();
((G4THitsCollection<ExN02TrackerHit>*)param)->insert((ExN02TrackerHit*)anElement);
}
}
msh_cursor += msh_currentSize;
}
};
template <class T> class MarshaledG4THitsCollection : public MarshaledObj {
public:
G4THitsCollection<T>* param;
ShadowedMarshaledG4THitsCollection<T>* Shadowed_param;
public:
// Function implementations
MarshaledG4THitsCollection(G4THitsCollection<T>* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
if (objptr == NULL)
return;
marshal1();
}
MarshaledG4THitsCollection(void *buf, char chIsUnmarshaling = 'u')
: MarshaledObj(buf, chIsUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4THitsCollection() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4THitsCollection<T>* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4THitsCollection<T>();
}
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
return this->param;
}
}
void unmarshalTo(G4THitsCollection<T>* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4THitsCollection<T>*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
//code for size, just dummy code because the size will be set correctly
// at the end of marshaling code
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
//size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
MarshaledG4HitsCollection marParent(param);
EXTEND_BUFFER(marParent.getBufferSize());
memcpy(msh_cursor,marParent.getBuffer(), marParent.getBufferSize());
msh_currentSize = marParent.getBufferSize();
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
MarshaledG4HitsCollection marObj(msh_cursor);
marObj.unmarshalTo(param);
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,274 @@
// This file was generated automatically by marshalgen.
#ifndef MarshaledG4VHitsCollection_H
#define MarshaledG4VHitsCollection_H
#include <G4VHitsCollection.hh>
#include <stdio.h>
#include <string.h>
#include "MarshaledObj.h"
class MarshaledG4VHitsCollection;
class ShadowedMarshaledG4VHitsCollection : public G4VHitsCollection{
friend class MarshaledG4VHitsCollection;
};
class MarshaledG4VHitsCollection : public MarshaledObj {
public:
G4VHitsCollection* param;
ShadowedMarshaledG4VHitsCollection* Shadowed_param;
public:
// Function implementations
MarshaledG4VHitsCollection(G4VHitsCollection* objptr) : MarshaledObj() {
msh_isUnmarshalDone = false;
this->param = objptr;
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
if (objptr == NULL)
return;
marshal1();
marshal2();
marshal3();
}
MarshaledG4VHitsCollection(void *buf, char chIsUnmarshaling = 'u')
: MarshaledObj(buf, chIsUnmarshaling) {
msh_isUnmarshalDone = false;
}
~MarshaledG4VHitsCollection() {
//if(msh_isUnmarshalDone && this->param != NULL) {
//delete this->param;
//}
}
G4VHitsCollection* unmarshal() {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return NULL;
} else {
{
param = new G4THitsCollection<ExN02TrackerHit>("","");
}
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
unmarshal2();
unmarshal3();
return this->param;
}
}
void unmarshalTo(G4VHitsCollection* obj) {
//We don't want to unmarshal the buffer is empty.
if(msh_size <= MSH_HEADER_SIZE) {
//This is buggy, we can't always assume that
//obj == NULL <==> List is empty.
return;
} else {
this->param = obj;
this->Shadowed_param = (ShadowedMarshaledG4VHitsCollection*)this->param;
this->msh_isUnmarshalDone = true;
unmarshal1();
unmarshal2();
unmarshal3();
}
}
void marshal1() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
// no need to declare size since msh_currentSize is already assigned
//in the MARSHAL field
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
//size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4String anElement;
anElement = param->GetName();
MarshaledG4String var(&anElement);
EXTEND_BUFFER(var.getBufferSize());
msh_currentSize = var.getBufferSize();
memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal1() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
MarshaledG4String var(msh_cursor, 'u');
G4String anElement;
var.unmarshalTo(&anElement);
Shadowed_param->collectionName=anElement;
}
msh_cursor += msh_currentSize;
}
void marshal2() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
// no need to declare size since msh_currentSize is already assigned
// in the MARSHAL field
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number
// of elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
// size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4String anElement;
anElement = param->GetSDname();
MarshaledG4String var(&anElement);
EXTEND_BUFFER(var.getBufferSize());
msh_currentSize = var.getBufferSize();
memcpy(msh_cursor, var.getBuffer(), var.getBufferSize());
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal2() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
MarshaledG4String var(msh_cursor, 'u');
G4String anElement;
var.unmarshalTo(&anElement);
Shadowed_param->SDname=anElement;
}
msh_cursor += msh_currentSize;
}
void marshal3() {
//declare field_size to be the size of this field
int msh_currentSize = 0;
if (isUnmarshaling())
throw "Tried to marshal in obj marked isUnmarshaling == true";
//Copy the sizespec into msh_currentSize here:
{
//code for size, just dummy code because the size will be
//set correctly at the end of marshaling code
}
//Increase the size of buffer if needed
EXTEND_BUFFER(msh_currentSize + sizeof(int) + sizeof(int));
// 4 bytes for the total size of field, 4 bytes for the number of
// elements in the array (in the case of array marshaling)
//Mark the beginning position for this field, will write the total
//size of this field here later
msh_field_begin = msh_cursor;
//Advance cursor of distance = sizeof(int)
msh_cursor += sizeof(int);
//Now just copy "get" functions here
{
G4THitsCollection<ExN02TrackerHit> *aObj293 = (G4THitsCollection<ExN02TrackerHit>*)param;
MarshaledG4THitsCollection<ExN02TrackerHit> marChild(aObj293);
EXTEND_BUFFER(marChild.getBufferSize());
memcpy(msh_cursor,marChild.getBuffer(), marChild.getBufferSize());
msh_currentSize = marChild.getBufferSize();
msh_typechoice = 0;
}
//Now advance the cursor
msh_cursor += msh_currentSize;
//Now set the size of this field
int tmp; //use memcpy instead of *(int*)... =... to prevent bus error
tmp = (msh_cursor-msh_field_begin) - sizeof(int);
memcpy(msh_field_begin, &tmp, sizeof(int));
//Now set msh_size
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size); MSH_SET_TYPECHOICE(msh_typechoice);
}
void unmarshal3() {
//declare currentSize to be the size of this field
int msh_currentSize = 0;
//copy the size of the current field into currentSize
memcpy(&msh_currentSize, msh_cursor, sizeof(int));
msh_cursor += sizeof(int);
//Now copy the setspec here
{
MarshaledG4THitsCollection<ExN02TrackerHit> marObj(msh_cursor);
marObj.unmarshalTo((G4THitsCollection<ExN02TrackerHit>*)param);
}
msh_cursor += msh_currentSize;
}
};
#endif
@@ -0,0 +1,199 @@
/**********************************************************************
* Include file with Base Class of Marshalgen *
**********************************************************************/
#ifndef MARSHALEDOBJ_H
#define MARSHALEDOBJ_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define MSH_ASSERT(X) {assert(X);}
#define MSH_HEADER_SIZE (sizeof(int)*2)
// the first field (first sizeof(int) bytes) contains the $TYPE_CHOICE
// the second field contains the size including the header
#define MSH_TOTALSIZE_OFFSET (sizeof(int))
#define MSH_TYPECHOICE_OFFSET 0
#define MSH_SET_TYPECHOICE(X) { memcpy(msh_buffer+MSH_TYPECHOICE_OFFSET,&(X),sizeof(int));}
#define MSH_SET_TOTALSIZE(X) { memcpy(msh_buffer+MSH_TOTALSIZE_OFFSET,&(X),sizeof(int));}
#define MSH_GET_TYPECHOICE(X,BUF) { memcpy(&(X), ((char*)BUF)+MSH_TYPECHOICE_OFFSET,sizeof(int));}
#define MSH_GET_TOTALSIZE(X,BUF) { memcpy(&(X), ((char*)BUF)+MSH_TOTALSIZE_OFFSET,sizeof(int));}
class MarshaledObj {
private:
// Make sure all marshaled objects are word aligned.
static const int WORD_SIZE = sizeof(long);
public:
static int ROUND_UP( int x ){
return (((x)+(WORD_SIZE-1)) / WORD_SIZE) * WORD_SIZE;
}
public:
// Constructs an empty MarshaledObj,
MarshaledObj(){
msh_extent = 128;
msh_size = MSH_HEADER_SIZE;
msh_isUnmarshalDone = false;
msh_buffer = (char *)malloc(msh_extent);
MSH_ASSERT(msh_buffer);
msh_cursor = msh_buffer + MSH_HEADER_SIZE;
msh_field_begin = msh_cursor;
msh_typechoice = 0;
int totalsize = msh_cursor-msh_buffer;
MSH_SET_TYPECHOICE(msh_typechoice);
MSH_SET_TOTALSIZE(totalsize);
}
//MarshaledObj(void *buf);
// This constructs a MarshledObj from a buffer (of type char*) for unmarshaling.
// buf is obtain from an already marshaled object.
// The first field of buf must be an int that contains the size of the buf
// NOT including itself.
// isUnmarshaling must be 'u' (for unmarshaling) .
MarshaledObj(void *buf, char chIsUnmarshaling) {
msh_isUnmarshalDone = false;
if(chIsUnmarshaling != 'u') {
printf("MarshaledObj(void*, char): wrong argument\n");
return;
}
//msh_extent = ROUND_UP(*(int *)buf + sizeof(int));
MSH_GET_TYPECHOICE(msh_typechoice,buf);
MSH_GET_TOTALSIZE(msh_size,buf);
msh_extent = ROUND_UP(msh_size);
msh_buffer = (char *)malloc(msh_extent);
MSH_ASSERT(msh_buffer);
memcpy(msh_buffer, (char *)buf, msh_extent);
msh_cursor = msh_buffer + MSH_HEADER_SIZE;
msh_field_begin = msh_cursor;
//MSH_SET_TYPECHOICE(msh_typechoice);
}
~MarshaledObj() {
if ( ! isUnmarshaling() )
free(msh_buffer);
}
inline bool isUnmarshaling() {
return (msh_extent <= 0);
}
private:
// Dont use copy constructor
const MarshaledObj& operator=(const MarshaledObj& right);
protected:
int msh_typechoice; // alias of $TYPE_CHOICE
// points to the buffer (header+body)
char *msh_buffer;
// msh_field_begin points to the size of the current field being marshaled
char* msh_field_begin;
// msh_size contains the total size of msh_buffer. i.e.,
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
size_t msh_extent;
bool msh_isUnmarshalDone; //Is unmarshaling done yet?
public:
inline void EXTEND_BUFFER(int size){
msh_size += size;
if(msh_size > msh_extent){
resizeBuffer(msh_size);
}
}
void resizeBuffer(size_t new_size ) {
int msh_displacement = msh_cursor - msh_buffer;
int field_displacement = msh_field_begin - msh_buffer;
while(new_size > msh_extent)
msh_extent *= 2;
msh_buffer = (char *)realloc( msh_buffer, msh_extent);
MSH_ASSERT(msh_buffer);
msh_cursor = msh_buffer + msh_displacement;
msh_field_begin = msh_buffer + field_displacement;
}
public:
// Returns the total size of buffer
inline int getBufferSize() {
return msh_size;
}
inline char *getBuffer() {
return msh_buffer;
}
/* p: pointer to the data field, size: size of that primitive data field */
void marshalPrimitive(void* p, int size) {
int msh_currentSize;
if (isUnmarshaling())
throw "Tried to marshal in object marked isUnmarshaling = true";
msh_currentSize = size;
EXTEND_BUFFER(msh_currentSize + sizeof(int));
// *(int *)msh_cursor = msh_currentSize;
memcpy(msh_cursor, &msh_currentSize, sizeof(int));
msh_cursor += sizeof(int);
memcpy(msh_cursor, p, size);
msh_cursor += msh_currentSize;
msh_size = msh_cursor - msh_buffer;
MSH_SET_TOTALSIZE(msh_size);
}
void unmarshalPrimitive(void* p, int size) {
int msh_currentSize;
//memcpy(&msh_currentSize, msh_cursor, sizeof(int));
/* in case *msh_cursor is invalid, use "size" not to crash the memory */
msh_currentSize = size;
msh_cursor += sizeof(int);
memcpy(p, msh_cursor, msh_currentSize);
msh_cursor += msh_currentSize;
//msh_size = msh_cursor - msh_buffer;
}
};
/* Used for distinguish the class types of the template parameter
vietha 2003.05.01 */
template <class T,class>
class MSH_IsSameClass
{
public:
enum {Is = 0};
};
template<class T>
class MSH_IsSameClass<T,T>
{
public:
enum {Is = 1};
};
#endif
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/include/ParRunManager.hh
/// \brief Definition of the ParRunManager class
//
// $Id: ParRunManager.hh 78055 2013-12-03 08:27:48Z gcosmo $
//
// --------------------------------------------------------------------
// Parallel Library for Geant4
//
// Gene Cooperman <gene@ccs.neu.edu>, 2001
// --------------------------------------------------------------------
#ifndef ParRunManager_h
#define ParRunManager_h 1
#include "G4RunManager.hh"
#include "G4StateManager.hh"
#include "G4UserEventAction.hh"
#include "topc.h"
class ParRunManager : public G4RunManager
{
protected:
virtual void DoEventLoop(G4int n_event,
const char* macroFile=0,
G4int n_select=-1);
private: // TOP-C callbacks
TOPC_BUF GenerateEventInput();
TOPC_BUF DoEvent( void * input_buf );
TOPC_ACTION CheckEventResult( void * input_buf, void * ignore );
static ParRunManager* myRunManager;
static TOPC_BUF MyGenerateEventInput();
static TOPC_BUF MyDoEvent( void * input_buf );
static TOPC_ACTION MyCheckEventResult( void * input_buf, void * ignore );
// Copies of local variables of G4RunManager::DoEventLoop()
static G4StateManager* stateManager;
static G4int n_event;
static G4int n_select;
static G4String msg;
inline void ImportDoEventLoopLocals(
G4StateManager* stateManager, G4int n_event,
G4int n_select, G4String msg )
{
ParRunManager::stateManager = stateManager;
ParRunManager::n_event = n_event;
ParRunManager::n_select = n_select;
ParRunManager::msg = msg;
ParRunManager::myRunManager = this;
}
// Copy of userEventAction: see ParRunManager.cc for further comments
G4UserEventAction * origUserEventAction;
};
#endif
@@ -0,0 +1,77 @@
surface#
# Macro file for the initialization phase of "ParN02.cc"
# when runing in interactive mode
#
# Sets some default verbose
#
/control/verbose 2
/run/verbose 2
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
#
# Use this open statement to create a .prim file suitable for
# viewing in DAWN:
#/vis/open DAWNFILE
#
# Use this open statement to create a .heprep file suitable for
# viewing in HepRApp:
#/vis/open HepRepFile
#
# Use this open statement to create a .wrl file suitable for
# viewing in a VRML viewer:
#/vis/open VRML2FILE
#
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose errors
#
# Draw geometry:
/vis/drawVolume
#
# Specify view angle:
/vis/viewer/set/viewpointThetaPhi 90. 180.
#
# Specify zoom value:
/vis/viewer/zoom 1.4
#
# Specify style (surface or wireframe):
#/vis/viewer/set/style wireframe
#
# Draw coordinate axes:
#/vis/scene/add/axes 0 0 0 1 m
#
# Draw smooth trajectories at end of event, showing trajectory points
# as markers 2 pixels wide:
/vis/scene/add/trajectories smooth
/vis/modeling/trajectories/create/drawByCharge
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
#
# Draw hits at end of event:
#/vis/scene/add/hits
#
# To draw only gammas:
#/vis/filtering/trajectories/create/particleFilter
#/vis/filtering/trajectories/particleFilter-0/add gamma
#
# To invert the above, drawing all particles except gammas,
# keep the above two lines but also add:
#/vis/filtering/trajectories/particleFilter-0/invert true
#
# Many other options are available with /vis/modeling and /vis/filtering.
# For example, to select colour by particle ID:
#/vis/modeling/trajectories/create/drawByParticleID
#/vis/modeling/trajectories/drawByParticleID-0/set e- blue
#
# To superimpose all of the events from a given run:
#/vis/scene/endOfEventAction accumulate
#
# Re-establish auto refreshing and verbosity:
/vis/viewer/set/autoRefresh true
/vis/verbose warnings
#
# For file-based drivers, use this to create an empty detector view:
#/vis/viewer/flush
@@ -0,0 +1,62 @@
# NOTE: '#' in column 0 is a comment.
local 0
localhost 1 - >slave1.out
localhost 1 - >slave2.out
# lxplus015.cern.ch 1 - >slave1.out
# lxplus016.cern.ch 1 - >slave2.out
# xplus017.cern.ch 1 - >slave2.out
# The general format is that "local 0" (required) implies creation of a master.
# Otherwise there is one line per slave.
# The first field is the hostname or localhost (in a form valid for "rsh")
# If you prefer ssh over rsh, then (e.g. in csh): setenv RSH ssh
# The second field, 1, is obligatory.
# The third field is an absolute or relative pathname (e.g.: ./XXX or ../XXX)
# of the binary. A relative pathname is appended to path of the binary
# on master. The slave process will execute in the same directory
# as the current working directory of the master, if possible.
# Otherwise, the slave will execute in the home directory.
# If the third field is `-', then the command line (including arguments)
# for that slave will be the same as on the master.
# Any additional fields (fourth and beyond) are appended to the
# command line for that slave only.
# Note that '>slave1.out' works, redirecting standard output. However,
# the output file, slave1.out, will be placed in the home directory.
# Currently, `localhost' implies the Bourne shell, and any other
# name implies the default user shell for that machine.
# By default, standard output and error are sent to user tty (a la rsh).
#
# The format is inherited from MPICH, which grew from P4.
#=========================================================================
#EXAMPLE:
# # Master process
# local 0
# # One slave process on local computer, using same binary and same arguments
# localhost 1 -
# # One remote slave process, with absolute path to binary and no arguments
# regulus.ccs.neu.edu 1 /ccs/tmp/gene/a.out
# # One slave using alpha architecture,
# # with path of alpha binary relative to binary of this master process.
# # Output placed in slave-alpha-1.out in user's home directory.
# alpha.ccs.neu.edu 1 ../alpha/a.out > slave-alpha-1.out
#=========================================================================
#IF YOU HAVE PROBLEMS:
# MPINU uses "rsh" to start a slave process. Diagnose it via:
# rsh REMOTE_SLAVE_HOST hostname
# If it doesn't work or if it asks you for a password, try:
# 1. Add a .rhosts file on the remote host and specify your local host.
# 2. Sometimes adding .localhost to your .rhosts helps.
# 3. Specify an alternative to "rsh" in your shell. For example:
# RSH=ssh; export RSH # in Bourne shell, bash, etc.
# setenv RSH ssh # in csh, tcsh, etc.
# 4. If you use "ssh", you may also need to copy keys to allow
# login to the remote host without a password.
# It's also possible that mpinu guessed badly the hostname of your local host.
# If you suspect this, on the master try (in csh, tcsh):
# setenv CALLBACK_HOST LOCAL_MASTER_HOST
# where LOCAL_MASTER_HOST is the correct hostname of the local master.
@@ -0,0 +1,71 @@
# This procgroup file is designed for the lxplus cluster at CERN.
# It assumes that 50 slaves, lxplus002 to lxplus051, are all available via
# rsh without a password (assuming the master process is on lxplus001.
# The 50 slave files are placed in your home directory
# (and in the next version, in your current directory).
# Make sure that your run-time files are all in afs directories
# so that the files are also visible to slaves.
# Remember that other users may be using this cluster.
# Use this only for a short demonstration.
# When running, consider adding --TOPC-num-slaves=10
# or something similarly moderate at first.
# There can be long delays in starting many slaves at once.
local 0
lxplus001 1 - > slave001.out
lxplus002 1 - > slave002.out
lxplus003 1 - > slave003.out
lxplus004 1 - > slave004.out
lxplus005 1 - > slave005.out
lxplus006 1 - > slave006.out
lxplus007 1 - > slave007.out
lxplus008 1 - > slave008.out
lxplus009 1 - > slave009.out
lxplus011 1 - > slave011.out
lxplus012 1 - > slave012.out
lxplus013 1 - > slave013.out
lxplus014 1 - > slave014.out
lxplus015 1 - > slave015.out
lxplus016 1 - > slave016.out
lxplus017 1 - > slave017.out
lxplus018 1 - > slave018.out
lxplus019 1 - > slave019.out
lxplus021 1 - > slave021.out
lxplus022 1 - > slave022.out
lxplus023 1 - > slave023.out
lxplus024 1 - > slave024.out
lxplus025 1 - > slave025.out
lxplus026 1 - > slave026.out
lxplus027 1 - > slave027.out
lxplus028 1 - > slave028.out
lxplus029 1 - > slave029.out
lxplus031 1 - > slave031.out
lxplus032 1 - > slave032.out
lxplus033 1 - > slave033.out
lxplus034 1 - > slave034.out
lxplus035 1 - > slave035.out
lxplus036 1 - > slave036.out
lxplus037 1 - > slave037.out
lxplus038 1 - > slave038.out
lxplus039 1 - > slave039.out
lxplus041 1 - > slave041.out
lxplus042 1 - > slave042.out
lxplus043 1 - > slave043.out
lxplus044 1 - > slave044.out
lxplus045 1 - > slave045.out
lxplus046 1 - > slave046.out
lxplus047 1 - > slave047.out
lxplus048 1 - > slave048.out
lxplus049 1 - > slave049.out
lxplus041 1 - > slave041.out
lxplus042 1 - > slave042.out
lxplus043 1 - > slave043.out
lxplus044 1 - > slave044.out
lxplus045 1 - > slave045.out
lxplus046 1 - > slave046.out
lxplus047 1 - > slave047.out
lxplus048 1 - > slave048.out
lxplus049 1 - > slave049.out
lxplus050 1 - > slave050.out
lxplus051 1 - > slave051.out
@@ -0,0 +1,23 @@
# $Id: run1.mac 66241 2012-12-13 18:34:42Z gunter $
#
# Macro file for "ParN02.cc"
#
# can be run in batch, without graphic
# or interactively: Idle> /control/execute run1.mac
#
/run/verbose 2
/event/verbose 0
#
# proton 3 GeV to the direction (0.,0.,1.) (default kinematic)
# 1 event with detailled printing
#
/tracking/verbose 1
/run/beamOn 1
#
# muon 300 MeV to the direction (0.,0.,1.)
# 3 events (no printing)
#
/gun/particle mu-
/gun/energy 300 MeV
/tracking/verbose 0
/run/beamOn 3
@@ -0,0 +1,23 @@
# $Id: run2.mac 66241 2012-12-13 18:34:42Z gunter $
#
# Macro file for "ParN02.cc"
#
# can be run in batch, without graphic
# or interactively: Idle> /control/execute run2.mac
#
/run/verbose 2
/event/verbose 0
#
# proton 3 GeV to the direction (0.,0.,1.) (default kinematic)
# 1 event with detailled printing
#
/tracking/verbose 1
/run/beamOn 1
#
# set a magnetic field
# 1 events; print the hits
#
/N02/det/setField 2 tesla
/tracking/verbose 0
/hits/verbose 1
/run/beamOn 1
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02ChamberParameterisation.cc
/// \brief Implementation of the ExN02ChamberParameterisation class
//
//
// $Id: ExN02ChamberParameterisation.cc 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02ChamberParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Box.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02ChamberParameterisation::ExN02ChamberParameterisation(
G4int NoChambers,
G4double startZ, // Z of center of first
G4double spacingZ, // Z spacing of centers
G4double widthChamber,
G4double lengthInitial,
G4double lengthFinal )
{
fNoChambers = NoChambers;
fStartZ = startZ;
fHalfWidth = widthChamber*0.5;
fSpacing = spacingZ;
fHalfLengthFirst = 0.5 * lengthInitial;
// fHalfLengthLast = lengthFinal;
if( NoChambers > 0 ){
fHalfLengthIncr = 0.5 * (lengthFinal-lengthInitial)/NoChambers;
if (spacingZ < widthChamber) {
G4Exception("ExN02ChamberParameterisation::ExN02ChamberParameterisation()",
"InvalidSetup", FatalException,
"Width>Spacing");
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02ChamberParameterisation::~ExN02ChamberParameterisation()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02ChamberParameterisation::ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume* physVol) const
{
G4double Zposition= fStartZ + (copyNo+1) * fSpacing;
G4ThreeVector origin(0,0,Zposition);
physVol->SetTranslation(origin);
physVol->SetRotation(0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02ChamberParameterisation::ComputeDimensions
(G4Box& trackerChamber, const G4int copyNo, const G4VPhysicalVolume*) const
{
G4double halfLength= fHalfLengthFirst + copyNo * fHalfLengthIncr;
trackerChamber.SetXHalfLength(halfLength);
trackerChamber.SetYHalfLength(halfLength);
trackerChamber.SetZHalfLength(fHalfWidth);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,315 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02DetectorConstruction.cc
/// \brief Implementation of the ExN02DetectorConstruction class
//
//
// $Id: ExN02DetectorConstruction.cc 78055 2013-12-03 08:27:48Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02DetectorConstruction.hh"
#include "ExN02DetectorMessenger.hh"
#include "ExN02ChamberParameterisation.hh"
#include "ExN02MagneticField.hh"
#include "ExN02TrackerSD.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "G4SDManager.hh"
#include "G4GeometryTolerance.hh"
#include "G4GeometryManager.hh"
#include "G4UserLimits.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02DetectorConstruction::ExN02DetectorConstruction()
:solidWorld(0), logicWorld(0), physiWorld(0),
solidTarget(0), logicTarget(0), physiTarget(0),
solidTracker(0),logicTracker(0),physiTracker(0),
solidChamber(0),logicChamber(0),physiChamber(0),
TargetMater(0), ChamberMater(0),chamberParam(0),
stepLimit(0), fpMagField(0),
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
NbOfChambers(0) , ChamberWidth(0.), ChamberSpacing(0.)
{
fpMagField = new ExN02MagneticField();
detectorMessenger = new ExN02DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02DetectorConstruction::~ExN02DetectorConstruction()
{
delete fpMagField;
delete stepLimit;
delete chamberParam;
delete detectorMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
{
//--------- Material definition ---------
G4double a, z;
G4double density, temperature, pressure;
G4int nel;
//Air
G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
G4Element* O = new G4Element("Oxygen" , "O", z=8., a= 16.00*g/mole);
G4Material* Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
Air->AddElement(N, 70*perCent);
Air->AddElement(O, 30*perCent);
//Lead
G4Material* Pb =
new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
//Xenon gas
G4Material* Xenon =
new G4Material("XenonGas", z=54., a=131.29*g/mole, density= 5.458*mg/cm3,
kStateGas, temperature= 293.15*kelvin, pressure= 1*atmosphere);
// Print all the materials defined.
//
G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//--------- Sizes of the principal geometrical components (solids) ---------
NbOfChambers = 5;
ChamberWidth = 20*cm;
ChamberSpacing = 80*cm;
fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker
fTargetLength = 5.0 * cm; // Full length of Target
TargetMater = Pb;
ChamberMater = Xenon;
fWorldLength= 1.2 *(fTargetLength+fTrackerLength);
G4double targetSize = 0.5*fTargetLength; // Half length of the Target
G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
//------------------------------
// World
//------------------------------
G4double HalfWorldLength = 0.5*fWorldLength;
G4GeometryManager::GetInstance()->SetWorldMaximumExtent(fWorldLength);
G4cout << "Computed tolerance = "
<< G4GeometryTolerance::GetInstance()->GetSurfaceTolerance()/mm
<< " mm" << G4endl;
solidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength);
logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0);
// Must place the World Physical volume unrotated at (0,0,0).
//
physiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
logicWorld, // its logical volume
"World", // its name
0, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Target
//------------------------------
G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetSize+trackerSize));
solidTarget = new G4Box("target",targetSize,targetSize,targetSize);
logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"Target",0,0,0);
physiTarget = new G4PVPlacement(0, // no rotation
positionTarget, // at (x,y,z)
logicTarget, // its logical volume
"Target", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
G4cout << "Target is " << fTargetLength/cm << " cm of "
<< TargetMater->GetName() << G4endl;
//------------------------------
// Tracker
//------------------------------
G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
solidTracker = new G4Box("tracker",trackerSize,trackerSize,trackerSize);
logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
physiTracker = new G4PVPlacement(0, // no rotation
positionTracker, // at (x,y,z)
logicTracker, // its logical volume
"Tracker", // its name
logicWorld, // its mother volume
false, // no boolean operations
0); // copy number
//------------------------------
// Tracker segments
//------------------------------
//
// An example of Parameterised volumes
// dummy values for G4Box -- modified by parameterised volume
solidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm);
logicChamber = new G4LogicalVolume(solidChamber,ChamberMater,"Chamber",0,0,0);
G4double firstPosition = -trackerSize + 0.5*ChamberWidth;
G4double firstLength = fTrackerLength/10;
G4double lastLength = fTrackerLength;
chamberParam = new ExN02ChamberParameterisation(
NbOfChambers, // NoChambers
firstPosition, // Z of center of first
ChamberSpacing, // Z spacing of centers
ChamberWidth, // Width Chamber
firstLength, // lengthInitial
lastLength); // lengthFinal
// dummy value : kZAxis -- modified by parameterised volume
//
physiChamber = new G4PVParameterised(
"Chamber", // their name
logicChamber, // their logical volume
logicTracker, // Mother logical volume
kZAxis, // Are placed along this axis
NbOfChambers, // Number of chambers
chamberParam); // The parametrisation
G4cout << "There are " << NbOfChambers << " chambers in the tracker region. "
<< "The chambers are " << ChamberWidth/mm << " mm of "
<< ChamberMater->GetName() << "\n The distance between chamber is "
<< ChamberSpacing/cm << " cm" << G4endl;
//------------------------------------------------
// Sensitive detectors
//------------------------------------------------
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String trackerChamberSDname = "ExN02/TrackerChamberSD";
ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname );
SDman->AddNewDetector( aTrackerSD );
logicChamber->SetSensitiveDetector( aTrackerSD );
//--------- Visualization attributes -------------------------------
G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
logicWorld ->SetVisAttributes(BoxVisAtt);
logicTarget ->SetVisAttributes(BoxVisAtt);
logicTracker->SetVisAttributes(BoxVisAtt);
G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
logicChamber->SetVisAttributes(ChamberVisAtt);
//--------- example of User Limits -------------------------------
// below is an example of how to set tracking constraints in a given
// logical volume(see also in N02PhysicsList how to setup the processes
// G4StepLimiter or G4UserSpecialCuts).
// Sets a max Step length in the tracker region, with G4StepLimiter
//
G4double maxStep = 0.5*ChamberWidth;
stepLimit = new G4UserLimits(maxStep);
logicTracker->SetUserLimits(stepLimit);
// Set additional contraints on the track, with G4UserSpecialCuts
//
// G4double maxLength = 2*fTrackerLength, maxTime = 0.1*ns, minEkin = 10*MeV;
// logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
// minEkin));
return physiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02DetectorConstruction::setTargetMaterial(G4String materialName)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
if (pttoMaterial)
{TargetMater = pttoMaterial;
logicTarget->SetMaterial(pttoMaterial);
G4cout << "\n----> The target is " << fTargetLength/cm << " cm of "
<< materialName << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02DetectorConstruction::setChamberMaterial(G4String materialName)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
if (pttoMaterial)
{ChamberMater = pttoMaterial;
logicChamber->SetMaterial(pttoMaterial);
G4cout << "\n----> The chambers are " << ChamberWidth/cm << " cm of "
<< materialName << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02DetectorConstruction::SetMagField(G4double fieldValue)
{
fpMagField->SetMagFieldValue(fieldValue);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02DetectorConstruction::SetMaxStep(G4double maxStep)
{
if ((stepLimit)&&(maxStep>0.)) stepLimit->SetMaxAllowedStep(maxStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,107 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02DetectorMessenger.cc
/// \brief Implementation of the ExN02DetectorMessenger class
//
//
// $Id: ExN02DetectorMessenger.cc 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02DetectorMessenger.hh"
#include "ExN02DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02DetectorMessenger::ExN02DetectorMessenger(ExN02DetectorConstruction* myDet)
:myDetector(myDet)
{
N02Dir = new G4UIdirectory("/N02/");
N02Dir->SetGuidance("UI commands specific to this example.");
detDir = new G4UIdirectory("/N02/det/");
detDir->SetGuidance("detector control.");
TargMatCmd = new G4UIcmdWithAString("/N02/det/setTargetMate",this);
TargMatCmd->SetGuidance("Select Material of the Target.");
TargMatCmd->SetParameterName("choice",false);
TargMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
ChamMatCmd = new G4UIcmdWithAString("/N02/det/setChamberMate",this);
ChamMatCmd->SetGuidance("Select Material of the Target.");
ChamMatCmd->SetParameterName("choice",false);
ChamMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
FieldCmd = new G4UIcmdWithADoubleAndUnit("/N02/det/setField",this);
FieldCmd->SetGuidance("Define magnetic field.");
FieldCmd->SetGuidance("Magnetic field will be in X direction.");
FieldCmd->SetParameterName("Bx",false);
FieldCmd->SetUnitCategory("Magnetic flux density");
FieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
StepMaxCmd = new G4UIcmdWithADoubleAndUnit("/N02/det/stepMax",this);
StepMaxCmd->SetGuidance("Define a step max");
StepMaxCmd->SetParameterName("stepMax",false);
StepMaxCmd->SetUnitCategory("Length");
StepMaxCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02DetectorMessenger::~ExN02DetectorMessenger()
{
delete TargMatCmd;
delete ChamMatCmd;
delete FieldCmd;
delete StepMaxCmd;
delete detDir;
delete N02Dir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == TargMatCmd )
{ myDetector->setTargetMaterial(newValue);}
if( command == ChamMatCmd )
{ myDetector->setChamberMaterial(newValue);}
if( command == FieldCmd )
{ myDetector->SetMagField(FieldCmd->GetNewDoubleValue(newValue));}
if( command == StepMaxCmd )
{ myDetector->SetMaxStep(StepMaxCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02EventAction.cc
/// \brief Implementation of the ExN02EventAction class
//
//
// $Id: ExN02EventAction.cc 78055 2013-12-03 08:27:48Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02EventAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02EventAction::ExN02EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02EventAction::~ExN02EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02EventAction::BeginOfEventAction(const G4Event*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02EventAction::EndOfEventAction(const G4Event* evt)
{
G4int event_id = evt->GetEventID();
// get number of stored trajectories
//
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
// periodic printing
//
if (event_id < 100 || event_id%100 == 0) {
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
G4cout << " " << n_trajectories
<< " trajectories stored in this event." << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02MagneticField.cc
/// \brief Implementation of the ExN02MagneticField class
//
//
// $Id: ExN02MagneticField.cc 66241 2012-12-13 18:34:42Z gunter $
//
// User Field class implementation.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02MagneticField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02MagneticField::ExN02MagneticField()
: G4UniformMagField(G4ThreeVector())
{
GetGlobalFieldManager()->SetDetectorField(this);
GetGlobalFieldManager()->CreateChordFinder(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02MagneticField::ExN02MagneticField(G4ThreeVector fieldVector)
: G4UniformMagField(fieldVector)
{
GetGlobalFieldManager()->SetDetectorField(this);
GetGlobalFieldManager()->CreateChordFinder(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02MagneticField::~ExN02MagneticField()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Set the value of the Global Field to fieldValue along X
//
void ExN02MagneticField::SetMagFieldValue(G4double fieldValue)
{
SetMagFieldValue(G4ThreeVector(fieldValue,0,0));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Set the value of the Global Field
//
void ExN02MagneticField::SetMagFieldValue(G4ThreeVector fieldVector)
{
// Find the Field Manager for the global field
G4FieldManager* fieldMgr= GetGlobalFieldManager();
if(fieldVector!=G4ThreeVector(0.,0.,0.))
{
SetFieldValue(fieldVector);
fieldMgr->SetDetectorField(this);
} else {
// If the new field's value is Zero, then it is best to
// insure that it is not used for propagation.
G4MagneticField* magField = 0;
fieldMgr->SetDetectorField(magField);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4FieldManager* ExN02MagneticField::GetGlobalFieldManager()
{
return G4TransportationManager::GetTransportationManager()->GetFieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,289 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02PhysicsList.cc
/// \brief Implementation of the ExN02PhysicsList class
//
//
// $Id: ExN02PhysicsList.cc 78055 2013-12-03 08:27:48Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02PhysicsList.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02PhysicsList::ExN02PhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 1.0*cm;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02PhysicsList::~ExN02PhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBaryons();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PhysicsList::ConstructLeptons()
{
// leptons
// e+/-
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
// mu+/-
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
// nu_e
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
// nu_mu
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PhysicsList::ConstructMesons()
{
// mesons
// light mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PhysicsList::ConstructBaryons()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructGeneral();
AddStepMax();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4eMultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuMultipleScattering.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hMultipleScattering.hh"
#include "G4hIonisation.hh"
#include "G4hBremsstrahlung.hh"
#include "G4hPairProduction.hh"
#include "G4ionIonisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
// gamma
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
pmanager->AddDiscreteProcess(new G4ComptonScattering);
pmanager->AddDiscreteProcess(new G4GammaConversion);
} else if (particleName == "e-") {
//electron
pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
} else if (particleName == "e+") {
//positron
pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4MuIonisation, -1, 2, 2);
pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3);
pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4);
} else if( particleName == "proton" ||
particleName == "pi-" ||
particleName == "pi+" ) {
//proton
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3);
pmanager->AddProcess(new G4hPairProduction, -1, 4, 4);
} else if( particleName == "alpha" ||
particleName == "He3" ) {
//alpha
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);
} else if( particleName == "GenericIon" ) {
//Ions
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Decay.hh"
void ExN02PhysicsList::ConstructGeneral()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4StepLimiter.hh"
#include "G4UserSpecialCuts.hh"
void ExN02PhysicsList::AddStepMax()
{
// Step limitation seen as a process
G4StepLimiter* stepLimiter = new G4StepLimiter();
////G4UserSpecialCuts* userCuts = new G4UserSpecialCuts();
theParticleIterator->reset();
while ((*theParticleIterator)()){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (particle->GetPDGCharge() != 0.0)
{
pmanager ->AddDiscreteProcess(stepLimiter);
////pmanager ->AddDiscreteProcess(userCuts);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PhysicsList::SetCuts()
{
//G4VUserPhysicsList::SetCutsWithDefault method sets
//the default cut value for all particle types
//
SetCutsWithDefault();
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02PrimaryGeneratorAction.cc
/// \brief Implementation of the ExN02PrimaryGeneratorAction class
//
//
// $Id: ExN02PrimaryGeneratorAction.cc 78055 2013-12-03 08:27:48Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02PrimaryGeneratorAction.hh"
#include "ExN02DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02PrimaryGeneratorAction::ExN02PrimaryGeneratorAction(
ExN02DetectorConstruction* myDC)
:myDetector(myDC)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
// default particle
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition* particle = particleTable->FindParticle("proton");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticleEnergy(3.0*GeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02PrimaryGeneratorAction::~ExN02PrimaryGeneratorAction()
{
delete particleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4double position = -0.5*(myDetector->GetWorldFullLength());
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02RunAction.cc
/// \brief Implementation of the ExN02RunAction class
//
//
// $Id: ExN02RunAction.cc 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02RunAction.hh"
#include "G4Run.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02RunAction::ExN02RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02RunAction::~ExN02RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02RunAction::EndOfRunAction(const G4Run*)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,50 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02SteppingAction.cc
/// \brief Implementation of the ExN02SteppingAction class
//
//
// $Id: ExN02SteppingAction.cc 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02SteppingAction.hh"
#include "G4SteppingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02SteppingAction::ExN02SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02SteppingAction::UserSteppingAction(const G4Step*)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,172 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02SteppingVerbose.cc
/// \brief Implementation of the ExN02SteppingVerbose class
//
//
// $Id: ExN02SteppingVerbose.cc 78055 2013-12-03 08:27:48Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02SteppingVerbose::ExN02SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02SteppingVerbose::~ExN02SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
}
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< " ";
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
G4cout << " "
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << " UserLimit";
}
G4cout << G4endl;
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << "\n :----- List of secondaries ----------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " "
<< std::setw(13)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName()
<< ": energy ="
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< " time ="
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time");
G4cout << G4endl;
}
G4cout << " :------------------------------------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< " ";
if(fTrack->GetNextVolume()){
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
G4cout << " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02TrackerHit.cc
/// \brief Implementation of the ExN02TrackerHit class
//
//
// $Id: ExN02TrackerHit.cc 78055 2013-12-03 08:27:48Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02TrackerHit.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
G4Allocator<ExN02TrackerHit> ExN02TrackerHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02TrackerHit::ExN02TrackerHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02TrackerHit::~ExN02TrackerHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02TrackerHit::ExN02TrackerHit(const ExN02TrackerHit& right)
: G4VHit()
{
trackID = right.trackID;
chamberNb = right.chamberNb;
edep = right.edep;
pos = right.pos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const ExN02TrackerHit& ExN02TrackerHit::operator=(const ExN02TrackerHit& right)
{
trackID = right.trackID;
chamberNb = right.chamberNb;
edep = right.edep;
pos = right.pos;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int ExN02TrackerHit::operator==(const ExN02TrackerHit& right) const
{
return (this==&right) ? 1 : 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02TrackerHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4Circle circle(pos);
circle.SetScreenSize(2.);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,0.,0.);
G4VisAttributes attribs(colour);
circle.SetVisAttributes(attribs);
pVVisManager->Draw(circle);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02TrackerHit::Print()
{
G4cout << " trackID: " << trackID << " chamberNb: " << chamberNb
<< " energy deposit: " << G4BestUnit(edep,"Energy")
<< " position: " << G4BestUnit(pos,"Length") << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file parallel/ParN02/src/ExN02TrackerSD.cc
/// \brief Implementation of the ExN02TrackerSD class
//
//
// $Id: ExN02TrackerSD.cc 66241 2012-12-13 18:34:42Z gunter $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN02TrackerSD.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02TrackerSD::ExN02TrackerSD(G4String name)
:G4VSensitiveDetector(name)
{
G4String HCname;
collectionName.insert(HCname="trackerCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN02TrackerSD::~ExN02TrackerSD(){ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02TrackerSD::Initialize(G4HCofThisEvent* HCE)
{
trackerCollection = new ExN02TrackerHitsCollection
(SensitiveDetectorName,collectionName[0]);
static G4int HCID = -1;
if(HCID<0)
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
HCE->AddHitsCollection( HCID, trackerCollection );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool ExN02TrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return false;
ExN02TrackerHit* newHit = new ExN02TrackerHit();
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchableHandle()
->GetCopyNumber());
newHit->SetEdep (edep);
newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
trackerCollection->insert( newHit );
//newHit->Print();
//newHit->Draw();
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN02TrackerSD::EndOfEvent(G4HCofThisEvent*)
{
if (verboseLevel>0) {
G4int NbHits = trackerCollection->entries();
G4cout << "\n-------->Hits Collection: in this event they are " << NbHits
<< " hits in the tracker chambers: " << G4endl;
for (G4int i=0;i<NbHits;i++) (*trackerCollection)[i]->Print();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,260 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: ParRunManager.cc 78055 2013-12-03 08:27:48Z gcosmo $
//
/// \file parallel/ParN02/src/ParRunManager.cc
/// \brief Implementation of the ParRunManager class
//
#ifdef G4USE_TOPC
#include "G4Timer.hh"
#include "G4RunManager.hh"
#include "Randomize.hh"
#include "G4Run.hh"
#include "G4RunMessenger.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4VUserPhysicsList.hh"
#include "G4UserRunAction.hh"
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4GeometryManager.hh"
#include "G4SDManager.hh"
#include "G4TransportationManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ApplicationState.hh"
#include "G4StateManager.hh"
#include "G4VPersistencyManager.hh"
#include "G4UImanager.hh"
#include "G4ParticleTable.hh"
#include "G4ProcessTable.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "ParRunManager.hh"
//include file for marshaling structures
#include "MarshaledG4HCofThisEvent.h"
#include "G4ios.hh"
#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
* the data and using the 3 static member functions to point to the corresponding
* functions of the singleton class instance.
*/
G4StateManager* ParRunManager::stateManager;
G4int ParRunManager::n_event;
G4int ParRunManager::n_select;
G4String ParRunManager::msg;
ParRunManager* ParRunManager::myRunManager = 0;
//cross-context variables
static long* g_Seeds;
// TOP-C callbacks functions
TOPC_BUF ParRunManager::MyDoEvent( void *input_buf ) {
return myRunManager->DoEvent(input_buf);
}
TOPC_ACTION ParRunManager::MyCheckEventResult( void * input_buf, void *buf ) {
return myRunManager->CheckEventResult(input_buf, buf);
}
static void trace_event_input( void */*input*/ ) {
//G4cout << "Event " << *(G4int *)input << G4endl;
}
/*
* DoEventLoop is the most important piece in RunManager class to control the program runs,
* this is where we embed the TopC parallelism callbacks.
*/
void ParRunManager::DoEventLoop( G4int n_event, const char* macroFile, G4int n_select )
{
TOPC_OPT_trace_input = trace_event_input;
G4StateManager* stateManager = G4StateManager::GetStateManager();
#ifdef G4_ORIGINAL
cout << "ParRunManager::DoEventLoop" << endl;
G4RunManager::DoEventLoop(n_event, macroFile, n_select);
return;
#endif
if(verboseLevel>0)
{ timer->Start(); }
G4String msg;
if(macroFile!=0)
{
if(n_select<0) n_select = n_event;
msg = "/control/execute ";
msg += macroFile;
}
else
{ n_select = -1; }
// BeginOfEventAction() and EndOfEventAction() would normally be
// called inside G4EventManager::ProcessOneEvent() in ParRunManager::DoEvent
// on slave. Since this is often where hits are collected and where
// histogram data is first stored, must do it
// on master instead, to process hits. So, set user event action to NULL.
// Keep private copy, and execute it in CheckTaskResult().
// If user later does: SetUserAction( (G4UserEventAction *)NULL );
// we won't notice and copy it to origUserEventAction.
if ( eventManager->GetUserEventAction() ) {
origUserEventAction = eventManager->GetUserEventAction();
SetUserAction( (G4UserEventAction *)0 );
}
// Make these variables accessible to TOP-C callback functions
ImportDoEventLoopLocals( stateManager, n_event, n_select, msg );
// Setup random seeds for each slave
g_Seeds = (long*)calloc(n_event, sizeof(long));
for(G4int i_event=0; i_event<n_event; i_event++ )
{
g_Seeds[i_event] = (long) (100000000L * HepRandom::getTheGenerator()->flat());
}
// This is where all the parallelism occurs
TOPC_raw_begin_master_slave(MyDoEvent, MyCheckEventResult, NULL);
if(TOPC_is_master()){
for(G4int i_event=0; i_event<n_event; i_event++ )
{
TOPC_raw_submit_task_input(TOPC_MSG( &i_event, sizeof(G4int)));
if (runAborted) break;
}
}
TOPC_raw_end_master_slave();
free(g_Seeds);
if ( verboseLevel > 0 ) {
timer->Stop();
G4cout << "Run terminated." << G4endl;
G4cout << "Run Summary" << G4endl;
if ( runAborted ) {
G4cout << " Run Aborted." << G4endl;
} else {
G4cout << " Number of events processed : " << n_event << G4endl;
}
G4cout << " " << *timer << G4endl;
}
}
static MarshaledG4HCofThisEvent *aMarshaledObj = NULL;
TOPC_BUF ParRunManager::DoEvent( void *input_buf )
{
static
G4int i_event;
memcpy(&i_event, input_buf, sizeof(G4int));
HepRandom::setTheSeed(g_Seeds[i_event]);
// removed for Geant4.6
// stateManager->SetNewState(G4State_EventProc);
currentEvent = GenerateEvent(i_event);
eventManager->ProcessOneEvent(currentEvent);
G4HCofThisEvent* HCE = currentEvent->GetHCofThisEvent();
if(aMarshaledObj) delete aMarshaledObj;
aMarshaledObj = new MarshaledG4HCofThisEvent(HCE);
// 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;
memcpy(&i_event, input_buf, sizeof(G4int));
// removed for Geant4.6
//stateManager->SetNewState(G4State_EventProc);
// Geant4 6.0 requires the state to be G4State_GeomClosed
// before calling EventManager::ProcessOneEvent(..)
if ( !userPrimaryGeneratorAction ) {
G4Exception("ParRunManager::CheckEventResult", "InvalidSetup",
FatalException,
"G4VUserPrimaryGeneratorAction is not defined.");
}
//This creates a trivial event in lieu of GenerateEvent(i_event);
currentEvent = new G4Event( i_event );
//
SetUserAction( (G4UserEventAction *)0 );
// When Geant4 4.0 sees empty event, it still calls userStackingAction.
// On master, only trivial events exist, so we delete userStackingAction
SetUserAction( (G4UserStackingAction*)0 );
eventManager->ProcessOneEvent( currentEvent ); // Processing the trivial event
// Called with output_buf and no size, creates object for unmarshaling
// using marshalgen
MarshaledG4HCofThisEvent marshaledObj( output_buf );
G4HCofThisEvent* oldCE = currentEvent->GetHCofThisEvent();
G4HCofThisEvent* HCE = new G4HCofThisEvent(oldCE->GetNumberOfCollections());
marshaledObj.unmarshalTo(HCE);
if(oldCE) delete(oldCE);
currentEvent->SetHCofThisEvent(HCE);
// Original UserEventAction was saved and set to NULL. Do it now on master.
HepRandom::setTheSeed(g_Seeds[i_event]);
if ( origUserEventAction )
origUserEventAction->BeginOfEventAction( currentEvent );
if ( origUserEventAction )
origUserEventAction->EndOfEventAction( currentEvent );
AnalyzeEvent(currentEvent);
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);
currentEvent = 0;
return NO_ACTION;
}
#endif /* G4USE_TOPC */