Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
+530
View File
@@ -0,0 +1,530 @@
Geant4 3.0 Release Notes
------------------------
15th December 2000
These are the main new features/fixes included in this release (for the
detailed list of fixes/additions, please refer to the related History files):
o Analysis
--------
- New module for analysis/histogramming management and concrete
drivers interfaces through AIDA: JAS, Lizard, OpenScientist.
o Configuration:
-------------
- Added unsupported configuration WIN32-g++
for Windows/NT/9X and Cygwin with g++ compiler.
- Introduced changes to handle analysis module.
- Incorporated building of shared libraries into .gmk files
(NOTE: tests on shared libraries currently perfomed only on
Linux-g++ and SUN-CC platforms)
o Introduced new variables steering the building of shared/static
libraries (static still default): G4LIB_BUILD_SHARED and
G4LIB_BUILD_STATIC.
o Introduced new variable (G4LIB_USE_GRANULAR) to force using of
granular libraries.
- Added rules for "includes" gmake target, to copy all header files
in a single location specified by $G4INCLUDE path.
- Introduced SUN-CC5 G4SYSTEM architecture for SUN CC 5.1 compiler.
o Event:
-----
- Added new Set methods to G4PrimaryVertex and G4PrimaryParticle.
- Introduced ParticleGun for Ions and weights for primary vertex
and particle:
o G4ParticleGun: added Set/GetParticleCharge methods for ions.
o G4ParticleGunMessenger: added new command of /gun/ion;
modified command of /gun/particle.
o G4PrimaryParticle: add Set/GetCharge methods, added weight.
o G4PrimaryVertex: added weight.
o G4PrimaryTransformer: use G4PrimaryParticle::GetCharge to give
dynamic charge in G4DynamicParticle; set weight of G4Track.
- Introduced G4GeneralParticleSource and related classes.
G4GeneralParticleSource is an alternative primary source
generator to G4ParticleGun. It has all the functions of
G4ParticleGun plus many options for specifying the primary
event particle and vertex.
o Electromagnetic Processes (Low-energy):
--------------------------------------
- Bug fix to G4hLowEnergyIonisation, relevant for particles
with absolute charge value greater than 1.
- Bug fix on electron energy loss fluctuations.
- New features on antiproton ionisation, extending the model for
application to generic materials.
- Modifications in hadron classes (renaming of classes).
- Bug fix related to the charge dependence of ion fluctuations.
- Fixes to G4LowEnergyUtilities to replace the obsolete HepString
with G4String.
- Bug fixes for problems found on setting cuts.
- Bug fix for nuclear stopping table name, improvements in
code quality and added comments for the Software Reference Manual.
o Electromagnetic Processes (Standard):
------------------------------------
- G4eBremsstrahlung : new cross section and energy-loss parametrisation.
- Update to G4VhEnergyLoss.cc, G4VhEnergyLoss.hh, G4hIonisation.cc
in order to simulate energy losses of ions; correction to cross
section for particles with spin 1.
- Removed class G4ionIonisation.
- Fix in G4VhEnergyLoss and G4ionIonisation in AlongStepDoIt
for particles with Charge^2 > 1.
- Stopped very low energy photons in photo electric effect.
- Moved ElossMessenger to G4VEnergyLoss.
- Bug fix in G4Cerenkov and G4Scintillation: corrected usage of
the 'step length' to position the origins of secondaries.
- Corrections on Polarized Compton:
o Sampling of Phi
o Depolarization probability
- G4IeBremsstrahlung:
o new cross section/en.loss parametrisation, LPM flag.
o corrections in the LPM implementation.
- Changed signature in GetLossWithFluct.
- G4EnergyLossMessenger: created subdirectory /process/eLoss.
Added class description for Software Reference Manual.
- EnergyLossTable: use "const G4Material*" where required.
- Introduced correction to G4Cerenkov to fix a problem when
an optical medium has refraction indices all equal to 1.
o General Processes, Parameterisation, Decay, Optical:
---------------------------------------------------
- Bug fix in G4Decay to avoid direct modification of G4Track by
the Decay process.
- Fixed bugs in G4ProcTblElement::operator=
- Removed destruction of processes in G4ProcessTable destructor.
- Implemented full STL migration in G4ProcessVector.
- Added thePILfactor and GPIL methods in G4VProcess.
- Added Store/RetrievePhysicsTable() methods.
o Geometry:
--------
QA code cleanup. Cleanup warnings issued by "-Wall -ansi -pedantic"
g++ compiler options.
- Boolean solids:
o G4SubtractionSolid.cc: relaxed behavior in SurfaceNormal(p),
where it is now allowed for a point to be inside the solid.
A message is thrown to cerr instead of a G4Exception.
o Added new set methods for matrix/vectors to G4DisplacedSolid:
SetTransform(G4AffineTransform&),
SetDirectTransform(G4AffineTransform&),
SetFrameRotation(const G4RotationMatrix&),
SetFrameTranslation(const G4ThreeVector&),
SetObjectRotation(const G4RotationMatrix&),
SetObjectTranslation(const G4ThreeVector&).
- BREPS solids:
o Fix in G4Ellipse::Project() for computation of u as function
of atan2().
o Changed return value to be "const" pointer to functions:
- G4BREPSolid::GetPlace()
- G4BREPSolid::GetBBox()
o G4Assembly: fix in destructor, added call to clearAndDestroy().
o G4BREPSolid: changed method NumberOfFaces() to GetNumberOfFaces().
o G4Curve: fixed obsolete workaround for XlC compiler.
o G4OsloMatrix: changed internal class "Matrix" to "G4PointMatrix"
and updated classes making use of it.
o G4ThreeMat:removed unused overloaded operators =, +, -, +=, -=, *.
- CSG solids
o Fix to G4Tubs and G4Cons in DistanceToIn/DistanceToOut:
+ fixes to DistanceToOut(p,v,...) to make roots of quadratic
equations more stable.
+ added check against negative distance returned.
o Fixes to G4Cons:
+ corrected condition on conical surface to consider a real
projection of the conical surface thickness on XY plane
(0.5*kCarTolerance*secRMin instead of 0.5*kCarTolerance),
when dealing with cons with large opening angle.
+ fix in constructor to check if one of the Rmin different than 0,
to avoid degenerated cones.
o G4Torus: introduced Newton-based numerical method for computing
roots of equations in DistanceToIn() and DistanceToOut().
o Bug fixed in G4Tubs::Inside(p) for analysis of phi positioning
when on +-fDz surface.
o Fix in G4Tubs::DistanceToOut(p,v,...): initialised sr and sphi to
kInfinity and re-introduced additional condition on check for
Rmin intersection (t2 >= 0).
- Specific solids:
o Fix in G4IntersectingCone.cc: the check for a zero radical has been
adjusted to be less sensitive to round off error in LineHitsCone1(),
LineHitsCone2().
- STEP
o dirobj.h: protected from missing definition of MAXNAMLEN, S_IFMT
and S_IFDIR originally defined in /usr/include/sys/stat.h.
- STEPinterface
o Added GetInstanceManager() method to G4GeometryCreator.
o Changed return value to "const char*" to method Name() and made
post-const in all creator classes.
o Fix in G4Axis2Placement3dCreator::CreateSTEPGeometry(void*).
- Magnetic Field
o Fix in G4FieldManager: added check on existence of allocated
fChordFinder in CreateChordFinder(G4MagneticField*) method.
o Changed return value to be "const" pointer to functions:
+ G4EquationOfMotion::GetFieldObj()
+ G4FieldManager::GetDetectorField()
+ G4MagIntegratorDriver::GetStepper()
o Fixed and corrected signature to G4MagIntegratorDriver::SetHmin().
- Management
o Fixed bug in destructor of G4SolidStore. Memory corruption at
application exit was occuring when Boolean solids were involved.
o Fix in G4VSolid::CalculateClippedPoligonExtent():
removed assumption that pMin<pMax by eliminating "else"
condition.
- Volumes
o Changed return value to be "const" pointer to functions:
- G4LogicalBorderSurface::GetVolume1()
- G4LogicalBorderSurface::GetVolume2()
- G4LogicalSkinSurface::GetLogicalVolume()
o Global:
------
- Moved G4VStateDependent and G4StateManager classes into
global/management from intercoms.
- Added "Abort" state is added G4ApplicationState.
- Modified G4Exception to change Geant4 status to "Abort".
- Bug fix of "double deleting" in the destructor of G4StateManager.
- Defined G4RandGauss to invoke CLHEP's RandGaussQ,
needed to fix general events' reproducibility problem.
- Added STL wrapper for in management/include/g4std.
- QA code cleanup from Code-Wizard and warnings issued by
"-Wall -ansi -pedantic" g++ compiler options.
o Hadronic Processes:
------------------
- General update of source code documentation.
- management
o Introduced the possibility for cross-section biasing.
- util
o Added G4Pair class as utility (to be replaced with stl in due course)
o Added protection to G4ReactionDynamics in case no secondary has been
created.
- high_energy
o Fixed bug causing energy non-conservation in pion interactions.
o Code cleanup.
- neutron_hp
o Added several protections against non-physical cross-section values
removed 'const' in operator+ of G4NeutronHPVector to work around
compiler inconsistencies.
o Removed 'const' in GetXsec(G4int i) of G4NeutronHPVector to work
around compiler inconsistencies.
o Introduced self-hashing has table to optimize initialization and
run-time performance (factor 4 in init, 2 at run-time)
o Introduced correct treatment of compound cross-sections
full event by event correlations in Capture below 100 keV regardless
the data quality
o Correction of a Q-value miscalculation in exceptional conditions in
Capture
o Added Protections in case no photon energies given in the capture
data.
o Fixed error in accessing gamma level 49 in n->ngamma inelastic channel
o Added recoil production to several inelastic channels
o Added protections in cases interpolations between expansions in terms
of legendre polynomials lead to non-physical cross-section integrals.
- radiative_decay
o Fix to const-ness of G4DynamicParticle to co-work with latest changes
in 'track' module.
o Code correction in integration of Fermi beta functions.
- diffractive_string
o Updated sampling of impact parameter for re-use.
- kinetic_model
o Fixed a memory leak
o Added protection in case to pre-compound phase was registered
- management(gen)
o Added impact parameter sampling possibility to G4V3DNucleus.
- quark_gluon_string
o Fixed memory leak in G4SPBaryon and G4SPBaryonTable
o Introduced improved of low energy cut-off for string creation
o Updated sampling of impact parameter for re-use
- string_fragmentation
o Design iteration to allow for use of quark molecular dynamics.
- util
o Updated G4Parton to allow for use of quark molecular dynamics.
o Bug-fix in Lorentz boost in G4Fancy3DNucleus
o Added protection of G4Fragment against negative excitation energies
o Fixed memory leaks in G4KinetiTrack
- pre_equilibrium
o Design iteration
o Update of barrier penetration factors
- string_common
o Design iteration to allow for usage of quark molecular dynamics.
NOTE: the consistent data sets for photon evaporation and radio-active
decay (derived from the same version of the ENSDF data) are
provided from Web in the source download area. A previous version
of photon evaporation data is also provided.
o Interfaces:
----------
- Modified G4UIterminal, G4VUIshell, G4UIcsh and G4UItcsh to display
the break status as a prompt characters.
- Minor fixes in G4VInteractorManager and G4VUIShell.
o Materials:
---------
- Fixed initialization of pointers in G4SandiaTable constructor
and corrected deletion of fPhotoAbsorptionCof in destructor.
o Parameterisations
-----------------
- New top category for specific parameterisation models:
G4FoamXrayTRmodel, G4GamDistrXrayTRmodel, G4IrregularXrayTRmodel,
G4PAIclusterModel, G4PhotoClusterModel, G4PlateIrrGasXrayTRmodel,
G4RegularXrayTRmodel, G4VClusterModel, G4VXrayTRmodel.
o Particles:
---------
- Added const to G4DynamicParticle::GetPreAssignedDecayProducts.
- Added method G4IonTable::GetElementNumber.
- Added neutron life time.
- Fixed stable flag for G4PionMinus.
o Run and Intercoms:
-----------------
- Modified G4RunManager and G4RunMessenger: eliminated
G4StateManager::Pause().
- Made G4UImanager state dependent.
- Added Retrieve/StorePhysicsTable() and related methods in
G4VUserPhysicsList and modified BuildPhysicsTable() method.
- Added store/retreivePhysicsTable command in
G4UserPhysicsListMessenger.
- Moved default place for storing random number status out of main
directory.
- Added G4VModularPhysicsList and G4VPhysicsConstructor
to modularize UserPhysicsList.
- Fixed bug in G4VUserPhysicsList::StorePhysicsTable().
o Tracking & Track:
----------------
- Added protection when PiMinusAbsorptionAtRest and Decay processes
are deactivated.
- Bug fixes in copy constructor of G4ParticleChange.
- Added "const" to G4DynamicParticle pointer of returned value of
G4Track::GetDynamicParticle
o Visualization:
-------------
- Fixed bug in /vis/lights/direction to not refresh view.
- G4PhysicalVolumeModel: added protection against volumes without
material.
- Removed /vis/viewer/update from compound commands /vis/drawVolume
and /vis/specify.
o G4toG4 Tool:
-----------
- Moved tests clGeometry and cltog4 from source/g3tog4/test to
examples/extended/g3tog4. Default build mechanism is now used.
- Bug-fix in destructor for G3RotTable.
- Added handling of ELTU (Elliptical Tube) solid.
- Fixed initialisation of pDPhi for CONS in G3toG4MakeSolid.cc.
- G4PhysicalVolumeModel: added protection against volumes without
material.
- Added protection against multiple positiong of the same physical
volume and added methods ClearG3PosCopy(G4int) and ClearDivision()
in G3VolTableEntry .
- Removed useless G3toG4Debug global method and file.
Replaced verbosity by G3G4DEBUG flag.
- Removed obsolete class/files G3CalcParams[.hh.cc].
- Examples:
--------
o New "advanced" examples for specific applications:
xray_telescope, brachyterapy and gammaray_telescope.
Notes:
o Geant4 3.0 is based on STL and can be installed with strict
ISO/ANSI C++ compliant setup or not. See notes below.
The code and some binary libraries are available through our "Source
Code" Web page:
- see our <A href="http://cern.ch/geant4">Geant4 Home Page</A>.
Please refer to <A
href="http://cern.ch/geant4/G4UsersDocuments/Overview/html/index.html">Geant4
User Documentation</A> for further information about using Geant4.
Updates to the documentation for Geant4 3.0 are expected to be published as
usual within three weeks from the release date.
Contents
--------
1. Supported and Tested Platforms
2. ANAPHE and CLHEP
3. The Standard Template Library (STL)
4. Persistency
5. Compiler Specific Problems
6. Known Run-Time Problems
7. Compilation Warnings
8. Known Run-Time Warnings
1. Supported and Tested Platforms
---------------------------------
o SUN Solaris 5.6/5.7, C++ 4.2 Patch 104631-04, C++ 5.1 Patch 109490-01.
o HP 10.20, aCC C++ B3910B A.01.23
o Linux 2.2.12-20, gcc C++ egcs-2.91.66 (egcs 1.1.2).
This configuration was tested with the RedHat 6.1 distribution, but
versions of Geant4 have also been compiled successfully on Debian
and Suse distributions.
o NT 4.0 with Service Pack 4 and Cygnus Tools b20 with:
Visual C++ 6.0 Service Pack 2
Platforms also tested but giving rise to some problems - see below:
o DEC V4.0, cxx C++ V6.1-027.
Platforms configured but not tested and not supported:
o SGI V6.5.5, CC 7.2.1 with ObjectSpace
o AIX 4.3.2, xlC compiler with ObjectSpace
2. ANAPHE and CLHEP
-------------------
Geant4 3.0 requires the installation of CLHEP.
See <A href="http://wwwinfo.cern.ch/asd/lhc++/INSTALLATION/clhep.html">
CLHEP</A>. Tests have been performed with CLHEP 1.6.0.0.
By default, the CLHEP installation scripts will activate ISO/ANSI C++ features
if the compiler is capable. You need to explicitly disable CLHEP settings in
case you wish non-ISO/ANSI setup on specific compilers (for example, DEC).
Geant4 3.0 coworks with ANAPHE 3.2.0 and components included therein:
Objectivity 5.2.1
ObjectSpace 2.1
HepODBMS 0.3.1.4
CLHEP 1.6.0.0
For more information about ANAPHE 3.2.0, see:
<A href="http://wwwinfo.cern.ch/asd/lhc++/release/3.2.0/3.2.0.html">ANAPHE 3.2.0</A>
3. The Standard Template Library
--------------------------------
The following versions of STL have been tested:
ObjectSpace STL on
DEC, HP and SUN (CC 4.2).
See <A href="http://www.objectspace.com/">ObjectSpace</A>.
"Native" STL on: Windows/NT, Linux, HP, DEC and SUN (CC 5.1).
This is selected at installation/compile time by the environment variable
G4USE_OSPACE in the case of the former - see documentation.
NOTES:
- Be aware that by default, the installation scripts will expect to use
the native STL implementation. You must set the G4USE_OSPACE variable
in the environment in order to select the ObjectSpace implementation.
- Platform specific setup:
o DEC: ObjectSpace is required in non ISO/ANSI setup.
Native STL is required for ISO/ANSI setup.
o HP: either ObjectSpace or native STL can be used (non ISO/ANSI setup).
o SUN: ObjectSpace is required in non ISO/ANSI setup (CC 4.2).
Native STL is required for ISO/ANSI setup (CC 5.1 only).
o Linux: Native STL is required (non ISO/ANSI setup).
o NT: Native STL and ISO/ANSI setup required.
In the interest of stability, part of the code in Geant4 3.0 still makes use
of the "STL Interface" wrapper classes, used for allowing the migration from
Rogue Wave Tools.h++ container library. For these the emphasis has remained
on correct behaviour, rather than performance.
4. Persistency
--------------
Platform
--------
Persistency in Geant4 3.0 release is tested on the following
platforms:
G4SYSTEM OS C++ compiler HepODBMS Objectivity
--------- ----------- ------------ --------- -----------
SUN-CC SunOS 5.6 CC 4.2 0.3.1.4 5.2.1
SUN-CC5 SunOS 5.7 CC 6.0 0.3.2.3 (*) 6.0 (*)
Linux-g++ RedHat 6.1 egcs-2.91.66 0.3.1.4 5.2.1
(*) HepODBMS header files must be prepared with "ooddlx -noline" option.
See below.
Known Problems
--------------
- There are several warning messages on some platforms during the
installation of the libraries and the compilation of the examples.
Most of them can be safely ignored. It is annoying but hard to get
rid of them due to various reasons.
- A warning message "Could not find naming root directory" appears at
runtime of the persistency examples. It is generaged by HepDbApplication
in HepODBMS. It can be ignored.
- On Solaris7 (SUN-CC5), persistent header files has to be generated by
ooddlx with "-noline" option to work around a bug in C++ compiler.
This workaround applies not only to Geant4 Persistency category but
also to HepODBMS, and the user defined ddl files as well. This option
removes the "#line" directive of the file name and the line number of
the original ddl file. As a consequences, C++ compiler no longer
"tell" the correct file name and the line number of the ddl file if
compiler error occurs. Try to identify the compiler error by first
looking into the header file generated by ooddlx, and then locate the
source of the problem by looking into the ddl file.
A patch to the compiler is expected from Sun.
5. Compiler Specific Problems
-----------------------------
o DEC V4.0, cxx C++ V6.1-027.
- We have found cases of mis-compilation of min and max templates
on DEC. We have traced those which cause serious malfunction
but there is no guarantee that there are no other cases.
Detailed inspection of assembler output suggests that this
problem might not be confined to min and max. This has been
reported to DEC/Compaq. We understand a new version 6.2 of the
compiler is now available. However we cannot guarantee correct
execution of Geant4 on DEC with the current version of the
compiler.
- A bug in cin.getline() system function causes an anomalous
behavior when running in interactive-mode on DEC-cxx 6.1 in
ISO/ANSI mode. We tested the bug has been fixed in more recent
versions of the compiler.
6. Known Run-Time Problems and Limitations
------------------------------------------
For a complete list of outstanding run-time problems and to submit any
problem you may find running this version of Geant4, please refer to the
Geant4 Problem Reporting System, available on the Web at this address:
http://wwwinfo.cern.ch/asd/cgi-bin/geant4/problemreport
7. Compilation Warnings
-----------------------
There are compilation warnings on some platforms. We do not believe
that any will lead to incorrect run-time behaviour, but we are working
on reducing them.
8. Known Run-Time Warnings
--------------------------
The following messages can be written to error output while tracking. We
believe none give rise to incorrect behaviour.
o G4PropagateInField: Warning: Particle is looping
- tracking in field will be stopped.
It has performed 10000 steps in Field while a maximum of 10000
are allowed.
+7 -1
View File
@@ -1,4 +1,4 @@
# $Id: G4UI_USE.gmk,v 1.1 1999/01/07 15:58:31 gunter Exp $
# $Id: G4UI_USE.gmk,v 1.2 2000/11/21 10:15:22 maire Exp $
# -------------------------------------------------------------
# GNUmakefile for CPPFLAGS for interfaces USE phase.
# John Allison, 6th July 1998.
@@ -17,6 +17,12 @@ ifdef G4UI_USE_TERMINAL
CPPFLAGS += -DG4UI_USE_TERMINAL
endif
ifdef G4UI_USE_TCSH
G4UI_USE = 1
G4UI_USE_BASIC = 1
CPPFLAGS += -DG4UI_USE_TCSH
endif
ifdef G4UI_USE_XM
G4UI_USE = 1
G4UI_USE_BASIC = 1
+99 -2
View File
@@ -1,5 +1,5 @@
$Id: History,v 1.105 2000/05/23 06:48:25 gcosmo Exp $
$Name: geant4-02-00 $
$Id: History,v 1.129 2000/12/13 09:19:56 gcosmo Exp $
$Name: geant4-03-00 $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,103 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13th December 2000 Gunter Folger (config-V02-00-14)
- common.gmk: fix to rule for building dependencies, parsing is skip
if $(dependencies) is empty.
- globlib.gmk: added "includes" to PHONY target list and fixed typo.
- Added comments to "includes" rules.
8th December 2000 Gabriele Cosmo (config-V02-00-13)
- Changed G4LIB_BUILD_ARCHIVE to G4LIB_BUILD_STATIC in architecture.gmk,
common.gmk and globlib.gmk.
7th December 2000 Gabriele Cosmo (config-V02-00-12)
- Added options to SUN-CC5.gmk to handle multithreading and persistency.
5th December 2000 Youhei Morita (config-V02-00-11)
- Introduced GPPFLAGS to set -M or -MM according to G4ODBMS.
5th December 2000 Gabriele Cosmo (config-V02-00-10)
- Restored -MM option to g++ for making dependencies. -M was introduced in
tag config-V02-00-02 to allow dependency search on system headers as well
(#include<...> statements). This however introduces serious clashes with
Objectivity schema generation for the persistency module.
4th December 2000 Gunter Folger (config-V02-00-09)
- Disable G4RUNPATHOPTION (internal variable) for all but SUN. This is/will
be used when linking with G4 shared libraries to store the path to these
libraries in the executable.
1st December 2000 Gabriele Cosmo (config-V02-00-08)
- Added G4UI_USE_TCSH and related settings to G4UI_USE.gmk (M.Maire).
- Merged SUN-CC6.gmk to SUN-CC5.gmk and removed SUN-CC6.gmk.
1st December 2000 Gunter Folger (config-V02-00-07)
- Change -M to -M -MG in common.gmk, binmake.gmk. This will output a "correct"
dependency file even when missing header files are missing. Correct in the
sense that liblist will work, and that the missing header is supposed to be
(made) in the source directory.
17th November 2000 Gunter Folger (config-V02-00-06)
- Link with CLHEP using -L/-l instead of absolute filename; this allows
to link with shared lib of Anaphe, or static lib of Geant4.
- Added shared-lib settings to sys configurations.
14th November 2000 Gabriele Cosmo (config-V02-00-05)
- Added reference to new "parameterisations" top category.
Modified files: binmake.gmk.
- Removed makeshlib.sh script, now obsolete.
7th November 2000 Guy Barrand
- analysis.gmk : renamed OpenScientist things to "Lab" ;
Lab is the concrete package where analysis is done.
3rd November 2000 Gunter Folger (config-V02-00-04)
- common.gmk: fix for shared-library build.
- common.gmk, globlib.gmk: added rules for "includes" gmake target.
- architecture.gmk: introduced new user settable variable G4INCLUDE
to specify path where headers (files or symbolic-links) should be installed.
1st November 2000 Guy Barrand
- analysis.gmk: declared Lizard.
24th October 2000 Gunter Folger (config-V02-00-03)
- architecture.gmk, common.gmk, globlib.gmk, sys/*:
o merged building shared libraries into makefiles.
The MAKESHLIB script is no longer used.
- Introduced new variables steering the building of archive/shared libs:
G4LIB_BUILD_SHARED
G4LIB_BUILD_ARCHIVE (still default)
note that G4MAKESHLIB set will internally set G4LIB_BUILD_SHARED for
backwards compatiblity.
- Introduced new variable (G4LIB_USE_GRANULAR) to force using of granular
libraries, even when libG4global.a/.so exists.
14th September 2000 Guy Barrand
- Introduced changes to handle analysis module.
o added analysis.gmk.
o sys/Linux-g++.gmk: added macro DLDLIBS for library dynamic loading.
o binmake.gmk: added inclusion of analysis.gmk.
o binmake.gmk: place LDLIBS3 += $(ANALYSISLIBS) after LDLIBS3 += $(INTYLIBS).
22nd August 2000 John Allison (config-V02-00-02)
- Changed -MM to -M in dependency file making in binmake.gmk and common.gmk.
This causes dependencies of both #include "..." and #include <...> to be
followed. This is the safer option, since some users might/should use,
e.g., #include <g4std/...>, but even these files change sometime.
22nd August 2000 Gunter Folger
- globlib.gmk: fix for protection from infinite loops when a dir does
not exist (G.Folger).
1st August 2000 Gabriele Cosmo (config-V02-00-01)
- Added setup WIN32-g++ for Windows/NT/9X with Cygwin and g++ compiler.
Configuration non officially supported (courtesy of S.Agostinelli and
IST group, Genova).
24th July 2000 Gabriele Cosmo (config-V02-00-00)
- Added path to g3tog4 for global libs.
23rd May 2000 John Allison (config-V01-01-04)
- Added -I$(G4BASE)/processes/hadronic/models/radiative_decay/include to
binmake.gmk.
+152
View File
@@ -0,0 +1,152 @@
# Guy Barrand, 20th Mai 2000
#
# Analysis variables...
#
# -----------------------------------
ifdef G4ANALYSIS_USE
CPPFLAGS += -DG4ANALYSIS_USE
G4ANALYSIS_BUILD = 1
endif
ifdef G4ANALYSIS_BUILD
CPPFLAGS += -DG4ANALYSIS_BUILD
INC_ANALYSIS = 1
LIB_ANALYSIS = 1
endif
# ------------- Lab -----------------
ifdef G4ANALYSIS_USE_LAB
CPPFLAGS += -DG4ANALYSIS_USE_LAB
CPPFLAGS += -DG4ANALYSIS_USE
G4ANALYSIS_BUILD_LAB = 1
endif
ifdef G4ANALYSIS_BUILD_LAB
CPPFLAGS += -DG4ANALYSIS_BUILD
CPPFLAGS += -DG4ANALYSIS_BUILD_LAB
INC_ANALYSIS = 1
LIB_ANALYSIS = 1
INC_LAB = 1
LIB_LAB = 1
endif
# ------------- jas -----------------
ifdef G4ANALYSIS_USE_JAS
CPPFLAGS += -DG4ANALYSIS_USE_JAS
CPPFLAGS += -DG4ANALYSIS_USE
G4ANALYSIS_BUILD_JAS = 1
endif
ifdef G4ANALYSIS_BUILD_JAS
CPPFLAGS += -DG4ANALYSIS_BUILD
CPPFLAGS += -DG4ANALYSIS_BUILD_JAS
INC_ANALYSIS = 1
LIB_ANALYSIS = 1
INC_JAS = 1
LIB_JAS = 1
endif
# ------------- Lizard -----------------
ifdef G4ANALYSIS_USE_LIZARD
CPPFLAGS += -DG4ANALYSIS_USE_LIZARD
CPPFLAGS += -DG4ANALYSIS_USE
G4ANALYSIS_BUILD_LIZARD = 1
endif
ifdef G4ANALYSIS_BUILD_LIZARD
CPPFLAGS += -DG4ANALYSIS_BUILD
CPPFLAGS += -DG4ANALYSIS_BUILD_LIZARD
INC_ANALYSIS = 1
LIB_ANALYSIS = 1
INC_LIZARD = 1
LIB_LIZARD = 1
endif
# ------------- Else ---------------
ifdef G4ANALYSIS_NON_AIDA
CPPFLAGS += -DG4ANALYSIS_NON_AIDA
endif
# ------------- Hook packages -----------------
ANALYSISLIBS :=
#
ifdef INC_ANALYSIS
CPPFLAGS += -I$(G4BASE)/analysis/management/include
# AIDA interfaces :
ifdef G4ANALYSIS_AIDA
CPPFLAGS += -I$(G4ANALYSIS_AIDA)
endif
endif
#
ifdef LIB_LAB
ANALYSISLIBS += -lG4Lab
endif
ifdef LIB_JAS
ANALYSISLIBS += -lG4jas
endif
ifdef LIB_LIZARD
ANALYSISLIBS += -lG4Lizard
endif
ifdef LIB_ANALYSIS
ANALYSISLIBS += -lG4analysis_management
endif
#
# ------------- Lab -----------------
ifdef INC_LAB
CPPFLAGS += -I$(G4BASE)/analysis/Lab/include
CPPFLAGS += -I$(LIBROOT)/include -I$(HCLROOT)/include -I$(LABROOT)/include
CPPFLAGS += -DHasRio
ifdef G4ANALYSIS_LAB_VISUALIZATION
CPPFLAGS += -DG4ANALYSIS_LAB_VISUALIZATION
CPPFLAGS += -I$(ONXROOT)/include
INC_XM = 1
endif
endif
#
ifdef LIB_LAB
ifdef G4ANALYSIS_LAB_VISUALIZATION
ANALYSISLIBS += $(ONXROOT)/$(ONXCONFIG)/XmUI.o
ANALYSISLIBS += -L$(ONXROOT)/$(ONXCONFIG) -lOnXInventorXt
ANALYSISLIBS += -L$(HEPVISROOT)/$(HEPVISCONFIG) -lHEPVisXt
ANALYSISLIBS += -L$(ONXROOT)/$(ONXCONFIG) -lOnXInventor
ANALYSISLIBS += -L$(ONXROOT)/$(ONXCONFIG) -lOnX
ANALYSISLIBS += -L$(EXPATROOT)/$(EXPATCONFIG) -lexpat
ANALYSISLIBS += -L$(SOFREEROOT)/$(SOFREECONFIG) -lSoFreeXt
ANALYSISLIBS += -L$(HEPVISROOT)/$(HEPVISCONFIG) -lHEPVis
ANALYSISLIBS += -L$(SOFREEROOT)/$(SOFREECONFIG) -lSoFree
LIB_XM = 1
LIB_GL = 1
endif
ANALYSISLIBS += -L$(LABROOT)/$(LABCONFIG) -lLab
ANALYSISLIBS += -L$(RIOGRANDEROOT)/$(RIOGRANDECONFIG) -lRioTree -lRioBed
ANALYSISLIBS += -L$(CINTROOT)/$(CINTCONFIG) -lcint
ANALYSISLIBS += -L$(HCLROOT)/$(HCLCONFIG) -lHCL
ANALYSISLIBS += -L$(MIDNIGHTROOT)/$(MIDNIGHTCONFIG) -lMidnight
ANALYSISLIBS += -L$(LIBROOT)/$(LIBCONFIG) -lLib
ANALYSISLIBS += $(DLDLIBS)
endif
#
# ------------- jas -----------------
ifdef INC_JAS
CPPFLAGS += -I$(G4BASE)/analysis/jas/include
CPPFLAGS += -I$(JDKHOME)/include -I$(JDKHOME)/include/linux
endif
#
ifdef LIB_JAS
ANALYSISLIBS += -L$(JDKHOME)/jre/lib/i386/classic -L$(JDKHOME)/jre/lib/i386/native_threads -ljvm -lhpi
endif
# ------------- Lizard -----------------
ifdef INC_LIZARD
CPPFLAGS += -I$(G4BASE)/analysis/Lizard/include
CPPFLAGS += -I$(LIZARDROOT)/include
endif
#
ifdef LIB_LIZARD
ANALYSISLIBS += -L$(LIZARDROOT)/lib -lAIDA_HTL -lT_Histoxx -lVector -lAIDA_Annotation -lAIDA_Plotter -lqp -lqpview -lqpqwt -lqt -lHepUtilities
endif
+27 -5
View File
@@ -1,4 +1,4 @@
# $Id: architecture.gmk,v 1.66 2000/05/19 07:29:06 gcosmo Exp $
# $Id: architecture.gmk,v 1.70 2000/12/08 09:41:26 gcosmo Exp $
# ------------------------------------------------------------------------
# GEANT 4 - Architecture configuration script for GNU Make
#
@@ -86,6 +86,28 @@ endif
G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4LIB) ] && mkdir -p $(G4LIB) )
G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4LIB)/$(G4SYSTEM) ] && mkdir -p $(G4LIB)/$(G4SYSTEM) )
# If not specified, the default path to install G4 include files is G4INCLUDE
# set to $G4INSTALL/include ...
#
ifndef G4INCLUDE
G4INCLUDE := $(G4INSTALL)/include
endif
G4DUMMY_VARIABLE:=$(shell [ ! -d $(G4INCLUDE) ] && mkdir -p $(G4INCLUDE) )
# backwards compatiblity
ifneq ($(G4MAKESHLIB),)
G4LIB_BUILD_SHARED = 1
endif
# defaults for library BUILD. No default for USE, ie. take what is found.
ifeq ($(G4LIB_BUILD_SHARED),)
ifeq ($(G4LIB_BUILD_STATIC),)
# default is building static libs
G4LIB_BUILD_STATIC = 1
endif
endif
# If not specified, the default path for G4 binaries G4BIN is
# set to $G4WORKDIR/bin/$G4SYSTEM ...
#
@@ -280,10 +302,10 @@ ifeq ($(G4SYSTEM),WIN32-VC)
LDFLAGS := -link $(LIB_PATH)$(CLHEP_LIB_DIR)
LOADLIBS := $(CLHEP_LIB)
else
## LDFLAGS := -L$(CLHEP_LIB_DIR)
LDFLAGS :=
## LOADLIBS := -l$(CLHEP_LIB)
LOADLIBS := $(CLHEP_LIB_DIR)/lib$(CLHEP_LIB).a
LDFLAGS := -L$(CLHEP_LIB_DIR)
# LDFLAGS :=
LOADLIBS := -l$(CLHEP_LIB)
# LOADLIBS := $(CLHEP_LIB_DIR)/lib$(CLHEP_LIB).a
LOADLIBS += -lm
endif
+44 -7
View File
@@ -1,4 +1,4 @@
# $Id: binmake.gmk,v 1.45 2000/05/23 05:32:14 stesting Exp $
# $Id: binmake.gmk,v 1.54 2000/12/05 17:19:49 morita Exp $
# ----------------------------------------------------------
# Script defining rules and paths for making binaries.
# Gabriele Cosmo, 25/06/1998.
@@ -13,6 +13,7 @@ G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
include $(G4INSTALL)/config/G4UI_USE.gmk
include $(G4INSTALL)/config/G4VIS_USE.gmk
include $(G4INSTALL)/config/interactivity.gmk
include $(G4INSTALL)/config/analysis.gmk
ifndef INCFLAGS
INCFLAGS := \
@@ -22,6 +23,7 @@ ifndef INCFLAGS
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/run/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/parameterisations/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/leptons/include \
@@ -77,7 +79,8 @@ ifndef INCFLAGS
-I$(G4BASE)/readout/include \
-I$(G4BASE)/event/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/intercoms/include
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/g3tog4/include
endif
ifdef G4ODBMS
@@ -97,20 +100,41 @@ ifdef G4ODBMS
-DHep_HAS_BUILDIN_BOOL_CONSTANTS
endif
ifndef G4LIB_USE_GRANULAR
GLOBALLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4global.a && echo yes)
ifndef GLOBALLIBS
GLOBALLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4global.$(SHEXT) && echo yes)
SHAREDLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4global.$(SHEXT) && echo yes)
endif
endif
ifndef SHAREDLIBS
SHAREDLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4globman.$(SHEXT) && echo yes)
endif
CPPFLAGS += $(INCFLAGS)
LDFLAGS += -L$(G4LIBDIR)
ifdef SHAREDLIBS
ifdef G4RUNPATHOPTION
LDFLAGS += $(G4RUNPATHOPTION)$(G4LIBDIR)
endif
endif
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)/$(G4TARGET)
G4BINDIR := $(G4BIN)/$(G4SYSTEM)
ifdef G4EXLIB
G4LIBDIR := $(G4TMPDIR)
LDFLAGS += -L$(G4LIBDIR)
ifdef SHAREDLIBS
ifdef G4RUNPATHOPTION
LDFLAGS += $(G4RUNPATHOPTION)$(G4LIBDIR)
endif
endif
include $(G4INSTALL)/config/common.gmk
endif
GLOBALLIBS := $(shell test -f $(G4LIB)/$(G4SYSTEM)/libG4global.a && echo yes)
ifdef LDLIBS
USER_DEFINED_LDLIBS := 1
endif
@@ -143,7 +167,9 @@ ifdef GLOBALLIBS
LDLIBS2 := -lG4readout \
-lG4run \
-lG4event \
-lG3toG4 \
-lG4tracking \
-lG4parmodels \
-lG4processes \
-lG4digits+hits \
-lG4track \
@@ -163,7 +189,7 @@ else
$(G4LIB)/$(G4SYSTEM)/liblist \
-d $(G4TMPDIR) \
< $(G4LIB)/$(G4SYSTEM)/libname.map; fi)
# Warning: do not add to LDLIBS2 with += becuase this causes it to be
# Warning: do not add to LDLIBS2 with += because this causes it to be
# expanded too soon. Hence extra libraries must have a different name...
# Extra libraries to resolve remaining circular dependencies...
# LDLIBS2EXTRA =
@@ -172,6 +198,7 @@ endif
# LDLIBS3 contains the first set of low level libraries...
#
LDLIBS3 += $(INTYLIBS)
LDLIBS3 += $(ANALYSISLIBS)
endif # ifndef USER_DEFINED_LDLIBS
@@ -211,7 +238,11 @@ else
LDLIBS = $(LDLIBS_PREFINAL)
endif
ifdef transform-RPath
#invoke system specific transformation of
include $(G4INSTALL)/config/sys/$(G4SYSTEM)-runpath.gmk
endif
sources := $(wildcard $(G4TARGET).cc)
objects := $(patsubst %.cc,$(G4TMPDIR)/exe/%.o,$(sources))
dependencies := $(patsubst %.cc,$(G4TMPDIR)/exe/%.d,$(sources))
@@ -277,6 +308,12 @@ else
-c $(OUT_OBJ)$(G4TMPDIR)/exe/$(G4TARGET).o $(G4TARGET).cc
endif
ifdef G4ODBMS
GPPFLAGS := "-MM"
else
GPPFLAGS := "-M"
endif
# Make the $(G4TARGET).d file and include it.
ifdef G4SKIP_DEPEND
$(G4TMPDIR)/exe/$(G4TARGET).d: $(G4TARGET).cc
@@ -288,7 +325,7 @@ $(G4TMPDIR)/exe/$(G4TARGET).d: $(G4TARGET).cc
@if [ ! -d $(G4TMPDIR)/exe ] ; then mkdir $(G4TMPDIR)/exe ;fi
@echo Making dependency for file $<...
@($(ECHO) $(G4TMPDIR)/exe/\\c ; \
g++ -MM $(CPPFLAGS) $< ) | sed 's!$(G4TMPDIR)/exe/$*.o!& $@!' >$@
g++ $(GPPFLAGS) $(CPPFLAGS) $< ) | sed 's!$(G4TMPDIR)/exe/$*.o!& $@!' >$@
-include $(dependencies)
endif
+52 -21
View File
@@ -1,4 +1,4 @@
# $Id: common.gmk,v 1.14 1999/12/05 22:41:38 morita Exp $
# $Id: common.gmk,v 1.24 2000/12/13 08:31:31 gcosmo Exp $
# ----------------------------------------------------------------
# Common part of GNUmakefile for libraries. John Allison, 5/7/95.
# ----------------------------------------------------------------
@@ -42,25 +42,35 @@ ifdef G4ODBMS
objects += $(patsubst include/%.ddl,$(G4TMPDIR)/%_ddl.o,$(schema_ddl))
endif
ifneq ($(G4MAKESHLIB),)
# Make shared library.
$(G4LIBDIR)/lib$(name).$(SHEXT): $(G4LIBDIR)/lib$(name).a
ifneq ($(G4TMPDIR),$(G4LIBDIR))
@cp $(G4TMPDIR)/*.o $(G4LIBDIR)/.
@sh $(G4MAKESHLIB) $(G4LIBDIR) $(name)
@$(RM) $(G4LIBDIR)/*.o
else
@sh $(G4MAKESHLIB) $(G4LIBDIR) $(name)
g4libraries_to_build :=
ifneq ($(G4LIB_BUILD_SHARED),)
g4libraries_to_build += $(G4LIBDIR)/lib$(name).$(SHEXT)
endif
ifneq ($(G4LIB_BUILD_STATIC),)
g4libraries_to_build += $(G4LIBDIR)/lib$(name).a
endif
# Make library.
lib: $(g4libraries_to_build)
ifneq ($(G4LIB_BUILD_SHARED),)
# Make shared library.
$(G4LIBDIR)/lib$(name).$(SHEXT): $(G4TMPDIR)/obj.last
@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
@echo Creating shared library $@
@$(RM) $@
# use architecture specific macro defined in sys/$(G4SYSTEM).gmk
$(build-granular-shared-lib)
endif
ifneq ($(G4LIB_BUILD_STATIC),)
# Make static (archive) library.
$(G4LIBDIR)/lib$(name).a: $(G4TMPDIR)/obj.last
@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
@echo Creating/replacing object files in $(G4LIBDIR)/lib$(name).a
@rm -f $(G4LIBDIR)/lib$(name).a
@$(AR) $(OUT_LIB)$(G4LIBDIR)/lib$(name).a $(G4TMPDIR)/*.o
@if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then ranlib $(G4LIBDIR)/lib$(name).a ;fi
endif
# Touch the versioning file
$(G4TMPDIR)/obj.last: $(objects)
@@ -116,7 +126,7 @@ endif
endif
# Make the .d file(s) and include it(them).
# g++ -MM is good at this, except it forgets the subdirectory
# g++ -MM (or -M) is good at this, except it forgets the subdirectory
# (hence the use of $G4TMP/).
# define G4SKIP_DEPEND for simplicity
@@ -126,8 +136,16 @@ ifdef G4ODBMS
endif
endif
ifdef G4ODBMS
GPPFLAGS := "-MM"
else
GPPFLAGS := "-M"
endif
ifdef G4SKIP_DEPEND
$(G4TMPDIR)/%.d:
$(G4TMPDIR)/%.d: src/%.cc
@if [ ! -d $(G4TMP)/$(G4SYSTEM) ] ; then mkdir $(G4TMP)/$(G4SYSTEM) ;fi
@if [ ! -d $(G4TMPDIR) ] ; then mkdir $(G4TMPDIR) ;fi
@echo Skip dependency file creation for file $< ...
else
$(G4TMPDIR)/%.d: src/%.cc
@@ -135,16 +153,18 @@ $(G4TMPDIR)/%.d: src/%.cc
@if [ ! -d $(G4TMPDIR) ] ; then mkdir $(G4TMPDIR) ;fi
@echo Making dependency for file $< ...
@($(ECHO) $(G4TMPDIR)/\\c ; \
g++ -MM $(CPPFLAGS) $< ) | sed 's!$(G4TMPDIR)/$*.o!& $@!' >$@
g++ $(GPPFLAGS) $(CPPFLAGS) $< ) | sed 's!$(G4TMPDIR)/$*.o!& $@!' >$@
ifneq ($(dependencies),)
-include $(dependencies)
endif
endif
# .PHONY targets are executed regardless of time-stamp of any file of
# same name.
ifdef G4ODBMS_DEPEND
.PHONY: all obj lib clean clean_libs d_files install_schema
.PHONY: all obj lib clean clean_libs d_files install_schema includes
else
.PHONY: all obj lib clean clean_libs
.PHONY: all obj lib clean clean_libs includes
endif
obj: $(G4TMPDIR)/obj.last
@@ -162,16 +182,24 @@ install_schema:
echo " schema header file does not exist, so ignore the error message...")
endif
ifneq ($(G4MAKESHLIB),)
lib: $(G4LIBDIR)/lib$(name).$(SHEXT)
else
lib: $(G4LIBDIR)/lib$(name).a
endif
installed_includes:=$(foreach file,$(wildcard include/*),$(shell test -f $(file) && echo $(file)))
installed_includes:=$(patsubst include/%,$(G4INCLUDE)/%,$(installed_includes))
# NOTE: the double colon rule allows to add other rules for the same target
#
includes:: $(installed_includes)
# Static Pattern rules, see GNU make manual for details.
# target(s): target-pattern : dep-pattern
#
$(installed_includes): $(G4INCLUDE)/% : include/%
@cp -p $< $@
ifndef G4EXLIB
clean:
@echo Cleaning up ...
@rm -f $(G4LIBDIR)/lib$(name).a
@rm -f $(G4LIBDIR)/lib$(name).$(SHEXT)
@rm -f $(schema_hh) $(schema_ref_hh)
@rm -rf $(G4TMPDIR)
endif
@@ -180,4 +208,7 @@ clean_libs:
@if [ -f $(G4LIBDIR)/lib$(name).a ] ; then \
$(ECHO) Removing library lib$(name).a ... ; \
$(RM) -f $(G4LIBDIR)/lib$(name).a ; fi
@if [ -f $(G4LIBDIR)/lib$(name).$(SHEXT) ] ; then \
$(ECHO) Removing library lib$(name).$(SHEXT) ... ; \
$(RM) -f $(G4LIBDIR)/lib$(name).$(SHEXT) ; fi
+51 -18
View File
@@ -1,4 +1,4 @@
# $Id: globlib.gmk,v 1.10 1999/11/30 19:41:08 morita Exp $
# $Id: globlib.gmk,v 1.16 2000/12/13 09:19:14 gcosmo Exp $
# --------------------------------------------------------------
# Script for compound libraries. Gabriele Cosmo, 25/6/98.
# --------------------------------------------------------------
@@ -11,31 +11,47 @@ include $(G4INSTALL)/config/architecture.gmk
G4LIBDIR = $(G4LIB)/$(G4SYSTEM)
.PHONY : all glob global objs clean clean_libs wipe_libs
.PHONY : all glob global objs includes clean clean_libs wipe_libs
all:
ifndef G4ODBMS
@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE)); done
@for dir in $(SUBDIRS); do (cd $$dir && $(MAKE)); done
else
@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) headers); done
@for dir in $(SUBDIRS); do (cd $$dir; G4ODBMS_DEPEND=1; \
export G4ODBMS_DEPEND; $(MAKE)); done
@for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) headers); done
@for dir in $(SUBDIRS); do (cd $$dir && G4ODBMS_DEPEND=1 && \
export G4ODBMS_DEPEND && $(MAKE)); done
@echo Copying tmp schema header from G4TMPDIR to $(G4SCHEMA_INCLUDE)
@rm -f $(G4SCHEMA_INCLUDE)/*.hh
@for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) install_schema); done
@for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) install_schema); done
@echo Copying tmp schema to $(G4SCHEMA_DIR) for FDID $(G4SCHEMA_FDID)
@rm -f $(G4SCHEMA_DIR)/G4SCHEMA
@rm -f $(G4SCHEMA_DIR)/G4SCHEMA.FDDB
@$(HEP_ODBMS_DIR)/etc/getdb $(G4TMPSCHEMA_BOOT) \
$(G4SCHEMA_DIR)/G4SCHEMA $(G4SCHEMA_FDID)
endif
g4libraries_to_build:=
ifndef G4ODBMS
glob global: objs wipe_libs $(G4LIBDIR)/lib$(name).a
ifneq ($(G4LIB_BUILD_SHARED),)
SHARED_LIB=$(G4LIBDIR)/lib$(name).$(SHEXT)
g4libraries_to_build += $(SHARED_LIB)
else
glob global: headers d_files objs wipe_libs $(G4LIBDIR)/lib$(name).a $(G4SCHEMA_DIR)/G4SCHEMA.FDDB
SHARED_LIB=
endif
ifneq ($(G4LIB_BUILD_STATIC),)
g4libraries_to_build += $(G4LIBDIR)/lib$(name).a
endif
ifndef G4ODBMS
glob global: objs wipe_libs $(g4libraries_to_build)
else
glob global: headers d_files objs wipe_libs $(g4libraries_to_build) $(G4SCHEMA_DIR)/G4SCHEMA.FDDB
endif
##
## make static libraries
##
ifneq ($(G4LIB_BUILD_STATIC),)
$(G4LIBDIR)/lib$(name).a: \
$(foreach dir,$(SUBLIBS),$(G4TMP)/$(G4SYSTEM)/$(dir)/obj.last)
@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ; fi
@@ -68,14 +84,19 @@ $(G4LIBDIR)/lib$(name).a: \
#
@if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then \
ranlib $(G4LIBDIR)/lib$(name).a ; fi
endif
##
## make shared libraries
##
ifneq ($(G4MAKESHLIB),)
@for lib in $(SUBLIBS); do (cp $(G4TMP)/$(G4SYSTEM)/$$lib/*.o $(G4LIBDIR)/.); done
@sh $(G4MAKESHLIB) $(G4LIBDIR) $(name)
@$(RM) $(G4LIBDIR)/*.o
ifneq ($(G4LIB_BUILD_SHARED),)
$(SHARED_LIB): $(foreach dir,$(SUBLIBS),$(G4TMP)/$(G4SYSTEM)/$(dir)/obj.last)
@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ; fi
@echo Creating global shared library $@
@$(RM) $@
# use system specific commands to build the library
$(build-global-shared-lib)
endif
ifdef G4ODBMS
@@ -97,20 +118,32 @@ objs:
@for dir in $(SUBDIRS); \
do (cd $$dir; $(MAKE) -q obj && ok=yes; \
if [ $$ok ]; \
then echo Nothing to be done for lib$(name).a in $$dir/.; \
then echo Nothing to be done for lib$(name) in $$dir/.; \
else $(MAKE) clean_libs; $(MAKE) obj; \
fi; ) \
done
includes::
@for dir in $(SUBDIRS); do (cd $$dir && $(MAKE) $@ ); done
wipe_libs:
@for lib in $(SUBLIBS); do (rm -f $(G4LIBDIR)/lib$$lib.a); done
@for lib in $(SUBLIBS); do (rm -f $(G4LIBDIR)/lib$$lib.$(SHEXT)); done
clean:
@echo Cleaning up ...
@for lib in $(SUBLIBS); do (rm -rf $(G4TMP)/$(G4SYSTEM)/$$lib; rm -f $(G4LIBDIR)/lib$$lib.a); done
@for lib in $(SUBLIBS); do ( \
rm -rf $(G4TMP)/$(G4SYSTEM)/$$lib;\
rm -f $(G4LIBDIR)/lib$$lib.a;\
rm -f $(G4LIBDIR)/lib$$lib.$(SHEXT) );\
done
@rm -f $(G4LIBDIR)/lib$(name).a
clean_libs:
@echo Removing lib$(name).a and sub-libraries ...
@for lib in $(SUBLIBS); do (rm -f $(G4LIBDIR)/lib$$lib.a); done
@echo Removing lib$(name).a/.$(SHEXT) and sub-libraries ...
@for lib in $(SUBLIBS); do ( \
rm -f $(G4LIBDIR)/lib$$lib.a;\
rm -f $(G4LIBDIR)/lib$$lib.$(SHEXT) );\
done
@rm -f $(G4LIBDIR)/lib$(name).a
@rm -f $(G4LIBDIR)/lib$(name).$(SHEXT)
-143
View File
@@ -1,143 +0,0 @@
#!/bin/sh -f
############################################
##### To build GEANT4 shared libraries #####
############# G.Barrand ####################
############################################
if test $# -eq 2 ; then
g4system=$1
name=$2
liba=lib$name.a
#echo $g4system
#echo $name
############################################
##### build libs ###########################
############################################
if test `uname` = "OSF1" ; then
if test -f $g4system/$liba ; then
cd $g4system
# Need to specify a path, so that at run time loader
# is able to find the so lib. This path is put in the
# binaries at link time. In principle a relative
# path from the binary is ok, but we will have
# more than one binary at different places; so
# we have to specify an absolute path.
rpath=`pwd`
#echo $rpath
libso=lib$name.so
/bin/rm -f $libso
/bin/rm -f so_locations
ld -expect_unresolved '*' -shared -o $libso -all $liba -rpath $rpath
cd ..
echo "$libso built."
else
ArchiveError=1
fi
fi
if test `uname` = "HP-UX" ; then
cd $g4system
libso=lib$name.sl
/bin/rm -f $libso
# get .o files
objs=`ls *.o`
#ld -b -a shared -o $libso $objs
# CC does more than ld.
aCC -b -o $libso $objs
cd ..
echo "$libso built."
fi
if test `uname` = "SunOS" ; then
cd $g4system
libso=lib$name.so
/bin/rm -f $libso
# get .o files
objs=`ls *.o`
CC -G -o $libso $objs
cd ..
echo "$libso built."
fi
if test `uname` = "IRIX" ; then
if test -f $g4system/$liba ; then
cd $g4system
# For path same remarks as for OSF1.
rpath=`pwd`
libso=lib$name.so
/bin/rm -f $libso
/bin/rm -f so_locations
#ld -shared -o $libso -all $liba -rpath $rpath
# CC does more than ld.
CC -Wl,-rpath,$rpath -shared -o $libso -all $liba
cd ..
echo "$libso built."
else
ArchivError=1
fi
fi
if test `uname` = "Linux" ; then
cd $g4system
# For path same remarks as for OSF1.
libso=lib$name.so
/bin/rm -f $libso
g++ -Wl,-soname,$libso -shared *.o -o $libso
echo "$libso built."
fi
if test `uname` = "AIX" ; then
# Not yet ready.
exit
#set -x
cd $g4system
libso=lib$name'.so'
/bin/rm -f lib$name.o
/bin/rm -f $libso
/bin/rm -f lib$name.exp
# Get .o files
objs=`ls *.o`
# Determine how to invoke nm depending on AIX version
AIXVERSION=`uname -v`
case ${AIXVERSION} in
#{
3*)
NM=/usr/ucb/nm
;;
4*)
NM='/usr/bin/nm -B'
;;
*)
echo "Error in g4makeshlib.sh!"
exit 1
;;
#}
esac
# Build export file (from Mesa mklib.aix).
echo "#! lib$name.so " > lib$name.exp
echo "noentry" >> lib$name.exp
$NM $objs | awk '/ [BD] /{print $3}' | sort | uniq >> lib$name.exp
# Below command from Mesa mklib.aix.
#cc -o lib$name.o $objs $3 -bE:lib$name.exp -bM:SRE -enoentry
# Unnecessary option -enoentry that produces
# noentry file that contains exported symbols
cc -o lib$name.o $objs $3 -bE:lib$name.exp -bM:SRE
if test -f lib$name.o ; then
ar r $libso lib$name.o
/bin/rm -f lib$name.o
else
echo "Can't create lib$name.o."
fi
#cp $libso lib$name.a
cd ..
echo "$libso treated."
fi
if [ $ArchiveError ]; then
echo "ERROR: Archive libraries needed and not found."
echo " Compile first with G$MAKESHLIB unset."
fi
############################################
else
echo 'Give name of binary directory and library'
fi
+8
View File
@@ -34,4 +34,12 @@ ifeq ($(G4SYSTEM),AIX-xlC)
CPPFLAGS += -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += $(OSPACEINC) -I$(OSPACE_BASE_DIR)
endif
define build-granular-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
endef
define build-global-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
endef
endif
+12
View File
@@ -14,6 +14,8 @@ ifeq ($(G4SYSTEM),DEC-cxx)
endif
G4_HAVE_BOOL := yes
CXXFLAGS += -ieee -timplicit_local
SHEXT := so
#future G4RUNPATHOPTION := -rpath
FC := f77
FCLIBS := -lUfor -lfor -lFutil -lots
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
@@ -38,4 +40,14 @@ ifeq ($(G4SYSTEM),DEC-cxx)
CPPFLAGS += -DG4USE_STD_NAMESPACE
endif
endif
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
$(CXX) -shared -o $$libdir/$(@F) *.o
endef
# transform-RPath = 1
define build-global-shared-lib
@echo "Global shared Libraries not yet supported on $(G4SYSTEM)
endef
endif
+16 -1
View File
@@ -14,11 +14,14 @@ ifeq ($(G4SYSTEM),HP-aCC)
endif
CXXFLAGS += +DAportable +W823
CPPFLAGS += -I/usr
ifdef G4MAKESHLIB
ifdef G4LIB_BUILD_SHARED
CXXFLAGS += +Z
FCFLAGS += +Z
CCFLAGS += +Z
endif
G4_HAVE_BOOL := yes
FC := f77
SHEXT := sl
FCFLAGS += +E6 +ppu
CCFLAGS += -Ae +DAportable
X11FLAGS := -I/usr/include/X11/extensions -I/usr/contrib/X11R6/include
@@ -42,4 +45,16 @@ ifeq ($(G4SYSTEM),HP-aCC)
CPPFLAGS += -DOS_NO_WSTRING -DOS_NO_ALLOCATORS -D__HPACC_NOEH
CPPFLAGS += $(OSPACEINC) -I$(OSPACE_BASE_DIR)
endif
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
$(CXX) -b -o $$libdir/$(@F) *.o
endef
define build-global-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMP)/$(G4SYSTEM); \
$(CXX) -b -o $$libdir/$(@F) $(foreach dir,$(SUBLIBS),$(dir)/*.o);
endef
endif
+17 -1
View File
@@ -16,19 +16,22 @@ ifeq ($(G4SYSTEM),Linux-g++)
CCFLAGS := -g
endif
endif
ifdef G4MAKESHLIB
ifdef G4LIB_BUILD_SHARED
CXXFLAGS += -fPIC
FCFLAGS += -fPIC
CCFLAGS += -fPIC
endif
#future G4RUNPATHOPTION := -rpath
FC := g77
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
FCLIBS := -lg2c -lnsl
ECHO := /bin/echo -e
SHEXT := so
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
XMFLAGS := -I/usr/X11R6/include
XMLIBS := -lXm -lXpm
DLDLIBS := -ldl
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
@@ -44,4 +47,17 @@ ifeq ($(G4SYSTEM),Linux-g++)
ifdef G4ODBMS
G4OODDLX_FLAGS += -D__STL_CLASS_PARTIAL_SPECIALIZATION -Dstd=""
endif
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
$(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) *.o
endef
define build-global-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMP)/$(G4SYSTEM); \
$(CXX) -Wl,-soname,$(@F) -shared -o $$libdir/$(@F) \
$(foreach dir,$(SUBLIBS),$(dir)/*.o);
endef
endif
+8
View File
@@ -33,4 +33,12 @@ ifeq ($(G4SYSTEM),SGI-CC)
CPPFLAGS += -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += $(OSPACEINC) -I$(OSPACE_BASE_DIR)
endif
define build-granular-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
endef
define build-global-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
endef
endif
+17 -1
View File
@@ -12,9 +12,12 @@ ifeq ($(G4SYSTEM),SUN-CC)
CCFLAGS := -g
endif
endif
ifdef G4MAKESHLIB
ifdef G4LIB_BUILD_SHARED
CXXFLAGS += -KPIC
FCFLAGS += -KPIC
CCFLAGS += -KPIC
endif
G4RUNPATHOPTION = -R
# CXXFLAGS += -fnonstd
CFRONT_G4TEMPLATE_REPOSITORY := true
FC := f77
@@ -47,4 +50,17 @@ ifeq ($(G4SYSTEM),SUN-CC)
CPPFLAGS += -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += $(OSPACEINC) -I$(OSPACE_BASE_DIR)
endif
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
$(CXX) -G $(CXXTEMPLATE_FLAGS) -o $$libdir/$(@F) -h $(@F) *.o
endef
define build-global-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMP)/$(G4SYSTEM); \
$(CXX) -G $(CXXTEMPLATE_FLAGS) -o $$libdir/$(@F) -h $(@F) \
$(foreach dir,$(SUBLIBS),$(dir)/*.o);
endef
endif
+20 -1
View File
@@ -12,10 +12,14 @@ ifeq ($(G4SYSTEM),SUN-CC5)
CCFLAGS := -g
endif
endif
CXXFLAGS += -features=no%anachronisms -mt -lpthread
# CXXFLAGS += -fnonstd
ifdef G4MAKESHLIB
ifdef G4LIB_BUILD_SHARED
CXXFLAGS += -KPIC
FCFLAGS += -KPIC
CCFLAGS += -KPIC
endif
G4RUNPATHOPTION := -R
G4_HAVE_BOOL := yes
CFRONT_G4TEMPLATE_REPOSITORY := true
FC := f77
@@ -43,6 +47,9 @@ ifeq ($(G4SYSTEM),SUN-CC5)
LOADLIBS += -L/usr/lib -lsocket -lnsl
CPPFLAGS += -DG4NOT_ISO_DELETES
CPPFLAGS += -I$(G4STLINC)/wrappers/$(G4SYSTEM)
ifdef G4ODBMS
G4OODDLX_FLAGS += -noline
endif
ifdef G4USE_OSPACE
CPPFLAGS += -DOS_SOLARIS_2_5 -DOS_NEW_CHECK -DOS_STL_ASSERT
CPPFLAGS += -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
@@ -56,4 +63,16 @@ ifeq ($(G4SYSTEM),SUN-CC5)
CXXFLAGS += -compat
endif
endif
define build-granular-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMPDIR); \
$(CXX) -G $(CXXTEMPLATE_FLAGS) -o $$libdir/$(@F) -h $(@F) *.o
endef
define build-global-shared-lib
@libdir=`(cd $(@D);/bin/pwd)`; \
cd $(G4TMP)/$(G4SYSTEM); \
$(CXX) -G $(CXXTEMPLATE_FLAGS) -o $$libdir/$(@F) -h $(@F) \
$(foreach dir,$(SUBLIBS),$(dir)/*.o);
endef
endif
+8
View File
@@ -49,4 +49,12 @@ ifeq ($(G4SYSTEM),WIN32-VC)
ifndef OGLLIBS
OGLLIBS := -lGLU -lGL
endif
define build-granular-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
endef
define build-global-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
endef
endif
+61
View File
@@ -0,0 +1,61 @@
#
# ------ GNU/WIN32 CYGNUS ------ !!! not supported !!!
# cygnus b20 with cygwin1.dll 1.1.5 patch
# Windows 95 4.00.1111
#
# Sys file by Stefano Agostinelli, July 2000
# IST Group: Franca Foppiano, Stefania Garelli, Stefano Agostinelli
#
ifeq ($(G4SYSTEM),WIN32-g++)
CXX := g++
GNU_GCC = 1
CXXFLAGS := -pipe -fno-for-scope -DGNU_GCC
ifdef G4OPTIMISE
CXXFLAGS += -O
FCFLAGS := -O
CCFLAGS := -O
else
ifdef G4DEBUG
CXXFLAGS += -g
FCFLAGS := -g
CCFLAGS := -g
endif
endif
ifdef G4LIB_BUILD_SHARED
CXXFLAGS += -fPIC
FCFLAGS += -fPIC
CCFLAGS += -fPIC
endif
FC := g77
FCFLAGS += -fno-automatic -fno-backslash -fno-second-underscore
FCLIBS := -lg2c -lnsl
ECHO := echo -e
X11FLAGS := -I/usr/include/X11/extensions -I/usr/include/X11
X11LIBS := -L/usr/X11R6/lib -lXmu -lXt -lXext -lX11 -lSM -lICE
XMFLAGS := -I/usr/X11R6/include
XMLIBS := -lXm -lXpm
ifndef OGLFLAGS
OGLFLAGS := -I$(OGLHOME)/include
endif
ifndef OGLLIBS
OGLLIBS := -L$(OGLHOME)/lib -lGLU -lGL
endif
OIVFLAGS += -I$(OIHOME)/include
ifdef G4USE_OSPACE
CPPFLAGS += -DOS_LINUX_2 -DOS_NEW_CHECK -DOS_STL_ASSERT
CPPFLAGS += -DOS_NO_WSTRING -DOS_NO_ALLOCATORS
CPPFLAGS += -I$(OSPACE_BASE_DIR)/ospace/std -I$(OSPACE_BASE_DIR)
endif
ifdef G4ODBMS
G4OODDLX_FLAGS += -D__STL_CLASS_PARTIAL_SPECIALIZATION -Dstd=""
endif
define build-granular-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
endef
define build-global-shared-lib
@echo "Shared Libraries not supported on $(G4SYSTEM)
endef
endif
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: EXPO.cc,v 1.8 2000/03/17 08:56:10 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
#include <stdlib.h>
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: TEST.cc,v 1.3 1999/12/15 14:48:40 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
#include <stdlib.h>
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: EXPO_Detector.icc,v 1.3 1999/12/15 14:48:41 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
// See also G4/run/example/MyDetectorConstruction.cc.
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: EXPO_PhysicsList.hh,v 1.4 1999/12/15 14:48:41 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: EXPO_PhysicsList.icc,v 1.4 1999/12/15 14:48:41 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: EXPO_Primary.icc,v 1.3 1999/12/15 14:48:41 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
// See also G4/run/example/EXPO_PrimaryGeneratorAction.cc.
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4o.h,v 1.3 1999/12/15 14:48:41 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oCommon.hh,v 1.3 1999/12/15 14:48:41 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/*
Included by G4o.h.
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oCommon.icc,v 1.3 1999/12/15 14:48:41 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/*
Included by G4o.cc.
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oDrawer.hh,v 1.3 1999/12/15 14:48:43 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oEXPO.h,v 1.3 1999/12/15 14:48:43 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oScene.hh,v 1.4 2000/03/17 08:58:32 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oState.hh,v 1.4 1999/12/15 14:48:43 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
#ifndef G4oState_h
#define G4oState_h
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: WoG4o.h,v 1.3 1999/12/15 14:48:43 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4o.cc,v 1.7 2000/03/17 08:57:45 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/*
#define DEBUG
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oDrawer.cc,v 1.6 2000/03/17 08:57:46 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/*
From geant4/visualization/management/src/G4VisManager.cc.
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oScene.cc,v 1.7 2000/06/09 10:00:58 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
/* +---------------------- Copyright notice -------------------------------+ */
/* | Copyright (C) 1995, Guy Barrand, LAL Orsay, (barrand@lal.in2p3.fr) | */
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4oState.cc,v 1.6 2000/03/17 08:57:48 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//#define DEBUG
+11 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.55 2000/06/17 12:56:56 stesting Exp $
$Id: History,v 1.58 2000/11/18 10:56:11 stesting Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,16 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
18th Nov 2000 Steve O'Neale (examples-V02-00-05)
- Updated test 102,104,508 outputs
9th August 2000 Steve O'Neale (examples-V02-00-00)
- Updated all (except large_N) .out files ready for public patch
geant4-02-00
24th June 2000 John Allison (examples-V01-01-08)
- Updated .out files where necessary for stand-V01-01-05 and utils-V01-01-03.
17th June 2000 John Allison (examples-V01-01-07)
- Updated all .out files for geant4-01-01-ref-06.
+118
View File
@@ -0,0 +1,118 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this
// statement, and all its terms.
//
// $Id: Brachy.cc,v 1.4 2000/12/10 08:56:15 chauvie Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by:
// S. Agostinelli, F. Foppiano, S. Garelli and M. Tropeano
//
// Brachytherapy simulates the dose deposition in a cubic (30*cm)
// water phantom for a Ir-192 MicroSelectron High Dose Rate
// brachytherapy source.
//
// Simplified gamma generation is used.
// Source axis is oriented along Z axis.
// Voxel data on the X-Z plane is output to ASCII file
// "Brachy.out".
//
// For information related to this code contact the developers.
//
// --------------------------------------------------------------
#include "BrachyEventAction.hh"
#include "BrachyDetectorConstruction.hh"
#include "BrachyPhysicsList.hh"
#include "BrachyPrimaryGeneratorAction.hh"
#include "BrachyWaterBoxSD.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
int main()
{
// Number of generated photons
G4int NumberOfEvents = 10;
// Define number of voxels in X-Z plane
G4int NumVoxelX = 101;
G4int NumVoxelZ = 101;
// Construct the default run manager
G4RunManager* pRunManager = new G4RunManager;
// Set mandatory initialization classes
G4String SDName = "WaterBox";
BrachyDetectorConstruction *pDetectorConstruction;
pRunManager->SetUserInitialization(pDetectorConstruction = new BrachyDetectorConstruction(SDName,NumVoxelX,NumVoxelZ));
pRunManager->SetUserInitialization(new BrachyPhysicsList);
// Set mandatory user action class
pRunManager->SetUserAction(new BrachyPrimaryGeneratorAction);
// Initialize G4 kernel
pRunManager->Initialize();
// Alloc and initialize voxel matrix
G4float* pVoxel = new G4float[NumVoxelX*NumVoxelZ];
for(G4int j=0;j<NumVoxelX*NumVoxelZ;j++)
pVoxel[j] = 0.0F;
BrachyEventAction *pEventAction;
pRunManager->SetUserAction(pEventAction = new BrachyEventAction(pVoxel,NumVoxelX,NumVoxelZ));
// Get the pointer to the UI manager and set verbosities
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/run/verbose 0");
UI->ApplyCommand("/event/verbose 0");
UI->ApplyCommand("/tracking/verbose 0");
pRunManager->BeamOn(NumberOfEvents);
if(pVoxel)
{
G4std::ofstream ofs;
// Output voxel data to text file
// Format = x coord [mm] <tab> z coord [mm] <tab> edep [MeV] <eol>
ofs.open("Brachy.out");
{
G4double VoxelWidth_X = pDetectorConstruction->m_BoxDimX/NumVoxelX;
G4double VoxelWidth_Z = pDetectorConstruction->m_BoxDimZ/NumVoxelZ;
G4double x,z;
for(G4int k=0;k<NumVoxelZ;k++)
{
z = (-NumVoxelZ+1+2*k)*VoxelWidth_Z/2;
for(G4int i=0;i<NumVoxelX;i++)
{
G4int j = i+k*NumVoxelX;
x = (-NumVoxelX+1+2*i)*VoxelWidth_X/2;
// Do not consider near voxels
if(fabs(x) > 3*mm || fabs(z) > 6*mm)
ofs << x << '\t' << z << '\t' << pVoxel[j] << G4endl;
}
}
ofs.close();
}
}
delete[] pVoxel;
// Job termination
delete pRunManager;
return 0;
}
@@ -0,0 +1,19 @@
# --------------------------------------------------------------
# $Id: GNUmakefile,v 1.2 2000/12/10 08:38:46 chauvie Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := Brachy
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
+22
View File
@@ -0,0 +1,22 @@
-------------------------------------------------------------------
$Id: History,v 1.3 2000/12/10 08:42:44 chauvie Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - Brachytherapy example
=========================================================
Category History file
---------------------
09.11.2000 - SA, tag brachy-V02-00-00
(dvnote) First submission of Brachytherapy advanced example.
15.11.2000 - SA, tag brachy-V02-00-01
(minrev) Data fully compliant to Geant4 types.
(newfea) LowEnergy option available (see BRACHY_OPT_USELOWENERGY in BrachyPhysicsList.cc).
10.12.2000 - Stephane Chauvie
(minrev) DOS -> Unix text conversion.
(newfea) Added Low Energy Electromagnetic physics. Removed switch to standard.
+38
View File
@@ -0,0 +1,38 @@
-------------------------------------------------------------------
$Id: README,v 1.2 2000/12/10 08:39:39 chauvie Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - Brachytherapy example
=========================================================
README
---------------------
0. Introduction.
Brachytherapy example simulates energy deposition on a voxel grid
for a MicroSelectron Ir-192 HDR brachytherapy source.
1. Technical description
1.0. MicroSelectron HDR Ir-192 source is constructed in the
brachyDetectorConstruction class. The source is composed by
an iridium core encapsulated in a stainless steel capsule
(body + tip). The source is put into a 30*cm water box.
1.1. The water box is made sensitive detector. A longitudinal slice
of it is associated to a planar read out geometry. At every hit
energy deposition is read and stored into a voxel matrix.
1.2. Voxel matrix is output to an ASCII file for further processing
(e.g. anysotropy and isodose calculations).
2. Make
A standard Geant4 example GNUmakefile is provided.
2. Usage
Simply run "Brachy" executable. The ASCII "Brachy.out" file is
produced.
@@ -0,0 +1,36 @@
// ****************************************
// * *
// * BrachyDetectorConstruction.hh *
// * *
// ****************************************
#ifndef BrachyDetectorConstruction_H
#define BrachyDetectorConstruction_H 1
#include "G4VUserDetectorConstruction.hh"
class G4VPhysicalVolume;
class BrachyWaterBoxSD;
class BrachyDetectorConstruction : public G4VUserDetectorConstruction
{
public:
BrachyDetectorConstruction(G4String &SDName,G4int NumVoxelX,G4int NumVoxelZ);
~BrachyDetectorConstruction();
public:
const G4double m_BoxDimX;
const G4double m_BoxDimY;
const G4double m_BoxDimZ;
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
G4String m_SDName;
public:
G4VPhysicalVolume* Construct();
};
#endif
@@ -0,0 +1,31 @@
// ********************************
// * *
// * BrachyDummySD.hh *
// * *
// ********************************
// Dummy sensitive used only to flag sensitivity in cells of RO geometry.
#ifndef BrachyDummySD_h
#define BrachyDummySD_h 1
#include "G4VSensitiveDetector.hh"
class G4Step;
class BrachyDummySD : public G4VSensitiveDetector
{
public:
BrachyDummySD();
~BrachyDummySD() {};
void Initialize(G4HCofThisEvent*HCE) {};
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) {return false;}
void EndOfEvent(G4HCofThisEvent*HCE) {};
void clear() {};
void DrawAll() {};
void PrintAll() {};
};
BrachyDummySD::BrachyDummySD() : G4VSensitiveDetector("dummySD")
{}
#endif
@@ -0,0 +1,35 @@
// **********************************
// * *
// * BrachyEventAction.hh *
// * *
// **********************************
#ifndef BrachyEventAction_h
#define BrachyEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class BrachyEventAction : public G4UserEventAction
{
public:
BrachyEventAction(G4float *pVoxel,G4int NumVoxelX,G4int NumVoxelZ);
~BrachyEventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
public:
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
G4float *m_pVoxel;
private:
G4int m_HitsCollectionID;
};
#endif
@@ -0,0 +1,70 @@
// **********************************
// * *
// * BrachyPhysicsList.hh *
// * *
// **********************************
#ifndef BrachyPhysicsList_h
#define BrachyPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4LowEnergyIonisation;
class G4LowEnergyPhotoElectric;
class G4LowEnergyBremsstrahlung;
class BrachyPhysicsList: public G4VUserPhysicsList
{
public:
BrachyPhysicsList();
~BrachyPhysicsList();
protected:
// Construct particle and physics
void ConstructParticle();
void ConstructProcess();
void SetCuts();
public:
// Set Cuts
void SetGammaCut(G4double);
void SetElectronCut(G4double);
void SetPositronCut(G4double);
void SetGammaLowLimit(G4double);
void SetElectronLowLimit(G4double);
void SetGELowLimit(G4double);
void SetLowEnSecPhotCut(G4double);
void SetLowEnSecElecCut(G4double);
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForPositron;
protected:
// these methods Construct particles
void ConstructBosons();
void ConstructLeptons();
protected:
// these methods Construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
private:
G4LowEnergyIonisation* loweIon;
G4LowEnergyPhotoElectric* lowePhot;
G4LowEnergyBremsstrahlung* loweBrem;
};
#endif
@@ -0,0 +1,33 @@
// ********************************************
// * *
// * BrachyPrimaryGeneratorAction.hh *
// * *
// ********************************************
#ifndef BrachyPrimaryGeneratorAction_h
#define BrachyPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4RadioactiveDecay.hh"
class G4ParticleGun;
class G4Event;
class BrachyPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
BrachyPrimaryGeneratorAction();
~BrachyPrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent);
private:
G4ParticleGun* m_pParticleGun;
G4RadioactiveDecay *m_pRadioactiveDecay;
};
#endif
@@ -0,0 +1,85 @@
// ********************************
// * *
// * BrachyWaterBoxHit.hh *
// * *
// ********************************
#ifndef BrachyWaterBoxHit_h
#define BrachyWaterBoxHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
class BrachyWaterBoxHit : public G4VHit
{
public:
BrachyWaterBoxHit(G4LogicalVolume* logVol,G4int XID,G4int ZID);
~BrachyWaterBoxHit();
BrachyWaterBoxHit(const BrachyWaterBoxHit &right);
const BrachyWaterBoxHit& operator=(const BrachyWaterBoxHit &right);
int operator==(const BrachyWaterBoxHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
void Draw();
void Print();
private:
G4ThreeVector m_Pos;
G4RotationMatrix m_Rot;
const G4LogicalVolume* m_pLogV;
G4double m_Edep;
G4int m_XID;
G4int m_ZID;
public:
inline void SetCellID(G4int XID,G4int ZID)
{m_XID = XID;m_ZID = ZID;}
inline G4int GetXID()
{return m_XID;}
inline G4int GetZID()
{return m_ZID;}
inline void SetEdep(G4double edep)
{m_Edep = edep;}
inline void AddEdep(G4double edep)
{m_Edep += edep;}
inline G4double GetEdep()
{return m_Edep;}
inline void SetPos(G4ThreeVector xyz)
{m_Pos = xyz;}
inline G4ThreeVector GetPos()
{return m_Pos;}
inline void SetRot(G4RotationMatrix rmat)
{m_Rot = rmat;}
inline G4RotationMatrix GetRot()
{return m_Rot;}
inline const G4LogicalVolume * GetLogV()
{return m_pLogV;}
};
typedef G4THitsCollection<BrachyWaterBoxHit> BrachyWaterBoxHitsCollection;
extern G4Allocator<BrachyWaterBoxHit> BrachyWaterBoxHitAllocator;
inline void* BrachyWaterBoxHit::operator new(size_t)
{
void *aHit;
aHit = (void *) BrachyWaterBoxHitAllocator.MallocSingle();
return aHit;
}
inline void BrachyWaterBoxHit::operator delete(void *aHit)
{
BrachyWaterBoxHitAllocator.FreeSingle((BrachyWaterBoxHit*) aHit);
}
#endif
@@ -0,0 +1,29 @@
// ************************************
// * *
// * BrachyWaterBoxROGeometry.hh *
// * *
// ************************************
#ifndef BrachyWaterBoxROGeometry_h
#define BrachyWaterBoxROGeometry_h 1
#include "G4VReadOutGeometry.hh"
class BrachyWaterBoxROGeometry : public G4VReadOutGeometry
{
public:
BrachyWaterBoxROGeometry(G4String aString,G4double DetDimX,G4double DetDimZ,G4int NumVoxelX,G4int NumVoxelZ);
~BrachyWaterBoxROGeometry();
public:
const G4double m_DetDimX;
const G4double m_DetDimZ;
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
private:
G4VPhysicalVolume* Build();
};
#endif
@@ -0,0 +1,37 @@
// ********************************
// * *
// * BrachyWaterBoxSD.hh *
// * *
// ********************************
#ifndef BrachyWaterBoxSD_h
#define BrachyWaterBoxSD_h 1
#include "G4VSensitiveDetector.hh"
#include "BrachyWaterBoxHit.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class BrachyWaterBoxSD : public G4VSensitiveDetector
{
public:
BrachyWaterBoxSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ);
~BrachyWaterBoxSD();
void Initialize(G4HCofThisEvent*HCE);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
private:
BrachyWaterBoxHitsCollection *m_pWaterBoxHitsCollection;
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
G4int *m_pVoxelID;
};
#endif
@@ -0,0 +1,183 @@
// ****************************************
// * *
// * BrachyDetectorConstruction.cc *
// * *
// ****************************************
#include "BrachyWaterBoxROGeometry.hh"
#include "BrachyWaterBoxSD.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4CSGSolid.hh"
#include "G4Sphere.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4SDManager.hh"
#include "G4SubtractionSolid.hh"
#include "G4RunManager.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4PVParameterised.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
//....
BrachyDetectorConstruction::BrachyDetectorConstruction(G4String &SDName,G4int NumVoxelX,G4int NumVoxelZ) :
m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ),m_BoxDimX(30*cm),m_BoxDimY(30*cm),m_BoxDimZ(30*cm)
{
m_SDName = SDName;
}
//....
BrachyDetectorConstruction::~BrachyDetectorConstruction()
{
}
//....
G4VPhysicalVolume* BrachyDetectorConstruction::Construct()
{
// Define required materials
G4double A; // atomic mass
G4double Z; // atomic number
G4double d; // density
// General elements
A = 1.01*g/mole;
Z = 1;
G4Element* elH = new G4Element ("Hydrogen","H",Z,A);
A = 14.01*g/mole;
Z = 7;
G4Element* elN = new G4Element("Nitrogen","N",Z,A);
A = 16.00*g/mole;
Z = 8;
G4Element* elO = new G4Element("Oxygen","O",Z,A);
// Elements for source capsule and cable
A = 54.94*g/mole;
Z = 25;
G4Element* elMn = new G4Element("Manganese","Mn",Z,A);
A = 28.09*g/mole;
Z = 14;
G4Element* elSi = new G4Element("Silicon","Si",Z,A);
A = 52.00*g/mole;
Z = 24;
G4Element* elCr = new G4Element("Chromium","Cr",Z,A);
A = 58.70*g/mole;
Z = 28;
G4Element* elNi = new G4Element("Nickel","Ni",Z,A);
A = 55.85*g/mole;
Z = 26;
G4Element* elFe = new G4Element("Iron","Fe",Z,A);
// Lead material
A = 207.19*g/mole;
Z = 82;
d = 11.35*g/cm3;
G4Material* matPb = new G4Material("Lead",Z,A,d);
// Air material
d = 1.290*mg/cm3;
G4Material* matAir = new G4Material("Air",d,2);
matAir->AddElement(elN,0.7);
matAir->AddElement(elO,0.3);
// Water
d = 1.000*g/cm3;
G4Material* matH2O = new G4Material("Water",d,2);
matH2O->AddElement(elH,2);
matH2O->AddElement(elO,1);
// Iridium (Medical Physics, Vol 25, No 10, Oct 1998)
d = 22.42*g/cm3;
A = 191.96260*g/mole ;
Z = 77;
G4Material* matIr192 = new G4Material("Iridium",Z,A,d);
// Stainless steel (Medical Physics, Vol 25, No 10, Oct 1998)
d = 8.02*g/cm3 ;
G4Material* matSteel = new G4Material("Stainless steel",d,5);
matSteel->AddElement(elMn, 0.02);
matSteel->AddElement(elSi, 0.01);
matSteel->AddElement(elCr, 0.19);
matSteel->AddElement(elNi, 0.10);
matSteel->AddElement(elFe, 0.68);
// Volumes
// EXPERIMENTAL HALL (our world volume)
G4double ExpHall_x = 4.0*m;
G4double ExpHall_y = 4.0*m;
G4double ExpHall_z = 4.0*m;
G4Box* ExpHall = new G4Box("ExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
G4LogicalVolume* ExpHallLog = new G4LogicalVolume(ExpHall,matAir,"ExpHallLog",0,0,0);
G4VPhysicalVolume* ExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ExpHallPhys",ExpHallLog,0,false,0);
// Water Box
G4Box* WaterBox = new G4Box("WaterBox",m_BoxDimX/2,m_BoxDimY/2,m_BoxDimZ/2);
G4LogicalVolume* WaterBoxLog = new G4LogicalVolume(WaterBox,matH2O,"WaterBoxLog",0,0,0);
G4VPhysicalVolume* WaterBoxPhys = new G4PVPlacement(0,G4ThreeVector(),WaterBoxLog,"WaterBoxPhys",ExpHallLog,false,0);
// Capsule main body
G4Tubs* Capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
G4LogicalVolume* CapsuleLog = new G4LogicalVolume(Capsule,matSteel,"CapsuleLog");
G4VPhysicalVolume* CapsulePhys = new G4PVPlacement(0,G4ThreeVector(0,0,-1.975),CapsuleLog,"CapsulePhys",WaterBoxLog,false,0);
// Capsule tip
G4Sphere* CapsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg);
G4LogicalVolume* CapsuleTipLog = new G4LogicalVolume(CapsuleTip,matSteel,"CapsuleTipLog");
G4VPhysicalVolume* CapsuleTipPhys = new G4PVPlacement(0,G4ThreeVector(0.,0.,1.75*mm),CapsuleTipLog,"CapsuleTipPhys",WaterBoxLog,false,0);
// Iridium core
G4Tubs* IridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
G4LogicalVolume* IridiumCoreLog = new G4LogicalVolume(IridiumCore,matIr192,"IridiumCoreLog");
G4VPhysicalVolume* IridiumCorePhys = new G4PVPlacement(0,G4ThreeVector(),IridiumCoreLog,"IridiumCorePhys",CapsuleLog,false,0);
// Sensitive Detector and ReadOut geometry definition
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
BrachyWaterBoxSD* pWaterBoxSD = new BrachyWaterBoxSD(m_SDName,m_NumVoxelX,m_NumVoxelZ);
if(pWaterBoxSD)
{
G4String ROGeometryName = "WaterBoxROGeometry";
BrachyWaterBoxROGeometry* pWaterBoxROGeometry = new BrachyWaterBoxROGeometry(ROGeometryName,m_BoxDimX,m_BoxDimZ,m_NumVoxelX,m_NumVoxelZ);
pWaterBoxROGeometry->BuildROGeometry();
pWaterBoxSD->SetROgeometry(pWaterBoxROGeometry);
pSDManager->AddNewDetector(pWaterBoxSD);
WaterBoxLog->SetSensitiveDetector(pWaterBoxSD);
CapsuleLog->SetSensitiveDetector(pWaterBoxSD);
CapsuleTipLog->SetSensitiveDetector(pWaterBoxSD);
IridiumCoreLog->SetSensitiveDetector(pWaterBoxSD);
}
return ExpHallPhys;
}
@@ -0,0 +1,69 @@
// *******************************
// * *
// * BrachyEventAction.cc *
// * *
// *******************************
#include "BrachyEventAction.hh"
#include "BrachyWaterBoxHit.hh"
#include "BrachyWaterBoxSD.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
//....
BrachyEventAction::BrachyEventAction(G4float *pVoxel,G4int NumVoxelX,G4int NumVoxelZ) :
m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
m_HitsCollectionID = -1;
m_pVoxel = pVoxel;
}
//....
BrachyEventAction::~BrachyEventAction()
{
}
//....
void BrachyEventAction::BeginOfEventAction(const G4Event*)
{
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
if(m_HitsCollectionID == -1)
m_HitsCollectionID = pSDManager->GetCollectionID("WaterBoxHitsCollection");
}
//....
void BrachyEventAction::EndOfEventAction(const G4Event* evt)
{
if(m_HitsCollectionID < 0)
return;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
BrachyWaterBoxHitsCollection* CHC = NULL;
if(HCE)
CHC = (BrachyWaterBoxHitsCollection*)(HCE->GetHC(m_HitsCollectionID));
if(CHC)
{
if(m_pVoxel)
{
// Fill voxel matrix with energy deposit data
G4int HitCount = CHC->entries();
for (G4int h=0; h<HitCount; h++)
m_pVoxel[((*CHC)[h])->GetZID() + ((*CHC)[h])->GetXID()*m_NumVoxelX] += (*CHC)[h]->GetEdep();
}
}
}
@@ -0,0 +1,236 @@
// **********************************
// * *
// * BrachyPhysicsList.cc *
// * *
// **********************************
#include "BrachyPhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
BrachyPhysicsList::BrachyPhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 1*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForPositron = defaultCutValue;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
BrachyPhysicsList::~BrachyPhysicsList()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::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();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::ConstructBosons()
{
// gamma
G4Gamma::GammaDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4MultipleScattering.hh"
// gamma
#include "G4LowEnergyRayleigh.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
// e-
#include "G4LowEnergyIonisation.hh"
#include "G4LowEnergyBremsstrahlung.hh"
// e+
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
//processes
lowePhot = new G4LowEnergyPhotoElectric("LowEnPhotoElec");
loweIon = new G4LowEnergyIonisation("LowEnergyIoni");
loweBrem = new G4LowEnergyBremsstrahlung("LowEnBrem");
if (particleName == "gamma") {
//gamma
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
pmanager->AddDiscreteProcess(lowePhot);
pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);
} else if (particleName == "e-") {
//electron
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager->AddProcess(loweIon, -1, 2,2);
pmanager->AddProcess(loweBrem, -1,-1,3);
} else if (particleName == "e+") {
//positron
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForPositron, "e+");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetGammaLowLimit(G4double lowcut)
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::SetCuts:";
G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
}
G4Gamma::SetEnergyRange(lowcut,1e5);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetElectronLowLimit(G4double lowcut)
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::SetCuts:";
G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
}
G4Electron::SetEnergyRange(lowcut,1e5);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetGELowLimit(G4double lowcut)
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::SetCuts:";
G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
}
G4Gamma::SetEnergyRange(lowcut,1e5);
G4Electron::SetEnergyRange(lowcut,1e5);
G4Positron::SetEnergyRange(lowcut,1e5);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetGammaCut(G4double val)
{
ResetCuts();
cutForGamma = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetElectronCut(G4double val)
{
// ResetCuts();
cutForElectron = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetPositronCut(G4double val)
{
// ResetCuts();
cutForPositron = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetLowEnSecPhotCut(G4double cut){
G4cout<<"Low energy secondary photons cut is now set to: "<<cut*MeV<<" (MeV)"<<G4endl;
G4cout<<"for processes LowEnergyPhotoElectric, LowEnergyBremsstrahlung, LowEnergyIonisation"<<G4endl;
lowePhot->SetCutForLowEnSecPhotons(cut);
loweIon->SetCutForLowEnSecPhotons(cut);
loweBrem->SetCutForLowEnSecPhotons(cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetLowEnSecElecCut(G4double cut){
G4cout<<"Low energy secondary electrons cut is now set to: "<<cut*MeV<<" (MeV)"<<G4endl;
G4cout<<"for processes LowEnergyIonisation"<<G4endl;
loweIon->SetCutForLowEnSecElectrons(cut);
}
@@ -0,0 +1,80 @@
// ********************************************
// * *
// * BrachyPrimaryGeneratorAction.cc *
// * *
// ********************************************
#include "BrachyPrimaryGeneratorAction.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4RadioactiveDecay.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include <math.h>
//....
BrachyPrimaryGeneratorAction::BrachyPrimaryGeneratorAction()
{
// Generate a gamma particle with energy = Ir-192 mean energy
G4int NumParticles = 1;
G4double Energy = 0.356*MeV;
m_pParticleGun = new G4ParticleGun(NumParticles);
if(m_pParticleGun)
m_pParticleGun->SetParticleEnergy(Energy);
}
//....
BrachyPrimaryGeneratorAction::~BrachyPrimaryGeneratorAction()
{
if(m_pParticleGun)
delete m_pParticleGun;
}
//....
void BrachyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4ParticleTable* pParticleTable = G4ParticleTable::GetParticleTable();
G4String ParticleName = "gamma";
G4ParticleDefinition* pParticle = pParticleTable->FindParticle(ParticleName);
m_pParticleGun->SetParticleDefinition(pParticle);
// Random generation of gamma source point inside the Iridium core cylinder(R=0.3*mm,h=3.5*mm)
G4double radius = 0.3*mm;
G4double x,y,z;
do{
x = (G4UniformRand()-0.5)*radius/0.5;
y = (G4UniformRand()-0.5)*radius/0.5;
}while(x*x+y*y > radius*radius);
z = (G4UniformRand()-0.5)*1.75*mm/0.5;
G4ThreeVector position(x,y,z);
m_pParticleGun->SetParticlePosition(position);
// Random generation of the impulse direction
G4double a,b,c;
G4double n;
do{
a = (G4UniformRand()-0.5)/0.5;
b = (G4UniformRand()-0.5)/0.5;
c = (G4UniformRand()-0.5)/0.5;
n = a*a+b*b+c*c;
}while(n > 1 || n == 0.0);
n = sqrt(n);
a /= n;
b /= n;
c /= n;
G4ThreeVector direction(a,b,c);
m_pParticleGun->SetParticleMomentumDirection(direction);
m_pParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,72 @@
// ********************************
// * *
// * BrachyWaterBoxHit.cc *
// * *
// ********************************
#include "BrachyWaterBoxHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
G4Allocator<BrachyWaterBoxHit> BrachyWaterBoxHitAllocator;
//....
BrachyWaterBoxHit::BrachyWaterBoxHit(G4LogicalVolume* logVol,G4int XID,G4int ZID)
:m_pLogV(logVol),m_XID(XID),m_ZID(ZID)
{
m_Edep=0;
}
//....
BrachyWaterBoxHit::~BrachyWaterBoxHit()
{
}
//....
BrachyWaterBoxHit::BrachyWaterBoxHit(const BrachyWaterBoxHit &right)
{
m_XID = right.m_XID;
m_ZID = right.m_ZID;
m_Edep = right.m_Edep;
m_Pos = right.m_Pos;
m_Rot = right.m_Rot;
m_pLogV = right.m_pLogV;
}
//....
const BrachyWaterBoxHit& BrachyWaterBoxHit::operator=(const BrachyWaterBoxHit &right)
{
m_XID = right.m_XID;
m_ZID = right.m_ZID;
m_Edep = right.m_Edep;
m_Pos = right.m_Pos;
m_Rot = right.m_Rot;
m_pLogV = right.m_pLogV;
return *this;
}
//....
int BrachyWaterBoxHit::operator==(const BrachyWaterBoxHit &right) const
{
return((m_XID==right.m_XID)&&(m_ZID==right.m_ZID));
}
//....
void BrachyWaterBoxHit::Draw()
{
}
//....
void BrachyWaterBoxHit::Print()
{
}
@@ -0,0 +1,94 @@
// ************************************
// * *
// * BrachyWaterBoxROGeometry.cc *
// * *
// ************************************
#include "BrachyWaterBoxROGeometry.hh"
#include "BrachyDummySD.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4SubtractionSolid.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
//....
BrachyWaterBoxROGeometry::BrachyWaterBoxROGeometry(G4String aString,G4double DetDimX,G4double DetDimZ,G4int NumVoxelX,G4int NumVoxelZ)
: G4VReadOutGeometry(aString),m_DetDimX(DetDimX),m_DetDimZ(DetDimZ),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
}
//....
BrachyWaterBoxROGeometry::~BrachyWaterBoxROGeometry()
{
}
//....
G4VPhysicalVolume* BrachyWaterBoxROGeometry::Build()
{
// A dummy material is used to fill the volumes of the readout geometry.
// (It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
// Slice thickness is the average of Voxel X and Z sizes
G4double DetVoxel_y = (m_DetDimX/m_NumVoxelX+m_DetDimZ/m_NumVoxelZ)/2.0;
G4double ExpHall_x = 4.0*m;
G4double ExpHall_y = 4.0*m;
G4double ExpHall_z = 4.0*m;
G4double Det_x = m_DetDimX/2;
G4double Det_y = DetVoxel_y;
G4double Det_z = m_DetDimZ/2;
G4double DetVoxelX_x = Det_x/m_NumVoxelX;
G4double DetVoxelX_y = DetVoxel_y;
G4double DetVoxelX_z = Det_z;
G4double DetVoxelX_dx = 2*DetVoxelX_x;
G4double DetVoxelZ_x = Det_x;
G4double DetVoxelZ_y = DetVoxel_y;
G4double DetVoxelZ_z = Det_z/m_NumVoxelZ;
G4double DetVoxelZ_dz = 2*DetVoxelZ_z;
G4Box *ROExpHall = new G4Box("ROExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
G4LogicalVolume *ROExpHallLog = new G4LogicalVolume(ROExpHall,dummyMat,"ROExpHallLog",0,0,0);
G4VPhysicalVolume *ROExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ROExpHallPhys",ROExpHallLog,0,false,0);
G4Box *RODetector = new G4Box("RODetector", Det_x, Det_y, Det_z);
G4LogicalVolume *RODetectorLog = new G4LogicalVolume(RODetector,dummyMat,"RODetectorLog",0,0,0);
G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,G4ThreeVector(),"DetectorPhys",RODetectorLog,ROExpHallPhys,false,0);
// ReadOut Voxel division
// X division first...
G4Box *RODetectorXDivision = new G4Box("RODetectorXDivision",DetVoxelX_x,DetVoxelX_y,DetVoxelX_z);
G4LogicalVolume *RODetectorXDivisionLog = new G4LogicalVolume(RODetectorXDivision,dummyMat,"RODetectorXDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",RODetectorXDivisionLog,RODetectorPhys,kXAxis,m_NumVoxelX,DetVoxelX_dx);
// ...then Z division
G4Box *RODetectorZDivision = new G4Box("RODetectorZDivision",DetVoxelZ_x,DetVoxelZ_y,DetVoxelZ_z);
G4LogicalVolume *RODetectorZDivisionLog = new G4LogicalVolume(RODetectorZDivision,dummyMat,"RODetectorZDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorZDivisionPhys = new G4PVReplica("RODetectorZDivisionPhys",RODetectorZDivisionLog,RODetectorXDivisionPhys,kZAxis,m_NumVoxelZ,DetVoxelZ_dz);
BrachyDummySD *dummySD = new BrachyDummySD;
RODetectorZDivisionLog->SetSensitiveDetector(dummySD);
return ROExpHallPhys;
}
@@ -0,0 +1,119 @@
// ********************************
// * *
// * BrachyWaterBoxSD.cc *
// * *
// ********************************
#include "BrachyWaterBoxSD.hh"
#include "BrachyWaterBoxHit.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4Track.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ParticleDefinition.hh"
//....
BrachyWaterBoxSD::BrachyWaterBoxSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ)
:G4VSensitiveDetector(name),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
G4String HCname;
collectionName.insert(HCname="WaterBoxHitsCollection");
m_pVoxelID = new G4int[NumVoxelX*NumVoxelZ];
m_pWaterBoxHitsCollection = NULL;
}
//....
BrachyWaterBoxSD::~BrachyWaterBoxSD()
{
delete[] m_pVoxelID;
}
//....
void BrachyWaterBoxSD::Initialize(G4HCofThisEvent*HCE)
{
m_pWaterBoxHitsCollection = new BrachyWaterBoxHitsCollection(SensitiveDetectorName,collectionName[0]);
for(G4int k=0;k<m_NumVoxelZ;k++)
for(G4int i=0;i<m_NumVoxelX;i++)
m_pVoxelID[i+k*m_NumVoxelX] = -1;
}
//....
G4bool BrachyWaterBoxSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
if(!ROhist)
return false;
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "WaterBoxPhys")
return false;
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.)
return false;
G4VPhysicalVolume* physVol = ROhist->GetVolume();
G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
// Read Voxel indexes: i is the x index, k is the z index
G4int k = ROhist->GetReplicaNumber();
G4int i = ROhist->GetReplicaNumber(1);
if(m_pVoxelID[i+k*m_NumVoxelX]==-1)
{
BrachyWaterBoxHit* WaterBoxHit = new BrachyWaterBoxHit(physVol->GetLogicalVolume(),i,k);
G4RotationMatrix rotM;
if(physVol->GetObjectRotation())
rotM = *(physVol->GetObjectRotation());
WaterBoxHit->SetEdep(edep);
WaterBoxHit->SetPos(physVol->GetTranslation());
WaterBoxHit->SetRot(rotM);
G4int VoxelID = m_pWaterBoxHitsCollection->insert(WaterBoxHit);
m_pVoxelID[i+k*m_NumVoxelX] = VoxelID - 1;
}
else
(*m_pWaterBoxHitsCollection)[m_pVoxelID[i+k*m_NumVoxelX]]->AddEdep(edep);
return true;
}
//....
void BrachyWaterBoxSD::EndOfEvent(G4HCofThisEvent*HCE)
{
static G4int HCID = -1;
if(HCID<0)
{
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection(HCID,m_pWaterBoxHitsCollection);
}
//....
void BrachyWaterBoxSD::clear()
{
}
//....
void BrachyWaterBoxSD::DrawAll()
{
}
//....
void BrachyWaterBoxSD::PrintAll()
{
}
@@ -0,0 +1,23 @@
# $Id: GNUmakefile,v 1.3 2000/12/06 16:53:11 flongo Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := GammaRayTel
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
@@ -0,0 +1,144 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTel.cc,v 1.3 2000/12/06 16:53:12 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 main program
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTel example main program ------
// by F.Longo, R.Giannitrapani & G.Santin (29 nov 2000)
// See README file for details on this example
// ************************************************************
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#ifdef G4UI_USE_XM
#include "G4UIXm.hh"
#endif
#ifdef G4VIS_USE
#include "GammaRayTelVisManager.hh"
#endif
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelPhysicsList.hh"
#include "GammaRayTelPrimaryGeneratorAction.hh"
#include "GammaRayTelRunAction.hh"
#include "GammaRayTelEventAction.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
/* This global file is used to store relevant data for
analysis with external tools */
G4std::ofstream outFile;
// This is the main function
int main(int argc, char** argv)
{
// Construct the default run manager
G4RunManager* runManager = new G4RunManager;
// Set mandatory user initialization classes
GammaRayTelDetectorConstruction* detector =
new GammaRayTelDetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new GammaRayTelPhysicsList);
// Set mandatory user action classes
runManager->SetUserAction(new GammaRayTelPrimaryGeneratorAction(detector));
#ifdef G4ANALYSIS_USE
// Creation of the analysis manager
GammaRayTelAnalysisManager* analysisMgr = new GammaRayTelAnalysisManager(detector);
#endif
// Set optional user action classes
#ifdef G4ANALYSIS_USE
GammaRayTelEventAction* eventAction =
new GammaRayTelEventAction(analysisMgr);
GammaRayTelRunAction* runAction =
new GammaRayTelRunAction(analysisMgr);
#else
GammaRayTelEventAction* eventAction = new GammaRayTelEventAction();
GammaRayTelRunAction* runAction = new GammaRayTelRunAction();
#endif
runManager->SetUserAction(eventAction);
runManager->SetUserAction(runAction);
// Set visualization and user interface
// Initialization of the User Interface Session
G4UIsession* session=0;
#ifdef G4UI_USE_XM
// Create a XMotif user interface
session = new G4UIXm(argc,argv);
#else
// Create the standard user interface
session = new G4UIterminal;
#endif
#ifdef G4VIS_USE
// Visualization manager
G4VisManager* visManager = new GammaRayTelVisManager;
visManager->Initialize();
#endif
// Initialize G4 kernel
runManager->Initialize();
// Get the pointer to the UI manager
G4UImanager* UI = G4UImanager::GetUIpointer();
if (session)
{
/* prerunGammaRayTel.mac is loaded by default
unless a macro file is passed as the argument
of the executable */
if(argc>1)
{
G4String command = "/control/execute ";
for (int i=2; i<=argc; i++)
{
G4String macroFileName = argv[i-1];
UI->ApplyCommand(command+macroFileName);
}
}
else UI->ApplyCommand("/control/execute prerunGammaRayTel.mac");
session->SessionStart();
delete session;
}
// Job termination
#ifdef G4VIS_USE
delete visManager;
#endif
#ifdef G4ANALYSIS_USE
delete analysisMgr;
#endif
delete runManager;
return 0;
}
+262
View File
@@ -0,0 +1,262 @@
$Id: README,v 1.2 2000/12/06 16:53:12 flongo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
gammaray_telescope
------------------
F.Longo, R.Giannitrapani & G.Santin
December 2000
--------------------------------------------------------------
Acknowledgments to GEANT4 people, in particular to R.Nartallo,
A.Pfeiffer, M.G.Pia and G.Cosmo
--------------------------------------------------------------
GammaRayTel is an example of application of Geant4 in a space
envinronment. It simulates a typical telescope for gamma ray analysis;
the detector setup is composed by a tracker made with silicon planes,
subdivided in ladders and strips, a CsI calorimeter and an
anticoincidence system. In this version, only the tracker is made
sensitive; the hits on the tracker strips are registered and relevant
information (energy deposition, position etc) are dumped to an external
ASCII file for subsequent analysis. If Lizard is available on the user
platform, than some histograms with relevant hits information are
displayed and saved as PostScript files.
The main features of this example are
a) Macros for the visualization of geometry and tracks with
OpenGL, VRML and DAWN drivers
b) Implementation of messengers to change some parameters of
the detector geometry, the particle generator and the analysis
manager (if present) runtime
c) Readout geometry mechanism to describe an high number of
subdivisions of the planes of the tracker (strips) without
affecting in a relevant way the simulation performances
d) Histogramming for Linux and Solaris platform via the
Lizard system (tested on Linux platform); this is a preliminary
feature of GEANT4, so expect some changes and/or improvements in
future releases
e) User interfaces via Xmotif or normal terminal provided
1. Setting up the environment variables
---------------------------------------
- Setup for Visualization
IMPORTANT: be sure that your Geant4 installation has been done
with the proper visualization drivers; for details please see the
file geant4/source/visualization/README.
To use the visualization drivers set the following variables in
your local environment:
setenv G4VIS_USE_OPENGLX 1 # OpenGL visualization
setenv G4VIS_USE_DAWNFILE 1 # DAWN file
setenv G4VIS_USE_VRMLFILE 1 # VRML file
setenv G4VRMLFILE_VIEWER vrmlview # If installed
- Setup for Xmotif user interface
setenv G4UI_USE_XM 1
- Set up for analysis using Lizard
IMPORTANT: be sure that your G4 installation has been done properly;
in particular be sure that the following environment variables are
set prior to build the library (this is working only on Linux and
Solaris platform)
setenv G4ANALYSIS_BUILD 1 # Build the analysis tools
setenv G4ANALYSIS_BUILD_LIZARD 1 # Build the Lizard interface
setenv LIZARDROOT /usr/local/freeLizard/3.2.0 #get correct path
For example at CERN the path is
setenv LIZARDROOT /afs/cern.ch/project/asddat/lhcxx/3.2.0/freeLizard/3.2.0
To compile the GammaRayTel example with the analysis tools activated,
set the following variables
setenv G4ANALYSIS_USE 1 # Use the analysis tools
setenv G4ANALYSIS_USE_LIZARD 1 # Use the Lizard one
and be sure to have the right path to the Lizard library
#add to the LD_LIBRARY_PATH (get correct path)
setenv LD_LIBRARY_PATH /usr/local/freeLizard/3.2.0/Linux/lib
For example at CERN the path is
setenv LD_LIBRARY_PATH /afs/cern.ch/project/asddat/lhcxx/3.2.0/freeLizard/3.2.0/Linux/lib
2. Sample run
-------------
To run a sample simulation with gamma tracks interacting with
the detector in its standard configuration and without any
visualization, execute the following command in the example main
directory:
$G4WORKDIR/bin/$G4SYSTEM/GammaRayTel
It is possible also to run three different configuration defined in
macro1.mac, macro2.mac and macro3.mac for visualization (OpenGL, VRML
and DAWN respectively) with the following command
$G4WORKDIR/bin/$G4SYSTEM/GammaRayTel macroX.mac
where X can be 1, 2 or 3. Be sure to have the right environment (see
the preceding section) and the proper visualization driver enabled in
your local G4 installation (see geant4/source/visualization/README for
more information).
3. Detector description
-----------------------
The detector is defined in GammaRayTelDetectorConstruction.cc
It is composed of a Payload with three main detectors, a Tracker (TKR), a
Calorimeter (CAL) and an Anticoincidence system (ACD).
The standard configuration is made of a TKR of 15 Layers of Si detectors,
with Lead converter, and a CAL of 8 layers of CsI. 4 lateral panels and a
top layer of plastic scintillator (ACT and ACL) complete the configuration.
The Si detectors are composed of two silicon planes subdivided in strips
aligned along the X axis in one plane and along the Y axis for the other.
It is possible to modify in some way this configuration using the
commands defined in GammaRayTelDetectorMessenger.
This feature is available in the UI throught the commands subtree
"/payload/" (see the help command in the UI for more information).
4. Physics processes
--------------------
This example uses the standard Electromagnetic processes.
5. Particle Generator
---------------------
The GammaRayTelParticleGenerationAction and its Messenger let the user define
the incident flux of particles, from a specific direction or from an
isotropic background. The user can define also between two spectral options:
monochromatic or with a power-law dependence. The particle
generator parameters are accessible throught the UI tree "/gun/" (use the
UI help for more information). We are planning to include, in the next
release of this example, the new General Particle Source module of G4.
6. ReadOutGeometry
------------------
The tracker is made of Silicon Microstrips detectors. The ReadOut geometry
provides the description of the strips.
7. Hit
------
In this version only the hits from the TKR are recorded. Each hit
contains the following information
a) ID of the event (this is important for multiple events run)
b) Energy deposition of the particle in the strip (keV)
c) Number of the strip
d) Number of the plane
e) Type of the plane (1=X 0=Y)
f) Position of the hit (x,y,z) in the reference frame of the payload
The hit information are saved on an ASCII file named Tracks_N.dat, where
N is the progressive ID number associated to the run.
8. Histogramming
----------------
Some hits information can be visualized runtime using Lizard (if it is
available on the user platform); two 2D histograms and two 1D histograms
can be visualized and saved (as PostScript files) during the simulation
run. The 2D histograms contain the hits positions on the TKR projected on
the XZ plane and the YZ plane; the 1D histograms contain the energy
deposition in the last X plane of the TKR and the hits distribution along
the X planes of the TKR (note that this histograms have been chosen more
for pedagogical motivation than for physical one).
These histograms are filled and updated at every event and are initialized
with each new run; the scale of the histograms is automatically derived from
the detector geometry.
Throught a messenger it is possible to set some options with
the UI subtree "/analysis/" (use the UI help for more info); in particular
it is possible to enable or disable the drawing of the 1D and 2D histograms
at every event and to enable or disable the saving of PostScript files at the
end of each run. If you feel that the simulation is too slow with the
histograms updated every event, you can disable the drawing and retain
the saving. Please note that the updating of the histograms is triggered
only when there is some hit in an event.
In this example we only show the use of very basic feature of this new
simulation/analysis framework; histogramming and analysis in Geant4
are in an evolving phase, so expect some changes and/or improvements
for next releases.
9. Classes Overview
-------------------
This is the overview of the classes defined in this example
GammaRayTelPrimaryGeneratorAction
User action for primaries generator
GammaRayTelPrimaryGeneratorMessenger
Messenger for interactive particle generator
parameters modification via the User Interface
GammaRayTelPhysicsList
Determination of particles and processes active in this
example
GammaRayTelTelVisManager
Visualization manager class
GammaRayTelDetectorConstruction
Geometry and material definitions for the detector
GammaRayTelDetectorMessenger
Messenger for interactive geometry parameters
modification via the User Interface
GammaRayTelAnalysisManager
Analysis manager class with Lizard tool (experimental)
GammaRayTelAnalysisMessenger
Messenger for interactive analysis options modification
via the User Interface
GammaRayTelRunAction
User run action class
GammaRayTelEventAction
User event action class
GammaRayTelPayloadHit
Description of the hits on the tracker
GammaRayTelPayloadROGeometry
Description of the readout geometry for strips subdivision
GammaRayTelPayloadSD
Description of the sensitive detector
@@ -0,0 +1,99 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelAnalysisManager.hh,v 1.1 2000/12/06 16:53:12 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelAnalysisManager ------
// by R.Giannitrapani, F. Longo & G.Santin (30 nov 2000)
//
// ************************************************************
#ifdef G4ANALYSIS_USE
#ifndef GammaRayTelAnalysisManager_h
#define GammaRayTelAnalysisManager_h 1
#include "G4VAnalysisManager.hh"
#include "globals.hh"
#include "g4std/vector"
#include "G4ThreeVector.hh"
class GammaRayTelAnalysisMessenger;
class GammaRayTelDetectorConstruction;
class IHistogramFactory;
class IHistogram1D;
class IHistogram2D;
class IPlotter;
class IVectorFactory;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelAnalysisManager: public G4VAnalysisManager
{
public:
GammaRayTelAnalysisManager(GammaRayTelDetectorConstruction*);
virtual ~GammaRayTelAnalysisManager();
public:
G4bool RegisterAnalysisSystem(G4VAnalysisSystem*);
IHistogramFactory* GetHistogramFactory(const G4String&);
void Store(IHistogram* = 0, const G4String& = "");
void Plot(IHistogram* = 0);
void InsertPositionXZ(double x, double z);
void InsertPositionYZ(double y, double z);
void InsertEnergy(double en);
void InsertHits(int nplane);
void BeginOfRun();
void EndOfRun(G4int n);
void EndOfEvent(G4int flag);
void SetHisto1DDraw(G4String str) {histo1DDraw = str;};
void SetHisto1DSave(G4String str) {histo1DSave = str;};
void SetHisto2DDraw(G4String str) {histo2DDraw = str;};
void SetHisto2DSave(G4String str) {histo2DSave = str;};
void SetHisto2DMode(G4String str) {histo2DMode = str;};
G4String GetHisto2DMode() {return histo2DMode;};
private:
G4VAnalysisSystem* analysisSystem;
IPlotter* pl;
IVectorFactory* fVectorFactory;
IHistogramFactory* histoFactory;
IHistogram1D* energy;
IHistogram1D* hits;
IHistogram2D* posXZ;
IHistogram2D* posYZ;
GammaRayTelDetectorConstruction* GammaRayTelDetector;
G4String histo1DDraw;
G4String histo1DSave;
G4String histo2DDraw;
G4String histo2DSave;
G4String histo2DMode;
GammaRayTelAnalysisMessenger* analysisMessenger;
};
#endif
#endif
@@ -0,0 +1,66 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelAnalysisMessenger.hh,v 1.1 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelAnalysysMessenger ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dec 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4ANALYSIS_USE
#ifndef GammaRayTelAnalysisMessenger_h
#define GammaRayTelAnalysisMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class GammaRayTelAnalysisManager;
class G4UIdirectory;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelAnalysisMessenger: public G4UImessenger
{
public:
GammaRayTelAnalysisMessenger(GammaRayTelAnalysisManager* );
~GammaRayTelAnalysisMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
GammaRayTelAnalysisManager* GammaRayTelAnalysis;
G4UIdirectory* GammaRayTelAnalysisDir;
G4UIcmdWithAString* Histo1DDrawCmd;
G4UIcmdWithAString* Histo2DDrawCmd;
G4UIcmdWithAString* Histo1DSaveCmd;
G4UIcmdWithAString* Histo2DSaveCmd;
G4UIcmdWithAString* Histo2DModeCmd;
};
#endif
#endif
@@ -0,0 +1,288 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDetectorConstruction.hh,v 1.4 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDetectorConstruction ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#ifndef GammaRayTelDetectorConstruction_h
#define GammaRayTelDetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4UniformMagField;
class GammaRayTelDetectorMessenger;
class GammaRayTelPayloadSD;
class GammaRayTelPayloadROGeometry;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelDetectorConstruction : public G4VUserDetectorConstruction
{
public:
GammaRayTelDetectorConstruction();
~GammaRayTelDetectorConstruction();
public:
void SetNbOfTKRLayers (G4int); // TKR number of layers, material, detector
void SetTKRTileSizeXY (G4double);
void SetNbOfTKRTiles (G4int);
void SetTKRSiliconThickness(G4double);
void SetTKRSiliconPitch(G4double);
void SetTKRLayerDistance (G4double);
void SetTKRViewsDistance (G4double);
void SetConverterMaterial (G4String); // TKR Converter material & thickness
void SetConverterThickness(G4double);
void SetNbOfCALLayers (G4int); // CAL material, lenght, thickness
void SetNbOfCALBars (G4int);
void SetCALBarThickness(G4double);
void SetACDThickness (G4double); //ACD Thickness
void SetMagField(G4double); // Magnetic Field
G4VPhysicalVolume* Construct();
void UpdateGeometry();
public:
void PrintPayloadParameters();
G4double GetWorldSizeZ() {return WorldSizeZ;};
G4double GetWorldSizeXY() {return WorldSizeXY;};
G4double GetPayloadSizeZ() {return PayloadSizeZ;};
G4double GetPayloadSizeXY() {return PayloadSizeXY;};
G4double GetTKRSizeZ() {return TKRSizeZ;};
G4double GetTKRSizeXY() {return TKRSizeXY;};
G4double GetCALSizeZ() {return CALSizeZ;};
G4double GetCALTKRDistance() {return CALTKRDistance;};
G4double GetTKRSiliconThickness() {return TKRSiliconThickness;};
G4double GetTKRSiliconTileXY() {return TKRSiliconTileXY;};
G4double GetTKRSiliconPitch() {return TKRSiliconPitch;};
G4int GetNbOfTKRLayers() {return NbOfTKRLayers;};
G4int GetNbOfTKRTiles() {return NbOfTKRTiles;};
G4int GetNbOfTKRStrips() {return NbOfTKRStrips;};
G4double GetTKRLayerDistance() {return TKRLayerDistance;};
G4double GetTKRViewsDistance() {return TKRViewsDistance;};
G4double GetTKRActiveTileXY() {return TKRActiveTileXY;};
G4double GetTKRActiveTileZ() {return TKRActiveTileZ;};
G4double GetSiliconGuardRing() {return SiliconGuardRing;}
G4double GetTilesSeparation() {return TilesSeparation;};
G4Material* GetConverterMaterial() {return ConverterMaterial;};
G4double GetConverterThickness() {return ConverterThickness;};
G4double GetCALBarThickness() {return CALBarThickness;};
G4int GetNbOfCALLayers() {return NbOfCALLayers;};
G4int GetNbOfCALBars() {return NbOfCALBars;};
G4double GetACDThickness() {return ACDThickness;};
private:
G4Material* ConverterMaterial;
G4double ConverterThickness;
G4double TKRSiliconThickness;
G4double TKRSiliconTileXY;
G4double TKRSiliconPitch;
G4double TKRSizeXY;
G4double TKRSizeZ;
G4double TKRLayerDistance;
G4double TKRViewsDistance;
G4double TKRSupportThickness;
G4int NbOfTKRLayers;
G4int NbOfTKRTiles;
G4double CALBarThickness;
G4int NbOfCALLayers;
G4int NbOfCALBars;
G4double CALSizeXY;
G4double CALSizeZ;
G4double ACDThickness;
G4double ACTSizeXY;
G4double ACTSizeZ;
G4double ACL1SizeX;
G4double ACL1SizeY;
G4double ACL1SizeZ;
G4double ACL2SizeX;
G4double ACL2SizeY;
G4double ACL2SizeZ;
G4double TilesSeparation;
G4double ACDTKRDistance;
G4double CALTKRDistance;
G4double TKRActiveTileXY;
G4double TKRActiveTileZ;
G4double SiliconGuardRing;
G4int NbOfTKRStrips;
G4double TKRXStripX;
G4double TKRYStripX;
G4double TKRXStripY;
G4double TKRYStripY;
G4double TKRZStrip;
G4double PayloadSizeZ;
G4double PayloadSizeXY;
G4Material* defaultMaterial;
G4Material* CALMaterial;
G4Material* TKRMaterial;
G4Material* ACDMaterial;
G4double WorldSizeXY;
G4double WorldSizeZ;
G4Box* solidWorld; // World
G4LogicalVolume* logicWorld;
G4VPhysicalVolume* physiWorld;
G4Box* solidPayload; // Payload
G4LogicalVolume* logicPayload;
G4VPhysicalVolume* physiPayload;
G4Box* solidTKR; // Tracker
G4LogicalVolume* logicTKR;
G4VPhysicalVolume* physiTKR;
G4Box* solidCAL; // Calorimeter
G4LogicalVolume* logicCAL;
G4VPhysicalVolume* physiCAL;
G4Box* solidACT; // Top Anticoincidence
G4LogicalVolume* logicACT;
G4VPhysicalVolume* physiACT;
G4Box* solidACL1; // Lateral Anticoincidence
G4LogicalVolume* logicACL1;
G4VPhysicalVolume* physiACL1;
G4Box* solidACL2;
G4LogicalVolume* logicACL2;
G4VPhysicalVolume* physiACL2;
G4Box* solidTKRDetectorX; // Tracker PLANE X
G4LogicalVolume* logicTKRDetectorX;
G4VPhysicalVolume* physiTKRDetectorX;
G4Box* solidTKRDetectorY; // Tracker PLANE Y
G4LogicalVolume* logicTKRDetectorY;
G4VPhysicalVolume* physiTKRDetectorY;
G4Box* solidCALDetector; // Calorimeter PLANE
G4LogicalVolume* logicCALDetector;
G4VPhysicalVolume* physiCALDetectorX;
G4VPhysicalVolume* physiCALDetectorY;
G4Box* solidPlane; // Support Plane
G4LogicalVolume* logicPlane;
G4VPhysicalVolume* physiPlane;
G4Box* solidConverter; // Converter
G4LogicalVolume* logicConverter;
G4VPhysicalVolume* physiConverter;
G4UniformMagField* magField; //pointer to the magnetic field
GammaRayTelDetectorMessenger* detectorMessenger; //pointer to the Messenger
GammaRayTelPayloadSD* payloadSD; //pointer to the sensitive detector
private:
void DefineMaterials();
void ComputePayloadParameters();
G4VPhysicalVolume* ConstructPayload();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void GammaRayTelDetectorConstruction::ComputePayloadParameters()
{
// Compute derived parameters of the payload
TKRSupportThickness =TKRLayerDistance -2.*TKRSiliconThickness
- TKRViewsDistance;
TKRSizeXY = NbOfTKRTiles*TKRSiliconTileXY + (NbOfTKRTiles+1)*TilesSeparation;
TKRSizeZ = NbOfTKRLayers*TKRLayerDistance;
TKRActiveTileXY = TKRSiliconTileXY - 2*SiliconGuardRing;
TKRActiveTileZ = TKRSiliconThickness;
NbOfTKRStrips = G4int(TKRActiveTileXY/TKRSiliconPitch);
SiliconGuardRing = TKRActiveTileXY - NbOfTKRStrips*TKRSiliconPitch;
TKRActiveTileXY = TKRSiliconTileXY - 2*SiliconGuardRing;
TKRXStripX = TKRYStripY = TKRSiliconPitch;
TKRYStripX = TKRXStripY = TKRActiveTileXY;
TKRZStrip = TKRSiliconThickness;
CALSizeXY = TKRSizeXY;
CALSizeZ = 2.*NbOfCALLayers*CALBarThickness;
ACTSizeXY = TKRSizeXY + 2*ACDTKRDistance + 2*ACDThickness;
ACTSizeZ = ACDThickness;
ACL1SizeX = TKRSizeXY + 2*ACDTKRDistance + ACDThickness;
ACL1SizeY = ACDThickness;
ACL1SizeZ = TKRSizeZ + CALSizeZ + ACDTKRDistance + CALTKRDistance;
ACL2SizeX = ACDThickness;
ACL2SizeY = TKRSizeXY + 2*ACDTKRDistance + ACDThickness;
ACL2SizeZ = TKRSizeZ + CALSizeZ + ACDTKRDistance + CALTKRDistance;
PayloadSizeZ = 1.1*(ACL1SizeZ + ACTSizeZ);
PayloadSizeXY = (ACTSizeXY);
WorldSizeZ = 1.5*PayloadSizeZ; WorldSizeXY = 1.5*PayloadSizeXY;
}
#endif
@@ -0,0 +1,97 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDetectorMessenger.hh,v 1.2 2000/11/15 20:27:38 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDetectorMessenger ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelDetectorMessenger_h
#define GammaRayTelDetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class GammaRayTelDetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelDetectorMessenger: public G4UImessenger
{
public:
GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction* );
~GammaRayTelDetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
GammaRayTelDetectorConstruction* GammaRayTelDetector;
G4UIdirectory* GammaRayTeldetDir;
// Converter
G4UIcmdWithAString* ConverterMaterCmd;
G4UIcmdWithADoubleAndUnit* ConverterThickCmd;
// Silicon Tile
G4UIcmdWithADoubleAndUnit* SiliconThickCmd;
G4UIcmdWithADoubleAndUnit* SiliconTileXYCmd;
G4UIcmdWithAnInteger* NbSiTilesCmd;
G4UIcmdWithADoubleAndUnit* SiliconPitchCmd;
// Tracker
G4UIcmdWithAnInteger* NbTKRLayersCmd;
G4UIcmdWithADoubleAndUnit* LayerDistanceCmd;
G4UIcmdWithADoubleAndUnit* ViewsDistanceCmd;
// Calorimeter
G4UIcmdWithADoubleAndUnit* CALThickCmd;
G4UIcmdWithAnInteger* NbCALBarsCmd;
G4UIcmdWithAnInteger* NbCALLayersCmd;
// Anticoincidence
G4UIcmdWithADoubleAndUnit* ACDThickCmd;
// Total
G4UIcmdWithADoubleAndUnit* MagFieldCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
#endif
@@ -0,0 +1,49 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDummySD.hh,v 1.1 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDummySD ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
//
// Dummy sensitive used only to flag sensitivity
// in cells of RO geometry.
//
#ifndef GammaRayTelDummySD_h
#define GammaRayTelDummySD_h 1
#include "G4VSensitiveDetector.hh"
class G4Step;
class GammaRayTelDummySD : public G4VSensitiveDetector
{
public:
GammaRayTelDummySD();
~GammaRayTelDummySD() {};
void Initialize(G4HCofThisEvent*HCE) {};
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) {return false;}
void EndOfEvent(G4HCofThisEvent*HCE) {};
void clear() {};
void DrawAll() {};
void PrintAll() {};
};
GammaRayTelDummySD::GammaRayTelDummySD()
: G4VSensitiveDetector("dummySD")
{}
#endif
@@ -0,0 +1,68 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelEventAction.hh,v 1.3 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelEventAction ------
// by R.Giannitrapani, F. Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelEventAction_h
#define GammaRayTelEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelEventAction : public G4UserEventAction
{
public:
#ifdef G4ANALYSIS_USE
GammaRayTelEventAction(GammaRayTelAnalysisManager* analysisMgr);
#else
GammaRayTelEventAction();
#endif
virtual ~GammaRayTelEventAction();
public:
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
void SetDrawFlag (G4String val) {drawFlag = val;};
private:
G4int trackerCollID;
G4String drawFlag;
#ifdef G4ANALYSIS_USE
GammaRayTelAnalysisManager* analysisManager;
#endif
};
#endif
@@ -0,0 +1,105 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadHit.hh,v 1.2 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadHit ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
// This Class describe the hits on the Payload
#ifndef GammaRayTelPayloadHit_h
#define GammaRayTelPayloadHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPayloadHit : public G4VHit
{
public:
GammaRayTelPayloadHit();
~GammaRayTelPayloadHit();
GammaRayTelPayloadHit(const GammaRayTelPayloadHit&);
const GammaRayTelPayloadHit& operator=(const GammaRayTelPayloadHit&);
int operator==(const GammaRayTelPayloadHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
void Draw();
void Print();
private:
G4double EdepSil; // Energy deposited on the silicon strip
G4ThreeVector pos; // Position of the hit
G4int NStrip; // Number of the strip
G4int NSilPlane; // Number of the plane
G4int IsXPlane; // Type of the plane (1 X, 0 Y)
public:
inline void AddSil(G4double de) {EdepSil += de;};
inline void SetNStrip(G4int i) {NStrip = i;};
inline void SetNSilPlane(G4int i) {NSilPlane = i;};
inline void SetPlaneType(G4int i) {IsXPlane = i;};
inline void SetPos(G4ThreeVector xyz){ pos = xyz; }
inline G4double GetEdepSil() { return EdepSil; };
inline G4int GetNStrip() { return NStrip; };
inline G4int GetNSilPlane() { return NSilPlane; };
inline G4int GetPlaneType() {return IsXPlane;};
inline G4ThreeVector GetPos() { return pos; };
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
typedef G4THitsCollection<GammaRayTelPayloadHit> GammaRayTelPayloadHitsCollection;
extern G4Allocator<GammaRayTelPayloadHit> GammaRayTelPayloadHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void* GammaRayTelPayloadHit::operator new(size_t)
{
void* aHit;
aHit = (void*) GammaRayTelPayloadHitAllocator.MallocSingle();
return aHit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void GammaRayTelPayloadHit::operator delete(void* aHit)
{
GammaRayTelPayloadHitAllocator.FreeSingle((GammaRayTelPayloadHit*) aHit);
}
#endif
@@ -0,0 +1,45 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadROGeometry.hh,v 1.1 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadROGeometry ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#ifndef GammaRayTelPayloadROGeometry_h
#define GammaRayTelPayloadROGeometry_h 1
#include "G4VReadOutGeometry.hh"
class GammaRayTelDetectorConstruction;
class GammaRayTelPayloadROGeometry : public G4VReadOutGeometry
{
public:
GammaRayTelPayloadROGeometry();
GammaRayTelPayloadROGeometry(G4String);
GammaRayTelPayloadROGeometry(G4String, GammaRayTelDetectorConstruction*);
~GammaRayTelPayloadROGeometry();
private:
G4VPhysicalVolume* Build();
GammaRayTelDetectorConstruction* GammaRayTelDetector;
//pointer to the geometry
};
#endif
@@ -0,0 +1,66 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadSD.hh,v 1.3 2000/11/24 16:56:59 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadSD ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#ifndef GammaRayTelPayloadSD_h
#define GammaRayTelPayloadSD_h 1
#include "G4VSensitiveDetector.hh"
#include "globals.hh"
class GammaRayTelDetectorConstruction;
class G4HCofThisEvent;
class G4Step;
#include "GammaRayTelPayloadHit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPayloadSD : public G4VSensitiveDetector
{
public:
GammaRayTelPayloadSD(G4String, GammaRayTelDetectorConstruction* );
~GammaRayTelPayloadSD();
void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step* astep,G4TouchableHistory* ROHist);
void EndOfEvent(G4HCofThisEvent*);
void clear();
void DrawAll();
void PrintAll();
private:
GammaRayTelPayloadHitsCollection* PayloadCollection;
GammaRayTelDetectorConstruction* Detector;
G4int (*HitXID)[30];
G4int (*HitYID)[30];
G4int NbOfTKRLayers;
G4int NbOfTKRStrips;
};
#endif
@@ -0,0 +1,84 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPhysicsList.hh,v 1.2 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPhysicsList ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelPhysicsList_h
#define GammaRayTelPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPhysicsList: public G4VUserPhysicsList
{
public:
GammaRayTelPhysicsList();
~GammaRayTelPhysicsList();
protected:
// Construct particle and physics
virtual void ConstructParticle();
virtual void ConstructProcess();
virtual void SetCuts();
public:
// Set/Get cut values
void SetCutForGamma(G4double);
void SetCutForElectron(G4double);
void SetCutForProton(G4double);
G4double GetCutForGamma() const;
G4double GetCutForElectron() const;
G4double GetCutForProton() const;
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();
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForProton;
G4double currentDefaultCut;
};
#endif
@@ -0,0 +1,67 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPrimaryGeneratorAction.hh,v 1.3 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPrimaryGeneratorAction ------
// by G.Santin, F.Longo & R.Giannitrapani (30 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelPrimaryGeneratorAction_h
#define GammaRayTelPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
class GammaRayTelDetectorConstruction;
class GammaRayTelPrimaryGeneratorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
GammaRayTelPrimaryGeneratorAction(GammaRayTelDetectorConstruction*);
~GammaRayTelPrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event*);
void SetRndmFlag(G4String val) { rndmFlag = val;}
void SetSourceType(G4int val) { nSourceType = val;}
void SetSpectrumType(G4int val) { nSpectrumType = val;}
void SetVertexRadius(G4double val) { dVertexRadius = val;}
private:
G4ParticleGun* particleGun;
GammaRayTelDetectorConstruction* GammaRayTelDetector;
GammaRayTelPrimaryGeneratorMessenger* gunMessenger;
G4String rndmFlag; //flag for a random impact point
G4int nSourceType;
G4double dVertexRadius;
G4int nSpectrumType;
};
#endif
@@ -0,0 +1,58 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPrimaryGeneratorMessenger.hh,v 1.2 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPrimaryGeneratorMessenger ------
// by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelPrimaryGeneratorMessenger_h
#define GammaRayTelPrimaryGeneratorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class GammaRayTelPrimaryGeneratorAction;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPrimaryGeneratorMessenger: public G4UImessenger
{
public:
GammaRayTelPrimaryGeneratorMessenger(GammaRayTelPrimaryGeneratorAction*);
~GammaRayTelPrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
GammaRayTelPrimaryGeneratorAction* GammaRayTelAction;
G4UIcmdWithAString* RndmCmd;
G4UIcmdWithAnInteger* SourceTypeCmd;
G4UIcmdWithADoubleAndUnit* VertexRadiusCmd;
G4UIcmdWithAnInteger* SpectrumTypeCmd;
};
#endif
@@ -0,0 +1,61 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelRunAction.hh,v 1.3 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelRunAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelRunAction_h
#define GammaRayTelRunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Run;
class GammaRayTelRunAction : public G4UserRunAction
{
public:
#ifdef G4ANALYSIS_USE
GammaRayTelRunAction(GammaRayTelAnalysisManager* analysisMgr);
#else
GammaRayTelRunAction();
#endif
~GammaRayTelRunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
private:
#ifdef G4ANALYSIS_USE
GammaRayTelAnalysisManager* analysisManager;
#endif
};
#endif
@@ -0,0 +1,47 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelVisManager.hh,v 1.2 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelVisManager ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelVisManager_h
#define GammaRayTelVisManager_h 1
#ifdef G4VIS_USE
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelVisManager: public G4VisManager {
public:
GammaRayTelVisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif
#endif
@@ -0,0 +1,59 @@
# ----------------------------------------------
# Example macro file for the GammaRayTel
# Visualization with OpenGL
# ----------------------------------------------
# Authors: R.Giannitrapani, F.Longo and G.Santin
# ----------------------------------------------
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/gun/particle gamma
/gun/energy 1 GeV
/gun/vertexRadius 25. cm
/gun/sourceType 2
# You can modify the geometry of the telescope via a messenger
#/payload/setNbOfTKRLayers 15
#/payload/update
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Add volume to scene
/vis/scene/add/volume
#
# Create a scene handler for a specific graphics system
/vis/sceneHandler/create OGLSX
# Create a viewer
/vis/viewer/create
# Positioning of the camera
/vis/camera/viewpoint 30 30
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
#/vis/scene/include/trajectories
#
# Flush visualization
/vis/viewer/update
#
# Draw scene
/vis/scene/notifyHandlers
@@ -0,0 +1,68 @@
# ----------------------------------------------
# Example macro file for the GammaRayTel
# Visualization with VRML
# ----------------------------------------------
# Authors: R.Giannitrapani, F.Longo and G.Santin
# ----------------------------------------------
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/gun/particle mu-
/gun/energy 100 MeV
/gun/vertexRadius 30. cm
/gun/sourceType 2
/gun/direction 0 0 -1
# You can modify the geometry of the telescope via a messenger
/payload/setNbOfTKRLayers 10
/payload/update
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Add volume to scene
/vis/scene/add/volume
#
# Create a scene handler for a VRML file
/vis/sceneHandler/create VRML2FILE
# Create a viewer
/vis/viewer/create
# Positioning of the camera
/vis/camera/viewpoint 30 30
# Create a viewer
/vis/viewer/create
# Positioning of the camera
/vis/camera/viewpoint 90 0
# Draw scene
/vis/scene/notifyHandlers
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
#/vis/scene/include/trajectories
#
# Flush visualization
/vis/viewer/update
@@ -0,0 +1,59 @@
# ----------------------------------------------
# Example macro file for the GammaRayTel
# Visualization with DAWN
# ----------------------------------------------
# Authors: R.Giannitrapani, F.Longo and G.Santin
# ----------------------------------------------
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/gun/particle gamma
/gun/energy 1 GeV
/gun/vertexRadius 25. cm
/gun/sourceType 2
# You can modify the geometry of the telescope via a messenger
#/payload/setNbOfTKRLayers 15
#/payload/update
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Add volume to scene
/vis/scene/add/volume
#
# Create a scene handler for a specific graphics system
/vis/sceneHandler/create DAWNFILE
# Create a viewer
/vis/viewer/create
# Positioning of the camera
/vis/camera/viewpoint 30 30
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
#/vis/scene/include/trajectories
#
# Flush visualization
/vis/viewer/update
#
# Draw scene
/vis/scene/notifyHandlers
@@ -0,0 +1,17 @@
# Macro file for the initialization phase of the
# GammaRayTel
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/gun/particle gamma
/gun/energy 1 GeV
/gun/vertexRadius 25. cm
/gun/sourceType 2
@@ -0,0 +1,320 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelAnalysisManager.cc,v 1.1 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayAnalysisManager ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dic 2000)
//
// ************************************************************
#ifdef G4ANALYSIS_USE
#include <stdlib.h>
#include "g4std/fstream"
#include "GammaRayTelAnalysisManager.hh"
#include "G4VAnalysisSystem.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelAnalysisMessenger.hh"
#include <IHistogramFactory.h>
#include <IHistogram1D.h>
#include <IHistogram2D.h>
#include <IPlotter.h>
#include <IVector.h>
#include <IVectorFactory.h>
#include "G4LizardSystem.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisManager::GammaRayTelAnalysisManager(GammaRayTelDetectorConstruction* GammaRayTelDC):
GammaRayTelDetector(GammaRayTelDC),
posXZ(0), posYZ(0), energy(0), hits(0), histoFactory(0), pl(0),
histo1DDraw("enable"),histo1DSave("enable"),histo2DDraw("enable"),
histo2DSave("enable"),histo2DMode("strip")
{
// Define the messenger and the analysis system
analysisMessenger = new GammaRayTelAnalysisMessenger(this);
analysisSystem = new G4LizardSystem;
histoFactory = analysisSystem->GetHistogramFactory();
/*
The following lines set the plotter and the vectorfactory that
are needed in this example for a multiple histograms
visualization. Please see the README for more information
*/
fVectorFactory = createIVectorFactory();
pl = createIPlotter();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisManager::~GammaRayTelAnalysisManager() {
delete posXZ;
delete posYZ;
delete energy;
delete hits;
delete analysisSystem;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool GammaRayTelAnalysisManager::RegisterAnalysisSystem(G4VAnalysisSystem*)
{
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
IHistogramFactory* GammaRayTelAnalysisManager::GetHistogramFactory(const G4String& aSystem)
{
return histoFactory;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelAnalysisManager::Store(IHistogram* histo, const G4String& ID)
{
analysisSystem->Store(histo, ID);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/*
Since the Lizard interface and analysis classes in G4 are still
experimental, they lack for now the possibility to show directly
more than one histograms at the same time. In order to show 2 or 4 histo
in a single view in our example, we decided to override this implementation
and use directly the IPlotter interface for our needs. This will change
in future releases.
Please note that for visualization purpouses the histograms result
stretched along the x axis; when they are saved in a PostScript
file the proportions are the right ones.
*/
void GammaRayTelAnalysisManager::Plot(IHistogram* histo = 0)
{
// In a normal case we use the following line to use the standard plot
// analysisSystem->Plot(histo);
// We define some vectors
IVector* vxz = 0;
IVector* vyz = 0;
IVector* ve = 0;
IVector* vhit= 0;
// We fill them with the histograms and
// draw them
if(histo2DDraw == "enable")
{
vxz = fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(posXZ));
vyz = fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(posYZ));
pl->plot(vxz);
pl->plot(vyz);
pl->refresh();
}
if(histo1DDraw == "enable")
{
ve = fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(energy));
vhit = fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(hits));
pl->plot(ve);
pl->plot(vhit);
pl->refresh();
}
delete vxz;
delete vyz;
delete ve;
delete vhit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 2d histogram of the XZ positions
void GammaRayTelAnalysisManager::InsertPositionXZ(double x, double z)
{
posXZ->fill(x, z);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 2d histogram of the YZ positions
void GammaRayTelAnalysisManager::InsertPositionYZ(double y, double z)
{
posYZ->fill(y, z);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 1d histogram of the energy released in the last Si plane
void GammaRayTelAnalysisManager::InsertEnergy(double en)
{
energy->fill(en);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 1d histogram of the hits distribution along the TKR planes
void GammaRayTelAnalysisManager::InsertHits(int nplane)
{
hits->fill(nplane);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/*
This member reset the histograms and it is called at the begin
of each run; here we put the inizialization so that the histograms have
always the right dimensions depending from the detector geometry
*/
void GammaRayTelAnalysisManager::BeginOfRun()
{
float sizexy, sizez;
int nplane;
int Nstrip, Nplane, Ntile, N;
// Relevant data from the detector to set the histograms dimensions
Nplane = GammaRayTelDetector->GetNbOfTKRLayers();
Nstrip = GammaRayTelDetector->GetNbOfTKRStrips();
Ntile = GammaRayTelDetector->GetNbOfTKRTiles();
sizexy = GammaRayTelDetector->GetTKRSizeXY();
sizez = GammaRayTelDetector->GetTKRSizeZ();
N = Nstrip*Ntile;
if (histoFactory)
{
// 1D histogram that store the energy deposition of the
// particle in the last (number 0) TKR X-plane
histoFactory->destroy(energy);
energy = histoFactory->create1D("Energy deposition in the last X plane (keV)", 100, 50, 200);
// 1D histogram that store the hits distribution along the TKR X-planes
histoFactory->destroy(hits);
hits = histoFactory->create1D("Hits distribution in the TKR X planes",
Nplane, 0, Nplane-1);
// 2D histogram that store the position (mm) of the hits (XZ projection)
histoFactory->destroy(posXZ);
if (histo2DMode == "strip")
posXZ = histoFactory->create2D("Tracker Hits XZ (strip,plane)",
N, 0, N-1,
2*Nplane, 0, Nplane-1);
else
posXZ = histoFactory->create2D("Tracker Hits XZ (x,z) in mm",
sizexy/5, -sizexy/2, sizexy/2,
sizez/5, -sizez/2, sizez/2);
// 2D histogram that store the position (mm) of the hits (YZ projection)
histoFactory->destroy(posYZ);
if(histo2DMode=="strip")
posYZ = histoFactory->create2D("Tracker Hits YZ (strip,plane)",
N, 0, N-1,
2*Nplane, 0, Nplane-1);
else
posYZ = histoFactory->create2D("Tracker Hits YZ (y,z) in mm",
sizexy/5, -sizexy/2, sizexy/2,
sizez/5, -sizez/2, sizez/2);
}
if(posXZ)
posXZ->reset();
if(posYZ)
posYZ->reset();
if(energy)
energy->reset();
if(hits)
hits->reset();
// We divide the plotter in the right nuber of zone depending
// on which histograms the user want to draw
if((histo2DDraw == "enable") && (histo1DDraw == "enable"))
pl->zone(2,2);
else if((histo1DDraw == "enable") || (histo2DDraw == "enable"))
pl->zone(1,2);
else
pl->zone(1,1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/*
This member is called at the end of each run
*/
void GammaRayTelAnalysisManager::EndOfRun(G4int n)
{
// This variable contains the names of the PS files
char name[15];
// We define some vectors
IVector* vxz = 0;
IVector* vyz = 0;
IVector* ve = 0;
IVector* vhit = 0;
// Temporary we set one single zone for the plotter
pl->zone(1,1);
// We now print the histograms, each one in a separate file
if(histo2DSave == "enable")
{
vxz = fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(posXZ));
vyz = fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(posYZ));
sprintf(name,"posxz_%d.ps", n);
pl->plot(vxz);
pl->psPrint(name);
sprintf(name,"posyz_%d.ps", n);
pl->plot(vyz);
pl->psPrint(name);
}
if(histo1DSave == "enable")
{
ve = fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(energy));
vhit = fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(hits));
sprintf(name,"energy_%d.ps", n);
pl->plot(ve);
pl->psPrint(name);
sprintf(name,"hits_%d.ps", n);
pl->plot(vhit);
pl->psPrint(name);
}
delete vxz;
delete vyz;
delete ve;
delete vhit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/* This member is called at the end of every event */
void GammaRayTelAnalysisManager::EndOfEvent(G4int flag)
{
// The histograms are updated only if there is some
// hits in the event
if(flag) Plot();
}
#endif
@@ -0,0 +1,152 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelAnalysisMessenger.cc,v 1.1 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelAnalysisMessenger ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dic 2000)
//
// ************************************************************
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisMessenger.hh"
#include "GammaRayTelAnalysisManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisMessenger::GammaRayTelAnalysisMessenger(GammaRayTelAnalysisManager* analysisManager)
:GammaRayTelAnalysis(analysisManager)
{
GammaRayTelAnalysisDir = new G4UIdirectory("/analysis/");
GammaRayTelAnalysisDir->SetGuidance("GammaRayTel analysis control.");
/*
Commands for the 1D histograms (energy deposition in the last
TKR layer and hits distribution along the TKR)
The Draw command gives the possibility to draw the 1d histograms
at every event.
The Save command gives the possibility to save the 1d histograms in
two separate PostScript files at the end of the run.
*/
Histo1DDrawCmd = new G4UIcmdWithAString("/analysis/histo1dDraw",this);
Histo1DDrawCmd->SetGuidance("Enable the drawing of the 1d histograms every event.");
Histo1DDrawCmd->SetGuidance("Choice: disable, enable(default)");
Histo1DDrawCmd->SetParameterName("choice",true);
Histo1DDrawCmd->SetDefaultValue("ebable");
Histo1DDrawCmd->SetCandidates("disable enable");
Histo1DDrawCmd->AvailableForStates(Idle);
Histo1DSaveCmd = new G4UIcmdWithAString("/analysis/histo1dSave",this);
Histo1DSaveCmd->SetGuidance("Enable the saving of the 1d histograms every run.");
Histo1DSaveCmd->SetGuidance("Choice: disable, enable(default)");
Histo1DSaveCmd->SetParameterName("choice",true);
Histo1DSaveCmd->SetDefaultValue("enable");
Histo1DSaveCmd->SetCandidates("disable enable");
Histo1DSaveCmd->AvailableForStates(Idle);
/*
Commands for the 2D histograms (hits positions along the TKR)
The Draw command gives the possibility to draw the 1d histograms
at every event.
The Save command gives the possibility to save the 1d histograms in
two separate PostScript files at the end of the run.
Moreover there is the possibility to set the 2d histograms so
that the info stored are true position ((x,z) or (y,z)
coordinates with respect to the payload reference frame in mm) or
the number of the Strip and the number of the Plane in which the
hit occur. To note that this feature is just for visualization
purpouse since both the information are saved in the external ASCII
file.
*/
Histo2DDrawCmd = new G4UIcmdWithAString("/analysis/histo2dDraw",this);
Histo2DDrawCmd->SetGuidance("Enable the drawing of the 2d histograms every events.");
Histo2DDrawCmd->SetGuidance("Choice: disable, enable(default)");
Histo2DDrawCmd->SetParameterName("choice",true);
Histo2DDrawCmd->SetDefaultValue("enable");
Histo2DDrawCmd->SetCandidates("disable enable");
Histo2DDrawCmd->AvailableForStates(Idle);
Histo2DSaveCmd = new G4UIcmdWithAString("/analysis/histo2dSave",this);
Histo2DSaveCmd->SetGuidance("Enable the saving of the 2d histograms every run.");
Histo2DSaveCmd->SetGuidance("Choice: disable, enable(default)");
Histo2DSaveCmd->SetParameterName("choice",true);
Histo2DSaveCmd->SetDefaultValue("enable");
Histo2DSaveCmd->SetCandidates("disable enable");
Histo2DSaveCmd->AvailableForStates(Idle);
Histo2DModeCmd = new G4UIcmdWithAString("/analysis/histo2dMode",this);
Histo2DModeCmd->SetGuidance("Select the mode for the 2d histograms.");
Histo2DModeCmd->SetGuidance("Choice: position, strip(default)");
Histo2DModeCmd->SetGuidance("position -> the histo is filled with true positions in mm");
Histo2DModeCmd->SetGuidance("strip -> the histo is filled with the number of the strip and the plane");
Histo2DModeCmd->SetParameterName("choice",true);
Histo2DModeCmd->SetDefaultValue("strip");
Histo2DModeCmd->SetCandidates("position strip");
Histo2DModeCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisMessenger::~GammaRayTelAnalysisMessenger()
{
delete Histo1DDrawCmd;
delete Histo1DSaveCmd;
delete Histo2DDrawCmd;
delete Histo2DSaveCmd;
delete Histo2DModeCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelAnalysisMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
// 1D Histograms
if( command == Histo1DDrawCmd )
{ GammaRayTelAnalysis->SetHisto1DDraw(newValue);}
if( command == Histo1DSaveCmd )
{ GammaRayTelAnalysis->SetHisto1DSave(newValue);}
// 2D Histograms
if( command == Histo2DDrawCmd )
{ GammaRayTelAnalysis->SetHisto2DDraw(newValue);}
if( command == Histo2DSaveCmd )
{ GammaRayTelAnalysis->SetHisto2DSave(newValue);}
if( command == Histo2DModeCmd )
{ GammaRayTelAnalysis->SetHisto2DMode(newValue);}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,813 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDetectorConstruction.cc,v 1.4 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDetectorConstruction ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelDetectorMessenger.hh"
#include "GammaRayTelPayloadSD.hh"
#include "GammaRayTelPayloadROGeometry.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDetectorConstruction::GammaRayTelDetectorConstruction()
:solidWorld(0),logicWorld(0),physiWorld(0),
solidPayload(0),logicPayload(0),physiPayload(0),
solidTKR(0),logicTKR(0),physiTKR(0),
solidCAL(0),logicCAL(0),physiCAL(0),
solidACT(0),logicACT(0),physiACT(0),
solidACL1(0),logicACL1(0),physiACL1(0),
solidACL2(0),logicACL2(0),physiACL2(0),
solidConverter(0),logicConverter(0),physiConverter(0),
solidTKRDetectorX(0),logicTKRDetectorX(0),
solidTKRDetectorY(0),logicTKRDetectorY(0),
physiTKRDetectorX(0),physiTKRDetectorY(0),
solidCALDetector(0),logicCALDetector(0),
physiCALDetectorX(0),physiCALDetectorY(0),
solidPlane(0),logicPlane(0),physiPlane(0)
{
// default parameter values of the payload
ConverterThickness = 300.*micrometer;
TKRSiliconThickness = 400.*micrometer;
TKRSiliconTileXY = 9.*cm;
TKRSiliconPitch = 200.*micrometer;
TKRLayerDistance = 3.*cm;
SiliconGuardRing = 1.5*mm;
TKRViewsDistance = 1.*mm;
NbOfTKRLayers = 15;
NbOfTKRTiles = 4;
CALBarThickness = 1.5*cm;
NbOfCALBars = 12;
NbOfCALLayers = 5;
ACDThickness = 1.*cm;
TilesSeparation = 100.*micrometer;
ACDTKRDistance = 5.*cm;
CALTKRDistance = 1.5*cm;
ComputePayloadParameters();
// create commands for interactive definition of the payload
detectorMessenger = new GammaRayTelDetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDetectorConstruction::~GammaRayTelDetectorConstruction()
{ delete detectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* GammaRayTelDetectorConstruction::Construct()
{
DefineMaterials();
return ConstructPayload();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::DefineMaterials()
{
G4String name, symbol;
G4double a, z, density;
G4int ncomponents, natoms;
G4double abundance, fractionmass;
G4double temperature, pressure;
//
// define Elements
//
a = 1.01*g/mole;
G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
a = 12.01*g/mole;
G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
a = 14.006*g/mole;
G4Element* N = new G4Element(name="Nitrogen" ,symbol="N" , z= 7., a);
a = 15.99*g/mole;
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
a = 126.904*g/mole;
G4Element* I = new G4Element(name="Iodine" ,symbol="I" , z= 53., a);
a = 132.905*g/mole;
G4Element* Cs = new G4Element(name="Cesium" ,symbol="Cs" , z= 55., a);
//
// define simple materials
//
density = 2.700*g/cm3;
a = 26.98*g/mole;
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
density = 2.333*g/cm3;
a = 28.09*g/mole;
G4Material* Si = new G4Material(name="Silicon",z=14., a,density);
density = 19.3*g/cm3;
a = 183.84*g/mole;
G4Material* W = new G4Material(name="Tungsten", z=74., a, density);
density = 11.35*g/cm3;
a = 207.19*g/mole;
G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
density = 7.87*g/cm3;
a= 55.845*g/mole;
G4Material* Fe = new G4Material(name="Iron", z=26.,a,density);
//
// define a material from elements. case 1: chemical molecule
//
density = 1.032*g/cm3;
G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
Sci->AddElement(C, natoms=9);
Sci->AddElement(H, natoms=10);
density = 4.53*g/cm3;
G4Material* CsI = new G4Material(name="CesiumIodide", density, ncomponents=2);
CsI->AddElement(C, natoms=5);
CsI->AddElement(H, natoms=5);
//
// define a material from elements. case 2: mixture by fractional mass
//
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
//
// examples of vacuum
//
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
G4Material* vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,kStateGas,temperature,pressure);
density = 1.e-5*g/cm3;
pressure = 2.e-2*bar;
temperature = STP_Temperature; //from PhysicalConstants.h
G4Material* beam = new G4Material(name="Beam", density, ncomponents=1,
kStateGas,temperature,pressure);
beam->AddMaterial(Air, fractionmass=1.);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//default materials of the payload
ConverterMaterial = Pb;
defaultMaterial = vacuum;
ACDMaterial = Sci;
CALMaterial = CsI;
TKRMaterial = Si;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* GammaRayTelDetectorConstruction::ConstructPayload()
{
// complete the Payload parameters definition
ComputePayloadParameters();
//
// World
//
solidWorld = new G4Box("World",
WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
logicWorld = new G4LogicalVolume(solidWorld,
defaultMaterial,
"World");
physiWorld = new G4PVPlacement(0,G4ThreeVector(),"World",logicWorld,
0,false,0);
//
// Payload
//
solidPayload=0; logicPayload=0; physiPayload=0;
solidTKR=0;logicTKR=0;physiTKR=0;
solidCAL=0;logicCAL=0;physiCAL=0;
solidACT=0;logicACT=0;physiACT=0;
solidACL1=0;logicACL1=0;physiACL1=0;
solidACL2=0;logicACL2=0;physiACL2=0;
solidConverter=0;logicConverter=0;physiConverter=0;
solidTKRDetectorX=0;logicTKRDetectorX=0;
solidTKRDetectorY=0;logicTKRDetectorY=0;
physiTKRDetectorX=0;physiTKRDetectorY=0;
solidCALDetector=0;logicCALDetector=0;
physiCALDetectorX=0;physiCALDetectorY=0;
solidPlane=0;logicPlane=0;physiPlane=0;
// if (PayloadSizeZ > 0.)
// {
//
// Payload
//
solidPayload = new G4Box("Payload",
PayloadSizeXY/2,
PayloadSizeXY/2,
PayloadSizeZ/2);
logicPayload = new G4LogicalVolume(solidPayload,
defaultMaterial,
"Payload");
physiPayload = new G4PVPlacement(0,
G4ThreeVector(),
"Payload",
logicPayload,
physiWorld,
false,
0);
//
// Calorimeter (CAL)
//
solidCAL = new G4Box("CAL",
CALSizeXY/2,CALSizeXY/2,CALSizeZ/2);
logicCAL = new G4LogicalVolume(solidCAL,
defaultMaterial,
"CAL");
physiCAL = new G4PVPlacement(0,
G4ThreeVector(0,0,
-PayloadSizeZ/2+CALSizeZ/2),
"CAL",
logicCAL,
physiPayload,
false,
0);
//
// Tracker (TKR)
//
solidTKR = new G4Box("TKR",
TKRSizeXY/2,TKRSizeXY/2,TKRSizeZ/2);
logicTKR = new G4LogicalVolume(solidTKR,
defaultMaterial,
"TKR");
physiTKR = new G4PVPlacement(0,
G4ThreeVector(0,0,
-PayloadSizeZ/2+CALSizeZ+
CALTKRDistance+TKRSizeZ/2),
"TKR",
logicTKR,
physiPayload,
false,
0);
//
// Anticoincidence Top (ACT)
//
solidACT = new G4Box("ACT",
ACTSizeXY/2,ACTSizeXY/2,ACTSizeZ/2);
logicACT = new G4LogicalVolume(solidACT,ACDMaterial,"ACT");
physiACT = new G4PVPlacement(0,
G4ThreeVector(0,0,
-PayloadSizeZ/2+CALSizeZ+
CALTKRDistance+TKRSizeZ+
ACDTKRDistance+ACTSizeZ/2),
"ACT",
logicACT,
physiPayload,
false,
0);
//
// Anticoincidence Lateral Side (ACL)
//
solidACL1 = new G4Box("ACL1",
ACL1SizeX/2,ACL1SizeY/2,ACL1SizeZ/2);
logicACL1 = new G4LogicalVolume(solidACL1,ACDMaterial,"ACL");
physiACL1 = new G4PVPlacement(0,
G4ThreeVector(-PayloadSizeXY/2+ACL1SizeX/2,
-PayloadSizeXY/2+ACL1SizeY/2,
-PayloadSizeZ/2+ACL1SizeZ/2),
"ACL1",
logicACL1,
physiPayload,
false,
0);
physiACL1 = new G4PVPlacement(0,
G4ThreeVector(PayloadSizeXY/2-ACL1SizeX/2,
PayloadSizeXY/2-ACL1SizeY/2,
-PayloadSizeZ/2+ACL1SizeZ/2),
"ACL1",
logicACL1,
physiPayload,
false,
1);
solidACL2 = new G4Box("ACL2",
ACL2SizeX/2,ACL2SizeY/2,ACL2SizeZ/2);
logicACL2 = new G4LogicalVolume(solidACL2,
ACDMaterial,
"ACL2");
physiACL2 = new G4PVPlacement(0,
G4ThreeVector(-PayloadSizeXY/2+ACL2SizeX/2,
PayloadSizeXY/2-ACL2SizeY/2,
-PayloadSizeZ/2+ACL2SizeZ/2),
"ACL2",
logicACL2,
physiPayload,
false,
0);
physiACL2 = new G4PVPlacement(0,
G4ThreeVector(PayloadSizeXY/2-ACL2SizeX/2,
-PayloadSizeXY/2+ACL2SizeY/2,
-PayloadSizeZ/2+ACL2SizeZ/2),
"ACL2",
logicACL2,
physiPayload,
false,
1);
// Tracker Structure (Plane + Converter + TKRDetectorX + TKRDetectorY)
solidPlane = new G4Box("Plane",
TKRSizeXY/2,TKRSizeXY/2,TKRSupportThickness/2);
logicPlane = new G4LogicalVolume(solidPlane,
defaultMaterial,
"Plane");
solidTKRDetectorY = new G4Box
("TKRDetectorY",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
logicTKRDetectorY = new G4LogicalVolume(solidTKRDetectorY,
TKRMaterial,
"TKRDetector Y");
solidTKRDetectorX = new G4Box
("TKRDetectorX",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
logicTKRDetectorX = new G4LogicalVolume(solidTKRDetectorX,
TKRMaterial,
"TKRDetector X");
solidConverter = new G4Box
("Converter",TKRSizeXY/2,TKRSizeXY/2,ConverterThickness/2);
logicConverter = new G4LogicalVolume(solidConverter,
ConverterMaterial,
"Converter");
G4int i=0;
for (i = 0; i < NbOfTKRLayers; i++)
{
physiTKRDetectorY =
new G4PVPlacement(0,G4ThreeVector(0.,0.,-TKRSizeZ/2
+TKRSiliconThickness/2
+(i)*TKRLayerDistance),
"TKRDetectorY",
logicTKRDetectorY,
physiTKR,
false,
i);
physiTKRDetectorX =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
TKRSiliconThickness/2 +
TKRViewsDistance+
TKRSiliconThickness+
(i)*TKRLayerDistance),
"TKRDetectorX",
logicTKRDetectorX,
physiTKR,
false,
i);
physiConverter =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
2*TKRSiliconThickness +
TKRViewsDistance+
ConverterThickness/2+
(i)*TKRLayerDistance),
"Converter",
logicConverter,
physiTKR,
false,
i);
physiPlane =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
2*TKRSiliconThickness +
TKRViewsDistance+
ConverterThickness+
TKRSupportThickness/2),
"Plane",
logicPlane,
physiTKR,
false,
i);
}
G4VSolid * solidTKRActiveTileX = new
G4Box("Active Tile X", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
G4VSolid * solidTKRActiveTileY = new
G4Box("Active Tile Y", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
G4LogicalVolume* logicTKRActiveTileX =
new G4LogicalVolume(solidTKRActiveTileX, TKRMaterial,
"Active Tile X",0,0,0);
G4LogicalVolume* logicTKRActiveTileY =
new G4LogicalVolume(solidTKRActiveTileY, TKRMaterial,
"Active Tile Y",0,0,0);
G4int j=0;
G4int k=0;
G4VPhysicalVolume* physiTKRActiveTileX = 0;
G4VPhysicalVolume* physiTKRActiveTileY = 0;
G4double x=0.;
G4double y=0.;
G4double z=0.;
for (i=0;i< NbOfTKRTiles; i++)
{
for (j=0;j< NbOfTKRTiles; j++)
{
k = i*NbOfTKRTiles + j;
x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
TKRActiveTileXY/2+(i)*((2*SiliconGuardRing)+
TilesSeparation+TKRActiveTileXY);
y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
TKRActiveTileXY/2+(j)*((2*SiliconGuardRing)+TilesSeparation+
TKRActiveTileXY);
z = 0.;
physiTKRActiveTileY =
new G4PVPlacement(0,
G4ThreeVector(x,y,z),
"Active Tile Y",
logicTKRActiveTileY,
physiTKRDetectorY,
false,
k);
x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
TKRActiveTileXY/2+(j)*((2*SiliconGuardRing)+
TilesSeparation+TKRActiveTileXY);
y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
TKRActiveTileXY/2+(i)*((2*SiliconGuardRing)+
TilesSeparation+TKRActiveTileXY);
z = 0.;
physiTKRActiveTileX =
new G4PVPlacement(0,
G4ThreeVector(x,y,z),
"Active Tile X",
logicTKRActiveTileX,
physiTKRDetectorX,
false,
k);
}
}
// Calorimeter Structure (CALDetectorX + CALDetectorY)
solidCALDetector = new G4Box("CALDetector",
CALSizeXY/2,CALSizeXY/2,CALBarThickness/2);
logicCALDetector = new G4LogicalVolume(solidCALDetector,
CALMaterial,
"CALDetector");
for (i = 0; i < NbOfCALLayers; i++)
{
physiCALDetectorY =
new G4PVPlacement(0,G4ThreeVector(0,0,
-CALSizeZ/2+
CALBarThickness/2 +
(i)*2*CALBarThickness),
"CALDetectorY",
logicCALDetector,
physiCAL,
false,
i);
physiCALDetectorX =
new G4PVPlacement(0,G4ThreeVector(0,0,
-CALSizeZ/2+
CALBarThickness/2 +
CALBarThickness +
(i)*2*CALBarThickness),
"CALDetectorX",
logicCALDetector,
physiCAL,
false,
i);
}
//}
//
// Sensitive Detectors: TKRDetector
//
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if(!payloadSD)
{
payloadSD = new GammaRayTelPayloadSD("PayloadSD",this);
SDman->AddNewDetector( payloadSD );
}
G4String ROgeometryName = "PayloadROGeom";
G4VReadOutGeometry* payloadRO =
payloadRO = new GammaRayTelPayloadROGeometry(ROgeometryName, this);
payloadRO->BuildROGeometry();
payloadSD->SetROgeometry(payloadRO);
// if (logicTKRDetector)
// logicTKRDetector->SetSensitiveDetector(payloadSD); // sensitive planes
if (logicTKRActiveTileX)
logicTKRActiveTileX->SetSensitiveDetector(payloadSD); // sensitive tile
if (logicTKRActiveTileY)
logicTKRActiveTileY->SetSensitiveDetector(payloadSD); // sensitive tile
//
// Visualization attributes
//
// Invisible Volume
logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
logicPayload->SetVisAttributes (G4VisAttributes::Invisible);
logicTKR->SetVisAttributes(G4VisAttributes::Invisible);
logicTKRActiveTileX->SetVisAttributes(G4VisAttributes::Invisible);
logicTKRActiveTileY->SetVisAttributes(G4VisAttributes::Invisible);
logicPlane->SetVisAttributes(G4VisAttributes::Invisible);
logicConverter->SetVisAttributes(G4VisAttributes::Invisible);
// Some visualization styles
G4VisAttributes* VisAtt1= new G4VisAttributes(G4Colour(0.3,0.8,0.1));
VisAtt1->SetVisibility(true);
VisAtt1->SetForceSolid(TRUE);
G4VisAttributes* VisAtt2= new G4VisAttributes(G4Colour(0.2,0.3,0.8));
VisAtt2->SetVisibility(true);
VisAtt2->SetForceSolid(FALSE);
G4VisAttributes* VisAtt3= new G4VisAttributes(G4Colour(0.8,0.2,0.3));
VisAtt3->SetVisibility(true);
VisAtt3->SetForceWireframe(TRUE);
// Visible Volumes
logicCAL->SetVisAttributes(VisAtt1);
logicTKRDetectorX->SetVisAttributes(VisAtt2);
logicTKRDetectorY->SetVisAttributes(VisAtt2);
logicACT->SetVisAttributes(VisAtt3);
logicACL1->SetVisAttributes(VisAtt3);
logicACL2->SetVisAttributes(VisAtt3);
//
//always return the physical World
//
PrintPayloadParameters();
return physiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::PrintPayloadParameters()
{
G4cout << "\n------------------------------------------------------------"
<< "\n---> The Tracker is " << NbOfTKRLayers << " layers of: "
<< ConverterThickness/mm << "mm of " << ConverterMaterial->GetName()
<< "\n------------------------------------------------------------\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetConverterMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial)
{
ConverterMaterial = pttoMaterial;
logicConverter->SetMaterial(pttoMaterial);
PrintPayloadParameters();
}
}
void GammaRayTelDetectorConstruction::SetConverterThickness(G4double val)
{
ConverterThickness = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetTKRSiliconThickness(G4double val)
{
TKRSiliconThickness = val;
}
void GammaRayTelDetectorConstruction::SetTKRSiliconPitch(G4double val)
{
TKRSiliconPitch = val;
}
void GammaRayTelDetectorConstruction::SetTKRTileSizeXY(G4double val)
{
TKRSiliconTileXY = val;
}
void GammaRayTelDetectorConstruction::SetNbOfTKRLayers(G4int val)
{
NbOfTKRLayers = val;
}
void GammaRayTelDetectorConstruction::SetNbOfTKRTiles(G4int val)
{
NbOfTKRTiles = val;
}
void GammaRayTelDetectorConstruction::SetTKRLayerDistance(G4double val)
{
TKRLayerDistance = val;
}
void GammaRayTelDetectorConstruction::SetTKRViewsDistance(G4double val)
{
TKRViewsDistance = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetNbOfCALLayers(G4int val)
{
NbOfCALLayers = val;
}
void GammaRayTelDetectorConstruction::SetNbOfCALBars(G4int val)
{
NbOfCALBars = val;
}
void GammaRayTelDetectorConstruction::SetCALBarThickness(G4double val)
{
CALBarThickness = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetACDThickness(G4double val)
{
ACDThickness = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetMagField(G4double fieldValue)
{
//apply a global uniform magnetic field along Z axis
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
if(magField) delete magField; //delete the existing magn field
if(fieldValue!=0.) // create a new one if non nul
{ magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
fieldMgr->SetDetectorField(magField);
fieldMgr->CreateChordFinder(magField);
} else {
magField = 0;
fieldMgr->SetDetectorField(magField);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::UpdateGeometry()
{
// delete payloadSD;
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructPayload());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,256 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDetectorMessenger.cc,v 1.3 2000/12/06 16:53:14 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDetectorMessenger ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelDetectorMessenger.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDetectorMessenger::GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction * GammaRayTelDet)
:GammaRayTelDetector(GammaRayTelDet)
{
GammaRayTeldetDir = new G4UIdirectory("/payload/");
GammaRayTeldetDir->SetGuidance("GammaRayTel payload control.");
// converter material command
ConverterMaterCmd = new G4UIcmdWithAString("/payload/setConvMat",this);
ConverterMaterCmd->SetGuidance("Select Material of the Converter.");
ConverterMaterCmd->SetParameterName("choice",false);
ConverterMaterCmd->AvailableForStates(Idle);
// converter thickness command
ConverterThickCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setConvThick",this);
ConverterThickCmd->SetGuidance("Set Thickness of the Converter");
ConverterThickCmd->SetParameterName("Size",false);
ConverterThickCmd->SetRange("Size>=0.");
ConverterThickCmd->SetUnitCategory("Length");
ConverterThickCmd->AvailableForStates(Idle);
// tracker silicon thickness command
SiliconThickCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setSiThick",this);
SiliconThickCmd->SetGuidance("Set Thickness of the Silicon");
SiliconThickCmd->SetParameterName("Size",false);
SiliconThickCmd->SetRange("Size>=0.");
SiliconThickCmd->SetUnitCategory("Length");
SiliconThickCmd->AvailableForStates(Idle);
// tracker silicon pitch command
SiliconPitchCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setSiPitch",this);
SiliconPitchCmd->SetGuidance("Set Pitch of the Silicon Strips");
SiliconPitchCmd->SetParameterName("Size",false);
SiliconPitchCmd->SetRange("Size>=0.");
SiliconPitchCmd->SetUnitCategory("Length");
SiliconPitchCmd->AvailableForStates(Idle);
// tracker silicon tile size command
SiliconTileXYCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setSiTileXY",this);
SiliconTileXYCmd->SetGuidance("Set XY dimensions of Si Tile");
SiliconTileXYCmd->SetParameterName("Size",false);
SiliconTileXYCmd->SetRange("Size>=0.");
SiliconTileXYCmd->SetUnitCategory("Length");
SiliconTileXYCmd->AvailableForStates(Idle);
// tracker number of silicon tiles
NbSiTilesCmd = new G4UIcmdWithAnInteger("/payload/setNbOfSiTiles",this);
NbSiTilesCmd->SetGuidance("Set number of Si Tiles.");
NbSiTilesCmd->SetParameterName("NbSiTiles",false);
NbSiTilesCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
NbSiTilesCmd->AvailableForStates(Idle);
// tracker number of silicon layers
NbTKRLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfTKRLayers",this);
NbTKRLayersCmd->SetGuidance("Set number of TKR Layers.");
NbTKRLayersCmd->SetParameterName("NbTKRLayers",false);
NbTKRLayersCmd->SetRange("NbTKRLayers>0 && NbTKRLayers<30");
NbTKRLayersCmd->AvailableForStates(Idle);
// tracker layer distance
LayerDistanceCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setLayerDistance",this);
LayerDistanceCmd->SetGuidance("Set distance between two layers");
LayerDistanceCmd->SetParameterName("Size",false);
LayerDistanceCmd->SetRange("Size>=0.");
LayerDistanceCmd->SetUnitCategory("Length");
LayerDistanceCmd->AvailableForStates(Idle);
// tracker views distance
ViewsDistanceCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setViewsDistance",this);
ViewsDistanceCmd->SetGuidance("Set distance between X and Y views");
ViewsDistanceCmd->SetParameterName("Size",false);
ViewsDistanceCmd->SetRange("Size>=0.");
ViewsDistanceCmd->SetUnitCategory("Length");
ViewsDistanceCmd->AvailableForStates(Idle);
// calorimeter detector thickness
CALThickCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setCALThick",this);
CALThickCmd->SetGuidance("Set thickness of CAL detectors");
CALThickCmd->SetParameterName("Size",false);
CALThickCmd->SetRange("Size>=0.");
CALThickCmd->SetUnitCategory("Length");
CALThickCmd->AvailableForStates(Idle);
// number calorimeter detectors
NbCALBarsCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALBars",this);
NbCALBarsCmd->SetGuidance("Set number of CsI Bars.");
NbCALBarsCmd->SetParameterName("NbSiTiles",false);
NbCALBarsCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
NbCALBarsCmd->AvailableForStates(Idle);
// number calorimeter layers
NbCALLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALLayers",this);
NbCALLayersCmd->SetGuidance("Set number of CAL Layers.");
NbCALLayersCmd->SetParameterName("NbCALLayers",false);
NbCALLayersCmd->SetRange("NbCALLayers>0 && NbCALLayers<16");
NbCALLayersCmd->AvailableForStates(Idle);
// calorimeter detector thickness
ACDThickCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setACDThick",this);
ACDThickCmd->SetGuidance("Set thickness of ACD detectors");
ACDThickCmd->SetParameterName("Size",false);
ACDThickCmd->SetRange("Size>=0.");
ACDThickCmd->SetUnitCategory("Length");
ACDThickCmd->AvailableForStates(Idle);
// update Payload
UpdateCmd = new G4UIcmdWithoutParameter("/payload/update",this);
UpdateCmd->SetGuidance("Update payload geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(Idle);
// magnetic field
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/payload/setField",this);
MagFieldCmd->SetGuidance("Define magnetic field.");
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
MagFieldCmd->SetParameterName("Bz",false);
MagFieldCmd->SetUnitCategory("Magnetic flux density");
MagFieldCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDetectorMessenger::~GammaRayTelDetectorMessenger()
{
delete ConverterMaterCmd; delete ConverterThickCmd;
delete NbSiTilesCmd; delete NbTKRLayersCmd;
delete SiliconTileXYCmd; delete SiliconPitchCmd;
delete SiliconThickCmd; delete LayerDistanceCmd;
delete ViewsDistanceCmd; delete ACDThickCmd;
delete NbCALLayersCmd; delete NbCALBarsCmd;
delete CALThickCmd; delete UpdateCmd;
delete MagFieldCmd; delete GammaRayTeldetDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
// converter
if( command == ConverterMaterCmd )
{ GammaRayTelDetector->SetConverterMaterial(newValue);}
if( command == ConverterThickCmd )
{ GammaRayTelDetector->SetConverterThickness(ConverterThickCmd->GetNewDoubleValue(newValue));}
// tracker
if( command == SiliconTileXYCmd )
{ GammaRayTelDetector->SetTKRTileSizeXY(SiliconTileXYCmd->GetNewDoubleValue(newValue));}
if( command == SiliconPitchCmd )
{ GammaRayTelDetector->SetTKRSiliconPitch(SiliconPitchCmd->GetNewDoubleValue(newValue));}
if( command == SiliconThickCmd )
{ GammaRayTelDetector->SetTKRSiliconThickness(SiliconThickCmd->GetNewDoubleValue(newValue));}
if( command == NbSiTilesCmd )
{ GammaRayTelDetector->SetNbOfTKRTiles(NbSiTilesCmd->GetNewIntValue(newValue));}
if( command == NbTKRLayersCmd )
{ GammaRayTelDetector->SetNbOfTKRLayers(NbTKRLayersCmd->GetNewIntValue(newValue));}
if( command == LayerDistanceCmd )
{ GammaRayTelDetector->SetTKRLayerDistance(LayerDistanceCmd->GetNewDoubleValue(newValue));}
if( command == ViewsDistanceCmd )
{ GammaRayTelDetector->SetTKRViewsDistance(ViewsDistanceCmd->GetNewDoubleValue(newValue));}
// calorimeter
if( command == NbCALLayersCmd )
{ GammaRayTelDetector->SetNbOfCALLayers(NbCALLayersCmd->GetNewIntValue(newValue));}
if( command == NbCALBarsCmd )
{ GammaRayTelDetector->SetNbOfCALBars(NbCALBarsCmd->GetNewIntValue(newValue));}
if( command == CALThickCmd )
{ GammaRayTelDetector->SetCALBarThickness(CALThickCmd->GetNewDoubleValue(newValue));}
// anticoincidence
if( command == ACDThickCmd )
{ GammaRayTelDetector->SetACDThickness(ACDThickCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ GammaRayTelDetector->UpdateGeometry(); }
if( command == MagFieldCmd )
{ GammaRayTelDetector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,173 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelEventAction.cc,v 1.4 2000/12/06 16:53:14 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelEventAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelEventAction.hh"
#include "GammaRayTelPayloadHit.hh"
#include "g4rw/tvordvec.h"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
// This file is a global variable in which we store energy deposition per hit
// and other relevant information
extern G4std::ofstream outFile;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4ANALYSIS_USE
GammaRayTelEventAction::GammaRayTelEventAction(GammaRayTelAnalysisManager* aMgr)
:drawFlag("all"),trackerCollID(-1),analysisManager(aMgr)
{
}
#else
GammaRayTelEventAction::GammaRayTelEventAction()
:drawFlag("all"), trackerCollID(-1)
{
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelEventAction::~GammaRayTelEventAction()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelEventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
G4cout << "Event: " << evtNb << G4endl;
if (trackerCollID==-1)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
trackerCollID = SDman->GetCollectionID("PayloadCollection");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelEventAction::EndOfEventAction(const G4Event* evt)
{
G4int event_id = evt->GetEventID();
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
GammaRayTelPayloadHitsCollection* CHC = NULL;
if (HCE)
CHC = (GammaRayTelPayloadHitsCollection*)(HCE->GetHC(trackerCollID));
if (CHC)
{
int n_hit = CHC->entries();
G4cout << "Number of hits in this event = " << n_hit << G4endl;
G4double ESil=0;
G4int NStrip, NPlane, IsX;
// This is a cycle on all the hits of this event
for (int i=0;i<n_hit;i++)
{
// Here we put the hit data in a an ASCII file for
// later analysis
ESil = (*CHC)[i]->GetEdepSil();
NStrip = (*CHC)[i]->GetNStrip();
NPlane = (*CHC)[i]->GetNSilPlane();
IsX = (*CHC)[i]->GetPlaneType();
outFile << G4std::setw(7) << event_id << " " <<
ESil/keV << " " << NStrip <<
" " << NPlane << " " << IsX << " " <<
(*CHC)[i]->GetPos().x()/mm <<" "<<
(*CHC)[i]->GetPos().y()/mm <<" "<<
(*CHC)[i]->GetPos().z()/mm <<" "<<
G4endl;
#ifdef G4ANALYSIS_USE
// Here we fill the histograms of the Analysis manager
if(IsX)
{
if (analysisManager->GetHisto2DMode()=="position")
analysisManager->InsertPositionXZ((*CHC)[i]->GetPos().x()/mm,(*CHC)[i]->GetPos().z()/mm);
else
analysisManager->InsertPositionXZ(NStrip, NPlane);
if (NPlane == 0) analysisManager->InsertEnergy(ESil/keV);
analysisManager->InsertHits(NPlane);
}
else
if (analysisManager->GetHisto2DMode()=="position")
analysisManager->InsertPositionYZ((*CHC)[i]->GetPos().y()/mm,(*CHC)[i]->GetPos().z()/mm);
else
analysisManager->InsertPositionYZ(NStrip, NPlane);
#endif
}
// Here we call the analysis manager function for visualization
#ifdef G4ANALYSIS_USE
analysisManager->EndOfEvent(n_hit);
#endif
}
if(G4VVisManager::GetConcreteInstance())
{
for(G4int i=0; i<n_trajectories; i++)
{ G4Trajectory* trj = (G4Trajectory *)((*(evt->GetTrajectoryContainer()))[i]);
if (drawFlag == "all") trj->DrawTrajectory(50);
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
trj->DrawTrajectory(50);
}
}
}
@@ -0,0 +1,91 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadHit.cc,v 1.2 2000/11/15 20:27:41 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadHit ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelPayloadHit.hh"
G4Allocator<GammaRayTelPayloadHit> GammaRayTelPayloadHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadHit::GammaRayTelPayloadHit()
{
EdepSil = 0.;
NStrip = 0; NSilPlane = 0; IsXPlane = 0;
pos = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadHit::~GammaRayTelPayloadHit()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadHit::GammaRayTelPayloadHit(const GammaRayTelPayloadHit& right)
{
EdepSil = right.EdepSil;
NStrip = right.NStrip; NSilPlane = right.NSilPlane;
IsXPlane = right.IsXPlane;
pos = right.pos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const GammaRayTelPayloadHit& GammaRayTelPayloadHit::operator=(const GammaRayTelPayloadHit& right)
{
EdepSil = right.EdepSil;
NStrip = right.NStrip; NSilPlane = right.NSilPlane;
IsXPlane = right.IsXPlane;
pos =right.pos;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int GammaRayTelPayloadHit::operator==(const GammaRayTelPayloadHit& right) const
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadHit::Draw()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadHit::Print()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,336 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadROGeometry.cc,v 1.2 2000/11/20 16:49:02 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadROGeometry class ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelPayloadROGeometry.hh"
#include "GammaRayTelDummySD.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
GammaRayTelPayloadROGeometry::GammaRayTelPayloadROGeometry()
: G4VReadOutGeometry()
{
}
GammaRayTelPayloadROGeometry::GammaRayTelPayloadROGeometry(G4String aString,GammaRayTelDetectorConstruction* GammaRayTelDC)
:GammaRayTelDetector(GammaRayTelDC), G4VReadOutGeometry(aString)
{
}
GammaRayTelPayloadROGeometry::GammaRayTelPayloadROGeometry(G4String aString)
: G4VReadOutGeometry(aString)
{
}
GammaRayTelPayloadROGeometry::~GammaRayTelPayloadROGeometry()
{
}
G4VPhysicalVolume* GammaRayTelPayloadROGeometry::Build()
{
// A dummy material is used to fill the volumes of the readout geometry.
// ( It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
//Builds the ReadOut World:
G4double WorldSizeXY = GammaRayTelDetector->GetWorldSizeXY();
G4double WorldSizeZ = GammaRayTelDetector->GetWorldSizeZ();
G4Box* ROWorldBox = new
G4Box("ROWorldBox",WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
G4LogicalVolume* ROWorldLog = new G4LogicalVolume(ROWorldBox, dummyMat,
"ROWorldLogical");
G4PVPlacement* ROWorldPhys =
new G4PVPlacement(0,G4ThreeVector(),"ROWorldPhysical",
ROWorldLog,0,false,0);
// Payload RO volume:
G4double PayloadSizeXY = GammaRayTelDetector->GetPayloadSizeXY();
G4double PayloadSizeZ = GammaRayTelDetector->GetPayloadSizeZ();
G4VSolid* solidPayloadRO
= new G4Box("Payload RO",
PayloadSizeXY/2,
PayloadSizeXY/2,
PayloadSizeZ/2);
G4LogicalVolume* logicPayloadRO = new
G4LogicalVolume(solidPayloadRO,dummyMat,"Payload RO",0,0,0);
G4VPhysicalVolume* physiPayloadRO =
new G4PVPlacement(0, G4ThreeVector(),
"Payload RO", logicPayloadRO,ROWorldPhys,false, 0);
// -------------------------------
// Tracker readout division:
// -------------------------------
// TRK Layers of Silicon MicroStrips
G4double TKRSizeXY = GammaRayTelDetector->GetTKRSizeXY();
G4double TKRSizeZ = GammaRayTelDetector->GetTKRSizeZ();
G4double CALSizeZ = GammaRayTelDetector->GetCALSizeZ();
G4double CALTKRDistance = GammaRayTelDetector->GetCALTKRDistance();
G4VSolid* ROsolidTKR =
new G4Box("ReadOutTKR", TKRSizeXY/2,TKRSizeXY/2,TKRSizeZ/2);
G4LogicalVolume* ROlogicTKR =
new G4LogicalVolume(ROsolidTKR,dummyMat, "ReadOutTKR",0,0,0);
G4VPhysicalVolume* ROphysiTKR =
new G4PVPlacement(0, G4ThreeVector(0,0,-PayloadSizeZ/2+CALSizeZ+
CALTKRDistance+TKRSizeZ/2),
"ReadOutTKR",ROlogicTKR,physiPayloadRO,
false, 0);
// TKR Layers
G4double TKRSiliconThickness =
GammaRayTelDetector->GetTKRSiliconThickness();
G4int NbOfTKRLayers = GammaRayTelDetector->GetNbOfTKRLayers();
G4double TKRLayerDistance = GammaRayTelDetector->GetTKRLayerDistance();
G4double TKRViewsDistance = GammaRayTelDetector->GetTKRViewsDistance();
G4VSolid* solidTKRDetectorYRO = new G4Box
("TKRDetectorYRO",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
G4LogicalVolume* logicTKRDetectorYRO =
new G4LogicalVolume(solidTKRDetectorYRO,dummyMat, "TKRDetectorYRO",0,0,0);
G4VSolid* solidTKRDetectorXRO = new G4Box
("TKRDetectorXRO",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
G4LogicalVolume* logicTKRDetectorXRO =
new G4LogicalVolume(solidTKRDetectorXRO,dummyMat, "TKRDetectorXRO",0,0,0);
G4int i=0;
G4VPhysicalVolume* physiTKRDetectorXRO = 0;
G4VPhysicalVolume* physiTKRDetectorYRO = 0;
for (i = 0; i < NbOfTKRLayers; i++)
{
physiTKRDetectorYRO =
new G4PVPlacement(0,G4ThreeVector(0.,0.,-TKRSizeZ/2
+TKRSiliconThickness/2
+(i)*TKRLayerDistance),
"TKRDetectorYRO",
logicTKRDetectorYRO,
ROphysiTKR,
false,
i);
physiTKRDetectorXRO =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
TKRSiliconThickness/2 +
TKRViewsDistance+
TKRSiliconThickness+
(i)*TKRLayerDistance),
"TKRDetectorXRO",
logicTKRDetectorXRO,
ROphysiTKR,
false,
i);
}
// Silicon Tiles
// some problems with the RO tree
G4double TKRActiveTileXY = GammaRayTelDetector->GetTKRActiveTileXY();
G4double TKRActiveTileZ = GammaRayTelDetector->GetTKRActiveTileZ();
G4VSolid * solidTKRActiveTileXRO = new
G4Box("Active Tile X", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
G4VSolid * solidTKRActiveTileYRO = new
G4Box("Active Tile Y", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
G4LogicalVolume* logicTKRActiveTileXRO =
new G4LogicalVolume(solidTKRActiveTileXRO, dummyMat,"Active Tile",0,0,0);
G4LogicalVolume* logicTKRActiveTileYRO =
new G4LogicalVolume(solidTKRActiveTileYRO, dummyMat,"Active Tile",0,0,0);
G4int j=0;
G4int k=0;
G4int NbOfTKRTiles = GammaRayTelDetector->GetNbOfTKRTiles();
G4double SiliconGuardRing = GammaRayTelDetector->GetSiliconGuardRing();
G4double TilesSeparation = GammaRayTelDetector->GetTilesSeparation();
G4VPhysicalVolume* physiTKRActiveTileXRO = 0;
G4VPhysicalVolume* physiTKRActiveTileYRO = 0;
G4double x=0.;
G4double y=0.;
G4double z=0.;
for (i=0;i< NbOfTKRTiles; i++)
{
for (j=0;j< NbOfTKRTiles; j++)
{
k = i*NbOfTKRTiles + j;
x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
(j)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
(i)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
z = 0.;
physiTKRActiveTileXRO =
new G4PVPlacement(0,
G4ThreeVector(x,y,z),
"Active Tile X",
logicTKRActiveTileXRO,
physiTKRDetectorXRO,
false,
k);
x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
(i)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
(j)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
z = 0.;
physiTKRActiveTileYRO =
new G4PVPlacement(0,
G4ThreeVector(x,y,z),
"Active Tile Y",
logicTKRActiveTileYRO,
physiTKRDetectorYRO,
false,
k);
}
}
// Silicon Strips
// some problems with the RO tree
G4double TKRXStripX=0.;
G4double TKRYStripY=0.;
G4double TKRYStripX=0.;
G4double TKRXStripY=0.;
TKRXStripX = TKRYStripY = GammaRayTelDetector->GetTKRSiliconPitch();
TKRYStripX = TKRXStripY= GammaRayTelDetector->GetTKRActiveTileXY();
G4double TKRZStrip = GammaRayTelDetector->GetTKRSiliconThickness();
G4int NbOfTKRStrips = GammaRayTelDetector->GetNbOfTKRStrips();
G4VSolid* solidTKRStripX = new G4Box("Strip X",
TKRXStripX/2,TKRYStripX/2,
TKRZStrip/2);
G4LogicalVolume* logicTKRStripX =
new G4LogicalVolume(solidTKRStripX,dummyMat,"Strip X",0,0,0);
G4VSolid* solidTKRStripY = new G4Box("Strip Y",
TKRXStripY/2,TKRYStripY/2,
TKRZStrip/2);
G4LogicalVolume* logicTKRStripY =
new G4LogicalVolume(solidTKRStripY,dummyMat,"Strip Y",0,0,0);
G4VPhysicalVolume* physiTKRStripX = 0;
G4VPhysicalVolume* physiTKRStripY = 0;
G4double TKRSiliconPitch = GammaRayTelDetector->GetTKRSiliconPitch();
for (i=0;i< NbOfTKRStrips; i++)
{
physiTKRStripX = new
G4PVPlacement(0,G4ThreeVector(-TKRActiveTileXY/2 +TKRSiliconPitch/2 +
(i)*TKRSiliconPitch, 0., 0.),
"Strip X",
logicTKRStripX,
physiTKRActiveTileXRO,
false,
i);
physiTKRStripY = new
G4PVPlacement(0,G4ThreeVector(0.,-TKRActiveTileXY/2
+TKRSiliconPitch/2 +
(i)*TKRSiliconPitch, 0.),
"Strip Y",
logicTKRStripY,
physiTKRActiveTileYRO,
false,
i);
}
//Flags the strip as sensitive .The pointer here serves
// as a flag only to check for sensitivity.
// (Could we make it by a simple cast of a non-NULL value ?)
GammaRayTelDummySD * dummySensi = new GammaRayTelDummySD;
logicTKRStripX->SetSensitiveDetector(dummySensi);
logicTKRStripY->SetSensitiveDetector(dummySensi);
//logicTKRActiveTileXRO->SetSensitiveDetector(dummySensi);
//logicTKRActiveTileYRO->SetSensitiveDetector(dummySensi);
//logicTKRDetectorRO->SetSensitiveDetector(dummySensi);
return ROWorldPhys;
}
@@ -0,0 +1,223 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadSD.cc,v 1.6 2000/12/06 17:48:10 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadSD ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelPayloadSD.hh"
#include "GammaRayTelPayloadHit.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadSD::GammaRayTelPayloadSD(G4String name,
GammaRayTelDetectorConstruction* det)
:G4VSensitiveDetector(name),Detector(det)
{
G4int NbOfTKRTiles = Detector->GetNbOfTKRTiles();
NbOfTKRStrips = Detector->GetNbOfTKRStrips();
NbOfTKRLayers = Detector->GetNbOfTKRLayers();
NbOfTKRStrips = NbOfTKRStrips*NbOfTKRTiles;
HitXID = new G4int[NbOfTKRStrips][30];
HitYID = new G4int[NbOfTKRStrips][30];
collectionName.insert("PayloadCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadSD::~GammaRayTelPayloadSD()
{
delete [] HitXID;
delete [] HitYID;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::Initialize(G4HCofThisEvent*HCE)
{
PayloadCollection = new GammaRayTelPayloadHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int i=0;i<NbOfTKRStrips;i++)
for (G4int j=0;j<NbOfTKRLayers;j++)
{
HitXID[i][j] = -1;
HitYID[i][j] = -1;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool GammaRayTelPayloadSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if ((edep/keV == 0.)) return false;
G4int StripTotal = Detector->GetNbOfTKRStrips();
G4int TileTotal = Detector->GetNbOfTKRTiles();
// This TouchableHistory is used to obtain the physical volume
// of the hit
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* phys_tile = theTouchable->GetVolume();
G4VPhysicalVolume* plane = phys_tile->GetMother();
G4int PlaneNumber = 0;
PlaneNumber=plane->GetCopyNo();
G4String PlaneName = plane->GetName();
// The RO History is used to obtain the real strip
// of the hit
G4int StripNumber = 0;
G4VPhysicalVolume* strip = 0;
strip = ROhist->GetVolume();
G4String StripName = strip->GetName();
StripNumber= strip->GetCopyNo();
ROhist->MoveUpHistory();
G4VPhysicalVolume* tile = ROhist->GetVolume();
G4int TileNumber = tile->GetCopyNo();
G4String TileName = tile->GetName();
G4int NTile = (TileNumber%TileTotal);
G4int j=0;
for (j=0;j<TileTotal;j++)
{
if(NTile==j) StripNumber += StripTotal*NTile;
}
// G4cout << " Plane Number = " << PlaneNumber << " " << PlaneName << G4endl;
// G4cout << StripName << " " << StripNumber << G4endl;
ROhist->MoveUpHistory();
G4VPhysicalVolume* ROPlane = ROhist->GetVolume();
G4int ROPlaneNumber = ROPlane->GetCopyNo();
G4String ROPlaneName = ROPlane->GetName();
if (PlaneName == "TKRDetectorX" )
// The hit is on an X silicon plane
{
// This is a new hit
if (HitXID[StripNumber][PlaneNumber]==-1)
{
GammaRayTelPayloadHit* PayloadHit = new GammaRayTelPayloadHit;
PayloadHit->SetPlaneType(1);
PayloadHit->AddSil(edep);
PayloadHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
PayloadHit->SetNSilPlane(PlaneNumber);
PayloadHit->SetNStrip(StripNumber);
HitXID[StripNumber][PlaneNumber] =
PayloadCollection->insert(PayloadHit) -1;
}
else // This is not new
{
(*PayloadCollection)[HitXID[StripNumber][PlaneNumber]]->AddSil(edep);
// G4cout << "X" << PlaneNumber << " " << StripNumber << G4endl;
}
}
if (PlaneName == "TKRDetectorY")
// The hit is on an Y silicon plane
{
// This is a new hit
if (HitYID[StripNumber][PlaneNumber]==-1)
{
GammaRayTelPayloadHit* PayloadHit = new GammaRayTelPayloadHit;
PayloadHit->SetPlaneType(0);
PayloadHit->AddSil(edep);
PayloadHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
PayloadHit->SetNSilPlane(PlaneNumber);
PayloadHit->SetNStrip(StripNumber);
HitYID[StripNumber][PlaneNumber] =
PayloadCollection->insert(PayloadHit)-1;
}
else // This is not new
{
(*PayloadCollection)[HitYID[StripNumber][PlaneNumber]]->AddSil(edep);
// G4cout << "Y" << PlaneNumber << " " << StripNumber << G4endl;
}
}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::EndOfEvent(G4HCofThisEvent* HCE)
{
static G4int HCID = -1;
if(HCID<0)
{
HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
}
HCE->AddHitsCollection(HCID,PayloadCollection);
for (G4int i=0;i<NbOfTKRLayers;i++)
for (G4int j=0;j<NbOfTKRStrips;j++)
{
HitXID[i][j] = -1;
HitYID[i][j] = -1;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::clear()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::DrawAll()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::PrintAll()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,302 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPhysicsList.cc,v 1.2 2000/11/15 20:27:41 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPhysicsList ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelPhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPhysicsList::GammaRayTelPhysicsList(): G4VUserPhysicsList()
{
currentDefaultCut = defaultCutValue = 0.1*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForProton = defaultCutValue;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPhysicsList::~GammaRayTelPhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::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 GammaRayTelPhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructMesons()
{
// 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 GammaRayTelPhysicsList::ConstructBaryons()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructGeneral();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::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 G4MultipleScattering(),-1, 1,1);
pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
} else if (particleName == "e+") {
//positron
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1,4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
pmanager->AddProcess(new G4MuIonisation(), -1, 2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(), -1,-1,3);
pmanager->AddProcess(new G4MuPairProduction(), -1,-1,4);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4hIonisation(), -1,2,2);
}
}
}
#include "G4Decay.hh"
void GammaRayTelPhysicsList::ConstructGeneral()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::SetCuts()
{
// reactualise cutValues
if (currentDefaultCut != defaultCutValue)
{
if(cutForGamma == currentDefaultCut) cutForGamma = defaultCutValue;
if(cutForElectron == currentDefaultCut) cutForElectron = defaultCutValue;
if(cutForProton == currentDefaultCut) cutForProton = defaultCutValue;
currentDefaultCut = defaultCutValue;
}
if (verboseLevel >0){
G4cout << "GammaRayTelPhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForElectron, "e+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
SetCutValue(cutForProton, "proton");
SetCutValue(cutForProton, "anti_proton");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::SetCutForGamma(G4double cut)
{
ResetCuts();
cutForGamma = cut;
}
void GammaRayTelPhysicsList::SetCutForElectron(G4double cut)
{
ResetCuts();
cutForElectron = cut;
}
void GammaRayTelPhysicsList::SetCutForProton(G4double cut)
{
ResetCuts();
cutForProton = cut;
}
G4double GammaRayTelPhysicsList::GetCutForGamma() const
{
return cutForGamma;
}
G4double GammaRayTelPhysicsList::GetCutForElectron() const
{
return cutForElectron;
}
G4double GammaRayTelPhysicsList::GetCutForProton() const
{
return cutForProton;
}
@@ -0,0 +1,210 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPrimaryGeneratorAction.cc,v 1.3 2000/11/24 16:57:00 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPrimaryGeneratorAction ------
// by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelPrimaryGeneratorAction.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelPrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorAction::GammaRayTelPrimaryGeneratorAction
(GammaRayTelDetectorConstruction* GammaRayTelDC)
:GammaRayTelDetector(GammaRayTelDC),rndmFlag("off"),
nSourceType(0),nSpectrumType(0)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
//create a messenger for this class
gunMessenger = new GammaRayTelPrimaryGeneratorMessenger(this);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="e-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,-1.));
particleGun->SetParticleEnergy(30.*MeV);
G4double position = 0.5*(GammaRayTelDetector->GetWorldSizeZ());
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorAction::~GammaRayTelPrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
G4double z0 = 0.5*(GammaRayTelDetector->GetWorldSizeZ());
G4double x0 = 0.*cm, y0 = 0.*cm;
G4ThreeVector pos0;
G4ThreeVector dir0;
G4ThreeVector vertex0 = G4ThreeVector(x0,y0,z0);
dir0 = G4ThreeVector(0.,0.,-1.);
G4double theta, phi, y, f;
G4double theta0,phi0;
switch(nSourceType) {
case 0:
particleGun->SetParticlePosition(vertex0);
particleGun->SetParticleMomentumDirection(dir0);
break;
case 1:
// GS: Generate random position on the 4PIsphere to create a unif. distrib.
// GS: on the sphere
phi = G4UniformRand() * 2.0 * M_PI;
do {
y = G4UniformRand()*1.0;
theta = G4UniformRand() * M_PI;
f = sin(theta);
} while (y > f);
vertex0 = G4ThreeVector(1.,0.,0.);
vertex0.setMag(dVertexRadius);
vertex0.setTheta(theta);
vertex0.setPhi(phi);
particleGun->SetParticlePosition(vertex0);
dir0 = G4ThreeVector(1.,0.,0.);
do {
phi = G4UniformRand() * 2.0 * M_PI;
do {
y = G4UniformRand()*1.0;
theta = G4UniformRand() * M_PI;
f = sin(theta);
} while (y > f);
dir0.setPhi(phi);
dir0.setTheta(theta);
} while (vertex0.dot(dir0) >= -0.7 * vertex0.mag());
particleGun->SetParticleMomentumDirection((G4ParticleMomentum)dir0);
break;
case 2:
// GS: Generate random position on the upper semi-sphere z>0 to create a unif. distrib.
// GS: on a plane
phi = G4UniformRand() * 2.0 * M_PI;
do {
y = G4UniformRand()*1.0;
theta = G4UniformRand() * M_PI/2;
f = sin(theta) * cos(theta);
} while (y > f);
vertex0 = G4ThreeVector(1.,0.,0.);
G4double xy = GammaRayTelDetector->GetWorldSizeXY();
G4double z = GammaRayTelDetector->GetWorldSizeZ();
if (dVertexRadius > xy*0.5)
{
G4cout << "vertexRadius too big " << G4endl;
G4cout << "vertexRadius setted to " << xy*0.45 << G4endl;
dVertexRadius = xy*0.45;
}
if (dVertexRadius > z*0.5)
{
G4cout << "vertexRadius too high " << G4endl;
G4cout << "vertexRadius setted to " << z*0.45 << G4endl;
dVertexRadius = z*0.45;
}
vertex0.setMag(dVertexRadius);
vertex0.setTheta(theta);
vertex0.setPhi(phi);
// GS: Get the user defined direction for the primaries and
// GS: Rotate the random position according to the user defined direction for the particle
dir0 = particleGun->GetParticleMomentumDirection();
if (dir0.mag() > 0.001)
{
theta0 = dir0.theta();
phi0 = dir0.phi();
}
if (theta0!=0.)
{
G4ThreeVector rotationAxis(1.,0.,0.);
rotationAxis.setPhi(phi0+M_PI/2.);
vertex0.rotate(theta0+M_PI,rotationAxis);
}
particleGun->SetParticlePosition(vertex0);
break;
}
G4double pEnergy;
switch(nSpectrumType) {
case 0:
break;
case 1:
break;
case 2:
do {
y = G4UniformRand()*100000.0;
pEnergy = G4UniformRand() * 10. * GeV;
f = pow(pEnergy * (1/GeV), -4.);
} while (y > f);
particleGun->SetParticleEnergy(pEnergy);
break;
case 3:
break;
}
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,106 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPrimaryGeneratorMessenger.cc,v 1.2 2000/11/15 20:27:41 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPrimaryGeneratorMessenger ------
// by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelPrimaryGeneratorMessenger.hh"
#include "GammaRayTelPrimaryGeneratorAction.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorMessenger::GammaRayTelPrimaryGeneratorMessenger
(GammaRayTelPrimaryGeneratorAction* GammaRayTelGun)
:GammaRayTelAction(GammaRayTelGun)
{
RndmCmd = new G4UIcmdWithAString("/gun/random",this);
RndmCmd->SetGuidance("Shoot randomly the incident particle.");
RndmCmd->SetGuidance(" Choice : on(default), off");
RndmCmd->SetParameterName("choice",true);
RndmCmd->SetDefaultValue("on");
RndmCmd->SetCandidates("on off");
RndmCmd->AvailableForStates(PreInit,Idle);
SourceTypeCmd = new G4UIcmdWithAnInteger("/gun/sourceType",this);
SourceTypeCmd->SetGuidance("Select the type of incident flux.");
SourceTypeCmd->SetGuidance(" Choice : 0(default), 1(isotropic), 2(wide parallel beam)");
SourceTypeCmd->SetParameterName("choice",true);
SourceTypeCmd->SetDefaultValue((G4int)0);
SourceTypeCmd->AvailableForStates(PreInit,Idle);
VertexRadiusCmd = new G4UIcmdWithADoubleAndUnit("/gun/vertexRadius",this);
VertexRadiusCmd->SetGuidance("Radius (and unit) of sphere for vertices of incident flux.");
VertexRadiusCmd->SetParameterName("choice",true);
VertexRadiusCmd->SetDefaultValue((G4double)1.*cm);
VertexRadiusCmd->AvailableForStates(PreInit,Idle);
SpectrumTypeCmd = new G4UIcmdWithAnInteger("/gun/spectrumType",this);
SpectrumTypeCmd->SetGuidance("Select the type of incident spectrum.");
SpectrumTypeCmd->SetGuidance(" Choice : 0(default), 1(), 2(E^{-gamma}), 3()");
SpectrumTypeCmd->SetParameterName("choice",true);
SpectrumTypeCmd->SetDefaultValue((G4int)0);
SpectrumTypeCmd->AvailableForStates(PreInit,Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorMessenger::~GammaRayTelPrimaryGeneratorMessenger()
{
delete RndmCmd;
delete SourceTypeCmd;
delete VertexRadiusCmd;
delete SpectrumTypeCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if( command == RndmCmd )
{ GammaRayTelAction->SetRndmFlag(newValue);}
if( command == SourceTypeCmd )
{ GammaRayTelAction->SetSourceType(SourceTypeCmd->GetNewIntValue(newValue));}
if( command == VertexRadiusCmd )
{ GammaRayTelAction->SetVertexRadius(VertexRadiusCmd->GetNewDoubleValue(newValue));}
if( command == SpectrumTypeCmd )
{ GammaRayTelAction->SetSpectrumType(SpectrumTypeCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,103 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelRunAction.cc,v 1.3 2000/12/06 16:53:14 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelRunAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelRunAction.hh"
#include <stdlib.h>
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
extern ofstream outFile;
#ifdef G4ANALYSIS_USE
GammaRayTelRunAction::GammaRayTelRunAction(GammaRayTelAnalysisManager* aMgr)
:analysisManager(aMgr)
{
}
#else
GammaRayTelRunAction::GammaRayTelRunAction()
{
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelRunAction::~GammaRayTelRunAction()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelRunAction::BeginOfRunAction(const G4Run* aRun)
{
char name[15];
// Open the file for the tracks of this run
sprintf(name,"Tracks_%d.dat", aRun->GetRunID());
outFile.open(name);
// Prepare the visualization
if (G4VVisManager::GetConcreteInstance())
{
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/scene/notifyHandlers");
}
// If analysis is used reset the histograms
#ifdef G4ANALYSIS_USE
analysisManager->BeginOfRun();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelRunAction::EndOfRunAction(const G4Run* aRun)
{
// Run ended, update the visualization
if (G4VVisManager::GetConcreteInstance()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
// Close the file with the hits information
outFile.close();
// If analysis is used, print out the histograms
#ifdef G4ANALYSIS_USE
analysisManager->EndOfRun(aRun->GetRunID());
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,139 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelVisManager.cc,v 1.2 2000/11/15 20:27:42 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelVisManager ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#ifdef G4VIS_USE
#include "GammaRayTelVisManager.hh"
// Supported drivers...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_DAWNFILE
#include "G4DAWNFILE.hh"
#endif
#ifdef G4VIS_USE_OPACS
#include "G4Wo.hh"
#include "G4Xo.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
#ifdef G4VIS_USE_VRMLFILE
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelVisManager::GammaRayTelVisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelVisManager::RegisterGraphicsSystems () {
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_DAWNFILE
RegisterGraphicsSystem (new G4DAWNFILE);
#endif
#ifdef G4VIS_USE_OPACS
RegisterGraphicsSystem (new G4Wo);
RegisterGraphicsSystem (new G4Xo);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
#ifdef G4VIS_USE_VRMLFILE
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,21 @@
# --------------------------------------------------------------
# $Id: GNUmakefile,v 1.4 2000/11/16 13:46:04 nartallo Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := XrayTel
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
G4VIS_USE = 1
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
+68
View File
@@ -0,0 +1,68 @@
$Id: History,v 1.9 2000/12/06 18:34:34 nartallo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
06.12.2000 - RN, tag xraytel-V02-00-10
Removed old XrayTelPrimaryGeneratorMessenger.cc and .hh
files from cvs
30.11.2000 - RN, tag xraytel-V02-00-09
Removed longsection.macro file from cvs
30.11.2000 - RN, tag xraytel-V02-00-08
Implemented AnalysisManager class and related histograming
code. Analysis is limited to the Lizard package for now.
16.11.2000 - RN, tag xraytel-V02-00-07
Removed analysis directory
16.11.2000 - RN, tag xraytel-V02-00-06
Replace standard gun with General Particle Source
Remove all code related to old Histogram implementation
Modified all macros to work with GPS
Cleaned GNUmakefile
Started drafting README file
08.11.2000 - RN, tag xraytel-V02-00-05
Tydied up macros
Small bug fixes to compile on Linux, SUN and DEC platforms
06.11.2000 - RN, tag xraytel-V02-00-04
Tydied up code added headers
18.10.2000 - RN, tag xraytel-V02-00-03
Modified geometry and PrimaryGenerator to speed up events
Modified SteppingAction.cc to call histoManager analyser
Modified Histogram.cc to do all the histo work
17.10.2000 - RN, tag xraytel-V02-00-02
Added histograming capability
Added XrayTelHistogram.hh, XrayTelHistogram.cc
Modified: GNUmakefile
XrayTel.cc
XrayTelSteppingAction.hh
XrayTelSteppingAction.cc
17.10.2000 - RN, tag xraytel-V02-00-01
Tydied up geometry
Add all physics processes to XrayTelPhysicsList.cc
Modified *.hh accordingly
06.10.2000 - RN, tag xraytel-V02-00-00
First submission of XrayTel advanced example.
+171
View File
@@ -0,0 +1,171 @@
$Id: README,v 1.5 2000/12/06 18:34:42 nartallo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
xray_telescope
--------------
XrayTel is an advanced Geant4 example based on a realistic simulation of
an X-ray Telescope. It is based on work carried out by a team of Geant4
experts to simulate the interaction between X-ray Telescopes XMM-Newton
and Chandra with low energy protons present in the orbital radiation
background. The X-ray mirrors are designed to collect x-ray photons at
grazing-incidence angles and focus them onto detectors at the focal plane.
However, this mechanism also seems to work for low energy protons which,
if they reach the detectors in sufficient numbers, can cause damage.
In this example, the geometry has been simplified by using a single mirror
shell and no baffles, but all the dimensions and materials are realistic.
The aim of this advanced example is to illustrate the use advanced
GUI, visualisation, particle generation and analysis schemes available
in Geant4:
- the simulation can be run from GAG or the command prompt
- macros are provided to display the geometry and particle tracks with
OpenGL, DAWN Postscript or VRML visualisation
- the generation of particles is done via the new General Particle Source
- histograming facilities are provided for the Linux environment only
with the Lizard system at present, other analysis systems such as
OpenScientist and JAS will be implemented at a later stage
In order to be able to use any of these packages, prior installation is
necessary and a number of environment variables will have to be set.
1. Setting up the environment variables for GAG, Visualisation and
Analysis options (example based on Linux at CERN)
#set up GAG
setenv G4UI_BUILD_GAG_SESSION 1
setenv G4UI_USE_GAG 1
#set up VRMLview
setenv G4VIS_BUILD_VRMLFILE_DRIVER 1
setenv G4VIS_USE_VRML 1
setenv G4VIS_USE_VRMLFILE 1
setenv G4VRMLFILE_MAX_FILE_NUM 100
setenv G4VRMLFILE_VIEWER vrmlview #if installed
setenv G4VIS_USE_VRML 1
setenv G4VIS_USE_VRMLFILE 1
setenv PATH ${PATH}:"/afs/cern.ch/sw/contrib/VRML/bin/Linux"
#set up OpenGL or Mesa
setenv G4VIS_BUILD_OPENGLX_DRIVER 1
setenv G4VIS_USE_OPENGLX 1
setenv OGLHOME /afs/cern.ch/sw/geant4/dev/Mesa/Linux-g++
#set up DAWN
setenv G4VIS_BUILD_DAWN_DRIVER 1
setenv G4VIS_BUILD_DAWNFILE_DRIVER 1
setenv G4VIS_USE_DAWN 1
setenv G4VIS_USE_DAWNFILE 1
setenv PATH ${PATH}:"/afs/cern.ch/sw/geant4/dev/DAWN/Linux-g++"
#set up Lizard
setenv LIZARDROOT /usr/local/freeLizard/3.2.0 #get correct path
setenv G4ANALYSIS_SYSTEM Lizard
setenv G4ANALYSIS_USE 1
setenv G4ANALYSIS_USE_LIZARD 1
setenv G4ANALYSIS_BUILD 1
setenv G4ANALYSIS_BUILD_LIZARD 1
#add to the LD_LIBRARY_PATH
setenv LD_LIBRARY_PATH /usr/local/freeLizard/3.2.0/Linux/lib:$OGLHOME/lib
IMPORTANT WARNING!
setenv G4ANALYSIS_BUILD 1
must always be set to build the example even if the analysis option
is not required
Sources
-------
GAG can be obtained from
http://erpc1.naruto-u.ac.jp/~geant4/
OpenGL Mesa needs to be installed prior to building Geant4 and can be
downloaded from
http://www.mesa3d.org/download.html
DAWN can be obtained from
http://133.7.51.8/dawn/
VRMLview for Linux can be obtained from
2. Run
To execute a sample simulation with visualisation of proton tracks
reaching the detector run:
XrayTel opengl.mac for OpenGL display
XrayTel vrml.mac for VRML display and output file
XrayTel dawn.mac for dawn display and PS output file
To execute a run without visualisation
XrayTel test.mac
If the Lizard analysis options are set, histograming windows will
automatically open and the corresponding files will be created.
A 2D histogram (scatter plot) will display in real time every proton
hit that reaches the detector.
A 1D histogram will display the energy distribution of the protons
that reach the detector at the end of the run.
The final energy and (x,y,z) position of the protons that reach the
detector is output to a file "detector.hits". This file is created
if it does not exist or appended to if it does.
3. Detector description
The telescope and detector geometry is defined in
XrayTelDetectorConstruction.cc
4. Physics processes
The physics processes are in XrayTelPhysicsList.cc
The main process in this example is MultipleScattering of the protons
on the mirror surfaces.
5. Event generation
This is done using the new General Particle Source. Documentation for
this can be found in
http://www.space.dera.gov.uk/space_env/gspm.html
6. Analysis
At present the analysis package implemented is Lizard. As this is still
under development only simple histograming is used. The main purpose of
including this facility was to provide the basis for the implementation of
AIDA interfaces between Geant4 and analysis packages, in particular
Lizard, OpenScientist and JAS. More complex analysis features may be
implemented in future releases.
The current implementation of the analysis class is very preliminary
and new tags of this example are anticipated to be released soon after
the general release
Lizard is not currently implemented on platforms other than Linux.
To build and execute the example on other platforms the analysis
environment variables must not be set, except for G4ANALYSIS_BUILD
which is required for building the executable.
+124
View File
@@ -0,0 +1,124 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTel.cc main file *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// HISTORY
// -------
//
// The development of this advanced example is based on earlier work
// carried out by a team of Geant4 collaborators to simulate the Chandra
// and XMM X-ray observatories. The authors involved in those models are
// J Apostolakis, P Arce, S Giani, F Lei, R Nartallo, S Magni,
// P Truscott, L Urban
//
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 R. Nartallo, A. Pfeiffer
// - Implementation of analysis manager code for histograming
//
// 15.11.2000 R. Nartallo
// - Minor changes proposed by F. Lei to implement the GPS module now
// replacing the standard particle gun
// - Remove commented lines related to old histograming code
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
// - Lines for using GAG and the histogram manager are commented out.
//
//
// **********************************************************************
#include "G4RunManager.hh"
#include "G4UImanager.hh"
//#include "G4UIGAG.hh"
#include "G4UIterminal.hh"
#include "G4UIXm.hh"
#include "XrayTelDetectorConstruction.hh"
#include "XrayTelPhysicsList.hh"
#include "XrayTelVisManager.hh"
#include "XrayTelEventAction.hh"
#include "XrayTelRunAction.hh"
#include "XrayTelSteppingAction.hh"
#include "XrayTelPrimaryGeneratorAction.hh"
#include <iostream.h>
#include "g4std/vector"
#include "XrayTelAnalysisManager.hh"
int main( int argc, char** argv )
{
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
runManager->SetUserInitialization(new XrayTelDetectorConstruction ) ;
runManager->SetUserInitialization(new XrayTelPhysicsList);
// setup some of the common variables
G4bool drawEvent;
G4std::vector<G4double*> EnteringEnergy;
G4std::vector<G4ThreeVector*> EnteringDirection;
// create manager for analysis.
char* s = getenv("G4ANALYSIS_SYSTEM");
XrayTelAnalysisManager* analysisManager = new XrayTelAnalysisManager(s?s:"");
// set mandatory user action class
runManager->SetUserAction(new XrayTelPrimaryGeneratorAction);
runManager->SetUserAction(new XrayTelRunAction(&EnteringEnergy,
&EnteringDirection, &drawEvent, analysisManager));
runManager->SetUserAction(new XrayTelEventAction(&drawEvent));
runManager->SetUserAction(new XrayTelSteppingAction(
&EnteringEnergy, &EnteringDirection, &drawEvent, analysisManager));
// visualization manager
G4VisManager* visManager = new XrayTelVisManager;
visManager->Initialize();
//Initialize G4 kernel
runManager->Initialize();
// get the pointer to the User Interface manager
G4UImanager *UI = G4UImanager::GetUIpointer();
if ( argc==1 ){
// G4UIsession * session = new G4UIGAG;
G4UIsession * session = new G4UIterminal;
session->SessionStart();
delete session;
}
else {
// Create a pointer to the User Interface manager
G4String command = "/control/execute ";
for (int i=2; i<=argc; i++) {
G4String macroFileName = argv[i-1];
UI->ApplyCommand(command+macroFileName);
}
}
// job termination
delete visManager;
delete analysisManager;
delete runManager;
return 0;
}
+131
View File
@@ -0,0 +1,131 @@
#######################################################################
# #
# This code implementation is the intellectual property of #
# the GEANT4 collaboration. #
# #
# By copying, distributing or modifying the Program (or any work #
# based on the Program) you indicate your acceptance of this #
# statement, and all its terms. #
# #
# ******************************************************************* #
# * * #
# * GEANT 4 xray_telescope advanced example * #
# * * #
# * MACRO: dawn.mac * #
# * ------ demostrates the DAWN DRIVER * #
# * * #
# * Version: 0.6 * #
# * Date: 15/11/00 * #
# * Author: R Nartallo * #
# * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * #
# * * #
# ******************************************************************* #
# #
# NOTES #
# ----- #
# USAGE: Idle> /control/execute dawn.mac #
# prompt> XrayTel dawn.mac #
# #
# REQUIRED PLATFORMS & SOFTWARE: DAWN (version 3.85 or after) #
# Ghostview #
# #
# ENVIRONMENT VARIABLES (C-MACROS) FOR INSTALLATION: #
# (See geant4/source/visualization/README for details.) #
# #
# % setenv G4VIS_USE_DAWN 1 #
# % setenv G4VIS_USE_DAWNFILE 1 #
# % setenv G4VIS_BUILD_DAWN_DRIVER 1 #
# % setenv G4VIS_BUILD_DAWNFILE_DRIVER 1 #
# #
# Addional Notes: #
# #
# * You may have to set the command path to the directory where #
# a Fukui Renderer DAWN is installed, e.g., to #
# "/afs/cern.ch/sw/contrib/DAWN/3.85/bin/Linux/" #
# at CERN. #
# #
# * Set as follows to skip DAWN GUI: #
# % setenv G4DAWNFILE_VIEWER "dawn -d" #
# #
# * In order to make the generated PostScript file "g4_XX.eps" #
# printable, append the "showpage" PostScript command to the file. #
# You can do it with the 4th page of the DAWN GUI panel #
# or by editing the file by hand. #
# #
#######################################################################
# #
# CHANGE HISTORY #
# -------------- #
# #
# 15.11.2000 R. Nartallo #
# - Replaced standard particle gun by GPS set options #
# #
# 08.11.2000 R. Nartallo #
# - Modified version #
# #
# 17.10.2000 S. Tanaka #
# - First implementation #
# #
#######################################################################
# Set verbose level
/run/verbose 2
# Invoke the DAWNFILE driver
/vis/open DAWNFILE
# Create a new scene
/vis/scene/create
# Attach the current scene handler to the current scene
/vis/sceneHandler/attach
# Add the world volume to the current scene
/vis/scene/add/volume
# Set drawing style
/vis/viewer/set/style surface
#/vis/viewer/set/style wireframe
# Set camera
/vis/camera/reset
/vis/camera/viewpoint 25 0
# Visualize one event added to the current scene
# * Command "/vis/scene/notifyHandlers" is written in
# XrayTelRunAction::BeginOfRunAction()
# * Command "/vis/show/view" is written in
# XrayTelRunAction::EndOfRunAction()
# Store particle trajactories for visualization
/tracking/storeTrajectory 1
# Set to draw tracks of positively charged particles
/event/drawTracks charged
# Set General Particle Source options
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
# Set number of particles and start
/run/beamOn 10000
@@ -0,0 +1,91 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelAnalysisManager.cc *
// * ------- *
// * *
// * Version: 0.2 *
// * Date: 30/11/00 *
// * Author: A. Pfeiffer, G. Barrand, MG Pia, R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 M.G. Pia, R. Nartallo
// - Simplification of code
// - Inheritance directly from the base class G4VAnalysisManager instead
// of the derived class G4AnalysisManager
//
// 16.10.2000 G. Barrand
// - First implementation of XrayAnalysisManager class
// - Provision of code for various AIDA and non-AIDA systems
//
// **********************************************************************
#ifndef XrayTelAnalysisManager_h
#define XrayTelAnalysisManager_h 1
#include "G4VAnalysisManager.hh"
#include "globals.hh"
#include "g4std/vector"
#include "G4ThreeVector.hh"
class G4SteppingManager;
class G4VAnalysisSystem;
#ifdef G4ANALYSIS_USE
class IHistogramFactory;
class IHistogram1D;
class IHistogram2D;
#endif
#ifdef G4ANALYSIS_USE
class XrayTelAnalysisManager: public G4VAnalysisManager {
#endif
#ifndef G4ANALYSIS_USE
class XrayTelAnalysisManager {
#endif
public:
XrayTelAnalysisManager(const G4String&);
~XrayTelAnalysisManager();
G4bool RegisterAnalysisSystem(G4VAnalysisSystem*);
#ifdef G4ANALYSIS_USE
IHistogramFactory* GetHistogramFactory(const G4String&);
virtual void Store(IHistogram* = 0,const G4String& = "");
virtual void Plot(IHistogram*);
#endif
void BeginOfRun();
void EndOfRun();
void Step(const G4SteppingManager*);
private:
G4VAnalysisSystem* analysisSystem;
#ifdef G4ANALYSIS_USE
IHistogramFactory* hFactory;
IHistogram1D* enteringEnergyHistogram;
IHistogram2D* yzHistogram;
#endif
};
#endif
@@ -0,0 +1,59 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelDetectorConstruction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelDetectorConstruction_H
#define XrayTelDetectorConstruction_H 1
class G4VPhysicalVolume;
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
class XrayTelDetectorConstruction : public G4VUserDetectorConstruction
{
public:
XrayTelDetectorConstruction();
~XrayTelDetectorConstruction();
public:
G4VPhysicalVolume* Construct();
private:
G4double world_x;
G4double world_y;
G4double world_z;
void ConstructTelescope();
void ConstructFocalPlane();
G4VPhysicalVolume* physicalWorld;
};
#endif
@@ -0,0 +1,66 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventAction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelEventAction_h
#define XrayTelEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class XrayTelEventActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelEventAction : public G4UserEventAction
{
public:
XrayTelEventAction(G4bool* dEvent);
~XrayTelEventAction();
public:
void BeginOfEventAction(const G4Event* anEvent);
void EndOfEventAction(const G4Event* anEvent);
void SetDrawFlag(G4String val) {drawFlag = val;};
private:
G4bool* drawEvent;
G4String drawFlag; // control the drawing of event
XrayTelEventActionMessenger* eventMessenger;
};
#endif
@@ -0,0 +1,62 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventActionMessenger.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelEventActionMessenger_h
#define XrayTelEventActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class XrayTelEventAction;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelEventActionMessenger: public G4UImessenger
{
public:
XrayTelEventActionMessenger(XrayTelEventAction*);
~XrayTelEventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
XrayTelEventAction* eventAction;
G4UIcmdWithAString* DrawCmd;
};
#endif
@@ -0,0 +1,85 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPhysicsList.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelPhysicsList_h
#define XrayTelPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
class XrayTelPhysicsList: public G4VUserPhysicsList
{
public:
XrayTelPhysicsList();
~XrayTelPhysicsList();
protected:
// Construct particle and physics process
void ConstructParticle();
void ConstructProcess();
void SetCuts();
public:
// Set/Get cut values
void SetCutForGamma(G4double);
void SetCutForElectron(G4double);
void SetCutForProton(G4double);
G4double GetCutForGamma() const;
G4double GetCutForElectron() const;
G4double GetCutForProton() const;
protected:
// these methods Construct particles
void ConstructBosons();
void ConstructLeptons();
void ConstructMesons();
void ConstructBaryons();
void ConstructAllShortLiveds();
protected:
// these methods Construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForProton;
};
#endif

Some files were not shown because too many files have changed in this diff Show More