Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
+13 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.59 2001/01/25 11:58:05 stesting Exp $
$Id: History,v 1.63 2001/12/13 17:49:48 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,18 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
13th December 2001 Gabriele Cosmo (examples-V03-02-05)
- Updated reference outputs.
12th December 2001 John Allison (examples-V03-02-04)
- Updated new VisManagers for new graphics systems and defaults.
19th November 2001 John Allison (examples-V03-02-02)
- Updated VisManagers for new graphics systems and defaults.
23-Oct-2001 Gabriele Cosmo (examples-V03-02-01)
- Synchronised with HEAD revision. Removal of all occurences of RW wrappers.
25-Jan-2001 Steve O'Neale (examples-V03-00-00)
- Updated all "small_N" test outputs
+28 -15
View File
@@ -1,4 +1,4 @@
$Id: README,v 1.2 1999/05/31 08:14:43 asaim Exp $
$Id: README,v 1.3 2001/10/23 15:24:08 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -14,16 +14,18 @@ in a correct way those user-classes which the user is supposed to
customize in order to define his/her own simulation setup.
One set of examples is oriented to "novice" users and covering all
possible general use-cases typical of an "application"-oriented kind of
development. An "Extended" set of examples require some additional
libraries besides of Geant4. This set covers some realistic use cases
for actual detector simulation for HEP. An "advanced" set of examples
(not yet available at the current time), will cover the use-cases typical
of a "toolkit"-oriented kind of development.
development. An "extended" set of examples require some additional
libraries besides of Geant4. This set covers some specific use cases
for actual detector simulation. An "advanced" set of examples covers
the use-cases typical of a "toolkit"-oriented kind of development,
where real complete applications for different simulation studies are
provided; may require additional third party products to be built.
Most of the examples can be run both in interactive and batch mode, and
input macro files (*.in) and reference output files (*.out) are provided.
These examples are considered part of the validation procedure for the
official releases of the GEANT4 toolkit, as "acceptance"-testing phase
of the validation process.
Novice and most of the extended examples are considered part of the
system testing suite for validation of the official releases of the
GEANT4 toolkit. Novice examples are used as "acceptance"-tests for the
release process.
Novice level examples
ExampleN01
@@ -48,10 +50,21 @@ Novice level examples
- Optical photon processes
Extended level examples
ExampleE01
- CLHEP histogramming
ExampleE02
- Persistency by HepODBMS (CERN RD45)
ExampleE03
- STEP geometry interface
analysis
- Histogramming through the AIDA interface
electromagnetic
- Specific EM physics simulation with histogramming
field
- Specific simulation setups in magnetic field
g3tog3
- Examples of usage of the g3tog4 converter tool
persistency
- Persistency through the HepODBMS interface
Advanced level examples
brachytherapy
- Setup for brachytherapy Ir-192 HDR source
gammaray_telescope
- Simulation of a typical telescope for gamma ray analysis
xray_telescope
- Realistic simulation of an X-ray Telescope
+3 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 1999/01/07 16:05:17 gunter Exp $
# $Id: GNUmakefile,v 1.3 2001/12/04 13:38:55 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
@@ -9,7 +9,8 @@ endif
include $(G4INSTALL)/config/architecture.gmk
SUBDIRS = A01 A02 A03 A04 A05 A06
SUBDIRS = brachytherapy gammaray_telescope underground_physics
SUBDIRS += xray_fluorescence xray_telescope
.PHONY : all clean clean_libs
+10 -1
View File
@@ -1,4 +1,4 @@
$Id: README,v 1.1 1999/01/07 16:05:17 gunter Exp $
$Id: README,v 1.2 2001/10/23 15:09:27 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -8,3 +8,12 @@ $Id: README,v 1.1 1999/01/07 16:05:17 gunter Exp $
Advanced Examples
-----------------
In this directory one can find examples of real complete applications used
for different simulation studies. The applications included here may require
third party products for handling of the data produced (visualization,
analysis or persistency tools). Refer to the README and documentation provided
in each example for the details.
These application are made part of the official GEANT4 distribution, however
their maintenance and updates is under responsibility of the authors. These
applications are not subject to regular system testing.
+34 -14
View File
@@ -19,10 +19,7 @@
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: Brachy.cc,v 1.4.4.1 2001/06/28 19:06:34 gunter Exp $
// GEANT4 tag $Name: $
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
@@ -37,12 +34,13 @@
//
// Simplified gamma generation is used.
// Source axis is oriented along Z axis.
// Voxel data on the X-Z plane is output to ASCII file
// Voxel data on the X-Z plan
//e is output to ASCII file
// "Brachy.out".
//
// For information related to this code contact the developers.
//
// --------------------------------------------------------------
//
// $Id: Brachy.cc,v 1.8 2001/12/13 13:44:53 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
#include "BrachyEventAction.hh"
#include "BrachyDetectorConstruction.hh"
@@ -50,6 +48,7 @@
#include "BrachyPrimaryGeneratorAction.hh"
#include "BrachyWaterBoxSD.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
@@ -58,7 +57,7 @@
int main()
{
// Number of generated photons
G4int NumberOfEvents = 10;
G4int NumberOfEvents = 1000;
// Define number of voxels in X-Z plane
G4int NumVoxelX = 101;
@@ -103,8 +102,15 @@ int main()
// 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;
ofs<<" x(mm)"<<'\t'<<"z(mm)"<<'\t'<<"released energy(Mev)"
<<G4endl;
G4double VoxelWidth_X = pDetectorConstruction->GetBoxDim_X()/NumVoxelX;
G4double VoxelWidth_Z = pDetectorConstruction->GetBoxDim_Z()/NumVoxelZ;
G4double x,z;
for(G4int k=0;k<NumVoxelZ;k++)
@@ -118,8 +124,12 @@ int main()
// Do not consider near voxels
if(fabs(x) > 3*mm || fabs(z) > 6*mm)
ofs << x << '\t' << z << '\t' << pVoxel[j] << G4endl;
}
{ ofs << x << '\t' << z << '\t' << pVoxel[j] << G4endl;
//check released energy
// if(pVoxel[j]!=0)
// G4cout<<x<<'\t'<<z<< '\t'<<pVoxel[j]<<G4endl;
}
}
}
ofs.close();
}
@@ -132,3 +142,13 @@ int main()
return 0;
}
@@ -42,17 +42,20 @@ class BrachyDetectorConstruction : public G4VUserDetectorConstruction
~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;
G4double GetBoxDim_X() {return m_BoxDimX;};
G4double GetBoxDim_Z() {return m_BoxDimZ;};
public:
G4VPhysicalVolume* Construct();
};
private:
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
G4double m_BoxDimX;
G4double m_BoxDimY;
G4double m_BoxDimZ;
G4String m_SDName;
};
#endif
@@ -42,13 +42,17 @@ class BrachyEventAction : public G4UserEventAction
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
public:
private:
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
G4float *m_pVoxel;
private:
G4int m_HitsCollectionID;
};
#endif
@@ -28,7 +28,7 @@
#ifndef BrachyWaterBoxROGeometry_h
#define BrachyWaterBoxROGeometry_h 1
#define BrachyWaterBoxROGeometry_h
#include "G4VReadOutGeometry.hh"
@@ -38,7 +38,7 @@ class BrachyWaterBoxROGeometry : public G4VReadOutGeometry
BrachyWaterBoxROGeometry(G4String aString,G4double DetDimX,G4double DetDimZ,G4int NumVoxelX,G4int NumVoxelZ);
~BrachyWaterBoxROGeometry();
public:
private:
const G4double m_DetDimX;
const G4double m_DetDimZ;
const G4int m_NumVoxelX;
@@ -89,3 +89,15 @@ void BrachyEventAction::EndOfEventAction(const G4Event* evt)
}
}
}
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2000/12/06 16:53:11 flongo Exp $
# $Id: GNUmakefile,v 1.17 2001/12/10 08:52:09 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
@@ -11,13 +11,28 @@ ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/architecture.gmk
# Copy the GammaRayTelAnalysis files according to which version
# is selected.
# As the dependency is checked before "all" is reached, we need
# to do some tricks here ...
ifdef G4ANALYSIS_AIDA_CONFIG_CFLAGS
# AIDA (version 2.2 for now) selected
FOO := $(shell cp -p include/GammaRayTelAnalysis.hh-AIDA include/GammaRayTelAnalysis.hh )
FOO := $(shell cp -p src/GammaRayTelAnalysis.cc-AIDA src/GammaRayTelAnalysis.cc )
else
# Anaphe selected
include anaphe.gmk
FOO := $(shell cp -p include/GammaRayTelAnalysis.hh-Anaphe include/GammaRayTelAnalysis.hh )
FOO := $(shell cp -p src/GammaRayTelAnalysis.cc-Anaphe src/GammaRayTelAnalysis.cc )
endif
# End Analysis.
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTel.cc,v 1.3.4.2 2001/06/28 20:18:35 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTel.cc,v 1.8 2001/12/04 11:40:27 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
@@ -33,11 +33,14 @@
// ------------ GammaRayTel example main program ------
// by F.Longo, R.Giannitrapani & G.Santin (29 nov 2000)
// See README file for details on this example
// 20.11.01 G.Santin: new analysis management, and some modification in the
// construction of some Action's
// ************************************************************
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#ifdef G4UI_USE_XM
#include "G4UIXm.hh"
@@ -54,9 +57,11 @@
#include "GammaRayTelEventAction.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#include "GammaRayTelAnalysis.hh"
#endif
//using namespace Lizard;
/* This global file is used to store relevant data for
analysis with external tools */
@@ -75,24 +80,17 @@ int main(int argc, char** argv)
runManager->SetUserInitialization(new GammaRayTelPhysicsList);
// Set mandatory user action classes
runManager->SetUserAction(new GammaRayTelPrimaryGeneratorAction(detector));
runManager->SetUserAction(new GammaRayTelPrimaryGeneratorAction);
#ifdef G4ANALYSIS_USE
// Creation of the analysis manager
GammaRayTelAnalysisManager* analysisMgr = new GammaRayTelAnalysisManager(detector);
GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
#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);
@@ -102,10 +100,15 @@ int main(int argc, char** argv)
#ifdef G4UI_USE_XM
// Create a XMotif user interface
session = new G4UIXm(argc,argv);
#else
#ifdef G4UI_USE_TCSH
session = new G4UIterminal(new G4UItcsh);
#else
// Create the standard user interface
session = new G4UIterminal;
session = new G4UIterminal();
#endif
#endif
#ifdef G4VIS_USE
// Visualization manager
G4VisManager* visManager = new GammaRayTelVisManager;
@@ -143,7 +146,7 @@ int main(int argc, char** argv)
delete visManager;
#endif
#ifdef G4ANALYSIS_USE
delete analysisMgr;
delete analysis;
#endif
delete runManager;
return 0;
@@ -156,3 +159,5 @@ int main(int argc, char** argv)
+112 -41
View File
@@ -1,4 +1,4 @@
$Id: README,v 1.2 2000/12/06 16:53:12 flongo Exp $
$Id: README,v 1.11 2001/12/07 12:57:30 pfeiffer Exp $
-------------------------------------------------------------------
=========================================================
@@ -19,12 +19,14 @@ 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
anticoincidence system. In this version, the three detectors are made
sensitive but only 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.
ASCII file for subsequent analysis. If the user has set up the
AIDA (version 2.2 or compatible) environment or Anaphe/Lizard is available,
then some histograms with relevant hits information are displayed
and saved as PostScript files, and histograms and ntuples with
relevant information are stored on a HBOOK file.
The main features of this example are
@@ -39,11 +41,12 @@ The main features of this example are
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
d) Histograming facilities are presently provided for the Linux
environment either by using the AIDA interfaces, or through
the Anaphe/Lizard system. The AIDA compliant version has not
been tested by the developers and is here as a example of
"forward compatibility" on how to use analysis.
e) User interfaces via Xmotif or normal terminal provided
@@ -67,36 +70,43 @@ The main features of this example are
- Setup for Xmotif user interface
setenv G4UI_USE_XM 1
(IMPORTANT: Do not set G4ANALYSIS_USE_NTUPLE when using XM!)
- 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
- Set up for analysis using AIDA
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
To be sure to have the right compilation and link flags, the
'aida-config' command, provided by an AIDA compliant implementation
must be up and running ; in particular 'aida-config --cflags' and
'aida-config --libs' must be active.
#add to the LD_LIBRARY_PATH (get correct path)
setenv LD_LIBRARY_PATH /usr/local/freeLizard/3.2.0/Linux/lib
- Set up for analysis using Anaphe/Lizard
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
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_NTUPLE 1 # To store Ntuples
(IMPORTANT: Do not set G4UI_USE_XM when using Ntuples!)
and be sure to have the right path to the Lizard library, inserting this
on the .tcshrc:
(on a CERN machine with the gcc-2.95 compiler)
setenv PATH ${PATH}:/afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/3.6.5/bin
source /afs/cern.ch/sw/lhcxx/share/LHCXX/3.6.5/install/sharedstart.csh
(on a CERN machine with the egcs-2.91.66 compiler (G4SYSTEM Linux-egcs)
setenv PATH ${PATH}:/afs/cern.ch/sw/lhcxx/specific/redhat61/egcs_1.1.2/3.6.5-sec/bin
source /afs/cern.ch/sw/lhcxx/share/LHCXX/3.6.5-sec/install/sharedstart.csh
2. Sample run
@@ -120,6 +130,18 @@ The main features of this example are
your local G4 installation (see geant4/source/visualization/README for
more information).
ATTENTION:
If you use analysis with Lizard, you have to remove any hbook file in the
example directory obtained in previous Geant4 sessions. This issues will be
solved in future releases. Note also that the following error can be reported
during run with analysis activated
***** ERROR in HLNEXT : Bad sequence for RZ : ID= 1
Ignore this message; histograms (and ntuples) are correctly saved in the hbook files.
3. Detector description
-----------------------
@@ -163,8 +185,9 @@ The main features of this example are
7. Hit
------
In this version only the hits from the TKR are recorded. Each hit
contains the following information
In this version the hits from the TKR the CAL and the ACD are generated.
Only the hit from the TRK are saved. Each TKR 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)
@@ -176,7 +199,20 @@ The main features of this example are
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
8. Analysis
----------------
At present there are two options for analysis packages: either
explicitely the Anaphe 3.6.5 (or compatible) version is selected,
or any AIDA-2.2 compliant analysis system is chosen. This dual
approach will be removed in the next release when only the AIDA
compliant version will be present. Presently, the OpenScientist
package (version 8) provides an implementation of AIDA 2.2,
other packages as Anaphe and JAS will follow soon. The AIDA
compliant version has not been tested by the developers and is
here as a example of "forward compatibility" on how to use analysis.
9. Histogramming
----------------
Some hits information can be visualized runtime using Lizard (if it is
@@ -207,7 +243,20 @@ The main features of this example are
for next releases.
9. Classes Overview
10. Digi
--------
For the TKR also the digits corresponding to the Hits are generated.
A digi is generated when the hit energy deposit is greater than a threshold
(in this example setted at 120 keV).
The TKR digi information are stored on the same file Tracks_N.dat and contain:
a) ID of the event (this is important for multiple events run)
b) Number of the strip
c) Number of the plane
d) Type of the plane (1=X 0=Y)
11. Classes Overview
-------------------
This is the overview of the classes defined in this example
@@ -233,7 +282,7 @@ The main features of this example are
Messenger for interactive geometry parameters
modification via the User Interface
GammaRayTelAnalysisManager
GammaRayTelAnalysis
Analysis manager class with Lizard tool (experimental)
GammaRayTelAnalysisMessenger
@@ -246,14 +295,36 @@ The main features of this example are
GammaRayTelEventAction
User event action class
GammaRayTelPayloadHit
GammaRayTelTrackerHit
Description of the hits on the tracker
GammaRayTelPayloadROGeometry
GammaRayTelDigi
Description of the digi on the tracker
GammaRayTelDigitizer
Description of the digitizer for the tracker
GammaRayTelTrackerROGeometry
Description of the readout geometry for strips subdivision
GammaRayTelPayloadSD
Description of the sensitive detector
GammaRayTelTrackerSD
Description of the TKR sensitive detector
GammaRayTelAnticoincidenceHit
Description of the hits on the anticoincidence
GammaRayTelAnticoincidenceSD
Description of the ACD sensitive detector
GammaRayTelCalorimeterHit
Description of the hits on the calorimeter
GammaRayTelCalorimeterSD
Description of the CAL sensitive detector
@@ -0,0 +1,38 @@
# Some pieces to include if Anaphe is selected as analysis environment
# be aware that this will be obsolete as soon as Anaphe is implementing
# the AIDA 2.2 interfaces.
#
# This requires the env-var LHCXX_REL_DIR to be set up correctly,
# see the first lines in G4ComptonTest.cc
#
ifdef G4ANALYSIS_USE
CPPFLAGS += -I$(LHCXX_REL_DIR)/include
ifdef G4ANALYSIS_USE_NTUPLE
CPPFLAGS += -DG4ANALYSIS_USE_NTUPLE
endif
# C_FLAGS += -I$(LHCXX_REL_DIR)/include
LDFLAGS += -L$(LHCXX_REL_DIR)/lib
# general stuff:
LOADLIBS += -lHepUtilities -lAIDA_Annotation
# add for Histograms:
LOADLIBS += -lAIDA_HBook
# add for Vectors:
LOADLIBS += -lVector
# add for Plotter:
LOADLIBS += -lAIDA_Plotter -lqp -lqpview -lqt-mt -lqutil -lqt
# add for Ntuples:
LOADLIBS += -lAIDA_Ntuple -lNtupleTag -lNtupleTag_HBook
# ... and finally system stuff and to deal with the "Fortran legacy":
LOADLIBS += -lCHBook -ldl -lg2c
# Xm Xt
LDFLAGS += -L$/usr/local/lib -lXm -L/usr/X11R6/lib -lXt
endif
@@ -0,0 +1,32 @@
# tell HistoManager where to find the histograms:
# change the name to access hbook files different from the first run
hm.selectStore("gammaraytel0.hbook")
# ... and load them into memory:
hE = hm.load1D(1)
hPl = hm.load1D(2)
hXZ = hm.load2D(3)
hYZ = hm.load2D(4)
# set plotter to 3*2 zones
pl.zone(2,2)
# ... and plot the histograms
hplot(hE)
hplot(hPl)
hplot(hXZ)
hplot(hYZ)
# get the primary ntuple from the NtupleManager
nt1 = ntm.findNtuple("gammaraytel0.hbook::1" )
# see which attributes there are:
nt1.listAttributes()
@@ -21,23 +21,29 @@
// ********************************************************************
//
//
// $Id: GammaRayTelAnalysisManager.hh,v 1.2.2.2 2001/06/28 20:18:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelAnalysis.hh-AIDA,v 1.3 2001/12/07 13:20:20 pfeiffer Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
//
// ------------ GammaRayTelAnalysisManager ------
// ------------ GammaRayTelAnalysis ------
// by R.Giannitrapani, F. Longo & G.Santin (30 nov 2000)
//
// 07.12.2001 A.Pfeiffer
// - integrated Guy's addition of the ntuple
//
// 06.12.2001 A.Pfeiffer
// - updating to new design (singleton)
//
// 22.11.2001 G.Barrand
// - Adaptation to AIDA
//
// ************************************************************
#ifdef G4ANALYSIS_USE
#ifndef GammaRayTelAnalysisManager_h
#define GammaRayTelAnalysisManager_h 1
#include "G4VAnalysisManager.hh"
#ifndef GammaRayTelAnalysis_h
#define GammaRayTelAnalysis_h 1
#include "globals.hh"
#include "g4std/vector"
@@ -45,33 +51,29 @@
class GammaRayTelAnalysisMessenger;
class GammaRayTelDetectorConstruction;
class IAnalysisFactory;
class IHistogramFactory;
class ITree;
class IHistogram1D;
class IHistogram2D;
class ITuple;
class IPlotter;
class IVectorFactory;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelAnalysisManager: public G4VAnalysisManager
{
class GammaRayTelAnalysis {
public:
GammaRayTelAnalysisManager(GammaRayTelDetectorConstruction*);
virtual ~GammaRayTelAnalysisManager();
virtual ~GammaRayTelAnalysis();
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 BeginOfRun(G4int n);
void EndOfRun(G4int n);
void EndOfEvent(G4int flag);
void Init();
void Finish();
void SetHisto1DDraw(G4String str) {histo1DDraw = str;};
void SetHisto1DSave(G4String str) {histo1DSave = str;};
void SetHisto2DDraw(G4String str) {histo2DDraw = str;};
@@ -80,19 +82,35 @@ public:
G4String GetHisto2DMode() {return histo2DMode;};
void InsertPositionXZ(double x, double z);
void InsertPositionYZ(double y, double z);
void InsertEnergy(double en);
void InsertHits(int nplane);
void setNtuple(float E, float p, float x, float y, float z);
static GammaRayTelAnalysis* getInstance(int = 0, char** = 0);
private:
G4VAnalysisSystem* analysisSystem;
IPlotter* pl;
IVectorFactory* fVectorFactory;
IHistogramFactory* histoFactory;
GammaRayTelAnalysis(int = 0, char** = 0);
void plot1D(IHistogram1D* histo);
void plot2D(IHistogram2D* histo);
void Plot();
private:
static GammaRayTelAnalysis* instance;
GammaRayTelDetectorConstruction* GammaRayTelDetector;
IAnalysisFactory* analysisFactory;
ITree* tree;
IPlotter* plotter;
ITuple* tuple;
IHistogram1D* energy;
IHistogram1D* hits;
IHistogram2D* posXZ;
IHistogram2D* posYZ;
GammaRayTelDetectorConstruction* GammaRayTelDetector;
G4String histo1DDraw;
G4String histo1DSave;
G4String histo2DDraw;
@@ -104,13 +122,4 @@ private:
#endif
#endif
@@ -0,0 +1,175 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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. *
// ********************************************************************
//
// Author: A. Pfeiffer (Andreas.Pfeiffer@cern.ch)
// (copy of his UserAnalyser class)
//
// History:
// -----------
// 7 Nov 2001 MGP Implemented according to A. Pfeiffer's instructions
// 18 Nov 2001 G.Santin GammaRayTel analysis management modified
// according to the new design
//
// -------------------------------------------------------------------
// Class description:
// Example of analysis in a simulation application (histograms, ntuples etc.)
// This class follows the singleton design pattern;
// it is responsible for the analysis management and algorithms
// Histograms are compliant with AIDA, except for the usage of IHistoManager,
// which is Anaphe/Lizard-specific
// For ntuples, for which the AIDA interfaces and compliant implementations
// are still in progress at the time of the current Geant4 release,
// an implementation with Anaphe/Lizard is shown
// Other implementations specific to an analysis system are possible too
// (see, for instance, JAS and OpenScientist documentation from the links
// in http://aida.freehep.org/)
// The implementation of the usage of ntuples shown in this example
// is expected to change in future Geant4 releases, when AIDA interfaces
// and related implementations would be available
// Further documentation is available from: http://www.ge.infn.it/geant4/lowE/
// http://aida.freehep.org/
// http://cern.ch/anaphe/
// -------------------------------------------------------------------
#ifdef G4ANALYSIS_USE
#ifndef GammaRayTelAnalysis_h
#define GammaRayTelAnalysis_h
#include "globals.hh"
// Histogramming from AIDA
#include "Interfaces/IHistogram1D.h"
#include "Interfaces/IHistogram2D.h"
// Histogramming from Anaphe
#include "Interfaces/IHistoManager.h"
// Vectors from ?
#include "Interfaces/IVector.h"
#include "Interfaces/IVectorFactory.h"
// Plotting from Anaphe?
#include "Interfaces/IPlotter.h"
//#include "AIDA_Plotter/AIDAPlotter.h"
// Ntuples from Anaphe
#ifdef G4ANALYSIS_USE_NTUPLE
#include "NtupleTag/LizardNTupleFactory.h"
#include "NtupleTag/LizardQuantity.h"
#include "NtupleTag/LizardNTuple.h"
//using namespace Lizard;
#endif
class G4Track;
class GammaRayTelAnalysisMessenger;
class GammaRayTelDetectorConstruction;
class GammaRayTelAnalysis
{
public:
~GammaRayTelAnalysis();
void BeginOfRun(G4int n);
void EndOfRun(G4int n);
void EndOfEvent(G4int flag);
void Init();
void Finish();
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;};
void InsertPositionXZ(double x, double z);
void InsertPositionYZ(double y, double z);
void InsertEnergy(double en);
void InsertHits(int nplane);
#ifdef G4ANALYSIS_USE_NTUPLE
void setNtuple(float E, float p, float x, float y, float z);
#endif
static GammaRayTelAnalysis* getInstance();
private:
GammaRayTelAnalysis();
void plot1D(IHistogram1D* histo);
void plot2D(IHistogram2D* histo);
void Plot();
static GammaRayTelAnalysis* instance;
IHistoManager* histoManager;
IVectorFactory* vectorFactory;
IPlotter* plotter;
#ifdef G4ANALYSIS_USE_NTUPLE
// ---- NOTE ----
// Histograms are compliant to AIDA interfaces, ntuples are Lizard specific
Lizard::NTuple* ntuple;
Lizard::NTupleFactory* ntFactory;
// Quantities for the ntuple
Lizard::Quantity<float> ntEnergy;
Lizard::Quantity<float> ntPlane;
Lizard::Quantity<float> ntX;
Lizard::Quantity<float> ntY;
Lizard::Quantity<float> ntZ;
#endif
GammaRayTelDetectorConstruction* GammaRayTelDetector;
G4String histo1DDraw;
G4String histo1DSave;
G4String histo2DDraw;
G4String histo2DSave;
G4String histo2DMode;
GammaRayTelAnalysisMessenger* analysisMessenger;
};
#endif
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelAnalysisMessenger.hh,v 1.1.4.2 2001/06/28 20:18:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelAnalysisMessenger.hh,v 1.3 2001/11/23 17:44:54 santin Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
@@ -31,6 +31,7 @@
//
// ------------ GammaRayTelAnalysysMessenger ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dec 2000)
// 20.11.01 G.Santin: new analysis management, modified according to GammaRayTelAnalysis
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -42,7 +43,7 @@
#include "globals.hh"
#include "G4UImessenger.hh"
class GammaRayTelAnalysisManager;
class GammaRayTelAnalysis;
class G4UIdirectory;
class G4UIcmdWithAString;
@@ -51,14 +52,14 @@ class G4UIcmdWithAString;
class GammaRayTelAnalysisMessenger: public G4UImessenger
{
public:
GammaRayTelAnalysisMessenger(GammaRayTelAnalysisManager* );
GammaRayTelAnalysisMessenger(GammaRayTelAnalysis* );
~GammaRayTelAnalysisMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
GammaRayTelAnalysisManager* GammaRayTelAnalysis;
G4UIdirectory* GammaRayTelAnalysisDir;
GammaRayTelAnalysis* gammaRayTelAnalysis;
G4UIdirectory* gammaRayTelAnalysisDir;
G4UIcmdWithAString* Histo1DDrawCmd;
G4UIcmdWithAString* Histo2DDrawCmd;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelAnticoincidenceHit.hh,v 1.1.2.2 2001/06/28 20:18:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelAnticoincidenceHit.hh,v 1.2 2001/07/11 09:56:56 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelAnticoincidenceSD.hh,v 1.1.2.2 2001/06/28 20:18:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelAnticoincidenceSD.hh,v 1.3 2001/11/29 11:19:17 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -50,7 +50,7 @@ class GammaRayTelAnticoincidenceSD : public G4VSensitiveDetector
{
public:
GammaRayTelAnticoincidenceSD(G4String, GammaRayTelDetectorConstruction* );
GammaRayTelAnticoincidenceSD(G4String);
~GammaRayTelAnticoincidenceSD();
void Initialize(G4HCofThisEvent*);
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelCalorimeterHit.hh,v 1.1.2.2 2001/06/28 20:18:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelCalorimeterHit.hh,v 1.2 2001/07/11 09:56:56 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelCalorimeterSD.hh,v 1.1.2.2 2001/06/28 20:18:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelCalorimeterSD.hh,v 1.4 2001/11/29 11:19:17 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -50,7 +50,7 @@ class GammaRayTelCalorimeterSD : public G4VSensitiveDetector
{
public:
GammaRayTelCalorimeterSD(G4String, GammaRayTelDetectorConstruction* );
GammaRayTelCalorimeterSD(G4String);
~GammaRayTelCalorimeterSD();
void Initialize(G4HCofThisEvent*);
@@ -64,10 +64,14 @@ private:
GammaRayTelCalorimeterHitsCollection* CalorimeterCollection;
GammaRayTelDetectorConstruction* Detector;
G4int (*ChitXID)[12];
G4int (*ChitYID)[12];
G4int (*ChitXID);
G4int (*ChitYID);
G4int NbOfCALLayers;
G4int NbOfCALBars;
G4int NbOfCALChannels;
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelDetectorConstruction.hh,v 1.5.2.2 2001/06/28 20:18:37 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelDetectorConstruction.hh,v 1.6 2001/07/11 09:56:56 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelDetectorMessenger.hh,v 1.2.4.2 2001/06/28 20:18:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelDetectorMessenger.hh,v 1.3 2001/07/11 09:56:56 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: GammaRayTelDigi.hh,v 1.1 2001/10/24 13:11:54 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
//
// ------------ GammaRayTelDigi ------
// by F.Longo, R.Giannitrapani & G.Santin (24 oct 2001)
//
// ************************************************************
// This Class describe the digits
#ifndef GammaRayTelDigi_h
#define GammaRayTelDigi_h 1
#include "G4VDigi.hh"
#include "G4TDigiCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelDigi : public G4VDigi
{
public:
GammaRayTelDigi();
~GammaRayTelDigi();
GammaRayTelDigi(const GammaRayTelDigi&);
const GammaRayTelDigi& operator=(const GammaRayTelDigi&);
int operator==(const GammaRayTelDigi&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
void Draw();
void Print();
private:
G4int PlaneNumber; // (active detector)
G4int PlaneType; // (0 or 1 for X or Y plane)
G4int StripNumber; // strip number
public:
inline void SetPlaneNumber(G4int PlaneNum) {PlaneNumber = PlaneNum;};
inline void SetPlaneType(G4int PlaneTyp) {PlaneType = PlaneTyp;};
inline void SetStripNumber(G4int StripNum) {StripNumber = StripNum;};
inline G4int GetPlaneNumber() {return PlaneNumber;};
inline G4int GetPlaneType() {return PlaneType;};
inline G4int GetStripNumber() {return StripNumber;};
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
typedef G4TDigiCollection<GammaRayTelDigi> GammaRayTelDigitsCollection;
extern G4Allocator<GammaRayTelDigi> GammaRayTelDigiAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void* GammaRayTelDigi::operator new(size_t)
{
void* aDigi;
aDigi = (void*) GammaRayTelDigiAllocator.MallocSingle();
return aDigi;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void GammaRayTelDigi::operator delete(void* aDigi)
{
GammaRayTelDigiAllocator.FreeSingle((GammaRayTelDigi*) aDigi);
}
#endif
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: GammaRayTelDigitizer.hh,v 1.2 2001/11/29 09:34:17 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
//
// ------------ GammaRayTelDigitizer ------
//
// by F.Longo, R.Giannitrapani & G.Santin (24 oct 2001)
//
// ************************************************************
#ifndef GammaRayTelDigitizer_h
#define GammaRayTelDigitizer_h 1
#include "G4VDigitizerModule.hh"
#include "GammaRayTelDigi.hh"
#include "globals.hh"
//#include "g4std/vector"
class GammaRayTelDigitizerMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelDigitizer : public G4VDigitizerModule
{
public:
GammaRayTelDigitizer(G4String name);
~GammaRayTelDigitizer();
void Digitize();
void SetThreshold(G4double val) { Energy_Threshold = val;}
private:
GammaRayTelDigitsCollection* DigitsCollection;
G4double Energy_Threshold;
GammaRayTelDigitizerMessenger* digiMessenger;
};
#endif
@@ -0,0 +1,68 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: GammaRayTelDigitizerMessenger.hh,v 1.1 2001/11/29 09:34:17 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
//
// ------------ GammaRayTelDigitizerMessenger ------
// by F.Longo, G.Santin & R.Giannitrapani (29 nov 2001)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelDigitizerMessenger_h
#define GammaRayTelDigitizerMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class GammaRayTelDigitizer;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelDigitizerMessenger: public G4UImessenger
{
public:
GammaRayTelDigitizerMessenger(GammaRayTelDigitizer*);
~GammaRayTelDigitizerMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
GammaRayTelDigitizer* GammaRayTelAction;
G4UIcmdWithADoubleAndUnit* ThresholdCmd;
};
#endif
@@ -22,8 +22,8 @@
//
//
// $Id: GammaRayTelDummySD.hh,v 1.1.4.2 2001/06/28 20:18:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelDummySD.hh,v 1.4 2001/11/28 10:07:01 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -42,12 +42,14 @@
#define GammaRayTelDummySD_h 1
#include "G4VSensitiveDetector.hh"
#include "globals.hh"
class G4Step;
class GammaRayTelDummySD : public G4VSensitiveDetector
{
public:
GammaRayTelDummySD();
GammaRayTelDummySD(G4String name):G4VSensitiveDetector(name){};
~GammaRayTelDummySD() {};
void Initialize(G4HCofThisEvent*HCE) {};
@@ -57,7 +59,5 @@ public:
void DrawAll() {};
void PrintAll() {};
};
GammaRayTelDummySD::GammaRayTelDummySD()
: G4VSensitiveDetector("dummySD")
{}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelEventAction.hh,v 1.4.2.2 2001/06/28 20:18:38 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelEventAction.hh,v 1.9 2001/12/04 11:40:28 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -31,6 +31,8 @@
// ------------ GammaRayTelEventAction ------
// by R.Giannitrapani, F. Longo & G.Santin (13 nov 2000)
//
//- inclusion of Digits by F.Longo & R.Giannitrapani (24 oct 2001)
// 20.11.01 G.Santin: new analysis management, modified according to GammaRayTelAnalysis
// ************************************************************
@@ -43,21 +45,13 @@
#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:
@@ -67,13 +61,11 @@ public:
void SetDrawFlag (G4String val) {drawFlag = val;};
private:
G4int trackerCollID;
G4int calorimeterCollID;
G4int anticoincidenceCollID;
G4String drawFlag;
#ifdef G4ANALYSIS_USE
GammaRayTelAnalysisManager* analysisManager;
#endif
};
#endif
@@ -83,3 +75,4 @@ private:
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelPhysicsList.hh,v 1.2.4.2 2001/06/28 20:18:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelPhysicsList.hh,v 1.3 2001/07/11 09:56:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelPrimaryGeneratorAction.hh,v 1.3.4.2 2001/06/28 20:18:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelPrimaryGeneratorAction.hh,v 1.6 2001/11/29 11:19:17 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
@@ -55,7 +55,8 @@ class GammaRayTelPrimaryGeneratorMessenger;
class GammaRayTelPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
GammaRayTelPrimaryGeneratorAction(GammaRayTelDetectorConstruction*);
GammaRayTelPrimaryGeneratorAction();
~GammaRayTelPrimaryGeneratorAction();
public:
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelPrimaryGeneratorMessenger.hh,v 1.2.4.2 2001/06/28 20:18:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelPrimaryGeneratorMessenger.hh,v 1.3 2001/07/11 09:56:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelRunAction.hh,v 1.3.4.2 2001/06/28 20:18:39 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelRunAction.hh,v 1.5 2001/11/23 17:44:54 santin Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -30,6 +30,7 @@
//
// ------------ GammaRayTelRunAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
// 18.11.2001 G.Santin - Modified the analysis management according to the new design
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -41,10 +42,6 @@
#include "G4UserRunAction.hh"
#include "globals.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Run;
@@ -52,11 +49,7 @@ class G4Run;
class GammaRayTelRunAction : public G4UserRunAction
{
public:
#ifdef G4ANALYSIS_USE
GammaRayTelRunAction(GammaRayTelAnalysisManager* analysisMgr);
#else
GammaRayTelRunAction();
#endif
~GammaRayTelRunAction();
public:
@@ -64,9 +57,6 @@ public:
void EndOfRunAction(const G4Run*);
private:
#ifdef G4ANALYSIS_USE
GammaRayTelAnalysisManager* analysisManager;
#endif
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelTrackerHit.hh,v 1.1.2.2 2001/06/28 20:18:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelTrackerHit.hh,v 1.2 2001/07/11 09:56:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelTrackerROGeometry.hh,v 1.1.2.2 2001/06/28 20:18:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelTrackerROGeometry.hh,v 1.3 2001/11/29 11:19:17 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -45,7 +45,6 @@ class GammaRayTelTrackerROGeometry : public G4VReadOutGeometry
public:
GammaRayTelTrackerROGeometry();
GammaRayTelTrackerROGeometry(G4String);
GammaRayTelTrackerROGeometry(G4String, GammaRayTelDetectorConstruction*);
~GammaRayTelTrackerROGeometry();
private:
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelTrackerSD.hh,v 1.1.2.2 2001/06/28 20:18:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelTrackerSD.hh,v 1.4 2001/11/29 11:19:17 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -50,7 +50,7 @@ class GammaRayTelTrackerSD : public G4VSensitiveDetector
{
public:
GammaRayTelTrackerSD(G4String, GammaRayTelDetectorConstruction* );
GammaRayTelTrackerSD(G4String);
~GammaRayTelTrackerSD();
void Initialize(G4HCofThisEvent*);
@@ -64,10 +64,14 @@ private:
GammaRayTelTrackerHitsCollection* TrackerCollection;
GammaRayTelDetectorConstruction* Detector;
G4int (*ThitXID)[30];
G4int (*ThitYID)[30];
G4int (*ThitXID);
G4int (*ThitYID);
G4int NbOfTKRLayers;
G4int NbOfTKRStrips;
G4int NbOfTKRChannels;
};
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelVisManager.hh,v 1.2.4.2 2001/06/28 20:18:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelVisManager.hh,v 1.3 2001/07/11 09:56:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
@@ -22,35 +22,24 @@
#/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
/vis/open OGLSX
# Create a viewer
/vis/viewer/create
/vis/viewer/reset
/vis/viewer/viewpointThetaPhi 90 0
# Positioning of the camera
/vis/camera/viewpoint 30 30
# Visualize of the whole detector geometry
/vis/drawVolume
# 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
@@ -22,39 +22,21 @@
/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 specific graphics system
/vis/open VRML2FILE
#
# 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
/vis/viewer/reset
/vis/viewer/viewpointThetaPhi 90 0
# Visualize of the whole detector geometry
/vis/drawVolume
# 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
@@ -65,4 +47,3 @@
@@ -22,6 +22,7 @@
#/payload/setNbOfTKRLayers 15
#/payload/update
#
# Create empty scene ("world" is default)
/vis/scene/create
@@ -31,7 +32,7 @@
/vis/scene/add/volume
#
# Create a scene handler for a specific graphics system
# Create a scene handler for a VRML file
/vis/sceneHandler/create DAWNFILE
# Create a viewer
@@ -40,6 +41,17 @@
# 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
@@ -48,9 +60,9 @@
# Flush visualization
/vis/viewer/update
#
# Draw scene
/vis/scene/notifyHandlers
@@ -6,12 +6,10 @@
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/run/verbose 1
/gun/particle gamma
/gun/energy 1 GeV
/gun/vertexRadius 25. cm
/gun/sourceType 2
@@ -0,0 +1,344 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: GammaRayTelAnalysis.cc-AIDA,v 1.3 2001/12/07 13:20:20 pfeiffer Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
//
// ------------ GammaRayAnalysisManager ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dic 2000)
//
// 07.12.2001 A.Pfeiffer
// - integrated Guy's addition of the ntuple
//
// 06.12.2001 A.Pfeiffer
// - updating to new design (singleton)
//
// 22.11.2001 G.Barrand
// - Adaptation to AIDA
//
// ************************************************************
#include "G4RunManager.hh"
#include "GammaRayTelAnalysis.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelAnalysisMessenger.hh"
#ifdef G4ANALYSIS_USE
#include <AIDA/IAnalysisFactory.h>
#include <AIDA/ITreeFactory.h>
#include <AIDA/ITree.h>
#include <AIDA/IHistogramFactory.h>
#include <AIDA/IHistogram1D.h>
#include <AIDA/IHistogram2D.h>
#include <AIDA/IPlotterFactory.h>
#include <AIDA/IPlotter.h>
#include <AIDA/ITupleFactory.h>
#include <AIDA/ITuple.h>
#endif
GammaRayTelAnalysis* GammaRayTelAnalysis::instance = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysis::GammaRayTelAnalysis(int argc,char** argv)
:GammaRayTelDetector(0)
,analysisFactory(0), tree(0), plotter(0), tuple(0)
,energy(0), hits(0), posXZ(0), posYZ(0)
,histo1DDraw("enable"),histo1DSave("enable"),histo2DDraw("enable")
,histo2DSave("enable"),histo2DMode("strip")
{
G4RunManager* runManager = G4RunManager::GetRunManager();
GammaRayTelDetector =
(GammaRayTelDetectorConstruction*)(runManager->GetUserDetectorConstruction());
#ifdef G4ANALYSIS_USE
// Define the messenger and the analysis system
analysisMessenger = new GammaRayTelAnalysisMessenger(this);
analysisFactory = AIDA_createAnalysisFactory();
if(analysisFactory) {
ITreeFactory* treeFactory = analysisFactory->createTreeFactory();
if(treeFactory) {
// Tree in memory :
//tree = treeFactory->create();
// Create a "tree" associated to a ROOT "store" (in RECREATE mode).
tree = treeFactory->create("GammaRayTel.root",false,false,"ROOT");
if(tree) {
IHistogramFactory* histoFactory =
analysisFactory->createHistogramFactory(*tree);
if(histoFactory) {
// Create histos :
int Nplane = GammaRayTelDetector->GetNbOfTKRLayers();
int Nstrip = GammaRayTelDetector->GetNbOfTKRStrips();
int Ntile = GammaRayTelDetector->GetNbOfTKRTiles();
float sizexy = GammaRayTelDetector->GetTKRSizeXY();
float sizez = GammaRayTelDetector->GetTKRSizeZ();
int N = Nstrip*Ntile;
// 1D histogram that store the energy deposition of the
// particle in the last (number 0) TKR X-plane
energy = histoFactory->create1D("1","Energy deposition in the last X plane (keV)", 100, 50, 200);
// 1D histogram that store the hits distribution along the TKR X-planes
hits = histoFactory->create1D("2","Hits distribution in the TKR X planes",Nplane, 0, Nplane-1);
// 2D histogram that store the position (mm) of the hits (XZ projection)
if (histo2DMode == "strip")
posXZ = histoFactory->create2D("3","Tracker Hits XZ (strip,plane)",
N, 0, N-1,
2*Nplane, 0, Nplane-1);
else
posXZ = histoFactory->create2D("3","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)
if(histo2DMode=="strip")
posYZ = histoFactory->create2D("4","Tracker Hits YZ (strip,plane)",
N, 0, N-1,
2*Nplane, 0, Nplane-1);
else
posYZ = histoFactory->create2D("4","Tracker Hits YZ (y,z) in mm",
sizexy/5, -sizexy/2, sizexy/2,
sizez/5, -sizez/2, sizez/2);
delete histoFactory;
}
// Get a tuple factory :
ITupleFactory* tupleFactory = analysisFactory->createTupleFactory(*tree);
if(tupleFactory) {
// Create a tuple :
tuple = tupleFactory->create("tuple","tuple",
"energy plane x y z");
delete tupleFactory;
}
}
delete treeFactory; // Will not delete the ITree.
}
IPlotterFactory* plotterFactory =
analysisFactory->createPlotterFactory(argc,argv);
if(plotterFactory) {
plotter = plotterFactory->create();
if(plotter) {
plotter->show();
plotter->setParameter("pageTitle","Gamma Ray Tel");
}
delete plotterFactory;
}
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysis::~GammaRayTelAnalysis() {
Finish();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelAnalysis::Init()
{
}
void GammaRayTelAnalysis::Finish()
{
#ifdef G4ANALYSIS_USE
delete plotter;
delete analysisFactory; // Will delete tree and histos.
delete analysisMessenger;
analysisMessenger = 0;
#endif
}
GammaRayTelAnalysis* GammaRayTelAnalysis::getInstance(int argc,char** argv)
{
if (instance == 0) instance = new GammaRayTelAnalysis(argc,argv);
return instance;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 2d histogram of the XZ positions
void GammaRayTelAnalysis::InsertPositionXZ(double x, double z)
{
#ifdef G4ANALYSIS_USE
if(posXZ) posXZ->fill(x, z);
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 2d histogram of the YZ positions
void GammaRayTelAnalysis::InsertPositionYZ(double y, double z)
{
#ifdef G4ANALYSIS_USE
if(posYZ) posYZ->fill(y, z);
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 1d histogram of the energy released in the last Si plane
void GammaRayTelAnalysis::InsertEnergy(double en)
{
#ifdef G4ANALYSIS_USE
if(energy) energy->fill(en);
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 1d histogram of the hits distribution along the TKR planes
void GammaRayTelAnalysis::InsertHits(int nplane)
{
#ifdef G4ANALYSIS_USE
if(hits) hits->fill(nplane);
#endif
}
void GammaRayTelAnalysis::setNtuple(float E, float p, float x, float y, float z)
{
#ifdef G4ANALYSIS_USE
if(tuple) {
tuple->fill(0,E);
tuple->fill(1,p);
tuple->fill(2,x);
tuple->fill(3,y);
tuple->fill(4,z);
tuple->addRow();
}
#endif
}
//....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 GammaRayTelAnalysis::BeginOfRun(G4int n)
{
#ifdef G4ANALYSIS_USE
if(energy) energy->reset();
if(hits) hits->reset();
if(posXZ) posXZ->reset();
if(posYZ) posYZ->reset();
// Set the plotter ; set the number of regions and attach histograms
// to plot for each region.
// It is done here, since then EndOfRun set regions
// for paper output.
if(plotter) {
if((histo2DDraw == "enable") && (histo1DDraw == "enable")) {
plotter->createRegions(2,2);
plotter->plot(*posXZ);
plotter->next();
plotter->plot(*posYZ);
plotter->next();
plotter->plot(*energy);
plotter->next();
plotter->plot(*hits);
} else if((histo1DDraw == "enable") && (histo2DDraw != "enable")) {
plotter->createRegions(1,2);
plotter->plot(*energy);
plotter->next();
plotter->plot(*hits);
} else if((histo1DDraw != "enable") && (histo2DDraw == "enable")) {
plotter->createRegions(1,2);
plotter->plot(*posXZ);
plotter->next();
plotter->plot(*posYZ);
} else { // Nothing to plot.
plotter->createRegions(1,1);
}
plotter->refresh();
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/*
This member is called at the end of each run
*/
void GammaRayTelAnalysis::EndOfRun(G4int n)
{
#ifdef G4ANALYSIS_USE
if(tree) tree->commit();
if(plotter) {
// We set one single region for the plotter
plotter->createRegions(1,1);
// We now print the histograms, each one in a separate file
if(histo2DSave == "enable") {
char name[15];
sprintf(name,"posxz_%d.ps", n);
plotter->plot(*posXZ);
plotter->write(name,"PS");
sprintf(name,"posyz_%d.ps", n);
plotter->clearRegion();
plotter->plot(*posYZ);
plotter->write(name,"PS");
}
if(histo1DSave == "enable") {
char name[15];
sprintf(name,"energy_%d.ps", n);
plotter->plot(*energy);
plotter->write(name,"PS");
sprintf(name,"hits_%d.ps", n);
plotter->clearRegion();
plotter->plot(*hits);
plotter->write(name,"PS");
}
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/* This member is called at the end of every event */
void GammaRayTelAnalysis::EndOfEvent(G4int flag)
{
// The plotter is updated only if there is some
// hits in the event
if(!flag) return;
#ifdef G4ANALYSIS_USE
if(plotter) plotter->refresh();
#endif
}
@@ -0,0 +1,405 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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. *
// ********************************************************************
//
// Author: A. Pfeiffer (Andreas.Pfeiffer@cern.ch)
// (copied from his UserAnalyser class)
//
// History:
// -----------
// 7 Nov 2001 MGP Implementation
// 03 dic 2000 AnalysisManager by R.Giannitrapani, F.Longo & G.Santin
// 18 Nov 2001 G.Santin GammaRayTel analysis management modified
// according to the new design
//
// -------------------------------------------------------------------
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysis.hh"
#include "GammaRayTelAnalysisMessenger.hh"
#include "globals.hh"
#include "G4RunManager.hh"
#include "G4Track.hh"
#include "G4SteppingManager.hh"
#include "G4ThreeVector.hh"
#include "GammaRayTelDetectorConstruction.hh"
//using namespace Lizard;
GammaRayTelAnalysis* GammaRayTelAnalysis::instance = 0;
GammaRayTelAnalysis::GammaRayTelAnalysis() :
histoManager(0), vectorFactory(0),plotter(0),
histo1DDraw("enable"),histo1DSave("enable"),histo2DDraw("enable"),
histo2DSave("enable"),histo2DMode("strip"),
analysisMessenger(0)
{
}
GammaRayTelAnalysis::~GammaRayTelAnalysis()
{
Finish();
}
void GammaRayTelAnalysis::Init()
{
G4RunManager* runManager = G4RunManager::GetRunManager();
GammaRayTelDetector =
(GammaRayTelDetectorConstruction*)(runManager->GetUserDetectorConstruction());
analysisMessenger = new GammaRayTelAnalysisMessenger(this);
histoManager = createIHistoManager();
#ifdef G4ANALYSIS_USE_NTUPLE
ntFactory = Lizard::createNTupleFactory();
#endif
vectorFactory = createIVectorFactory();
plotter = createIPlotter();
}
void GammaRayTelAnalysis::Finish()
{
#ifdef G4ANALYSIS_USE_NTUPLE
delete ntFactory;
ntFactory = 0;
#endif
delete histoManager;
histoManager = 0;
delete vectorFactory;
vectorFactory = 0;
delete plotter;
plotter = 0;
delete analysisMessenger;
analysisMessenger = 0;
}
GammaRayTelAnalysis* GammaRayTelAnalysis::getInstance()
{
if (instance == 0) instance = new GammaRayTelAnalysis;
return instance;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 2d histogram of the XZ positions
void GammaRayTelAnalysis::InsertPositionXZ(double x, double z)
{
IHistogram2D* posXZ = histoManager->retrieveHisto2D("3");
posXZ->fill(x, z);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 2d histogram of the YZ positions
void GammaRayTelAnalysis::InsertPositionYZ(double y, double z)
{
IHistogram2D* posYZ = histoManager->retrieveHisto2D("4");
posYZ->fill(y, z);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 1d histogram of the energy released in the last Si plane
void GammaRayTelAnalysis::InsertEnergy(double en)
{
IHistogram1D* energy = histoManager->retrieveHisto1D("1");
energy->fill(en);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 1d histogram of the hits distribution along the TKR planes
void GammaRayTelAnalysis::InsertHits(int nplane)
{
IHistogram1D* hits = histoManager->retrieveHisto1D("2");
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 GammaRayTelAnalysis::BeginOfRun(G4int n)
{
float sizexy, sizez;
int Nstrip, Nplane, Ntile, N;
char name[30];
Init();
// 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 (histoManager) {
sprintf(name,"gammaraytel%d.hbook", n);
histoManager->selectStore(name);
// Check if deleteHisto is enough, maybe we need to delete the object
histoManager->deleteHisto("1");
histoManager->create1D("1","Energy deposition in the last X plane (keV)", 100, 50., 200.);
// 1D histogram that store the hits distribution along the TKR X-planes
histoManager->deleteHisto("2");
histoManager->create1D("2","Hits distribution in the TKR X planes",
Nplane, 0, Nplane-1);
// 2D histogram that store the position (mm) of the hits (XZ projection)
histoManager->deleteHisto("3");
if (histo2DMode == "strip")
histoManager->create2D("3","Tracker Hits XZ (strip,plane)",
N, 0, N-1,
2*Nplane, 0, Nplane-1);
else
histoManager->create2D("3","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)
histoManager->deleteHisto("4");
if(histo2DMode=="strip")
histoManager->create2D("4","Tracker Hits YZ (strip,plane)",
N, 0, N-1,
2*Nplane, 0, Nplane-1);
else
histoManager->create2D("4","Tracker Hits YZ (y,z) in mm",
sizexy/5, -sizexy/2, sizexy/2,
sizez/5, -sizez/2, sizez/2);
}
IHistogram2D* posXZ = histoManager->retrieveHisto2D("3");
if (posXZ)
posXZ->reset();
IHistogram2D* posYZ = histoManager->retrieveHisto2D("4");
if(posYZ)
posYZ->reset();
IHistogram1D* energy = histoManager->retrieveHisto1D("1");
if(energy)
energy->reset();
IHistogram1D* hits = histoManager->retrieveHisto1D("2");
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"))
plotter->zone(2,2,0,0);
else if((histo1DDraw == "enable") || (histo2DDraw == "enable"))
plotter->zone(1,2,0,0);
else
plotter->zone(1,1,0,0);
#ifdef G4ANALYSIS_USE_NTUPLE
// Book ntuples
sprintf(name,"gammaraytel%d.hbook::1", n);
ntuple = ntFactory->createC(name);
// Add and bind the attributes to the ntuple
if ( !( ntuple->addAndBind( "energy", ntEnergy) &&
ntuple->addAndBind( "plane" , ntPlane) &&
ntuple->addAndBind( "x" , ntX ) &&
ntuple->addAndBind( "y" , ntY ) &&
ntuple->addAndBind( "z" , ntZ ) ) ) {
delete ntuple;
G4Exception(" GammaRayTelAnalysis::BeginOfRun - Could not addAndBind ntuple");
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/*
This member is called at the end of each run
*/
void GammaRayTelAnalysis::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
plotter->zone(1,1,0,0);
// We now print the histograms, each one in a separate file
if(histo2DSave == "enable") {
IHistogram2D* posXZ = histoManager->retrieveHisto2D("3");
IHistogram2D* posYZ = histoManager->retrieveHisto2D("4");
plot2D(posXZ);
sprintf(name,"posxz_%d.ps", n);
plotter->psPrint(name);
plot2D(posYZ);
sprintf(name,"posyz_%d.ps", n);
plotter->psPrint(name);
}
if(histo1DSave == "enable") {
IHistogram1D* energy = histoManager->retrieveHisto1D("1");
IHistogram1D* hits = histoManager->retrieveHisto1D("2");
plot1D(energy);
sprintf(name,"energy_%d.ps", n);
plotter->psPrint(name);
plot1D(hits);
sprintf(name,"hits_%d.ps", n);
plotter->psPrint(name);
}
delete vxz;
delete vyz;
delete ve;
delete vhit;
// Store histograms
// Because of a Lizard feature, ntuples must be deleted at this stage,
// not in the destructor (otherwise the ntuples are not stored)
// In version 3.6.4 of Anaphe, no licence, storing other histograms after
// having stored a 2D one generates an error message "ERROR in HLNEXT"
// Histograms are stored correctly, in spite of the error message
// The same error message is issued if attempting to store 1D or 2D
// histograms after deleting a ntuple
histoManager->store("1");
histoManager->store("3");
histoManager->store("2");
histoManager->store("4");
#ifdef G4ANALYSIS_USE_NTUPLE
delete ntuple;
ntuple = 0;
G4cout << "Deleted ntuple" << G4endl;
#endif
// close files for this run
if (histoManager != 0) Finish();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/* This member is called at the end of every event */
void GammaRayTelAnalysis::EndOfEvent(G4int flag)
{
// The histograms are updated only if there is some
// hits in the event
if(flag) Plot();
}
void GammaRayTelAnalysis::Plot()
{
// 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")
{
IHistogram2D* posXZ = histoManager->retrieveHisto2D("3");
IHistogram2D* posYZ = histoManager->retrieveHisto2D("4");
plot2D(posXZ);
plot2D(posYZ);
plotter->refresh();
}
if(histo1DDraw == "enable")
{
IHistogram1D* energy = histoManager->retrieveHisto1D("1");
IHistogram1D* hits = histoManager->retrieveHisto1D("2");
plot1D(energy);
plot1D(hits);
plotter->refresh();
}
delete vxz;
delete vyz;
delete ve;
delete vhit;
}
void GammaRayTelAnalysis::plot1D(IHistogram1D* histo)
{
IVector* v = vectorFactory->from1D(histo);
plotter->plot(v,0);
plotter->refresh();
delete v;
}
void GammaRayTelAnalysis::plot2D(IHistogram2D* histo)
{
IVector* v = vectorFactory->from2D(histo);
plotter->plot(v,0);
plotter->refresh();
delete v;
}
#ifdef G4ANALYSIS_USE_NTUPLE
void GammaRayTelAnalysis::setNtuple(float E, float p, float x, float y, float z)
{
ntEnergy = E;
ntPlane = p;
ntX = x;
ntY = y;
ntZ = z;
ntuple->addRow();
}
#endif
#endif
@@ -1,334 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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.4.2 2001/06/28 20:18:40 gunter Exp $
// GEANT4 tag $Name: $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
//
// ------------ 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
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelAnalysisMessenger.cc,v 1.1.4.2 2001/06/28 20:18:40 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelAnalysisMessenger.cc,v 1.5 2001/12/04 11:40:28 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -31,23 +31,24 @@
//
// ------------ GammaRayTelAnalysisMessenger ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dic 2000)
//
// 20.11.01 G.Santin: modified according to the new GammaRayTelAnalysis.cc
// ************************************************************
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisMessenger.hh"
#include "GammaRayTelAnalysisManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "GammaRayTelAnalysisMessenger.hh"
#include "GammaRayTelAnalysis.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisMessenger::GammaRayTelAnalysisMessenger(GammaRayTelAnalysisManager* analysisManager)
:GammaRayTelAnalysis(analysisManager)
GammaRayTelAnalysisMessenger::GammaRayTelAnalysisMessenger(GammaRayTelAnalysis* analysis)
:gammaRayTelAnalysis(analysis)
{
GammaRayTelAnalysisDir = new G4UIdirectory("/analysis/");
GammaRayTelAnalysisDir->SetGuidance("GammaRayTel analysis control.");
gammaRayTelAnalysisDir = new G4UIdirectory("/analysis/");
gammaRayTelAnalysisDir->SetGuidance("GammaRayTel analysis control.");
/*
Commands for the 1D histograms (energy deposition in the last
@@ -139,21 +140,21 @@ void GammaRayTelAnalysisMessenger::SetNewValue(G4UIcommand* command,G4String new
// 1D Histograms
if( command == Histo1DDrawCmd )
{ GammaRayTelAnalysis->SetHisto1DDraw(newValue);}
{ gammaRayTelAnalysis->SetHisto1DDraw(newValue);}
if( command == Histo1DSaveCmd )
{ GammaRayTelAnalysis->SetHisto1DSave(newValue);}
{ gammaRayTelAnalysis->SetHisto1DSave(newValue);}
// 2D Histograms
if( command == Histo2DDrawCmd )
{ GammaRayTelAnalysis->SetHisto2DDraw(newValue);}
{ gammaRayTelAnalysis->SetHisto2DDraw(newValue);}
if( command == Histo2DSaveCmd )
{ GammaRayTelAnalysis->SetHisto2DSave(newValue);}
{ gammaRayTelAnalysis->SetHisto2DSave(newValue);}
if( command == Histo2DModeCmd )
{ GammaRayTelAnalysis->SetHisto2DMode(newValue);}
{ gammaRayTelAnalysis->SetHisto2DMode(newValue);}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelAnticoincidenceHit.cc,v 1.1.2.2 2001/06/28 20:18:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelAnticoincidenceHit.cc,v 1.2 2001/07/11 09:56:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelAnticoincidenceSD.cc,v 1.1.2.2 2001/06/28 20:18:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelAnticoincidenceSD.cc,v 1.4 2001/11/29 11:19:18 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -32,7 +32,7 @@
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#include "G4RunManager.hh"
#include "GammaRayTelAnticoincidenceSD.hh"
#include "GammaRayTelAnticoincidenceHit.hh"
#include "GammaRayTelDetectorConstruction.hh"
@@ -46,10 +46,13 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnticoincidenceSD::GammaRayTelAnticoincidenceSD(G4String name,
GammaRayTelDetectorConstruction* det)
:G4VSensitiveDetector(name),Detector(det)
GammaRayTelAnticoincidenceSD::GammaRayTelAnticoincidenceSD(G4String name)
:G4VSensitiveDetector(name)
{
G4RunManager* runManager = G4RunManager::GetRunManager();
Detector =
(GammaRayTelDetectorConstruction*)(runManager->GetUserDetectorConstruction());
NbOfACDLateralTiles = Detector->GetNbOfACDLateralTiles();
NbOfACDTopTiles = Detector->GetNbOfACDTopTiles();
@@ -105,7 +108,7 @@ G4bool GammaRayTelAnticoincidenceSD::ProcessHits(G4Step* aStep,G4TouchableHistor
G4int ACDTileNumber=acd_tile->GetCopyNo();
G4String ACDTileName = acd_tile->GetName();
G4cout << ACDTileName << " " << edep/keV << G4endl;
// G4cout << ACDTileName << " " << edep/keV << G4endl;
if (ACDTileName == "ACT" )
// The hit is on an top ACD tile (ACDType 0)
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelCalorimeterHit.cc,v 1.1.2.2 2001/06/28 20:18:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelCalorimeterHit.cc,v 1.2 2001/07/11 09:56:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelCalorimeterSD.cc,v 1.1.2.2 2001/06/28 20:18:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelCalorimeterSD.cc,v 1.4 2001/11/29 11:19:18 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -32,7 +32,7 @@
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#include "G4RunManager.hh"
#include "GammaRayTelCalorimeterSD.hh"
#include "GammaRayTelCalorimeterHit.hh"
#include "GammaRayTelDetectorConstruction.hh"
@@ -46,17 +46,22 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelCalorimeterSD::GammaRayTelCalorimeterSD(G4String name,
GammaRayTelDetectorConstruction* det)
:G4VSensitiveDetector(name),Detector(det)
GammaRayTelCalorimeterSD::GammaRayTelCalorimeterSD(G4String name):G4VSensitiveDetector(name)
{
G4RunManager* runManager = G4RunManager::GetRunManager();
Detector =
(GammaRayTelDetectorConstruction*)(runManager->GetUserDetectorConstruction());
NbOfCALBars = Detector->GetNbOfCALBars();
NbOfCALLayers = Detector->GetNbOfCALLayers();
G4cout << NbOfCALBars << " bars " << G4endl;
G4cout << NbOfCALLayers << " layers " << G4endl;
//G4cout << NbOfCALBars << " bars " << G4endl;
//G4cout << NbOfCALLayers << " layers " << G4endl;
ChitXID = new G4int[NbOfCALBars][12];
ChitYID = new G4int[NbOfCALBars][12];
NbOfCALChannels = NbOfCALBars*NbOfCALLayers;
ChitXID = new G4int[NbOfCALChannels];
ChitYID = new G4int[NbOfCALChannels];
collectionName.insert("CalorimeterCollection");
}
@@ -74,11 +79,10 @@ void GammaRayTelCalorimeterSD::Initialize(G4HCofThisEvent*HCE)
{
CalorimeterCollection = new GammaRayTelCalorimeterHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int i=0;i<NbOfCALBars;i++)
for (G4int j=0;j<NbOfCALLayers;j++)
for (G4int i=0;i<NbOfCALChannels;i++)
{
ChitXID[i][j] = -1;
ChitYID[i][j] = -1;
ChitXID[i] = -1;
ChitYID[i] = -1;
};
}
@@ -105,13 +109,18 @@ G4bool GammaRayTelCalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory* R
PlaneNumber=cal_plane->GetCopyNo();
G4String PlaneName = cal_plane->GetName();
if (PlaneName == "CALLayerX" )
G4int NChannel = 0;
NChannel = PlaneNumber * NbOfCALBars + CALBarNumber;
if (PlaneName == "CALLayerX" )
// The hit is on an X CsI plane
{
// This is a new hit
if (ChitXID[CALBarNumber][PlaneNumber]==-1)
if (ChitXID[NChannel]==-1)
{
GammaRayTelCalorimeterHit* CalorimeterHit = new GammaRayTelCalorimeterHit;
CalorimeterHit->SetCALType(1);
@@ -119,13 +128,13 @@ G4bool GammaRayTelCalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory* R
CalorimeterHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
CalorimeterHit->SetCALPlaneNumber(PlaneNumber);
CalorimeterHit->SetCALBarNumber(CALBarNumber);
ChitXID[CALBarNumber][PlaneNumber] =
ChitXID[NChannel] =
CalorimeterCollection->insert(CalorimeterHit) -1;
}
else // This is not new
{
(*CalorimeterCollection)
[ChitXID[CALBarNumber][PlaneNumber]]->AddEnergy(edep);
[ChitXID[NChannel]]->AddEnergy(edep);
}
}
@@ -133,7 +142,7 @@ G4bool GammaRayTelCalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory* R
// The hit is on an Y CsI plane
{
// This is a new hit
if (ChitYID[CALBarNumber][PlaneNumber]==-1)
if (ChitYID[NChannel]==-1)
{
GammaRayTelCalorimeterHit* CalorimeterHit
= new GammaRayTelCalorimeterHit;
@@ -142,13 +151,13 @@ G4bool GammaRayTelCalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory* R
CalorimeterHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
CalorimeterHit->SetCALPlaneNumber(PlaneNumber);
CalorimeterHit->SetCALBarNumber(CALBarNumber);
ChitYID[CALBarNumber][PlaneNumber] =
ChitYID[NChannel] =
CalorimeterCollection->insert(CalorimeterHit)-1;
}
else // This is not new
{
(*CalorimeterCollection)
[ChitYID[CALBarNumber][PlaneNumber]]->AddEnergy(edep);
[ChitYID[NChannel]]->AddEnergy(edep);
}
}
@@ -167,12 +176,11 @@ void GammaRayTelCalorimeterSD::EndOfEvent(G4HCofThisEvent* HCE)
HCE->AddHitsCollection(HCID,CalorimeterCollection);
for (G4int i=0;i<NbOfCALBars;i++)
for (G4int j=0;j<NbOfCALLayers;j++)
{
ChitXID[i][j] = -1;
ChitYID[i][j] = -1;
};
for (G4int i=0;i<NbOfCALChannels;i++)
{
ChitXID[i] = -1;
ChitYID[i] = -1;
};
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelDetectorConstruction.cc,v 1.5.2.2 2001/06/28 20:18:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelDetectorConstruction.cc,v 1.9 2001/11/29 11:19:18 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -70,16 +70,14 @@ GammaRayTelDetectorConstruction::GammaRayTelDetectorConstruction()
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),
solidCALDetectorX(0),logicCALDetectorX(0),physiCALDetectorX(0),
solidCALDetectorY(0),logicCALDetectorY(0),physiCALDetectorY(0),
solidTKRDetectorX(0),logicTKRDetectorX(0),physiTKRDetectorX(0),
solidTKRDetectorY(0),logicTKRDetectorY(0),physiTKRDetectorY(0),
solidCALLayerX(0),logicCALLayerX(0),physiCALLayerX(0),
solidCALLayerY(0),logicCALLayerY(0),physiCALLayerY(0),
solidPlane(0),logicPlane(0),physiPlane(0)
solidCALDetectorX(0),logicCALDetectorX(0),physiCALDetectorX(0),
solidCALDetectorY(0),logicCALDetectorY(0),physiCALDetectorY(0),
solidPlane(0),logicPlane(0),physiPlane(0),
solidConverter(0),logicConverter(0),physiConverter(0)
{
// default parameter values of the payload
@@ -132,7 +130,7 @@ void GammaRayTelDetectorConstruction::DefineMaterials()
G4double a, z, density;
G4int ncomponents, natoms;
G4double abundance, fractionmass;
G4double fractionmass;
G4double temperature, pressure;
//
@@ -151,36 +149,33 @@ void GammaRayTelDetectorConstruction::DefineMaterials()
a = 15.99*g/mole;
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
a = 26.98*g/mole;
G4Element* Alumin = new G4Element(name="Aluminum" ,symbol="Al" , z= 13., a);
a = 28.09*g/mole;
G4Element* Silicon = new G4Element(name="Silicon", symbol="Si", z=14., a);
a= 55.845*g/mole;
G4Element* Iron = new G4Element(name="Iron", symbol="Fe", z=26.,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
//
a = 207.19*g/mole;
G4Element* Lead = new G4Element(name="Lead", symbol="Pb", z=82., a);
density = 2.700*g/cm3;
a = 26.98*g/mole;
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
//
// define simple materials
//
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
//
@@ -192,8 +187,8 @@ void GammaRayTelDetectorConstruction::DefineMaterials()
density = 4.53*g/cm3;
G4Material* CsI = new G4Material(name="CesiumIodide", density, ncomponents=2);
CsI->AddElement(C, natoms=5);
CsI->AddElement(H, natoms=5);
CsI->AddElement(Cs, natoms=5);
CsI->AddElement(I, natoms=5);
//
// define a material from elements. case 2: mixture by fractional mass
@@ -203,11 +198,27 @@ void GammaRayTelDetectorConstruction::DefineMaterials()
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 = 2.700*g/cm3;
G4Material* Al = new G4Material(name="Aluminum", density, ncomponents=1);
Al->AddElement(Alumin, fractionmass=1.);
density = 2.333*g/cm3;
G4Material* Si = new G4Material(name="Silicon", density, ncomponents=1);
Si->AddElement(Silicon, fractionmass=1.);
density = 7.87*g/cm3;
G4Material* Fe = new G4Material(name="Iron", density, ncomponents=1);
Fe->AddElement(Iron, fractionmass=1.);
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Lead", density, ncomponents=1);
Pb->AddElement(Lead, fractionmass=1.);
//
// examples of vacuum
//
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
@@ -224,7 +235,7 @@ void GammaRayTelDetectorConstruction::DefineMaterials()
//default materials of the payload
ConverterMaterial = Pb;
ConverterMaterial = W;
defaultMaterial = vacuum;
ACDMaterial = Sci;
CALMaterial = CsI;
@@ -481,22 +492,23 @@ G4VPhysicalVolume* GammaRayTelDetectorConstruction::ConstructPayload()
physiTKR,
false,
i);
physiPlane =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
2*TKRSiliconThickness +
TKRViewsDistance+
ConverterThickness+
TKRSupportThickness/2),
TKRSupportThickness/2+
(i)*TKRLayerDistance),
"Plane",
logicPlane,
physiTKR,
false,
i);
}
@@ -676,17 +688,18 @@ G4VPhysicalVolume* GammaRayTelDetectorConstruction::ConstructPayload()
if(!trackerSD)
{
trackerSD = new GammaRayTelTrackerSD("TrackerSD",this);
trackerSD = new GammaRayTelTrackerSD("TrackerSD");
SDman->AddNewDetector( trackerSD );
}
G4String ROgeometryName = "TrackerROGeom";
G4VReadOutGeometry* trackerRO =
new GammaRayTelTrackerROGeometry(ROgeometryName, this);
new GammaRayTelTrackerROGeometry(ROgeometryName);
trackerRO->BuildROGeometry();
trackerSD->SetROgeometry(trackerRO);
if (logicTKRActiveTileX)
logicTKRActiveTileX->SetSensitiveDetector(trackerSD); // ActiveTileX
if (logicTKRActiveTileY)
@@ -700,7 +713,7 @@ G4VPhysicalVolume* GammaRayTelDetectorConstruction::ConstructPayload()
if(!calorimeterSD)
{
calorimeterSD = new GammaRayTelCalorimeterSD("CalorimeterSD",this);
calorimeterSD = new GammaRayTelCalorimeterSD("CalorimeterSD");
SDman->AddNewDetector( calorimeterSD );
}
@@ -716,7 +729,7 @@ G4VPhysicalVolume* GammaRayTelDetectorConstruction::ConstructPayload()
if(!anticoincidenceSD)
{
anticoincidenceSD = new GammaRayTelAnticoincidenceSD
("AnticoincidenceSD",this);
("AnticoincidenceSD");
SDman->AddNewDetector( anticoincidenceSD );
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelDetectorMessenger.cc,v 1.3.4.2 2001/06/28 20:18:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelDetectorMessenger.cc,v 1.4 2001/07/11 09:56:58 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: GammaRayTelDigi.cc,v 1.2 2001/12/13 13:44:55 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
//
// ------------ GammaRayTelDigi ------
// by F.Longo, R.Giannitrapani & G.Santin (21 oct 2001)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "GammaRayTelDigi.hh"
G4Allocator<GammaRayTelDigi> GammaRayTelDigiAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDigi::GammaRayTelDigi()
{
PlaneType = 0;
PlaneNumber = 0;
StripNumber=0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDigi::~GammaRayTelDigi()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDigi::GammaRayTelDigi(const GammaRayTelDigi& right)
{
PlaneType = right.PlaneType;
PlaneNumber = right.PlaneNumber;
StripNumber = right.StripNumber;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const GammaRayTelDigi& GammaRayTelDigi::operator=(const GammaRayTelDigi& right)
{
PlaneType = right.PlaneType;
PlaneNumber = right.PlaneNumber;
StripNumber = right.StripNumber;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int GammaRayTelDigi::operator==(const GammaRayTelDigi& right) const
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDigi::Draw()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDigi::Print()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,152 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: GammaRayTelDigitizer.cc,v 1.3 2001/12/04 11:40:28 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
//
// ------------ GammaRayTelDigitizer ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelDigitizer.hh"
#include "GammaRayTelDigi.hh"
#include "GammaRayTelDigitizerMessenger.hh"
#include "GammaRayTelTrackerHit.hh"
#include "G4EventManager.hh"
#include "G4Event.hh"
#include "G4SDManager.hh"
#include "G4DigiManager.hh"
#include "G4ios.hh"
//#include "G4CollectionNameVector.hh"
#include "g4std/vector"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDigitizer::GammaRayTelDigitizer(G4String name)
:G4VDigitizerModule(name)
{
G4String colName = "DigitsCollection";
collectionName.push_back(colName);
Energy_Threshold = 120.*keV;
//create a messenger for this class
digiMessenger = new GammaRayTelDigitizerMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDigitizer::~GammaRayTelDigitizer()
{
delete digiMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDigitizer::Digitize()
{
DigitsCollection = new GammaRayTelDigitsCollection
("TrackerDigitizer","DigitsCollection"); // to create the Digi Collection
G4DigiManager* DigiMan = G4DigiManager::GetDMpointer();
G4int THCID;
// hits collections IDs
THCID = DigiMan->GetHitsCollectionID("TrackerCollection");
// Hits collection
GammaRayTelTrackerHitsCollection* THC = 0;
THC = (GammaRayTelTrackerHitsCollection*)
(DigiMan->GetHitsCollection(THCID));
if (THC)
{
G4int n_hit = THC->entries();
for (G4int i=0;i<n_hit;i++)
{
G4double ESil = (*THC)[i]->GetEdepSil();
G4int NStrip = (*THC)[i]->GetNStrip();
G4int NPlane = (*THC)[i]->GetNSilPlane();
G4int IsX = (*THC)[i]->GetPlaneType();
// digi generation only if energy deposit greater than threshold
if (ESil>Energy_Threshold)
{
GammaRayTelDigi* Digi = new GammaRayTelDigi();
Digi->SetPlaneNumber(NPlane);
Digi->SetPlaneType(IsX);
Digi->SetStripNumber(NStrip);
DigitsCollection->insert(Digi);
}
}
G4cout << "Number of tracker digits in this event = "
<< DigitsCollection->entries()
// << " " << DigitsCollection->GetName()
// << " " << DigitsCollection->GetDMname()
<< G4endl;
StoreDigiCollection(DigitsCollection);
G4int DCID = -1;
if(DCID<0)
{
// DigiMan->List();
DCID = DigiMan->GetDigiCollectionID("TrackerDigitizer/DigitsCollection");
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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: GammaRayTelDigitizerMessenger.cc,v 1.1 2001/11/29 09:34:17 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
//
// ------------ GammaRayTelDigitizerMessenger ------
// by F.Longo, G.Santin & R.Giannitrapani (27 nov 2001)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelDigitizerMessenger.hh"
#include "GammaRayTelDigitizer.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDigitizerMessenger::GammaRayTelDigitizerMessenger
(GammaRayTelDigitizer* GammaRayTelDigit)
:GammaRayTelAction(GammaRayTelDigit)
{
ThresholdCmd = new G4UIcmdWithADoubleAndUnit("/digitizer/Threshold",this);
ThresholdCmd->SetGuidance("Energy deposition threshold for TKR digi generation");
ThresholdCmd->SetParameterName("choice",true);
ThresholdCmd->SetDefaultValue((G4double)20.*keV);
ThresholdCmd->SetRange("Threshold >=0.");
ThresholdCmd->SetUnitCategory("Energy");
ThresholdCmd->AvailableForStates(PreInit,Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDigitizerMessenger::~GammaRayTelDigitizerMessenger()
{
delete ThresholdCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDigitizerMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if( command == ThresholdCmd )
{
GammaRayTelAction->SetThreshold
(ThresholdCmd->GetNewDoubleValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelEventAction.cc,v 1.5.2.2 2001/06/28 20:18:41 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelEventAction.cc,v 1.13 2001/12/04 13:23:52 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -31,6 +31,10 @@
// ------------ GammaRayTelEventAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// - inclusion of Digits by F.Longo & R.Giannitrapani (24 oct 2001)
//
// - Modification of analysis management by G.Santin (18 Nov 2001)
//
// ************************************************************
#include "GammaRayTelEventAction.hh"
@@ -38,10 +42,8 @@
#include "GammaRayTelAnticoincidenceHit.hh"
#include "GammaRayTelCalorimeterHit.hh"
#include "g4rw/tvordvec.h"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#include "GammaRayTelAnalysis.hh"
#endif
#include "G4Event.hh"
@@ -57,25 +59,25 @@
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include "GammaRayTelDigi.hh"
#include "GammaRayTelDigitizer.hh"
#include "G4DigiManager.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), calorimeterCollID(-1),
anticoincidenceCollID(-1), analysisManager(aMgr)
{
}
#else
GammaRayTelEventAction::GammaRayTelEventAction()
:drawFlag("all"), trackerCollID(-1),calorimeterCollID(-1),
anticoincidenceCollID(-1)
{
:trackerCollID(-1),calorimeterCollID(-1),
anticoincidenceCollID(-1), drawFlag("all")
{
G4DigiManager * fDM = G4DigiManager::GetDMpointer();
GammaRayTelDigitizer * myDM = new GammaRayTelDigitizer( "TrackerDigitizer" );
fDM->AddNewModule(myDM);
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -90,22 +92,19 @@ void GammaRayTelEventAction::BeginOfEventAction(const G4Event* evt)
G4int evtNb = evt->GetEventID();
G4cout << "Event: " << evtNb << G4endl;
G4SDManager * SDman = G4SDManager::GetSDMpointer();
if (trackerCollID==-1)
{
trackerCollID = SDman->GetCollectionID("TrackerCollection");
}
if(anticoincidenceCollID==-1)
{
anticoincidenceCollID =
SDman->GetCollectionID("AnticoincidenceCollection");
}
if(calorimeterCollID==-1)
{
calorimeterCollID =
SDman->GetCollectionID("CalorimeterCollection");
}
if (trackerCollID==-1) {
trackerCollID = SDman->GetCollectionID("TrackerCollection");
}
if(anticoincidenceCollID==-1) {
anticoincidenceCollID =
SDman->GetCollectionID("AnticoincidenceCollection");
}
if(calorimeterCollID==-1) {
calorimeterCollID =
SDman->GetCollectionID("CalorimeterCollection");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -125,6 +124,8 @@ void GammaRayTelEventAction::EndOfEventAction(const G4Event* evt)
GammaRayTelAnticoincidenceHitsCollection* AHC = 0;
G4DigiManager * fDM = G4DigiManager::GetDMpointer();
if (HCE)
{
THC = (GammaRayTelTrackerHitsCollection*)(HCE->GetHC(trackerCollID));
@@ -142,8 +143,8 @@ void GammaRayTelEventAction::EndOfEventAction(const G4Event* evt)
G4int NStrip, NPlane, IsX;
// This is a cycle on all the tracker hits of this event
for (int i=0;i<n_hit;i++)
for (int i=0;i<n_hit;i++)
{
// Here we put the hit data in a an ASCII file for
// later analysis
@@ -158,44 +159,83 @@ void GammaRayTelEventAction::EndOfEventAction(const G4Event* evt)
(*THC)[i]->GetPos().x()/mm <<" "<<
(*THC)[i]->GetPos().y()/mm <<" "<<
(*THC)[i]->GetPos().z()/mm <<" "<<
G4endl;
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 fill the histograms of the Analysis manager
GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
if(IsX)
{
if (analysis->GetHisto2DMode()=="position")
analysis->InsertPositionXZ((*THC)[i]->GetPos().x()/mm,(*THC)[i]->GetPos().z()/mm);
else
analysis->InsertPositionXZ(NStrip, NPlane);
if (NPlane == 0) analysis->InsertEnergy(ESil/keV);
analysis->InsertHits(NPlane);
}
else
{
if (analysis->GetHisto2DMode()=="position")
analysis->InsertPositionYZ((*THC)[i]->GetPos().y()/mm,(*THC)[i]->GetPos().z()/mm);
else
analysis->InsertPositionYZ(NStrip, NPlane);
if (NPlane == 0) analysis->InsertEnergy(ESil/keV);
analysis->InsertHits(NPlane);
}
#ifdef G4ANALYSIS_USE_NTUPLE
analysis->setNtuple( ESil/keV, NPlane, (*THC)[i]->GetPos().x()/mm,
(*THC)[i]->GetPos().y()/mm,
(*THC)[i]->GetPos().z()/mm);
#endif
#endif
}
// Here we call the analysis manager function for visualization
#ifdef G4ANALYSIS_USE
analysisManager->EndOfEvent(n_hit);
GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
analysis->EndOfEvent(n_hit);
#endif
}
GammaRayTelDigitizer * myDM =
(GammaRayTelDigitizer*)fDM->FindDigitizerModule( "TrackerDigitizer" );
myDM->Digitize();
G4int myDigiCollID = fDM->GetDigiCollectionID("DigitsCollection");
// G4cout << "digi collecion" << myDigiCollID << G4endl;
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);
}
GammaRayTelDigitsCollection * DC = (GammaRayTelDigitsCollection*)fDM->GetDigiCollection( myDigiCollID );
if(DC) {
// G4cout << "Total Digits " << DC->entries() << G4endl;
G4int n_digi = DC->entries();
G4int NStrip, NPlane, IsX;
for (G4int i=0;i<n_digi;i++) {
// Here we put the digi data in a an ASCII file for
// later analysis
NStrip = (*DC)[i]->GetStripNumber();
NPlane = (*DC)[i]->GetPlaneNumber();
IsX = (*DC)[i]->GetPlaneType();
outFile << G4std::setw(7) << event_id << " " << NStrip <<
" " << NPlane << " " << IsX << " " << G4endl;
}
}
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);
}
}
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelPhysicsList.cc,v 1.2.4.2 2001/06/28 20:18:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelPhysicsList.cc,v 1.3 2001/07/11 09:56:58 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelPrimaryGeneratorAction.cc,v 1.3.4.2 2001/06/28 20:18:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelPrimaryGeneratorAction.cc,v 1.6 2001/11/29 11:19:18 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -36,6 +36,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4RunManager.hh"
#include "GammaRayTelPrimaryGeneratorAction.hh"
#include "GammaRayTelDetectorConstruction.hh"
@@ -49,11 +50,13 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorAction::GammaRayTelPrimaryGeneratorAction
(GammaRayTelDetectorConstruction* GammaRayTelDC)
:GammaRayTelDetector(GammaRayTelDC),rndmFlag("off"),
nSourceType(0),nSpectrumType(0)
GammaRayTelPrimaryGeneratorAction::GammaRayTelPrimaryGeneratorAction()
:rndmFlag("off"),nSourceType(0),nSpectrumType(0)
{
G4RunManager* runManager = G4RunManager::GetRunManager();
GammaRayTelDetector =
(GammaRayTelDetectorConstruction*)(runManager->GetUserDetectorConstruction());
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
@@ -98,7 +101,8 @@ void GammaRayTelPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
dir0 = G4ThreeVector(0.,0.,-1.);
G4double theta, phi, y, f;
G4double theta0,phi0;
G4double theta0=0.;
G4double phi0=0.;
switch(nSourceType) {
case 0:
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelPrimaryGeneratorMessenger.cc,v 1.2.4.2 2001/06/28 20:18:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelPrimaryGeneratorMessenger.cc,v 1.3 2001/07/11 09:56:58 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelRunAction.cc,v 1.3.4.2 2001/06/28 20:18:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelRunAction.cc,v 1.7 2001/12/04 11:40:28 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -30,6 +30,8 @@
//
// ------------ GammaRayTelRunAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
// 18.11.2001 G.Santin
// - Modified the analysis management according to the new design
//
// ************************************************************
@@ -39,24 +41,21 @@
#include "GammaRayTelRunAction.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysis.hh"
#endif
#include <stdlib.h>
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
extern ofstream outFile;
extern G4std::ofstream outFile;
#ifdef G4ANALYSIS_USE
GammaRayTelRunAction::GammaRayTelRunAction(GammaRayTelAnalysisManager* aMgr)
:analysisManager(aMgr)
{
}
#else
GammaRayTelRunAction::GammaRayTelRunAction()
{
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -84,7 +83,8 @@ void GammaRayTelRunAction::BeginOfRunAction(const G4Run* aRun)
// If analysis is used reset the histograms
#ifdef G4ANALYSIS_USE
analysisManager->BeginOfRun();
GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
analysis->BeginOfRun(aRun->GetRunID());
#endif
}
@@ -102,7 +102,8 @@ void GammaRayTelRunAction::EndOfRunAction(const G4Run* aRun)
// If analysis is used, print out the histograms
#ifdef G4ANALYSIS_USE
analysisManager->EndOfRun(aRun->GetRunID());
GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
analysis->EndOfRun(aRun->GetRunID());
#endif
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelTrackerHit.cc,v 1.1.2.2 2001/06/28 20:18:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelTrackerHit.cc,v 1.2 2001/07/11 09:56:58 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelTrackerROGeometry.cc,v 1.1.2.2 2001/06/28 20:18:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelTrackerROGeometry.cc,v 1.5 2001/11/29 11:19:18 griccard Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
@@ -34,7 +34,7 @@
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#include "G4RunManager.hh"
#include "GammaRayTelTrackerROGeometry.hh"
#include "GammaRayTelDummySD.hh"
#include "GammaRayTelDetectorConstruction.hh"
@@ -53,14 +53,12 @@ GammaRayTelTrackerROGeometry::GammaRayTelTrackerROGeometry()
: G4VReadOutGeometry()
{
}
GammaRayTelTrackerROGeometry::GammaRayTelTrackerROGeometry(G4String aString,GammaRayTelDetectorConstruction* GammaRayTelDC)
:GammaRayTelDetector(GammaRayTelDC), G4VReadOutGeometry(aString)
{
}
GammaRayTelTrackerROGeometry::GammaRayTelTrackerROGeometry(G4String aString)
: G4VReadOutGeometry(aString)
:G4VReadOutGeometry(aString)
{
G4RunManager* runManager = G4RunManager::GetRunManager();
GammaRayTelDetector =
(GammaRayTelDetectorConstruction*)(runManager->GetUserDetectorConstruction());
}
GammaRayTelTrackerROGeometry::~GammaRayTelTrackerROGeometry()
@@ -326,8 +324,7 @@ G4VPhysicalVolume* GammaRayTelTrackerROGeometry::Build()
// 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;
GammaRayTelDummySD * dummySensi = new GammaRayTelDummySD("Orpo");
logicTKRStripX->SetSensitiveDetector(dummySensi);
logicTKRStripY->SetSensitiveDetector(dummySensi);
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: GammaRayTelTrackerSD.cc,v 1.1.2.2 2001/06/28 20:18:42 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelTrackerSD.cc,v 1.6 2001/12/04 11:40:28 flongo Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -32,7 +32,7 @@
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#include "G4RunManager.hh"
#include "GammaRayTelTrackerSD.hh"
#include "GammaRayTelTrackerHit.hh"
@@ -49,17 +49,21 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelTrackerSD::GammaRayTelTrackerSD(G4String name,
GammaRayTelDetectorConstruction* det)
:G4VSensitiveDetector(name),Detector(det)
GammaRayTelTrackerSD::GammaRayTelTrackerSD(G4String name):G4VSensitiveDetector(name)
{
G4RunManager* runManager = G4RunManager::GetRunManager();
Detector =
(GammaRayTelDetectorConstruction*)(runManager->GetUserDetectorConstruction());
G4int NbOfTKRTiles = Detector->GetNbOfTKRTiles();
NbOfTKRStrips = Detector->GetNbOfTKRStrips();
NbOfTKRLayers = Detector->GetNbOfTKRLayers();
NbOfTKRStrips = NbOfTKRStrips*NbOfTKRTiles;
ThitXID = new G4int[NbOfTKRStrips][30];
ThitYID = new G4int[NbOfTKRStrips][30];
NbOfTKRChannels = NbOfTKRStrips* NbOfTKRTiles * NbOfTKRLayers;
ThitXID = new G4int[NbOfTKRChannels];
ThitYID = new G4int[NbOfTKRChannels];
collectionName.insert("TrackerCollection");
}
@@ -77,20 +81,19 @@ void GammaRayTelTrackerSD::Initialize(G4HCofThisEvent*HCE)
{
TrackerCollection = new GammaRayTelTrackerHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int i=0;i<NbOfTKRStrips;i++)
for (G4int j=0;j<NbOfTKRLayers;j++)
{
ThitXID[i][j] = -1;
ThitYID[i][j] = -1;
};
for (G4int i=0;i<NbOfTKRChannels;i++)
{
ThitXID[i] = -1;
ThitYID[i] = -1;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool GammaRayTelTrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if ((edep/keV == 0.)) return false;
@@ -101,7 +104,7 @@ G4bool GammaRayTelTrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhis
// of the hit
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* phys_tile = theTouchable->GetVolume();
G4VPhysicalVolume* plane = phys_tile->GetMother();
@@ -125,26 +128,26 @@ G4bool GammaRayTelTrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhis
G4int NTile = (TileNumber%TileTotal);
G4int j=0;
G4int NChannel = 0;
for (j=0;j<TileTotal;j++)
{
{
if(NTile==j) StripNumber += StripTotal*NTile;
}
// G4cout << " Plane Number = " << PlaneNumber << " " << PlaneName << G4endl;
// G4cout << StripName << " " << StripNumber << G4endl;
NChannel = PlaneNumber*TileTotal*StripTotal + StripNumber;
/* G4cout << NChannel << " Channel Number" << G4endl;
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 (ThitXID[StripNumber][PlaneNumber]==-1)
if (ThitXID[NChannel]==-1)
{
GammaRayTelTrackerHit* TrackerHit = new GammaRayTelTrackerHit;
TrackerHit->SetPlaneType(1);
@@ -152,21 +155,21 @@ G4bool GammaRayTelTrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhis
TrackerHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
TrackerHit->SetNSilPlane(PlaneNumber);
TrackerHit->SetNStrip(StripNumber);
ThitXID[StripNumber][PlaneNumber] =
ThitXID[NChannel] =
TrackerCollection->insert(TrackerHit) -1;
}
else // This is not new
{
(*TrackerCollection)[ThitXID[StripNumber][PlaneNumber]]->AddSil(edep);
(*TrackerCollection)[ThitXID[NChannel]]->AddSil(edep);
// G4cout << "X" << PlaneNumber << " " << StripNumber << G4endl;
}
}
if (PlaneName == "TKRDetectorY")
// The hit is on an Y silicon plane
{
// This is a new hit
if (ThitYID[StripNumber][PlaneNumber]==-1)
if (ThitYID[NChannel]==-1)
{
GammaRayTelTrackerHit* TrackerHit = new GammaRayTelTrackerHit;
TrackerHit->SetPlaneType(0);
@@ -174,12 +177,12 @@ G4bool GammaRayTelTrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhis
TrackerHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
TrackerHit->SetNSilPlane(PlaneNumber);
TrackerHit->SetNStrip(StripNumber);
ThitYID[StripNumber][PlaneNumber] =
ThitYID[NChannel] =
TrackerCollection->insert(TrackerHit)-1;
}
else // This is not new
{
(*TrackerCollection)[ThitYID[StripNumber][PlaneNumber]]->AddSil(edep);
(*TrackerCollection)[ThitYID[NChannel]]->AddSil(edep);
// G4cout << "Y" << PlaneNumber << " " << StripNumber << G4endl;
}
}
@@ -199,12 +202,11 @@ void GammaRayTelTrackerSD::EndOfEvent(G4HCofThisEvent* HCE)
HCE->AddHitsCollection(HCID,TrackerCollection);
for (G4int i=0;i<NbOfTKRStrips;i++)
for (G4int j=0;j<NbOfTKRLayers;j++)
{
ThitXID[i][j] = -1;
ThitYID[i][j] = -1;
};
for (G4int i=0;i<NbOfTKRChannels;i++)
{
ThitXID[i] = -1;
ThitYID[i] = -1;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -22,8 +22,8 @@
//
//
// $Id: GammaRayTelVisManager.cc,v 1.2.4.2 2001/06/28 20:18:43 gunter Exp $
// GEANT4 tag $Name: $
// $Id: GammaRayTelVisManager.cc,v 1.6 2001/11/23 17:39:04 santin Exp $
// GEANT4 tag $Name: geant4-04-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
@@ -40,14 +40,21 @@
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh"
#include "G4DAWNFILE.hh"
#include "G4GAGTree.hh"
//#include "G4HepRepFile.hh"
#include "G4RayTracer.hh"
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
// Needing external packages or libraries...
#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"
@@ -81,11 +88,6 @@
#include "G4VRML2.hh"
#endif
#ifdef G4VIS_USE_VRMLFILE
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelVisManager::GammaRayTelVisManager () {}
@@ -94,14 +96,21 @@ GammaRayTelVisManager::GammaRayTelVisManager () {}
void GammaRayTelVisManager::RegisterGraphicsSystems () {
// Graphics Systems not needing external packages or libraries...
RegisterGraphicsSystem (new G4ASCIITree);
RegisterGraphicsSystem (new G4DAWNFILE);
RegisterGraphicsSystem (new G4GAGTree);
// RegisterGraphicsSystem (new G4HepRepFile);
RegisterGraphicsSystem (new G4RayTracer);
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
// Graphics systems needing external packages or libraries...
#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);
@@ -135,11 +144,6 @@ void GammaRayTelVisManager::RegisterGraphicsSystems () {
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."
@@ -0,0 +1,145 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced example main program
// by A. Howard and H. Araujo
// (27th November 2001)
//
// main program
// --------------------------------------------------------------
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#ifdef G4UI_USE_XM
#include "G4UIXm.hh"
#endif
#include "Randomize.hh"
#ifdef G4VIS_USE
#include "DMXVisManager.hh"
#endif
#include "DMXDetectorConstruction.hh"
#include "DMXPhysicsList.hh"
#include "DMXPrimaryGeneratorAction.hh"
#include "DMXRunAction.hh"
#include "DMXEventAction.hh"
#include "DMXSteppingAction.hh"
#include "DMXStackingAction.hh"
#include "g4std/vector"
int main(int argc,char** argv) {
// choose the Random engine
HepRandom::setTheEngine(new RanecuEngine);
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
DMXDetectorConstruction* detector = new DMXDetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new DMXPhysicsList);
G4UIsession* session=0;
if (argc==1) // Define UI session for interactive mode.
{
// G4UIterminal is a (dumb) terminal.
#ifdef G4UI_USE_XM
session = new G4UIXm(argc,argv);
#else
#ifdef G4UI_USE_TCSH
session = new G4UIterminal(new G4UItcsh);
#else
session = new G4UIterminal();
#endif
#endif
}
#ifdef G4VIS_USE
// visualization manager
G4VisManager* visManager = new DMXVisManager;
visManager->Initialize();
#endif
// set user action classes
runManager->SetUserAction(new DMXPrimaryGeneratorAction);
runManager->SetUserAction(new DMXRunAction);
DMXEventAction* eventAction = new DMXEventAction;
runManager->SetUserAction(eventAction);
// eventAction is inherited by SteppingAction in order to switch colour
// flag:
runManager->SetUserAction(new DMXSteppingAction(eventAction));
runManager->SetUserAction(new DMXStackingAction);
//Initialize G4 kernel
runManager->Initialize();
// get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
// Define UI session for interactive mode.
if(session) {
// G4UIterminal is a (dumb) terminal.
UI->ApplyCommand("/control/execute initInter.mac");
/*
#ifdef G4UI_USE_XM
// Customize the G4UIXm menubar with a macro file :
UI->ApplyCommand("/control/execute gui.mac");
#endif
*/
session->SessionStart();
delete session;
}
// Batch mode
else
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI->ApplyCommand(command+fileName);
}
// job termination
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
return 0;
}
@@ -0,0 +1,22 @@
# $Id: GNUmakefile,v 1.4 2001/11/29 19:59:12 ahoward Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := DMX
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
visclean:
rm -f g4*.prim g4*.eps g4*.wrl
rm -f .DAWN_*
@@ -0,0 +1,174 @@
------------------------------Advanced Example--------------------------------- README FILE
UNDERGROUND PHYSICS
An example of a underground dark matter experiment.
Please see the UserRequirements.txt and related web-pages referred to
at the end of that document.
Over-view:
A single liquid xenon cell is simulated within Geant4 and the scintillation
light produced from interactions from various calibration species is recorded
as PhotoMultiplier hits. The output is then written to an ASCII file for
future off-line analysis.
Geometry:
Experimental set-up:
A "cavern" of dimensions 5m x 6m x 3m with concrete walls is defined
as the World Volume. In the centre of the cavern a steel vacuum
vessel containing liquid and gaseous xenon is placed. The internal
construction of the vessel accurately reproduces an existing prototype
Dark Matter detector which allows experimental comparison. The active
detector volume is defined by a series of metal rings, complemented by
a cover mirror and a PMT immersed in the liquid. Two grids and a
thermalising copper shield are also incorporated. The liquid/gas
interface is located 6mm away from the mirror surface. A Am241
calibration source is suspended from one of the grids in the liquid
phase, above the PMT.
XXX================XXX mirror
XXX________________XXX gas phase
XXX XXX
XXX XXX liquid phase
XXX XXX
XXX.......U........XXX grid + calibrator
XXX................XXX grid
XXX| |XXX
| ___------___ |
|| PMT ||
|| ||
Hits Output (file "hits.out"):
An ASCII file containing the following information:
Evt # : event number
Etot, MeV : energy deposited in liquid xenon
LXe hits : number of hits in liquid xenon
LXeTime, ns : time of first hit in liquid xenon
PMT hits : number of hits in PMT (photocathode)
PmtTime, ns : average PMT hit time relative to LXeTime
First hit : first particle to hit liquid xenon
Flags : particles contributing to energy deposition
Note:
The time information PmtTime is erroneous when forcing nuclear
decay with the RadioactiveDecay module due to the precision
required to detect nanosecond scintillation times on a global
time of 432 years (in the case of 241Am decay).
Pmt Output (file "pmt.out"):
Photon hit positions within the PMT face (overwritten every event):
"Hit# X, mm Y, mm Z, mm"
To Run:
Either run the macro files interactively or in batch with the command
DMX macro_name.mac.
Macros:
initInter.mac
Initialisation macro for interactive mode.
gamma.mac
Shoots one 60 keV gamma upwards from the calibrator and traces the
scintillation light produced in LXe to the PMT. All tracks are drawn
with custom colours. PMT hits in photocathode are also shown. Event
summary is writen to file "hits.out".
gamma_1000.mac
Similar to above, but 1000 gammas are emmited isotropically from the
source. No hits or tracks are draw, and the verbosity is reduced.
alpha.mac
Shoots one 5.486 MeV alpha particle upwards from the calibrator and
traces the scintillation light to the PMT. All tracks except
optical photons are drawn. Event summary is written to file
"hits.out" and PMT hits to file "pmt.out".
alpha_1000.mac
Similar to above, but 1000 alphas are emmited isotropically from the
source. No tracks are stored, and the verbosity is reduced. Event
summary is written to file "hits.out", PMT hits are not written out.
neutron.mac
Shoots one 2.48 MeV neutron inside the room aimed at the detector.
All tracks except scintillation photons are drawn (custom colours).
Gammas are not killed at the concrete wall. Event summery is written
to file "hits.out".
sourceAm241.mac
Forces the decay of 241Am nuclei in the calibrator and tracks the
resulting particles (237Np + alpha + gamma from 237Np
de-excitation). All tracks are drawn except scintillation photons.
Event summery is written to file "hits.out".
-> To be added for a future release
sourceAm241_1000.mac
Similar to above but for 1000 events. No tracks are stored.
-> To be added for a future release
Note:
The following environment variables need to be set:
G4RADIOACTIVEDATA : points to Radioactive Decay Data files
G4LEDATA : points to low energy data base - G4EMLOW0.5
G4LEVELGAMMADATA : points to PhotoEvaporation data
NeutronHPCrossSections : points to neutron data files G4NDL3.5
ERRORS:
When running interactively the following error will be shown:
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor: boolean operation failed
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor::caseIE : unimplemented case
BooleanProcessor: boolean operation failed
This is a "feature" of the visualisation of boolean volumes, but does not
affect functionality/performance so can be ignored.
NB:
If using explicit libraries (?) i.e. non-shared then compilation time with
neutrons in physics list is very long (>5 minutes) - check this.............
It is more efficient to use shared libraries that are loaded at run-time with
increased initialisation time (at run-time).
Also if using shared libraries the load time at run-time may be several minutes
- this is partially due to the neutron implementation requires full data sets
for each isotope being specified.
--------------------------------------
If running on Redhat 7.0 or above set G4SYSTEM to Linux-g++, alternatively you
can install backward compatibility to egcs, however, requires
config/sys/Linux-egcs.gmk to be altered so that CXX is set to kgcc
(compared to g++ in original file)
--------------------------------------
Alex Howard, 29/11/01
@@ -0,0 +1,95 @@
UR OOAD Implemention Test
-------------------------------------------------------------------------------
1.1 DMX Class Diagram DMXRunAction Start Run
1.2 DMX Class Diagram DMXEventAction Run events
2.1 DMX Class Diagram DMXDetectorConstruction Visualisation
2.2 DMX Class Diagram DMXScintHit Event output
2.3 DMX Class Diagram DMXPhysicsList Visualisation
2.4 DMX Class Diagram DMXDetectorConstruction Track visualisation
2.5 DMX Class Diagram DMXPmtHit Record photons
3.1 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.2 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.3 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.4 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.5 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.6 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.7 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.8 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.9 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.10 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.11 DMX Class Diagram DMXPhysicsList Compare output E with expt
3.12 DMX Class Diagram DMXPhysicsList Compare output E with expt
4.1 DMX Class Diagram DMXParticleSource Vis. and Event summary
4.2 DMX Class Diagram DMXParticleSource Vis. and Event summary
4.3 DMX Class Diagram DMXParticleSource Vis. and Event summary
4.4 DMX Class Diagram DMXParticleSource Vis. and Event summary
5.1 DMX Class Diagram DMXPhysicsList Run control and output
5.2 DMX Class Diagram DMXPhysicsList Run control and output
5.3 DMX Class Diagram DMXPhysicsList Run control and output
6.1 DMX Class Diagram DMXEventAction Saved output file
6.2 DMX Class Diagram DMXEventAction Saved output file
7.1 DMX Class Diagram DMXVisManager Visualisation
7.2 DMX Class Diagram DMXEventAction Visualisation
7.3 DMX Class Diagram DMXEventActionMessenger Visualisation
7.4 DMX Class Diagram DMXSteppingAction Visualisation
7.5 DMX Class Diagram DMXVisManager Outputfile into wired
8.1 DMX Class Diagram DMXParticleSourceMessenger User Control
8.2 DMX Class Diagram User Control
8.3 DMX Class Diagram DMXEventAction User Control
8.4 DMX Class Diagram DMXEventAction User Control
8.5 DMX Class Diagram DMXEventAction User Control
8.6 DMX Class Diagram DMXStackingActionMessenger User Control
9.1 DMX Class Diagram DMXMaxTimeCuts Output summary file
9.2 DMX Class Diagram DMXStackingAction Output and optimisation
@@ -0,0 +1,340 @@
UNDERGROUND PHYSICS ADVANCED EXAMPLE - DMX
UserRequirements.txt - Alex Howard, e-mail: a.s.howard@ic.ac.uk, 29/11/01.
Introduction:
This document is an initial introduction to the Dark Matter Example -
DMX. A single liquid xenon cell is simulated within Geant4 and the
scintillation light produced from interactions from various
calibration species is recorded as hits in a PhotoMultiplier Tube
(PMT). The output is then written to an ASCII file for future
off-line analysis.
-------------------------------------------------------------------------------
User Requirements:
General
UR 1.1: Configure the run management
UR 1.2: Configure the event loop
Geometry:
Experimental set-up:
UR 2.1:
A "cavern" of dimensions 5m x 6m x 3m with concrete walls is defined
as the World Volume. In the centre of the cavern a steel vacuum
vessel containing liquid and gaseous xenon is placed. The internal
construction of the vessel accurately reproduces an existing prototype
Dark Matter detector which allows experimental comparison. The active
detector volume is defined by a series of metal rings, complemented by
a cover mirror and a PMT immersed in the liquid. Two grids and a
thermalising copper shield are also incorporated. The liquid/gas
interface is located 6mm away from the mirror surface. A Am241
calibration source is suspended from one of the grids in the liquid
phase, above the PMT.
XXX================XXX mirror
XXX________________XXX gas phase
XXX XXX
XXX XXX liquid phase
XXX XXX
XXX.......U........XXX grid + calibrator
XXX................XXX grid
XXX| |XXX
| ___------___ |
|| PMT ||
|| ||
An accurate simulation of the above set-up should be carried.
UR 2.2:
Record the energy deposited in the sensitive volume of the xenon
chamber (liquid phase).
UR 2.3:
Produce scintillation photons with different time constants and light
yields depending upon the species of particle causing the excitation -
either nuclear recoil or electron recoil type interactions.
UR 2.4:
Implement reflectivities and transmission probabilities for all materials
concerned.
UR 2.5:
Ray trace the scintillation back to the PMT and record hit times, positions and
number of photons.
PHYSICS:
The following areas of physics should be included:
UR 3.1: · Low Energy Electromagnetic - to 250eV for both e and photons
Maximum energy range around 10 MeV for any particle
UR 3.2: · Compton Scattering
UR 3.3: · Photoelectric Effect
UR 3.4: · Bremsstrahlung
UR 3.5: · Rayleigh Scattering - for both optical photons and hard
X-rays/Gammas
UR 3.6: · Electromagnetic ionisation
UR 3.7: · Delta Rays
Produced discretely down to 250eV to allow secondaries and
tertiaries to be properly handled
UR 3.8: · Heavy Ion Transport - to 250eV for protons, alphas and nuclei
Allows separate scintillation time and yield compared to gammas
(electrons)
UR 3.9: · Radioactive Decay - induced
All materials are sensitive to induced activity as a consequence
of photo-nuclear or neutron capture
UR 3.10: · Radioactive Decay - sources
Specific nuclei can be decayed within the geometry to reproduce
experimental calibration the experiment
UR 3.11: · Neutron tracking from medium energy (few MeV) to thermal capture
Discretely transported through-out the volume to give full
detector response for both neutron capture activation and
elastic and inelastic interaction in the target volume
UR 3.12: · Scintillation light production and ray-tracing to PMT
Optical photon transport introduced to allow realistic
detector response to be produced.
ParticleSource:
UR 4.1:
Implement a generic particle source that allows various particles, ions and
nuclei to be fired or decayed anywhere within the volume.
UR 4.2:
Allow confinement of the particle source to within given volumes and randomly
select particle or ion production within that volume.
UR 4.3:
Allow various source shapes - point, sphere and cylinder have been
implemented.
UR 4.4: !!!! not in ours !!!
Allow spectrum of energies to be chosen as well as a monoenergetic particle
type.
Radioactive Decay Module:
UR 5.1:
Allows specific ions to be decayed within set nuclear limits and energies and
positions - linked to Particle Source above.
UR 5.2:
Can control induced activity to specific volumes.
UR 5.3:
Allows increased functionality in terms of choice of weighting for the decay
and other non-analogue MC techniques.
Analysis:
UR 6.1:
Outputs to file "hits.out" the event number (Evt #), the energy
deposited in the liquid phase (Etot, MeV), the number of hits in LXe
(LXe hits), the time of the first hit (LXeTime, ns), the number of PMT
hits (PMT hits), the average PMT hit time relative to the first hit in
LXe (PmtTime, ns), the first particle to hit the LXe (First hit) and
flags the type of particles depositing energy - gamma, neutron,
electron, positron, proton, other (Flags).
UR 6.2:
The "First hit" and "Flags" described above constitute a record of
particle type history important for identifying and differentiating
between elastic and inelastic neutron interactions.
Visualisation:
UR 7.1:
Visualise the experimental set-up.
UR 7.2:
Visualise tracks in the experimental set-up.
UR 7.3:
Allow the choice between scintillation light, PMT photocathode hits,
and full tracking to be displayed.
UR 7.4:
Allow the user to choose specific track colours for gammas, neutrons,
charged-plus and charged-minus tracks.
UR 7.5:
Allow output to stored interactive files using the HEPREP interface which can
then be read into Wired and other XML packages.
User Interface:
UR 8.1:
Allow control of the particle source via the /dmx/gun control:
Command directory path : /dmx/gun/
Guidance :
Particle Source control commands.
Sub-directories :
Commands :
1) List * List available particles.
2) particle * Set particle to be generated.
3) direction * Set momentum direction.
4) energy * Set kinetic energy.
5) position * Set starting position of the particle.
6) ion * Set properties of ion to be generated.
7) type * Sets source distribution type.
8) shape * Sets source shape type.
9) centre * Set centre coordinates of source.
10) halfz * Set z half length of source.
11) radius * Set radius of source.
12) confine * Confine source to volume (NULL to unset).
13) angtype * Sets angular source distribution type
14) energytype * Sets energy distribution type
15) verbose * Set Verbose level for gun
UR 8.2:
Control verbosities via:
The user should have the ability to change several features including
a) verbosities can be controlled for
/control/verbose
/run/verbose
/tracking/verbose
/hits/verbose
/grdm/verbose
/dmx/gun/verbose
UR 8.3:
Control the output to the screen into Modulo N events:
using printModulo control.
Command /dmx/printModulo
Guidance :
Print events modulo n
Range of parameters : EventNb>0
Parameter : EventNb
Parameter type : i
Omittable : False
UR 8.4:
Draw commands controlled via /dmx/draw/:
DM Example draw commands.
Sub-directories :
Commands :
1) drawColours * Tracks drawn by Event (standard colours) or
by Step (custom colours)
2) drawTracks * Which tracks to draw in the event
3) drawHits * Set flag to draw hits in PMT.
4) neutronColour * Colour of neutron in the event
5) gammaColour * Colour of gamma in the event
6) opticalColour * Colour of gamma in the event
7) chargedplusColour * colour of chargedplus in the event
8) chargedminusColour * colour of chargedminus in the event
UR 8.5:
Control the files to be saved - PMT hits and event summary in terms of
energy deposit and number of photon hits observed.
Command /dmx/savePmt
Guidance :
Set flag to save (x,y,z) of hits in PMT
into file 'pmt.out'
Default = false
Parameter : savePmtFlag
Parameter type : b
Omittable : False
Command /dmx/saveHits
Guidance :
Set flag to save hits in each run
into file 'hits.out'
Default = true
Parameter : saveHitsFlag
Parameter type : b
Omittable : False
UR 8.6:
Allow the suppression of physics processes within specific volumes in
order to optimise running of the neutron transport code.
Gammas may be killed in the concrete wall in order to reduce
processing time significantly.
Command /dmx/KillGammasInConcrete
Guidance :
Kills gammas produced by neutrons in the concrete wall
Default = false
Parameter : KillGammasFlag
Parameter type : b
Omittable : False
Default value : 0
CUTS:
UR 9.1:
User can apply special cuts to time and step length to tracks. If the
global time is exceeded then the track is killed.
UR 9.2:
Allow gammas to be killed in the concrete wall in order to optimise
processing time for neutron transport.
------------------------------------------------------------------------------
Background Information/Links
Information on the experimental side of this project can be obtained from the
following:
Who we are:
Imperial College High Energy Physics Group -> http://www.hep.ph.ic.ac.uk/
Imperial College Astrophysics -> http://astro.ic.ac.uk/
Dark Matter collaboration and existing experimental programme:
Boulby Collaboration Home Page -> http://hepwww.rl.ac.uk/ukdmc/
Full Users Requirement Document
A draft of the full users requirement document for the advanced example can be
downloaded/viewed at the following:
Word Document ->
http://icva.hep.ph.ic.ac.uk/~howard/g4_project/urd_draft1.doc
Web Page ->
http://icva.hep.ph.ic.ac.uk/~howard/g4_project/urd_draft1.htm
@@ -0,0 +1,50 @@
###############################################################################
# #
# alpha.mac #
# PMT hits from internal calibrator (single alphas) #
# output in files hits.out and pmt.out #
# #
###############################################################################
#
# verbosities
/control/verbose 1
/run/verbose 1
/tracking/verbose 0
/hits/verbose 1
#
# draw flags
/dmx/draw/drawColours standard
/dmx/draw/drawTracks noscint
/dmx/draw/drawHits 0
#
# file output
/dmx/savePmt 1
/dmx/saveHits 1
#
# gun: particle
/dmx/gun/verbose 1
/dmx/gun/particle alpha
/dmx/gun/energytype Mono
/dmx/gun/energy 5.486 MeV
#
# gun: isotropic
#/dmx/gun/angtype iso
#
# OR gun: shoot up
/dmx/gun/angtype direction
/dmx/gun/direction 0 0 1
#
# gun: source
/dmx/gun/type Volume
/dmx/gun/shape Cylinder
/dmx/gun/radius 250 mum
/dmx/gun/halfz 10.0 nm
/dmx/gun/centre 0 0 82.750 mm
/dmx/gun/confine americium_phys
#
# set to 0 if too many tracks to store
/tracking/storeTrajectory 1
#
/run/beamOn 1
@@ -0,0 +1,52 @@
###############################################################################
# #
# alpha_1000.mac #
# Alpha spectrum from internal calibrator #
# output in file hits.out #
# #
###############################################################################
#
# verbosities
/control/verbose 0
/run/verbose 0
/tracking/verbose 0
/hits/verbose 0
/dmx/printModulo 10
#
# draw flags
/dmx/draw/drawColours standard
/dmx/draw/drawTracks none
/dmx/draw/drawHits 0
#
# file output
/dmx/savePmt 0
/dmx/saveHits 1
#
# gun: particle
/dmx/gun/verbose 0
/dmx/gun/particle alpha
/dmx/gun/energytype Mono
/dmx/gun/energy 5.486 MeV
#
# gun: isotropic
/dmx/gun/angtype iso
#
# OR gun: shoot up
#/dmx/gun/angtype direction
#/dmx/gun/direction 0 0 1
#
# gun: source
/dmx/gun/type Volume
/dmx/gun/shape Cylinder
/dmx/gun/radius 250 mum
/dmx/gun/halfz 10.0 nm
/dmx/gun/centre 0 0 82.750 mm
/dmx/gun/confine americium_phys
#
# set to 0 if too many tracks to store
/tracking/storeTrajectory 0
#
/run/beamOn 1000
#
/tracking/storeTrajectory 1
@@ -0,0 +1,50 @@
###############################################################################
# #
# alpha.mac #
# PMT hits from internal calibrator (single alphas) #
# output in files hits.out and pmt.out #
# #
###############################################################################
#
# verbosities
/control/verbose 1
/run/verbose 1
/tracking/verbose 0
/hits/verbose 1
#
# draw flags
/dmx/draw/drawColours standard
/dmx/draw/drawTracks noscint
/dmx/draw/drawHits 0
#
# file output
/dmx/savePmt 1
/dmx/saveHits 1
#
# gun: particle
/dmx/gun/verbose 1
/dmx/gun/particle alpha
/dmx/gun/energytype Mono
/dmx/gun/energy 10.0 keV
#
# gun: isotropic
#/dmx/gun/angtype iso
#
# OR gun: shoot up
/dmx/gun/angtype direction
/dmx/gun/direction 0 0 1
#
# gun: source
/dmx/gun/type Volume
/dmx/gun/shape Cylinder
/dmx/gun/radius 250 mum
/dmx/gun/halfz 10.0 nm
/dmx/gun/centre 0 0 82.750 mm
/dmx/gun/confine americium_phys
#
# set to 0 if too many tracks to store
/tracking/storeTrajectory 1
#
/run/beamOn 1
@@ -0,0 +1,47 @@
###############################################################################
# #
# gamma.mac #
# Single gammas from internal calibrator #
# output in file hits.out #
# #
###############################################################################
#
# verbosities
/control/verbose 1
/run/verbose 1
/tracking/verbose 0
/hits/verbose 1
#
# draw flags
/dmx/draw/drawColours custom
/dmx/draw/gammaColour yellow
/dmx/draw/drawTracks all
/dmx/draw/drawHits 1
#
# file output
/dmx/savePmt 0
/dmx/saveHits 1
#
# gun: particle
/dmx/gun/verbose 0
/dmx/gun/particle gamma
/dmx/gun/energytype Mono
/dmx/gun/energy 60.0 keV
#
# gun: isotropic
#/dmx/gun/angtype iso
#
# OR gun: shoot up
/dmx/gun/angtype direction
/dmx/gun/direction 0 0 1
#
# gun: source
/dmx/gun/type Volume
/dmx/gun/shape Cylinder
/dmx/gun/radius 250 mum
/dmx/gun/halfz 10.0 nm
/dmx/gun/centre 0 0 82.750 mm
/dmx/gun/confine americium_phys
#
/run/beamOn 1
@@ -0,0 +1,47 @@
###############################################################################
# #
# gamma_1000.mac #
# Gamma spectrum from internal calibrator #
# output in file hits.out #
# #
###############################################################################
#
# verbosities
/control/verbose 0
/run/verbose 0
/tracking/verbose 0
/hits/verbose 0
/dmx/printModulo 10
#
# draw flags
/dmx/draw/drawColours standard
/dmx/draw/drawTracks none
/dmx/draw/drawHits 0
#
# file output
/dmx/savePmt 0
/dmx/saveHits 1
#
# gun: particle
/dmx/gun/verbose 0
/dmx/gun/particle gamma
/dmx/gun/energytype Mono
/dmx/gun/energy 60.0 keV
#
# gun: isotropic
/dmx/gun/angtype iso
#
# OR gun: shoot up
#/dmx/gun/angtype direction
#/dmx/gun/direction 0 0 1
#
# gun: source
/dmx/gun/type Volume
/dmx/gun/shape Cylinder
/dmx/gun/radius 250 mum
/dmx/gun/halfz 10.0 nm
/dmx/gun/centre 0 0 82.750 mm
/dmx/gun/confine americium_phys
#
/run/beamOn 1000
@@ -0,0 +1,47 @@
###############################################################################
# #
# gamma.mac #
# Single gammas from internal calibrator #
# output in file hits.out #
# #
###############################################################################
#
# verbosities
/control/verbose 1
/run/verbose 1
/tracking/verbose 0
/hits/verbose 1
#
# draw flags
/dmx/draw/drawColours custom
/dmx/draw/gammaColour yellow
/dmx/draw/drawTracks all
/dmx/draw/drawHits 1
#
# file output
/dmx/savePmt 0
/dmx/saveHits 1
#
# gun: particle
/dmx/gun/verbose 0
/dmx/gun/particle gamma
/dmx/gun/energytype Mono
/dmx/gun/energy 2.0 keV
#
# gun: isotropic
#/dmx/gun/angtype iso
#
# OR gun: shoot up
/dmx/gun/angtype direction
/dmx/gun/direction 0 0 1
#
# gun: source
/dmx/gun/type Volume
/dmx/gun/shape Cylinder
/dmx/gun/radius 250 mum
/dmx/gun/halfz 10.0 nm
/dmx/gun/centre 0 0 82.750 mm
/dmx/gun/confine americium_phys
#
/run/beamOn 1
@@ -0,0 +1,162 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// DetectorConstruction header
// --------------------------------------------------------------
#ifndef DMXDetectorConstruction_h
#define DMXDetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4Material;
class G4UserLimits;
class DMXScintSD;
class DMXPmtSD;
class DMXDetectorConstruction : public G4VUserDetectorConstruction
{
public:
DMXDetectorConstruction();
~DMXDetectorConstruction();
public:
G4VPhysicalVolume* Construct();
// methods for UserLimits
void UseUserLimits(G4bool value);
G4bool IsUseUserLimits() { return fUseUserLimits; }
G4double GetMaxTime() const { return theMaxTimeCuts; }
G4double GetMaxStepSize() const { return theMaxStepSize; }
G4double GetRoomTime() const { return theRoomTimeCut; }
void SetMaxTime(G4double value);
void SetMaxStepSize(G4double value);
void SetRoomTime(G4double value);
private:
void DefineMaterials();
G4bool fUseUserLimits;
G4UserLimits* theUserLimits;
G4double theMaxTimeCuts;
G4double theMaxStepSize;
G4double theRoomTimeCut;
G4Material* world_mat; // materials used
G4Material* lab_mat;
G4Material* jacket_mat;
G4Material* vacuum_mat;
G4Material* vessel_mat;
G4Material* detector_mat;
G4Material* liqPhase_mat;
G4Material* CuShield_mat;
G4Material* alpha_mat;
G4Material* americium_mat;
G4Material* ring_mat;
G4Material* mirror_mat;
G4Material* grid_mat;
G4Material* pmt_mat;
G4Material* window_mat;
G4Material* phcath_mat;
G4double worldRadius; // sizes
G4double worldHeight;
G4double sourceZ;
G4double sourceZ2;
G4LogicalVolume* world_log; // pointers
G4VPhysicalVolume* world_phys;
G4LogicalVolume* lab_log;
G4VPhysicalVolume* lab_phys;
G4LogicalVolume* jacket_log;
G4VPhysicalVolume* jacket_phys;
G4LogicalVolume* vacuum_log;
G4VPhysicalVolume* vacuum_phys;
G4LogicalVolume* vessel_log;
G4VPhysicalVolume* vessel_phys;
G4LogicalVolume* detector_log;
G4VPhysicalVolume* detector_phys;
G4LogicalVolume* CuShield_log;
G4VPhysicalVolume* CuShield_phys;
G4LogicalVolume* liqPhase_log;
G4VPhysicalVolume* liqPhase_phys;
G4LogicalVolume* alpha_log;
G4VPhysicalVolume* alpha_phys;
/*
G4LogicalVolume* recess_log;
G4VPhysicalVolume* recess_phys;
*/
G4LogicalVolume* americium_log;
G4VPhysicalVolume* americium_phys;
G4LogicalVolume* ring_log;
G4VPhysicalVolume* ring_phys_gas[1];
G4VPhysicalVolume* ring_phys_liq[5];
// G4VPhysicalVolume* ring_phys[8];
G4LogicalVolume* mirror_log;
G4VPhysicalVolume* mirror_phys;
G4LogicalVolume* grid1_log;
G4VPhysicalVolume* grid1_phys;
G4LogicalVolume* grid2_log;
G4VPhysicalVolume* grid2_phys;
G4LogicalVolume* pmt_log;
G4VPhysicalVolume* pmt_phys;
/*
G4LogicalVolume* window_log;
G4VPhysicalVolume* window_phys;
*/
G4LogicalVolume* phcath_log;
G4VPhysicalVolume* phcath_phys;
DMXScintSD* LXeSD; //pointer to sensitive detectors
DMXPmtSD* pmtSD;
};
#endif
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// EventAction header
// --------------------------------------------------------------
#ifndef DMXEventAction_h
#define DMXEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
#include "G4ios.hh"
#include "DMXScintHit.hh"
#include "DMXPmtHit.hh"
class DMXEventActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DMXEventAction : public G4UserEventAction {
public:
DMXEventAction();
virtual ~DMXEventAction();
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
private:
void writeScintHitsToFile(void);
void writePmtHitsToFile(const DMXPmtHitsCollection*);
void drawTracks(const G4Event*);
public:
void SetDrawTrksFlag (G4String val) {drawTrksFlag = val;};
G4String GetDrawTrksFlag() {return drawTrksFlag;};
void SetDrawColsFlag (G4String val) {drawColsFlag = val;};
G4String GetDrawColsFlag() {return drawColsFlag;};
void SetDrawHitsFlag (G4int val) {drawHitsFlag = val;};
void SetSavePmtFlag (G4int val) {savePmtFlag = val;};
void SetSaveHitsFlag (G4int val) {saveHitsFlag = val;};
void SetPrintModulo (G4int val) {printModulo = val;};
private:
G4int event_id;
// hits collections
G4int scintillatorCollID;
G4int pmtCollID;
G4int S_hits;
G4int P_hits;
// event summary
G4double aveTimePmtHits;
G4double totEnergy;
G4double totEnergyGammas;
G4double totEnergyNeutrons;
G4double hitEnergy;
G4double firstLXeHitTime;
G4double particleEnergy;
G4String particleName;
G4String firstParticleName;
G4bool gamma_ev;
G4bool neutron_ev;
G4bool positron_ev;
G4bool electron_ev;
G4bool proton_ev;
G4bool other_ev;
G4bool start_gamma;
G4bool start_neutron;
// messenger
G4String drawTrksFlag;
G4String drawColsFlag;
G4int drawHitsFlag;
G4int savePmtFlag;
G4int saveHitsFlag;
G4int printModulo;
DMXEventActionMessenger* eventMessenger;
};
#endif
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// EventActionMessenger header
// --------------------------------------------------------------
#ifndef DMXEventActionMessenger_h
#define DMXEventActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DMXEventAction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
class DMXEventActionMessenger: public G4UImessenger {
public:
DMXEventActionMessenger(DMXEventAction*);
~DMXEventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
DMXEventAction* eventAction;
G4UIdirectory* dmxDirectory;
G4UIdirectory* drawDirectory;
G4UIcmdWithAString* DrawTrksCmd;
G4UIcmdWithAString* DrawColsCmd;
G4UIcmdWithABool* DrawHitsCmd;
G4UIcmdWithABool* SavePmtCmd;
G4UIcmdWithABool* SaveHitsCmd;
G4UIcmdWithAnInteger* PrintCmd;
};
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// MaxTimeCuts header
// --------------------------------------------------------------
#ifndef DMXMaxTimeCuts_h
#define DMXMaxTimeCuts_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "DMXSpecialCuts.hh"
class DMXMaxTimeCuts : public DMXSpecialCuts
{
public:
DMXMaxTimeCuts(const G4String& processName ="DMXMaxTimeCuts" );
virtual ~DMXMaxTimeCuts();
// PostStep GPIL
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
private:
// hide assignment operator as private
DMXMaxTimeCuts(DMXMaxTimeCuts&);
DMXMaxTimeCuts& operator=(const DMXMaxTimeCuts& right);
};
#endif
@@ -0,0 +1,132 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// ParticleSource header
// --------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
// This particle source is a shortened version of G4GeneralParticleSource by
// C Ferguson, F Lei & P Truscott (University of Southampton / DERA), with
// some minor modifications.
//////////////////////////////////////////////////////////////////////////////
#ifndef DMXParticleSource_h
#define DMXParticleSource_h 1
#include "G4VPrimaryGenerator.hh"
#include "G4Navigator.hh"
#include "G4ParticleMomentum.hh"
#include "G4ParticleDefinition.hh"
#include "DMXParticleSourceMessenger.hh"
class DMXParticleSource : public G4VPrimaryGenerator {
public:
DMXParticleSource ();
~DMXParticleSource ();
void GeneratePrimaryVertex(G4Event *evt);
public:
// position distribution
void SetPosDisType(G4String);
void SetPosDisShape(G4String);
void SetCentreCoords(G4ThreeVector);
void SetHalfZ(G4double);
void SetRadius(G4double);
void GeneratePointSource();
void GeneratePointsInVolume();
G4bool IsSourceConfined();
void ConfineSourceToVolume(G4String);
// angular distribution
void SetAngDistType(G4String);
void SetParticleMomentumDirection(G4ParticleMomentum);
void GenerateIsotropicFlux();
// energy distribution
void SetEnergyDisType(G4String);
void SetMonoEnergy(G4double);
void GenerateMonoEnergetic();
// verbosity
void SetVerbosity(G4int);
// particle properties
void SetParticleDefinition(G4ParticleDefinition * aParticleDefinition);
inline void SetParticleCharge(G4double aCharge)
{ particle_charge = aCharge; }
private:
// position distribution
G4String SourcePosType;
G4String Shape;
G4double halfz;
G4double Radius;
G4ThreeVector CentreCoords;
G4bool Confine;
G4String VolName;
G4String AngDistType;
G4double MinTheta, MaxTheta, MinPhi, MaxPhi;
G4double Theta, Phi;
G4String EnergyDisType;
G4double MonoEnergy;
// particle properties
G4int NumberOfParticlesToBeGenerated;
G4ParticleDefinition* particle_definition;
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy;
G4double particle_charge;
G4ThreeVector particle_position;
G4double particle_time;
G4ThreeVector particle_polarization;
// Verbose
G4int verbosityLevel;
private:
DMXParticleSourceMessenger *theMessenger;
G4Navigator *gNavigator;
};
#endif
@@ -0,0 +1,108 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// ParticleSourceMessenger header
// --------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
// This particle source is a shortened version of G4GeneralParticleSource by
// C Ferguson, F Lei & P Truscott (University of Southampton / DERA), with
// some minor modifications.
//////////////////////////////////////////////////////////////////////////////
#ifndef DMXParticleSourceMessenger_h
#define DMXParticleSourceMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class DMXParticleSource;
class G4ParticleTable;
class G4UIcommand;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWith3Vector;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADouble;
class G4UIcmdWithABool;
class G4UIcmdWithoutParameter;
class DMXParticleSourceMessenger: public G4UImessenger {
public:
DMXParticleSourceMessenger(DMXParticleSource *fPtclGun);
~DMXParticleSourceMessenger();
void SetNewValue(G4UIcommand *command, G4String newValues);
private:
DMXParticleSource *fParticleGun;
G4ParticleTable *particleTable;
private:
G4UIdirectory *gunDirectory;
G4UIcmdWithAString *typeCmd;
G4UIcmdWithAString *shapeCmd;
G4UIcmdWith3VectorAndUnit *centreCmd;
G4UIcmdWithADoubleAndUnit *halfzCmd;
G4UIcmdWithADoubleAndUnit *radiusCmd;
G4UIcmdWithAString *confineCmd;
G4UIcmdWithAString *angtypeCmd;
G4UIcmdWithAString *energytypeCmd;
G4UIcmdWithAnInteger *verbosityCmd;
G4UIcommand *ionCmd;
G4UIcmdWithAString *particleCmd;
G4UIcmdWith3VectorAndUnit *positionCmd;
G4UIcmdWith3Vector *directionCmd;
G4UIcmdWithADoubleAndUnit *energyCmd;
G4UIcmdWithoutParameter *listCmd;
private:
G4bool fShootIon;
G4int fAtomicNumber;
G4int fAtomicMass;
G4int fIonCharge;
G4double fIonExciteEnergy;
};
#endif
@@ -0,0 +1,104 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// PhysicsList header
// --------------------------------------------------------------
#ifndef DMXPhysicsList_h
#define DMXPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DMXPhysicsList: public G4VUserPhysicsList
{
public:
DMXPhysicsList();
virtual ~DMXPhysicsList();
public:
virtual void SetCuts();
protected:
// Construct particle and physics
virtual void ConstructParticle();
virtual void ConstructProcess();
// these methods Construct physics processes and register them
virtual void ConstructGeneral();
virtual void ConstructEM();
virtual void ConstructHad();
virtual void ConstructOp();
/*
// these methods Construct all particles in each category
virtual void ConstructAllBosons();
virtual void ConstructAllLeptons();
virtual void ConstructAllMesons();
virtual void ConstructAllBaryons();
virtual void ConstructAllIons();
virtual void ConstructAllShortLiveds();
*/
virtual void AddTransportation();
private:
G4int VerboseLevel;
G4int OpVerbLevel;
G4double cutForGamma;
G4double cutForElectron;
G4double cutForPositron;
G4double cutForProton;
G4double cutForAlpha;
G4double cutForGenericIon;
G4double cutForOpticalPhoton;
// these methods Construct particles
void ConstructMyBosons();
void ConstructMyLeptons();
void ConstructMyMesons();
void ConstructMyBaryons();
void ConstructMyIons();
void ConstructMyShortLiveds();
};
#endif
@@ -0,0 +1,100 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// PmtHit (sensitive detector) header
// --------------------------------------------------------------
#ifndef DMXPmtHit_h
#define DMXPmtHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
class DMXPmtHit : public G4VHit
{
public:
DMXPmtHit();
~DMXPmtHit();
DMXPmtHit(const DMXPmtHit&);
const DMXPmtHit& operator=(const DMXPmtHit&);
int operator==(const DMXPmtHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
void Draw();
void Print();
private:
G4ThreeVector pos;
G4double time;
public:
inline void SetPos(G4ThreeVector xyz) {pos=xyz;};
inline G4ThreeVector GetPos() const {return pos;};
inline void SetTime(G4double t) {time=t;};
inline G4double GetTime() const {return time;};
};
// vector collection of one type of hits
typedef G4THitsCollection<DMXPmtHit> DMXPmtHitsCollection;
extern G4Allocator<DMXPmtHit> DMXPmtHitsAllocator;
inline void* DMXPmtHit::operator new(size_t) {
void* aHit;
aHit = (void*) DMXPmtHitsAllocator.MallocSingle();
return aHit;
}
inline void DMXPmtHit::operator delete(void* aHit) {
DMXPmtHitsAllocator.FreeSingle((DMXPmtHit*) aHit);
}
#endif
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// PmtSD (sensitive detector) header
// --------------------------------------------------------------
#ifndef DMXPmtSD_h
#define DMXPmtSD_h 1
#include "G4VSensitiveDetector.hh"
#include "globals.hh"
#include "DMXPmtHit.hh"
class DMXDetectorConstruction;
class G4Step;
class G4HCofThisEvent;
class DMXPmtSD : public G4VSensitiveDetector {
public:
DMXPmtSD(G4String, DMXDetectorConstruction*);
~DMXPmtSD();
void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step*,G4TouchableHistory*);
void EndOfEvent(G4HCofThisEvent*);
void clear();
void DrawAll();
void PrintAll();
private:
DMXPmtHitsCollection* pmtCollection;
DMXDetectorConstruction* DMXDetector;
G4int HitID;
};
#endif
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// PrimaryGeneratorAction header
// --------------------------------------------------------------
#ifndef DMXPrimaryGeneratorMessenger_h
#define DMXPrimaryGeneratorMessenger_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class DMXParticleSource;
class G4Event;
class DMXPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
public:
DMXPrimaryGeneratorAction();
~DMXPrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent);
private:
DMXParticleSource* particleGun;
};
#endif
@@ -0,0 +1,72 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// RunAction header
// --------------------------------------------------------------
#ifndef DMXRunAction_h
#define DMXRunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DMXRunActionMessenger;
class G4Run;
class DMXRunAction : public G4UserRunAction
{
public:
DMXRunAction();
~DMXRunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
void SetFilename(G4String val) { fileName = val; };
private:
G4String fileName; // log file name for the run
DMXRunActionMessenger* runMessenger;
};
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// RunActionMessenger header
// --------------------------------------------------------------
#ifndef DMXRunActionMessenger_h
#define DMXRunActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DMXRunAction;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DMXRunActionMessenger: public G4UImessenger
{
public:
DMXRunActionMessenger(DMXRunAction*);
~DMXRunActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
DMXRunAction* DMXRun;
G4UIcmdWithAString* FileCmd;
};
#endif
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// DetectorConstruction header
// --------------------------------------------------------------
#ifndef DMXScintHit_h
#define DMXScintHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DMXScintHit : public G4VHit
{
public:
DMXScintHit();
~DMXScintHit();
DMXScintHit(const DMXScintHit&);
const DMXScintHit& operator=(const DMXScintHit&);
int operator==(const DMXScintHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
void Draw();
void Print();
public:
void SetEdep (G4double de) { edep = de; };
void SetPos (G4ThreeVector xyz) { pos = xyz; };
void SetParticle (G4String name) { particleName = name; };
void SetParticleEnergy (G4double e1) { particleEnergy = e1; };
void SetTime (G4double t2) { time = t2; };
G4double GetEdep() { return edep; };
G4ThreeVector GetPos() { return pos; };
G4String GetParticle() { return particleName;};
G4double GetParticleEnergy() { return particleEnergy;};
G4double GetTime() { return time; };
private:
G4double edep;
G4ThreeVector pos;
G4double time;
G4String particleName;
G4double particleEnergy;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
typedef G4THitsCollection<DMXScintHit> DMXScintHitsCollection;
extern G4Allocator<DMXScintHit> DMXScintHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void* DMXScintHit::operator new(size_t)
{
void* aHit;
aHit = (void*) DMXScintHitAllocator.MallocSingle();
return aHit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void DMXScintHit::operator delete(void* aHit)
{
DMXScintHitAllocator.FreeSingle((DMXScintHit*) aHit);
}
#endif
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// ScintSD (sensitive detector) header
// --------------------------------------------------------------
#ifndef DMXScintSD_h
#define DMXScintSD_h 1
#include "G4VSensitiveDetector.hh"
#include "globals.hh"
#include "DMXScintHit.hh"
class DMXDetectorConstruction;
class G4Step;
class G4HCofThisEvent;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DMXScintSD : public G4VSensitiveDetector
{
public:
DMXScintSD(G4String, DMXDetectorConstruction*);
~DMXScintSD();
void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step*, G4TouchableHistory*);
void EndOfEvent(G4HCofThisEvent*);
void clear();
void DrawAll();
void PrintAll();
private:
DMXScintHitsCollection* scintillatorCollection;
DMXDetectorConstruction* DMXDetector;
G4int HitID;
};
#endif
@@ -0,0 +1,101 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// SpecialCuts header
// --------------------------------------------------------------
#ifndef DMXSpecialCuts_h
#define DMXSpecialCuts_h 1
#include "G4ios.hh"
#include "globals.hh"
#include "G4VProcess.hh"
class DMXSpecialCuts : public G4VProcess
{
public:
DMXSpecialCuts(const G4String& processName ="DMXSpecialCut" );
virtual ~DMXSpecialCuts();
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
virtual G4VParticleChange* PostStepDoIt(
const G4Track& ,
const G4Step&
);
// no operation in AtRestGPIL
virtual G4double AtRestGetPhysicalInteractionLength(
const G4Track& ,
G4ForceCondition*
){ return -1.0; };
// no operation in AtRestDoIt
virtual G4VParticleChange* AtRestDoIt(
const G4Track& ,
const G4Step&
){return NULL;};
// no operation in AlongStepGPIL
virtual G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*
){ return -1.0; };
// no operation in AlongStepDoIt
virtual G4VParticleChange* AlongStepDoIt(
const G4Track& ,
const G4Step&
) {return NULL;};
private:
// hide assignment operator as private
DMXSpecialCuts& operator=(const DMXSpecialCuts& right){return *this;};
};
#endif
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// StackingAction header
// --------------------------------------------------------------
#ifndef DMXStackingAction_H
#define DMXStackingAction_H 1
#include "globals.hh"
#include "G4UserStackingAction.hh"
class DMXStackingActionMessenger;
class G4Navigator;
class G4Track;
class DMXStackingAction : public G4UserStackingAction {
public:
DMXStackingAction();
virtual ~DMXStackingAction();
public:
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
virtual void NewStage();
virtual void PrepareNewEvent();
DMXStackingActionMessenger* theMessenger;
private:
G4bool killGammasFlag;
G4Navigator* gNavigator;
public:
inline void SetKillGammasFlag(G4bool val) {killGammasFlag = val;};
};
#endif
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// StackingActionMessenger header
// --------------------------------------------------------------
#ifndef protpStackingActionMessenger_h
#define DMXStackingActionMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class DMXStackingAction;
class G4UIcmdWithABool;
class DMXStackingActionMessenger: public G4UImessenger {
public:
DMXStackingActionMessenger(DMXStackingAction*);
~DMXStackingActionMessenger();
public:
void SetNewValue(G4UIcommand* , G4String);
private:
DMXStackingAction* DMXAction;
private:
G4UIcmdWithABool* KillGammasCmd;
};
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// SteppingAction header
// --------------------------------------------------------------
#ifndef DMXSteppingAction_h
#define DMXSteppingAction_h 1
#include "G4UserSteppingAction.hh"
#include "globals.hh"
class DMXSteppingActionMessenger;
class DMXEventAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DMXSteppingAction : public G4UserSteppingAction
{
public:
DMXSteppingAction(DMXEventAction*);
virtual ~DMXSteppingAction();
virtual void UserSteppingAction(const G4Step*);
public:
void SetColourNeutronFlag(G4String val) {colourNeutronFlag =val;};
void SetColourGammaFlag(G4String val) {colourGammaFlag =val;};
void SetColourOpticalFlag(G4String val) {colourOpticalFlag =val;};
void SetColourChargedPlusFlag(G4String val) {colourChargedPlusFlag =val;};
void SetColourChargedMinusFlag(G4String val) {colourChargedMinusFlag=val;};
private:
G4String colourNeutronFlag;
G4String colourGammaFlag;
G4String colourOpticalFlag;
G4String colourChargedPlusFlag;
G4String colourChargedMinusFlag;
DMXSteppingActionMessenger* steppingMessenger;
DMXEventAction* evtAction; //pointer to event action
};
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// SteppingActionMessenger header
// --------------------------------------------------------------
#ifndef DMXSteppingActionMessenger_h
#define DMXSteppingActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DMXSteppingAction;
class G4UIdirectory;
class G4UIcmdWithAString;
class DMXSteppingActionMessenger: public G4UImessenger {
public:
DMXSteppingActionMessenger(DMXSteppingAction*);
~DMXSteppingActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
DMXSteppingAction* steppingAction;
G4UIcmdWithAString* colourNeutronCmd;
G4UIcmdWithAString* colourGammaCmd;
G4UIcmdWithAString* colourOpticalCmd;
G4UIcmdWithAString* colourChargedPlusCmd;
G4UIcmdWithAString* colourChargedMinusCmd;
};
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// VisManager header
// --------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Example Visualization Manager implementing virtual function
// RegisterGraphicsSystems. Exploits C-pre-processor variables
// G4VIS_USE_DAWN, etc., which are set by the GNUmakefiles if
// environment variables of the same name are set.
// So all you have to do is set environment variables and compile and
// instantiate this in your main().
// Alternatively, you can implement an empty function here and just
// register the systems you want in your main(), e.g.:
// G4VisManager* DMXVisManager = new MyVisManager;
// DMXVisManager -> RegisterGraphicsSystem (new MyGraphicsSystem);
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef DMXVisManager_h
#define DMXVisManager_h 1
#ifdef G4VIS_USE
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class DMXVisManager: public G4VisManager {
public:
DMXVisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif
#endif
@@ -0,0 +1,40 @@
#############################################################################*#
# #
# initInter.mac #
# Initialisation macro for interactive mode #
# #
###############################################################################
#
/control/verbose 2
/control/saveHistory
#
# Create empty scene
/vis/scene/create
#
# Create a scene handler for a specific graphics system
# (Edit the next line(s) to choose another graphic system)
#/vis/open OGLSX
#/vis/open OGLIX
/vis/open OGLSXm
#/vis/open OGLIXm
#/vis/open DANWFILE
#/vis/open Xo
#
# Trajectories: set to 0 if too many
# alternatively use /dmx/drawTracks [none charged noscint all]
/tracking/storeTrajectory 1
#
#
# Camera viewpoint
/vis/drawView 70 -90 0. 0. cm 1.5
#
# Add detector to scene
/vis/drawVolume
#
# Flush visualization
/vis/viewer/update
#
#
# now run macro: gamma.mac, alpha.mac, neutron.mac, sourceAm241.mac
@@ -0,0 +1,56 @@
###############################################################################
# #
# neutron.mac #
# 1 neutron fired in the room #
# #
###############################################################################
#
# output log-file name
/run/filename n_phantom_100000.log
#
# verbosities
/control/verbose 1
/run/verbose 1
/tracking/verbose 0
/hits/verbose 1
#
# draw flags
/dmx/draw/drawColours custom
/dmx/draw/gammaColour green
/dmx/draw/drawTracks noscint
/dmx/draw/drawHits 0
#
# file output
/dmx/savePmt 0
/dmx/saveHits 1
#
# kill gammas in lab wall
/dmx/KillGammasInConcrete 0
#
# radioactive decay module
/grdm/analogueMC 1
/grdm/verbose 0
/grdm/allVolumes
#
# gun: particle
/dmx/gun/verbose 1
/dmx/gun/particle neutron
/dmx/gun/energytype Mono
/dmx/gun/energy 2.48 MeV
#
# gun: isotropic
# /dmx/gun/angtype iso
#
# OR gun: shoot at detector
/dmx/gun/angtype direction
/dmx/gun/direction 0 -1 -0 m
#
# gun: source
/dmx/gun/confine NULL
/dmx/gun/type Volume
/dmx/gun/shape Sphere
/dmx/gun/centre 0 2 0.090 m
/dmx/gun/radius 3 cm
#
/run/beamOn 1
@@ -0,0 +1,862 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// DetectorConstruction program
// --------------------------------------------------------------
#include "DMXDetectorConstruction.hh"
#include "DMXScintSD.hh"
#include "DMXPmtSD.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4Isotope.hh"
#include "G4UnitsTable.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Sphere.hh"
#include "G4UnionSolid.hh"
#include "G4SubtractionSolid.hh"
#include "G4SphericalSurface.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4ThreeVector.hh"
#include "G4RotationMatrix.hh"
#include "G4Transform3D.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4OpBoundaryProcess.hh"
#include "G4FieldManager.hh"
#include "G4UniformElectricField.hh"
#include "G4TransportationManager.hh"
#include "G4MagIntegratorStepper.hh"
#include "G4EqMagElectricField.hh"
#include "G4ClassicalRK4.hh"
#include "G4ChordFinder.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4UserLimits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXDetectorConstruction::DMXDetectorConstruction()
{
theUserLimits = NULL;
fUseUserLimits = false;
// theMaxTimeCuts = 1000000. * s;
// default time cut = infinite
// - note also number of steps cut in stepping action = MaxNoSteps
theMaxTimeCuts = DBL_MAX;
theMaxStepSize = DBL_MAX;
theRoomTimeCut = 10000. * s;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXDetectorConstruction::~DMXDetectorConstruction() {;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXDetectorConstruction::DefineMaterials() {
G4double density, // density
a, // atomic mass
z; // atomic number
G4String name, // name
symbol; // symbol
G4int ncomponents, // n components
iz, // number of protons
in; // number of nuceons
G4double abundance, // abundance
temperature, // temperature
pressure; // pressure
// making vacuum
G4Material* vacuum = new G4Material
(name="Vacuum", z=1., a=1.*g/mole, density=1.e-20*g/cm3,
kStateGas, temperature=0.1*kelvin, pressure=1.e-20*bar);
// xenons
G4Element* elementXe = new G4Element( "Xenon", "Xe", 54., 131.29*g/mole );
G4Material* LXe = new G4Material
("LXe", 3.02*g/cm3, 1, kStateLiquid, 173.15*kelvin, 1.5*atmosphere );
G4Material* GXe = new G4Material
("GXe", 0.005887*g/cm3, 1, kStateGas, 173.15*kelvin, 1.5*atmosphere );
LXe->AddElement( elementXe, 1);
GXe->AddElement( elementXe, 1);
const G4int NUMENTRIES = 2;
G4double LXe_PP[NUMENTRIES] = { 7.07*eV, 7.07*eV };
G4double LXe_SCINT[NUMENTRIES] = { 1.0, 1.0 };
G4double LXe_RIND[NUMENTRIES] = { 1.57, 1.57 };
G4double LXe_ABSL[NUMENTRIES] = { 35.*cm, 35.*cm};
G4MaterialPropertiesTable *LXe_mt = new G4MaterialPropertiesTable();
LXe_mt->AddProperty("SCINTILLATION", LXe_PP, LXe_SCINT, NUMENTRIES);
LXe_mt->AddProperty("RINDEX", LXe_PP, LXe_RIND, NUMENTRIES);
LXe_mt->AddProperty("ABSLENGTH", LXe_PP, LXe_ABSL, NUMENTRIES);
LXe->SetMaterialPropertiesTable(LXe_mt);
G4double GXe_PP[NUMENTRIES] = { 7.07*eV, 7.07*eV };
G4double GXe_SCINT[NUMENTRIES] = { 1.0, 1.0 };
G4double GXe_RIND[NUMENTRIES] = { 1.00, 1.00 };
G4double GXe_ABSL[NUMENTRIES] = { 100*m, 100*m};
G4MaterialPropertiesTable *GXe_mt = new G4MaterialPropertiesTable();
GXe_mt->AddProperty("SCINTILLATION", GXe_PP, GXe_SCINT, NUMENTRIES);
GXe_mt->AddProperty("RINDEX", GXe_PP, GXe_RIND, NUMENTRIES);
GXe_mt->AddProperty("ABSLENGTH", GXe_PP, GXe_ABSL, NUMENTRIES);
GXe->SetMaterialPropertiesTable(GXe_mt);
// making quartz
G4Element* O = new G4Element
(name="Oxygen" ,symbol="O" , z= 8., a=16.00*g/mole);
G4Element* Si = new G4Element
(name="Silicon",symbol="Si" , z= 14., a=28.09*g/mole);
G4Material* quartz = new G4Material
(name="quartz", density=2.200*g/cm3, ncomponents=2);
quartz->AddElement(Si, 1);
quartz->AddElement(O , 2);
G4double quartz_PP[NUMENTRIES] = { 6.69*eV, 7.50*eV }; // lambda range 4 ri
G4double quartz_RIND[NUMENTRIES] = { 1.575, 1.628 }; // ref index
G4double quartz_ABSL[NUMENTRIES] = { 1.5*cm, 1.5*cm }; // atten length
G4MaterialPropertiesTable *quartz_mt = new G4MaterialPropertiesTable();
quartz_mt->AddProperty("RINDEX", quartz_PP, quartz_RIND, NUMENTRIES);
quartz_mt->AddProperty("ABSLENGTH", quartz_PP, quartz_ABSL, NUMENTRIES);
quartz->SetMaterialPropertiesTable(quartz_mt);
// aluminium
G4Element* Al = new G4Element
(name="Aluminium" ,symbol="Al" , z= 13., a=26.98*g/mole);
G4Material* metalAl = new G4Material
(name="MetalAluminium", density=2.700*g/cm3, ncomponents=1);
metalAl->AddElement(Al, 1);
// iron
G4Element* Fe = new G4Element
(name="Iron" ,symbol="Fe" , z= 26., a=55.85*g/mole);
G4Material* metalFe = new G4Material
(name="MetalIron", density=7.874*g/cm3, ncomponents=1);
metalFe->AddElement(Fe, 1);
// stainless steel
G4Element* C = new G4Element( "Carbon", "C", 6. , 12.011*g/mole);
G4Element* Co = new G4Element( "Cobalt", "Co", 27. , 58.9332*g/mole);
G4Material* ssteel = new G4Material
(name="Steel", density=7.7*g/cm3, ncomponents=3);
ssteel->AddElement(C, 0.04);
ssteel->AddElement(Fe, 0.88);
ssteel->AddElement(Co, 0.08);
// copper
G4Element* Cu = new G4Element
(name="Copper" ,symbol="Cu" , z= 29., a=63.55*g/mole);
G4Material* metalCu = new G4Material
(name="MetalCopper", density=8.960*g/cm3, ncomponents=1);
metalCu->AddElement(Cu, 1);
// lead
G4Element* Pb = new G4Element
(name="Lead",symbol="Pb" , z= 82., a=207.2*g/mole);
G4Material* metalPb = new G4Material
(name="MetalLead", density=11.340*g/cm3, ncomponents=1);
metalPb->AddElement(Pb, 1);
/*
// Americium:
G4Isotope* Am241 = new G4Isotope
(name="Americium241", iz= 95, in=241, a=241.0*g/mole);
G4Element* Am = new G4Element
(name="Americium241", "Am", ncomponents=1);
Am->AddIsotope(Am241, abundance=1);
G4Material* sourceAm = new G4Material
(name="AmericiumSource", density=13.61*g/cm3, ncomponents=1);
sourceAm->AddElement(Am, 1);
*/
// using Uranium because Americium not yet defined for RDM
G4Isotope* U235 = new G4Isotope
(name="Uranium235", iz= 92, in=235, a=235.0*g/mole);
G4Element* U = new G4Element
(name="Uranium", "U", ncomponents=1);
U->AddIsotope(U235, abundance=1);
G4Material* sourceAm = new G4Material
(name="UraniumSource", density=13.61*g/cm3, ncomponents=1);
sourceAm->AddElement(U, 1);
// air
G4Element* N = new G4Element
(name="Nitrogen",symbol="N" , z= 7., a=14.00674*g/mole);
G4Material* Air = new G4Material
("AIR", 1.2929*kg/m3, 2, kStateGas, 300.00*kelvin, 1.0*atmosphere);
Air->AddElement(N, 0.8);
Air->AddElement(O , 0.2);
//concrete
G4Element* H = new G4Element
(name="Hydrogen",symbol="H" , z= 1., a=1.00794*g/mole);
G4Element* Ca = new G4Element
(name="Calcium",symbol="Ca" , z= 20., a=40.078*g/mole);
G4Material* concrete = new G4Material
(name="Concrete", density=2.3*g/cm3, ncomponents=6);
concrete->AddElement(Si, 0.227915);
concrete->AddElement(O, 0.60541);
concrete->AddElement(H, 0.09972);
concrete->AddElement(Ca, 0.04986);
concrete->AddElement(Al, 0.014245);
concrete->AddElement(Fe, 0.00285);
//water
G4Material* water = new G4Material
(name="water", density=1.00*g/cm3, ncomponents=2);
water->AddElement(H , 2);
water->AddElement(O , 1);
// print materials
// G4cout << *(G4Material::GetMaterialTable()) << G4endl;
// G4cout << *(G4Isotope::GetIsotopeTable()) << G4endl;
// G4cout << *(G4Element::GetElementTable()) << G4endl;
// assign materials
world_mat = concrete;
lab_mat = Air;
jacket_mat = ssteel;
vacuum_mat = vacuum;
vessel_mat = ssteel;
detector_mat = GXe;
CuShield_mat = metalCu;
liqPhase_mat = LXe;
alpha_mat = metalPb;
americium_mat = sourceAm;
ring_mat = ssteel;
mirror_mat = metalAl;
grid_mat = LXe;
pmt_mat = quartz;
phcath_mat = metalAl;
}
/*
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXDetectorConstruction::DefineField() {
G4double EField = 0.0*kilovolt/cm;
// create electric field
G4UniformElectricField* elecField =
new G4UniformElectricField(G4ThreeVector(0,EField,0));
// equation of motion
G4EqMagElectricField* EquationOfMotion =
new G4EqMagElectricField(elecField);
// stepper for equation of motion
G4MagIntegratorStepper* DMXStepper =
new G4ClassicalRK4(EquationOfMotion);
// chordfinder
G4ChordFinder* DMXChordFinder =
new G4ChordFinder(elecField, 1.0e-3*mm, DMXStepper);
// field manager
G4FieldManager* DMXFieldManager = new G4FieldManager();
DMXFieldManager->SetChordFinder(DMXChordFinder);
G4TransportationManager::GetTransportationManager()
-> SetFieldManager(DMXFieldManager);
}
*/
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* DMXDetectorConstruction::Construct() {
DefineMaterials();
// DefineField();
// make colours
G4Colour white (1.0, 1.0, 1.0) ;
G4Colour grey (0.5, 0.5, 0.5) ;
G4Colour lgrey (.75, .75, .75) ;
G4Colour red (1.0, 0.0, 0.0) ;
G4Colour blue (0.0, 0.0, 1.0) ;
G4Colour cyan (0.0, 1.0, 1.0) ;
G4Colour magenta (1.0, 0.0, 1.0) ;
G4Colour yellow (1.0, 1.0, 0.0) ;
G4Colour lblue (0.0, 0.0, .75) ;
// un-used colours:
// G4Colour black (0.0, 0.0, 0.0) ;
// G4Colour green (0.0, 1.0, 0.0) ;
// G4Colour lgreen (0.0, .75, 0.0) ;
// Universe - room wall - CONCRETE ************************************
G4double worldWidth = 5.0*m;
G4double worldLength = 6.0*m;
G4double worldHeight = 3.0*m;
G4Box* world_box= new G4Box
("world_box", 0.5*worldWidth, 0.5*worldLength, 0.5*worldHeight );
world_log = new G4LogicalVolume(world_box, world_mat, "world_log");
world_phys=new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
"world_phys", world_log, NULL, false,0);
G4VisAttributes* world_vat= new G4VisAttributes(white);
// world_log->SetVisAttributes(G4VisAttributes::Invisible);
world_vat->SetVisibility(true);
world_log->SetVisAttributes(world_vat);
// Lab Space - AIR *****************************************************
G4double wallThick = 30.*cm;
G4double labWidth = worldWidth - wallThick;
G4double labLength = worldLength - wallThick;
G4double labHeight = worldHeight - wallThick;
G4Box* lab_box= new G4Box
("lab_box", 0.5*labWidth, 0.5*labLength, 0.5*labHeight );
lab_log = new G4LogicalVolume(lab_box, lab_mat, "lab_log");
lab_phys=new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), "lab_phys",
lab_log, world_phys, false,0);
G4VisAttributes* lab_vat= new G4VisAttributes(white);
lab_log->SetVisAttributes(G4VisAttributes::Invisible);
// lab_log->SetVisibility(true);
lab_log->SetVisAttributes(lab_vat);
// outer vacuum jacket volume: stainless steel *************************
G4double jacketRadius = 15.0*cm;
G4double jacketHeight = 40.0*cm;
G4double jacketMetalThick = 3.0*mm;
G4Tubs* jacket_tube=new G4Tubs("jacket_tube",
0.*cm, jacketRadius, 0.5*jacketHeight, 0.*deg, 360.*deg);
jacket_log = new G4LogicalVolume(jacket_tube, jacket_mat, "jacket_log");
jacket_phys=new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
"jacket_phys", jacket_log, lab_phys, false,0);
G4VisAttributes* jacket_vat= new G4VisAttributes(grey);
// jacket_log->SetVisAttributes(G4VisAttributes::Invisible);
jacket_log->SetVisAttributes(jacket_vat);
// vacuum **************************************************************
G4double vacuumRadius = jacketRadius - jacketMetalThick;
G4double vacuumHeight = jacketHeight - jacketMetalThick;
G4Tubs* vacuum_tube=new G4Tubs("vacuum_tube",
0.*cm, vacuumRadius, 0.5*vacuumHeight, 0.*deg, 360.*deg);
vacuum_log = new G4LogicalVolume(vacuum_tube, vacuum_mat, "vacuum_log");
vacuum_phys=new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
"vacuum_phys", vacuum_log, jacket_phys, false,0);
// G4VisAttributes* vacuum_vat= new G4VisAttributes(lgrey);
vacuum_log->SetVisAttributes(G4VisAttributes::Invisible);
// inner vessel jacket volume: stainless steel ************************
G4double vesselRadius = 10.0*cm;
G4double vesselHeight = 30.0*cm;
G4double vesselMetalThick = 3.0*mm;
G4Tubs* vessel_tube=new G4Tubs("vessel_tube",
0.*cm, vesselRadius, 0.5*vesselHeight, 0.*deg, 360.*deg);
vessel_log = new G4LogicalVolume(vessel_tube, vessel_mat, "vessel_log");
vessel_phys=new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
"vessel_phys", vessel_log, vacuum_phys, false,0);
G4VisAttributes* vessel_vat= new G4VisAttributes(grey);
// vessel_log->SetVisAttributes(G4VisAttributes::Invisible);
vessel_log->SetVisAttributes(vessel_vat);
// *********************************************************************
// grid#1 to mirror surface: 21.75 mm
// LXe height = 15.75 mm, gXe height = 6.00 mm
// NB: Increased liquid height by 1mm - to take away problem with
// over-lapping volumes/ring pronounced from liquid phase..........
// *********************************************************************
// detector volume: gas phase ******************************************
G4double fullDetectorRadius = vesselRadius - vesselMetalThick;
G4double fullDetectorHeight = vesselHeight - vesselMetalThick;
G4Tubs* detector_tube=new G4Tubs("detector_tube",
0.*cm, fullDetectorRadius, 0.5*fullDetectorHeight, 0.*deg, 360.*deg);
detector_log = new G4LogicalVolume
(detector_tube, detector_mat, "detector_log");
detector_phys=new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
"detector_phys", detector_log, vessel_phys, false,0);
G4VisAttributes* detector_vat= new G4VisAttributes(yellow);
// detector_log->SetVisAttributes(G4VisAttributes::Invisible);
detector_log->SetVisAttributes(detector_vat);
// liquid phase *******************************************************
G4double detectorRadius = 4.0*cm;
G4double detectorHeight = 21.3*cm;
G4double liqPhaseHeight = 20.40*cm;
G4double liqPhaseRadius = fullDetectorRadius;
G4double liqPhaseVPosition = -0.5*(detectorHeight-liqPhaseHeight);
G4Tubs* liqPhase_tube=new G4Tubs("liqPhase_tube", 0.*cm,
liqPhaseRadius, 0.5*liqPhaseHeight, 0.*deg, 360.*deg);
liqPhase_log =
new G4LogicalVolume(liqPhase_tube, liqPhase_mat, "liqPhase_log");
liqPhase_phys=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, liqPhaseVPosition),
"liqPhase_phys", liqPhase_log, detector_phys, false, 0);
// attributes
G4VisAttributes* liqPhase_vat= new G4VisAttributes(yellow);
liqPhase_vat->SetVisibility(true);
liqPhase_log->SetVisAttributes(liqPhase_vat);
// Cu Shield **********************************************************
G4double CuShieldHeight = 17.7*cm;
G4double CuShieldThickness = 2.4*mm;
G4double CuShieldOuterRadius = 3.0*cm;
G4double CuShieldInnerRadius = CuShieldOuterRadius-CuShieldThickness;
G4double CuShieldVPosition = -0.5*(liqPhaseHeight-CuShieldHeight);
G4Tubs* CuShield_tube=new G4Tubs("CuShield_tube", CuShieldInnerRadius,
CuShieldOuterRadius, 0.5*CuShieldHeight, 0.*deg, 360.*deg);
CuShield_log =
new G4LogicalVolume(CuShield_tube, CuShield_mat, "CuShield_log");
CuShield_phys=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, CuShieldVPosition),
"CuShield_phys", CuShield_log, liqPhase_phys, false, 0);
G4VisAttributes* CuShield_vat= new G4VisAttributes(magenta);
CuShield_vat->SetVisibility(true);
CuShield_log->SetVisAttributes(CuShield_vat);
// Cu shield surface
G4OpticalSurface* OpCuShieldSurface = new G4OpticalSurface
("ShieldSurface", unified, polished, dielectric_metal);
G4LogicalBorderSurface* ShieldSurface;
ShieldSurface = new G4LogicalBorderSurface
("Shield", liqPhase_phys, CuShield_phys, OpCuShieldSurface);
const G4int NUM = 2;
G4double CuShield_PP[NUM] = { 7.0*eV, 7.50*eV };
G4double CuShield_REFL[NUM] = { 0.271, 0.230 };
G4MaterialPropertiesTable *CuShield_mt = new G4MaterialPropertiesTable();
CuShield_mt->AddProperty("REFLECTIVITY", CuShield_PP, CuShield_REFL, NUM);
OpCuShieldSurface->SetMaterialPropertiesTable(CuShield_mt);
// rings ***************************************************************
G4double ringHeight = 4.*mm;
G4double ringOuterRadius = detectorRadius;
G4double ringInnerRadius = CuShieldOuterRadius;
G4double ringVOffset = 0.5*ringHeight;
G4double ringVPosition = 0.5*detectorHeight-ringVOffset;
G4Tubs* ring_tube=new G4Tubs("ring_tube", ringInnerRadius,
ringOuterRadius, 0.5*ringHeight, 0.*deg, 360.*deg);
ring_log = new G4LogicalVolume(ring_tube, ring_mat, "ring_log");
// optical surface: ring materials table
G4double ring_PP[NUM] = { 7.00*eV, 7.50*eV };
G4double ring_REFL[NUM] = { 0.25, 0.25 };
G4MaterialPropertiesTable *ring_mt = new G4MaterialPropertiesTable();
ring_mt->AddProperty("REFLECTIVITY", ring_PP, ring_REFL, NUM);
G4OpticalSurface* OpRingSurface = new G4OpticalSurface("RingSurface",
unified, polished, dielectric_metal);
// omitted last argument which is surface roughness if it's non-polished
// - i.e. ground
OpRingSurface->SetMaterialPropertiesTable(ring_mt);
// rings
ring_phys_gas[0]=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, ringVPosition),
"ring_phys0",ring_log,detector_phys,false, 0);
G4LogicalBorderSurface* RingSurface_gas0;
RingSurface_gas0 = new G4LogicalBorderSurface
("Ring", detector_phys, ring_phys_gas[0], OpRingSurface);
ring_phys_gas[1]=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight+1.0*mm),
"ring_phys1",ring_log, detector_phys, false, 0);
G4LogicalBorderSurface* RingSurface_gas1;
RingSurface_gas1 = new G4LogicalBorderSurface
("Ring", detector_phys, ring_phys_gas[1], OpRingSurface);
// LIQUID Phase starts here:
ringVPosition+=0.5*(detectorHeight-liqPhaseHeight);
ring_phys_liq[0]=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight),
"ring_phys2",ring_log,liqPhase_phys, false, 0);
G4LogicalBorderSurface* RingSurface_liq0;
RingSurface_liq0 = new G4LogicalBorderSurface
("Ring", liqPhase_phys, ring_phys_liq[0], OpRingSurface);
ring_phys_liq[1]=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight+1.75*mm),
"ring_phys3",ring_log, liqPhase_phys, false, 0);
G4LogicalBorderSurface* RingSurface_liq1;
RingSurface_liq1 = new G4LogicalBorderSurface
("Ring", liqPhase_phys, ring_phys_liq[1], OpRingSurface);
ring_phys_liq[2]=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight),
"ring_phys4",ring_log, liqPhase_phys, false, 0);
G4LogicalBorderSurface* RingSurface_liq2;
RingSurface_liq2 = new G4LogicalBorderSurface
("Ring", liqPhase_phys, ring_phys_liq[2], OpRingSurface);
ring_phys_liq[3]=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight),
"ring_phys5",ring_log, liqPhase_phys, false, 0);
G4LogicalBorderSurface* RingSurface_liq3;
RingSurface_liq3 = new G4LogicalBorderSurface
("Ring", liqPhase_phys, ring_phys_liq[3], OpRingSurface);
ring_phys_liq[4]=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight+1.75*mm),
"ring_phys6",ring_log, liqPhase_phys,false, 0);
G4LogicalBorderSurface* RingSurface_liq4;
RingSurface_liq4 = new G4LogicalBorderSurface
("Ring", liqPhase_phys, ring_phys_liq[4], OpRingSurface);
ring_phys_liq[5]=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight+1.75*mm),
"ring_phys7",ring_log, liqPhase_phys,false, 0);
G4LogicalBorderSurface* RingSurface_liq5;
RingSurface_liq5 = new G4LogicalBorderSurface
("Ring", liqPhase_phys, ring_phys_liq[5], OpRingSurface);
G4VisAttributes* ring_vat= new G4VisAttributes(lgrey);
ring_vat->SetVisibility(true);
ring_log->SetVisAttributes(ring_vat);
// Mirror *************************************************************
G4double mirrorHeight = 2.0*mm;
G4double mirrorRadius = ringInnerRadius;
G4double mirrorVOffset = 0.5*ringHeight;
G4double mirrorVPosition = 0.5*detectorHeight-mirrorVOffset;
G4Tubs* mirror_tube=new G4Tubs("mirror_tube", 0.*cm, mirrorRadius,
0.5*mirrorHeight, 0.*deg, 360.*deg);
mirror_log =
new G4LogicalVolume(mirror_tube, mirror_mat, "mirror_log");
mirror_phys=new G4PVPlacement(0,
G4ThreeVector(0.*cm, 0.*cm, mirrorVPosition),
"mirror_phys", mirror_log, detector_phys, false, 0);
G4VisAttributes* mirror_vat= new G4VisAttributes(red);
mirror_vat->SetVisibility(true);
// mirror_vat->SetForceSolid(true);
mirror_log->SetVisAttributes(mirror_vat);
// mirror surface
G4OpticalSurface * OpMirrorSurface = new G4OpticalSurface
("MirrorSurface", unified, polished, dielectric_metal);
G4LogicalBorderSurface* MirrorSurface;
MirrorSurface = new G4LogicalBorderSurface
("Mirror", detector_phys, mirror_phys, OpMirrorSurface);
G4double mirror_PP[NUM] = { 7.00*eV, 7.50*eV };
G4double mirror_REFL[NUM] = { 0.70, 0.70 };
G4MaterialPropertiesTable *mirror_mt = new G4MaterialPropertiesTable();
mirror_mt->AddProperty("REFLECTIVITY", mirror_PP, mirror_REFL, NUM);
OpMirrorSurface->SetMaterialPropertiesTable(mirror_mt);
// Grids *************************************************************
G4double gridHeight = 0.100*mm;
G4double gridRadius = ringInnerRadius;
G4double grid1VOffset = 5.5*ringHeight+2.75*mm;
G4double grid1VPosition = 0.5*liqPhaseHeight+(detectorHeight-liqPhaseHeight)
- grid1VOffset;
G4double grid2VOffset = 6.5*ringHeight+4.50*mm;
G4double grid2VPosition = 0.5*liqPhaseHeight+(detectorHeight-liqPhaseHeight)
- grid2VOffset;
G4Tubs* grid_tube=new G4Tubs("grid_tube", 0.*cm, gridRadius,
0.5*gridHeight, 0.*deg, 360.*deg);
grid1_log = new G4LogicalVolume(grid_tube, grid_mat, "grid1_log");
grid1_phys=new G4PVPlacement(0, G4ThreeVector(0.*cm, 0.*cm, grid1VPosition),
"grid1_phys", grid1_log, liqPhase_phys, false, 0);
grid2_log = new G4LogicalVolume(grid_tube, grid_mat, "grid2_log");
grid2_phys=new G4PVPlacement(0, G4ThreeVector(0.*cm, 0.*cm, grid2VPosition),
"grid2_phys", grid2_log, liqPhase_phys, false, 0);
G4VisAttributes* grid_vat= new G4VisAttributes(red);
grid_vat->SetVisibility(true);
grid1_log->SetVisAttributes(grid_vat);
grid2_log->SetVisAttributes(grid_vat);
// alpha source holder ************************************************
G4double alphaHeight = 1.230*mm; // position where alpha starts
G4double recessHeight = 0.23*mm; // totals lead thickness = 1.23 mm
G4double alphaRadius = 0.65*mm;
G4double recessRadius = 0.40*mm;
G4double recessVOffset = 0.5*(alphaHeight - recessHeight);
// G4double recessVPosition = recessVOffset;
G4double alphaVOffset = grid1VOffset-0.5*alphaHeight;
G4double alphaVPosition = 0.5*liqPhaseHeight+(detectorHeight-liqPhaseHeight)
- alphaVOffset;
G4Tubs* alpha_tube = new G4Tubs("alpha_tube", 0.*cm, alphaRadius,
0.5*alphaHeight, 0.*deg, 360.*deg);
G4Tubs* recess_tube = new G4Tubs("recess_tube", 0.*cm, recessRadius,
0.5*recessHeight, 0.*deg, 360.*deg);
G4RotationMatrix rotMatrixAlpha;
rotMatrixAlpha.rotateY(0.0*deg);
G4SubtractionSolid* alpha_sol = new G4SubtractionSolid
("alpha_sol", alpha_tube, recess_tube, G4Transform3D
(rotMatrixAlpha, G4ThreeVector(0,0,recessVOffset)));
alpha_log = new G4LogicalVolume(alpha_sol, alpha_mat, "alpha_log");
alpha_phys = new G4PVPlacement(0, G4ThreeVector(0., 0., alphaVPosition),
"alpha_phys", alpha_log, liqPhase_phys, false, 0);
G4VisAttributes* alpha_vat= new G4VisAttributes(white);
alpha_vat->SetVisibility(true);
alpha_log ->SetVisAttributes(alpha_vat);
// alpha source HOLDER surface
G4OpticalSurface* OpAlphaSurface = new G4OpticalSurface("AlphaSurface",
unified, polished, dielectric_metal);
G4LogicalBorderSurface* AlphaSurface;
AlphaSurface = new G4LogicalBorderSurface
("Alpha", liqPhase_phys, alpha_phys, OpAlphaSurface);
G4double alpha_PP[NUM] = { 7.00*eV, 7.50*eV };
G4double alpha_REFL[NUM] = { 0.1, 0.1 };
G4MaterialPropertiesTable *alpha_mt = new G4MaterialPropertiesTable();
alpha_mt->AddProperty("REFLECTIVITY", alpha_PP, alpha_REFL, NUM);
OpAlphaSurface->SetMaterialPropertiesTable(alpha_mt);
// americium ***********************************************************
G4double americiumHeight = 20.*nanometer;
G4double americiumRadius = recessRadius;
G4double americiumVOffset = 0.5*(alphaHeight-americiumHeight)-recessHeight;
G4double americiumVPosition = americiumVOffset;
sourceZ = -0.5*(detectorHeight-liqPhaseHeight)+
alphaVPosition + americiumVPosition;
G4cout << "Calibration source: Z= " << sourceZ/mm << " mm" << G4endl;
G4Tubs* americium_tube = new G4Tubs("americium_tube", 0.*cm,
americiumRadius, 0.5*americiumHeight, 0.*deg, 360.*deg);
americium_log = new G4LogicalVolume(americium_tube, americium_mat,
"americium_log");
americium_phys = new G4PVPlacement(0, G4ThreeVector(0., 0.,
americiumVPosition),"americium_phys", americium_log, alpha_phys,false,0);
G4VisAttributes* americium_vat= new G4VisAttributes(cyan);
americium_vat->SetVisibility(true);
americium_vat->SetForceSolid(true);
americium_log->SetVisAttributes(americium_vat);
// Photomultiplier: ETL 9829 QA ****************************************
G4double pmtHeight = 12.0*cm;
G4double pmtRadius = 2.6*cm;
G4double pmtVOffset = 5.0*cm;
G4double pmtVPosition = -0.5*(liqPhaseHeight-pmtHeight)+pmtVOffset;
// G4double windowVOffset = 0.5*pmtHeight - 2.*pmtRadius*cos(30.0*deg);
// G4double windowVPosition = pmtVPosition + windowVOffset;
G4Sphere* pmt_window = new G4Sphere("pmt_sphere", 0.*cm, 2.*pmtRadius,
0.*deg, 360.*deg, 0.*deg, 30.0*deg);
G4Tubs* pmt_tube=new G4Tubs("pmt_tube", 0.*cm, pmtRadius, 0.5*pmtHeight,
0.*deg, 360.*deg);
G4RotationMatrix rotMatrixpmt; // unit rotation matrix
G4double anglepmt_Phys = 0.0*deg; // rotational angle
rotMatrixpmt.rotateY(anglepmt_Phys); // rot matrix
G4UnionSolid* pmt_sol = new G4UnionSolid("pmt_sol", pmt_tube, pmt_window,
G4Transform3D(rotMatrixpmt, G4ThreeVector(0,0,0.5*pmtHeight
-2.*pmtRadius*cos(30.0*deg))));
pmt_log = new G4LogicalVolume(pmt_sol, pmt_mat, "pmt_log");
pmt_phys = new G4PVPlacement(0,G4ThreeVector(0.*cm, 0.*cm, pmtVPosition),
"pmt_phys", pmt_log, liqPhase_phys, false, 0);
G4OpticalSurface* pmt_opsurf = new G4OpticalSurface("pmt_opsurf",
unified, polished, dielectric_dielectric);
G4LogicalBorderSurface* pmt_surf;
pmt_surf = new G4LogicalBorderSurface
("pmt_surf", liqPhase_phys, pmt_phys, pmt_opsurf);
G4VisAttributes* pmt_vat= new G4VisAttributes(blue);
pmt_vat->SetForceSolid(true);
pmt_vat->SetVisibility(true);
pmt_log->SetVisAttributes(pmt_vat);
// photocathode *******************************************************
// G4double phcathRadius = 22.5*mm;
// G4double phcathVOffset = 2.*pmtRadius*cos(30.*deg);
G4double phcathVPosition = 0.*cm;
G4Sphere* phcath_sol = new G4Sphere("phcath_sphere",
2.*pmtRadius-1.6*mm, 2.*pmtRadius-1.59*mm, 0.*deg, 360.*deg, 0.*deg,
27.0*deg);
phcath_log = new G4LogicalVolume(phcath_sol, phcath_mat, "phcath_log");
phcath_phys = new G4PVPlacement(0, G4ThreeVector(0., 0., phcathVPosition),
"phcath_phys", phcath_log, pmt_phys, false, 0);
G4OpticalSurface* phcath_opsurf = new G4OpticalSurface("phcath_opsurf",
unified, polished, dielectric_dielectric);
G4LogicalBorderSurface* phcath_surf;
phcath_surf = new G4LogicalBorderSurface
("phcath_surf", pmt_phys, phcath_phys, phcath_opsurf);
G4double phcath_PP[NUM] = { 7.00*eV, 7.50*eV };
G4double phcath_REFL[NUM] = { 0.0, 0.0};
G4MaterialPropertiesTable* phcath_mt = new G4MaterialPropertiesTable();
phcath_mt->AddProperty("REFLECTIVITY", phcath_PP, phcath_REFL, NUM);
phcath_opsurf->SetMaterialPropertiesTable(phcath_mt);
G4VisAttributes* phcath_vat= new G4VisAttributes(lblue);
phcath_vat->SetForceSolid(true);
phcath_vat->SetVisibility(true);
phcath_log->SetVisAttributes(phcath_vat);
// ......................................................................
// attach user limits ...................................................
G4double RoomTimeCut = 10000. * s;
world_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,RoomTimeCut));
lab_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,RoomTimeCut));
jacket_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,RoomTimeCut));
vacuum_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,RoomTimeCut));
vessel_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,RoomTimeCut));
detector_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
liqPhase_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
CuShield_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
ring_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
mirror_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
grid1_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
grid2_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
alpha_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
americium_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
pmt_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
phcath_log->SetUserLimits
(new G4UserLimits(theMaxStepSize,DBL_MAX,theMaxTimeCuts));
// ......................................................................
// sensitive detectors ..................................................
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String name="/DMXDet/LXeSD";
LXeSD = new DMXScintSD(name, this);
SDman->AddNewDetector(LXeSD);
liqPhase_log->SetSensitiveDetector(LXeSD);
SDman = G4SDManager::GetSDMpointer();
name="/DMXDet/pmtSD";
pmtSD = new DMXPmtSD(name, this);
SDman->AddNewDetector(pmtSD);
phcath_log->SetSensitiveDetector(pmtSD);
return world_phys;
}
@@ -0,0 +1,335 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// EventAction program
// --------------------------------------------------------------
#include "DMXEventAction.hh"
// note DMXPmtHit.hh and DMXScintHit.hh are included in DMXEventAction.hh
#include "DMXEventActionMessenger.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 "G4UnitsTable.hh"
#include "G4ios.hh"
#include "g4std/fstream"
#include "g4std/iomanip"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXEventAction::DMXEventAction() {
// create messenger
eventMessenger = new DMXEventActionMessenger(this);
// defaults for messenger
drawColsFlag = "standard";
drawTrksFlag = "all";
drawHitsFlag = 1;
savePmtFlag = 0;
saveHitsFlag = 1;
printModulo = 1;
// hits collections
scintillatorCollID = -1;
pmtCollID = -1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
DMXEventAction::~DMXEventAction() {
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXEventAction::BeginOfEventAction(const G4Event* evt) {
event_id = evt->GetEventID();
// print this information event by event (modulo n)
if (event_id%printModulo == 0)
G4cout << "\n---> Begin of event: " << event_id << G4endl;
// get ID for scintillator hits collection
if (scintillatorCollID==-1) {
G4SDManager *SDman = G4SDManager::GetSDMpointer();
scintillatorCollID = SDman->GetCollectionID("scintillatorCollection");
}
// get ID for pmt hits collection
if (pmtCollID==-1) {
G4SDManager *SDman = G4SDManager::GetSDMpointer();
pmtCollID = SDman->GetCollectionID("pmtCollection");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXEventAction::EndOfEventAction(const G4Event* evt) {
// check that both hits collections have been defined
if(scintillatorCollID<0||pmtCollID<0) return;
// address hits collections
DMXScintHitsCollection* SHC = NULL;
DMXPmtHitsCollection* PHC = NULL;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
if(HCE) {
SHC = (DMXScintHitsCollection*)(HCE->GetHC(scintillatorCollID));
PHC = (DMXPmtHitsCollection*)(HCE->GetHC(pmtCollID));
}
// event summary
totEnergy = 0.;
totEnergyGammas = 0.;
totEnergyNeutrons = 0.;
particleEnergy = 0.;
firstLXeHitTime = 0.;
aveTimePmtHits = 0.;
firstParticleName = "";
particleName = "";
// particle flags
gamma_ev = false;
neutron_ev = false;
positron_ev = false;
electron_ev = false;
proton_ev = false;
other_ev = false;
start_gamma = false;
start_neutron = false;
// scintillator hits
if(SHC) {
S_hits = SHC->entries();
for (G4int i=0; i<S_hits; i++) {
if(i==0) {
firstParticleName = (*SHC)[0]->GetParticle();
firstLXeHitTime = (*SHC)[0]->GetTime();
if (event_id%printModulo == 0)
G4cout << " First hit: " << firstParticleName << G4endl;
}
hitEnergy = (*SHC)[i]->GetEdep();
totEnergy += hitEnergy;
particleName = (*SHC)[i]->GetParticle();
particleEnergy = (*SHC)[i]->GetParticleEnergy();
if(particleName == "gamma") {
gamma_ev = true;
start_gamma = true;
start_neutron = false;
}
else if(particleName == "neutron")
neutron_ev = true;
else if(particleName == "e+")
positron_ev = true;
else if(particleName == "e-")
electron_ev = true;
else if(particleName == "proton")
proton_ev = true;
else {
other_ev = true;
start_gamma = false;
start_neutron = true;
}
if(start_gamma && !start_neutron)
totEnergyGammas += hitEnergy;
if(start_neutron && !start_gamma)
totEnergyNeutrons += hitEnergy;
}
if (event_id%printModulo == 0)
G4cout << " Total energy in LXe: "
<< G4BestUnit(totEnergy,"Energy") << G4endl;
}
// PMT hits
if(PHC) {
P_hits = PHC->entries();
// average time of PMT hits
for (G4int i=0; i<P_hits; i++)
aveTimePmtHits +=
((*PHC)[i]->GetTime() - firstLXeHitTime)
/ (G4double)P_hits;
if (event_id%printModulo == 0)
G4cout << " Average light collection time: "
<< G4BestUnit(aveTimePmtHits,"Time") << G4endl;
// write out (x,y,z) of PMT hits
if (savePmtFlag)
writePmtHitsToFile(PHC);
}
// write out event summary
if(saveHitsFlag)
writeScintHitsToFile();
// draw trajectories
if(drawColsFlag=="standard" && drawTrksFlag!="none")
drawTracks(evt);
// hits in PMT
if(drawHitsFlag && PHC)
PHC->DrawAllHits();
// print this event by event (modulo n)
if (event_id%printModulo == 0)
G4cout << "---> End of event: " << event_id << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXEventAction::writeScintHitsToFile(void) {
G4String filename="hits.out";
G4std::ofstream hitsfile(filename, G4std::ios::app);
if(!event_id) {
G4std::ofstream hitsfile(filename);
hitsfile <<"Evt Etot LXe LXeTime PMT PmtTime First Flags"
<< G4endl;
hitsfile <<"# MeV hits ns hits ns hit" << G4endl
<< G4endl;
}
if(hitsfile.is_open()) {
hitsfile << G4std::setiosflags(G4std::ios::fixed)
<< G4std::setprecision(4)
<< G4std::setiosflags(G4std::ios::left)
<< G4std::setw(6)
<< event_id << "\t"
<< totEnergy/MeV << "\t"
<< S_hits << "\t"
<< G4std::setiosflags(G4std::ios::scientific)
<< G4std::setprecision(2)
<< firstLXeHitTime/nanosecond << "\t"
<< P_hits << "\t"
<< G4std::setiosflags(G4std::ios::fixed)
<< G4std::setprecision(4)
<< aveTimePmtHits/nanosecond << "\t"
<< firstParticleName << "\t"
<< (gamma_ev ? "gamma " : "")
<< (neutron_ev ? "neutron " : "")
<< (positron_ev ? "positron " : "")
<< (electron_ev ? "electron " : "")
<< (other_ev ? "other " : "")
<< G4endl;
if (event_id%printModulo == 0)
G4cout << " Event summary in file " << filename << G4endl;
hitsfile.close();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXEventAction::writePmtHitsToFile(const DMXPmtHitsCollection* hits) {
G4String filename="pmt.out";
G4std::ofstream pmtfile(filename);
if(pmtfile.is_open()) {
pmtfile << "Hit# X, mm Y, mm Z, mm" << G4endl;
pmtfile << G4std::setiosflags(G4std::ios::fixed)
<< G4std::setprecision(3)
<< G4std::setiosflags(G4std::ios::left)
<< G4std::setw(6);
for (G4int i=0; i<P_hits; i++)
pmtfile << i << "\t"
<< ((*hits)[i]->GetPos()).x()/mm << "\t"
<< ((*hits)[i]->GetPos()).y()/mm << "\t"
<< ((*hits)[i]->GetPos()).z()/mm << G4endl;
pmtfile.close();
if (event_id%printModulo == 0)
G4cout << " PMT hits in " << filename << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void DMXEventAction::drawTracks(const G4Event* evt) {
if(G4VVisManager::GetConcreteInstance()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
G4TrajectoryContainer* trajContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if(trajContainer) n_trajectories = trajContainer->entries();
for (G4int i=0; i<n_trajectories; i++) {
G4Trajectory* trj = (G4Trajectory*)(*trajContainer)[i];
if (drawTrksFlag == "all")
trj->DrawTrajectory();
else if ((drawTrksFlag == "charged") && (trj->GetCharge() != 0.))
trj->DrawTrajectory();
else if ((drawTrksFlag == "noscint")
&& (trj->GetParticleName() != "opticalphoton"))
trj->DrawTrajectory();
}
// G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
}
@@ -0,0 +1,155 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// EventActionMessenger program
// --------------------------------------------------------------
#include "DMXEventActionMessenger.hh"
#include "DMXEventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcommand.hh"
#include "globals.hh"
DMXEventActionMessenger::DMXEventActionMessenger(DMXEventAction* EvAct)
:eventAction(EvAct){
// saving event information
dmxDirectory = new G4UIdirectory("/dmx/");
dmxDirectory->SetGuidance("DM Example commands.");
SavePmtCmd = new G4UIcmdWithABool("/dmx/savePmt",this);
SavePmtCmd->SetGuidance("Set flag to save (x,y,z) of hits in PMT");
SavePmtCmd->SetGuidance("into file 'pmt.out'");
SavePmtCmd->SetGuidance("Default = false");
SavePmtCmd->SetParameterName("savePmtFlag", false);
SaveHitsCmd = new G4UIcmdWithABool("/dmx/saveHits",this);
SaveHitsCmd->SetGuidance("Set flag to save hits in each run");
SaveHitsCmd->SetGuidance("into file 'hits.out'");
SaveHitsCmd->SetGuidance("Default = true");
SaveHitsCmd->SetParameterName("saveHitsFlag", false);
// drawing event
drawDirectory = new G4UIdirectory("/dmx/draw/");
drawDirectory->SetGuidance("DM Example draw commands.");
DrawColsCmd = new G4UIcmdWithAString("/dmx/draw/drawColours",this);
DrawColsCmd->SetGuidance("Tracks drawn by Event (standard colours) or by Step (custom colours)");
DrawColsCmd->SetGuidance(" Choice : custom, standard(default)");
DrawColsCmd->SetParameterName("drawColsFlag", false);
DrawColsCmd->SetCandidates("custom standard");
DrawColsCmd->AvailableForStates(Idle);
DrawTrksCmd = new G4UIcmdWithAString("/dmx/draw/drawTracks",this);
DrawTrksCmd->SetGuidance("Draw the tracks in the event");
DrawTrksCmd->SetGuidance(" Choice : none, charged, noscint, all(default)");
DrawTrksCmd->SetParameterName("drawTrksFlag", false);
DrawTrksCmd->SetCandidates("none charged noscint all");
DrawTrksCmd->AvailableForStates(Idle);
DrawHitsCmd = new G4UIcmdWithABool("/dmx/draw/drawHits",this);
DrawHitsCmd->SetGuidance("Set flag to draw hits in PMT.");
DrawHitsCmd->SetGuidance("Default = true");
DrawHitsCmd->SetParameterName("drawHitsFlag", false);
DrawHitsCmd->SetDefaultValue(true);
PrintCmd = new G4UIcmdWithAnInteger("/dmx/printModulo",this);
PrintCmd->SetGuidance("Print events modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
PrintCmd->AvailableForStates(Idle);
}
DMXEventActionMessenger::~DMXEventActionMessenger() {
delete SavePmtCmd;
delete SaveHitsCmd;
delete dmxDirectory;
delete DrawColsCmd;
delete DrawTrksCmd;
delete DrawHitsCmd;
delete drawDirectory;
delete PrintCmd;
}
void DMXEventActionMessenger::SetNewValue
(G4UIcommand* command, G4String newValue) {
if(command == DrawColsCmd)
eventAction->SetDrawColsFlag(newValue);
if(command == DrawTrksCmd)
eventAction->SetDrawTrksFlag(newValue);
if(command == DrawHitsCmd) {
G4int vl;
const char* t = newValue;
G4std::istrstream is((char*)t);
is >> vl;
eventAction->SetDrawHitsFlag(vl!=0);
}
if(command == SavePmtCmd) {
G4int vl;
const char* t = newValue;
G4std::istrstream is((char*)t);
is >> vl;
eventAction->SetSavePmtFlag(vl!=0);
}
if(command == SaveHitsCmd) {
G4int vl;
const char* t = newValue;
G4std::istrstream is((char*)t);
is >> vl;
eventAction->SetSaveHitsFlag(vl!=0);
}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// MaxTimeCuts program
// --------------------------------------------------------------
#include "DMXMaxTimeCuts.hh"
#include "G4Step.hh"
#include "G4UserLimits.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
DMXMaxTimeCuts::DMXMaxTimeCuts(const G4String& aName)
: DMXSpecialCuts(aName)
{
if (verboseLevel>1) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
SetProcessType(fUserDefined);
}
DMXMaxTimeCuts::~DMXMaxTimeCuts()
{}
DMXMaxTimeCuts::DMXMaxTimeCuts(DMXMaxTimeCuts& right)
{}
G4double DMXMaxTimeCuts::PostStepGetPhysicalInteractionLength(
const G4Track& aTrack,
G4double ,
G4ForceCondition* condition
)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double proposedStep = DBL_MAX;
// get the pointer to UserLimits
G4UserLimits* pUserLimits = aTrack.GetVolume()->GetLogicalVolume()->GetUserLimits();
const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
// can apply cuts for specific particles - use if(particleDef):
// G4ParticleDefinition* aParticleDef = aTrack.GetDefinition();
if (pUserLimits) {
G4double temp = DBL_MAX;
//max time limit
G4double dTime= (pUserLimits->GetUserMaxTime(aTrack) - aTrack.GetGlobalTime());
if (dTime < 0. ) {
proposedStep = 0.;
} else {
G4double beta = (aParticle->GetTotalMomentum())/(aParticle->GetTotalEnergy());
temp = beta*c_light*dTime;
if (proposedStep > temp) proposedStep = temp;
}
}
return proposedStep;
}
@@ -0,0 +1,426 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * 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 - Underground Dark Matter Detector Advanced Example
//
// For information related to this code contact: Alex Howard
// e-mail: a.s.howard@ic.ac.uk
// --------------------------------------------------------------
// Comments
//
// Underground Advanced
// by A. Howard and H. Araujo
// (27th November 2001)
//
// ParticleSource program
// --------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
// This particle source is a shortened version of G4GeneralParticleSource by
// C Ferguson, F Lei & P Truscott (University of Southampton / DERA), with
// some minor modifications.
//////////////////////////////////////////////////////////////////////////////
#include "DMXParticleSource.hh"
#include "G4PrimaryParticle.hh"
#include "G4Event.hh"
#include "Randomize.hh"
#include <math.h>
#include "G4TransportationManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4IonTable.hh"
#include "G4Ions.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
DMXParticleSource::DMXParticleSource() {
NumberOfParticlesToBeGenerated = 1;
particle_definition = NULL;
G4ThreeVector zero(0., 0., 0.);
particle_momentum_direction = G4ParticleMomentum(1., 0., 0.);
particle_energy = 1.0*MeV;
particle_position = zero;
particle_time = 0.0;
particle_polarization = zero;
particle_charge = 0.0;
SourcePosType = "Volume";
Shape = "NULL";
halfz = 0.;
Radius = 0.;
CentreCoords = zero;
Confine = false;
VolName = "NULL";
AngDistType = "iso";
MinTheta = 0.;
MaxTheta = pi;
MinPhi = 0.;
MaxPhi = twopi;
EnergyDisType = "Mono";
MonoEnergy = 1*MeV;
verbosityLevel = 0;
theMessenger = new DMXParticleSourceMessenger(this);
gNavigator = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking();
}
DMXParticleSource::~DMXParticleSource()
{
delete theMessenger;
}
void DMXParticleSource::SetPosDisType(G4String PosType)
{
SourcePosType = PosType;
}
void DMXParticleSource::SetPosDisShape(G4String shapeType)
{
Shape = shapeType;
}
void DMXParticleSource::SetCentreCoords(G4ThreeVector coordsOfCentre)
{
CentreCoords = coordsOfCentre;
}
void DMXParticleSource::SetHalfZ(G4double zhalf)
{
halfz = zhalf;
}
void DMXParticleSource::SetRadius(G4double rad)
{
Radius = rad;
}
void DMXParticleSource::ConfineSourceToVolume(G4String Vname)
{
VolName = Vname;
if(verbosityLevel == 2) G4cout << VolName << G4endl;
// checks if selected volume exists
G4VPhysicalVolume *tempPV = NULL;
G4PhysicalVolumeStore *PVStore = 0;
G4String theRequiredVolumeName = VolName;
PVStore = G4PhysicalVolumeStore::GetInstance();
G4int i = 0;
G4bool found = false;
if(verbosityLevel == 2) G4cout << PVStore->size() << G4endl;
// recasting required since PVStore->size() is actually a signed int...
while (!found && i<(G4int)PVStore->size())
{
tempPV = (*PVStore)[i];
found = tempPV->GetName() == theRequiredVolumeName;
if(verbosityLevel == 2)
G4cout << i << " " << " " << tempPV->GetName()
<< " " << theRequiredVolumeName << " " << found << G4endl;
if (!found)
{i++;}
}
// found = true then the volume exists else it doesnt.
if(found == true) {
if(verbosityLevel >= 1)
G4cout << "Volume " << VolName << " exists" << G4endl;
Confine = true;
}
else if(VolName=="NULL")
Confine = false;
else {
G4cout << " **** Error: Volume does not exist **** " << G4endl;
G4cout << " Ignoring confine condition" << G4endl;
VolName = "NULL";
Confine = false;
}
}
void DMXParticleSource::SetAngDistType(G4String atype)
{
AngDistType = atype;
}
void DMXParticleSource::GeneratePointSource()
{
// Generates Points given the point source.
if(SourcePosType == "Point")
particle_position = CentreCoords;
else
if(verbosityLevel >= 1)
G4cout << "Error SourcePosType is not set to Point" << G4endl;
}
void DMXParticleSource::GeneratePointsInVolume()
{
G4ThreeVector RandPos;
G4double x=0., y=0., z=0.;
if(SourcePosType != "Volume" && verbosityLevel >= 1)
G4cout << "Error SourcePosType not Volume" << G4endl;
if(Shape == "Sphere") {
x = Radius*2.;
y = Radius*2.;
z = Radius*2.;
while(((x*x)+(y*y)+(z*z)) > (Radius*Radius)) {
x = G4UniformRand();
y = G4UniformRand();
z = G4UniformRand();
x = (x*2.*Radius) - Radius;
y = (y*2.*Radius) - Radius;
z = (z*2.*Radius) - Radius;
}
}
else if(Shape == "Cylinder") {
x = Radius*2.;
y = Radius*2.;
while(((x*x)+(y*y)) > (Radius*Radius)) {
x = G4UniformRand();
y = G4UniformRand();
z = G4UniformRand();
x = (x*2.*Radius) - Radius;
y = (y*2.*Radius) - Radius;
z = (z*2.*halfz) - halfz;
}
}
else
G4cout << "Error: Volume Shape Does Not Exist" << G4endl;
RandPos.setX(x);
RandPos.setY(y);
RandPos.setZ(z);
particle_position = CentreCoords + RandPos;
}
G4bool DMXParticleSource::IsSourceConfined()
{
// Method to check point is within the volume specified
if(Confine == false)
G4cout << "Error: Confine is false" << G4endl;
G4ThreeVector null(0.,0.,0.);
G4ThreeVector *ptr;
ptr = &null;
// Check particle_position is within VolName
G4VPhysicalVolume *theVolume;
theVolume=gNavigator->LocateGlobalPointAndSetup(particle_position,ptr,true);
G4String theVolName = theVolume->GetName();
if(theVolName == VolName) {
if(verbosityLevel >= 1)
G4cout << "Particle is in volume " << VolName << G4endl;
return(true);
}
else
return(false);
}
void DMXParticleSource::SetParticleMomentumDirection
(G4ParticleMomentum aDirection) {
particle_momentum_direction = aDirection.unit();
}
void DMXParticleSource::GenerateIsotropicFlux()
{
G4double rndm, rndm2;
G4double px, py, pz;
G4double sintheta, sinphi, costheta, cosphi;
rndm = G4UniformRand();
costheta = cos(MinTheta) - rndm * (cos(MinTheta) - cos(MaxTheta));
sintheta = sqrt(1. - costheta*costheta);
rndm2 = G4UniformRand();
Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
sinphi = sin(Phi);
cosphi = cos(Phi);
px = -sintheta * cosphi;
py = -sintheta * sinphi;
pz = -costheta;
G4double ResMag = sqrt((px*px) + (py*py) + (pz*pz));
px = px/ResMag;
py = py/ResMag;
pz = pz/ResMag;
particle_momentum_direction.setX(px);
particle_momentum_direction.setY(py);
particle_momentum_direction.setZ(pz);
// particle_momentum_direction now holds unit momentum vector.
if(verbosityLevel >= 2)
G4cout << "Generating isotropic vector: " << particle_momentum_direction << G4endl;
}
void DMXParticleSource::SetEnergyDisType(G4String DisType)
{
EnergyDisType = DisType;
}
void DMXParticleSource::SetMonoEnergy(G4double menergy)
{
MonoEnergy = menergy;
}
void DMXParticleSource::GenerateMonoEnergetic()
{
particle_energy = MonoEnergy;
}
void DMXParticleSource::SetVerbosity(int vL)
{
verbosityLevel = vL;
G4cout << "Verbosity Set to: " << verbosityLevel << G4endl;
}
void DMXParticleSource::SetParticleDefinition
(G4ParticleDefinition* aParticleDefinition)
{
particle_definition = aParticleDefinition;
particle_charge = particle_definition->GetPDGCharge();
}
void DMXParticleSource::GeneratePrimaryVertex(G4Event *evt)
{
if(particle_definition==NULL) {
G4cout << "No particle has been defined!" << G4endl;
return;
}
// Position
G4bool srcconf = false;
G4int LoopCount = 0;
while(srcconf == false) {
if(SourcePosType == "Point")
GeneratePointSource();
else if(SourcePosType == "Volume")
GeneratePointsInVolume();
else {
G4cout << "Error: SourcePosType undefined" << G4endl;
G4cout << "Generating point source" << G4endl;
GeneratePointSource();
}
if(Confine == true) {
srcconf = IsSourceConfined();
// if source in confined srcconf = true terminating the loop
// if source isnt confined srcconf = false and loop continues
}
else if(Confine == false)
srcconf = true; // terminate loop
LoopCount++;
if(LoopCount == 100000) {
G4cout << "*************************************" << G4endl;
G4cout << "LoopCount = 100000" << G4endl;
G4cout << "Either the source distribution >> confinement" << G4endl;
G4cout << "or any confining volume may not overlap with" << G4endl;
G4cout << "the source distribution or any confining volumes" << G4endl;
G4cout << "may not exist"<< G4endl;
G4cout << "If you have set confine then this will be ignored" <<G4endl;
G4cout << "for this event." << G4endl;
G4cout << "*************************************" << G4endl;
srcconf = true; //Avoids an infinite loop
}
}
// Angular stuff
if(AngDistType == "iso")
GenerateIsotropicFlux();
else if(AngDistType == "direction")
SetParticleMomentumDirection(particle_momentum_direction);
else
G4cout << "Error: AngDistType has unusual value" << G4endl;
// Energy stuff
if(EnergyDisType == "Mono")
GenerateMonoEnergetic();
else
G4cout << "Error: EnergyDisType has unusual value" << G4endl;
// create a new vertex
G4PrimaryVertex* vertex =
new G4PrimaryVertex(particle_position,particle_time);
if(verbosityLevel >= 2)
G4cout << "Creating primaries and assigning to vertex" << G4endl;
// create new primaries and set them to the vertex
G4double mass = particle_definition->GetPDGMass();
G4double energy = particle_energy + mass;
G4double pmom = sqrt(energy*energy-mass*mass);
G4double px = pmom*particle_momentum_direction.x();
G4double py = pmom*particle_momentum_direction.y();
G4double pz = pmom*particle_momentum_direction.z();
if(verbosityLevel >= 1){
G4cout << "Particle name: "
<< particle_definition->GetParticleName() << G4endl;
G4cout << " Energy: "<<particle_energy << G4endl;
G4cout << " Position: "<<particle_position<< G4endl;
G4cout << " Direction: "<<particle_momentum_direction << G4endl;
G4cout << " NumberOfParticlesToBeGenerated: "
<< NumberOfParticlesToBeGenerated << G4endl;
}
for( G4int i=0; i<NumberOfParticlesToBeGenerated; i++ ) {
G4PrimaryParticle* particle =
new G4PrimaryParticle(particle_definition,px,py,pz);
particle->SetMass( mass );
particle->SetCharge( particle_charge );
particle->SetPolarization(particle_polarization.x(),
particle_polarization.y(),
particle_polarization.z());
vertex->SetPrimary( particle );
}
evt->AddPrimaryVertex( vertex );
if(verbosityLevel > 1)
G4cout << " Primary Vetex generated "<< G4endl;
}

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