Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,308 @@
|
||||
//$Id$
|
||||
|
||||
///\file "B5/.README"
|
||||
///\brief Example B5 README page
|
||||
|
||||
/*! \page ExampleB5 Example B5
|
||||
|
||||
Example B5 implements a double-arm spectrometer with wire chambers,
|
||||
hodoscopes and calorimeters. Event simulation and collection are
|
||||
enabled, as well as event display and analysis.
|
||||
|
||||
|
||||
\section B5_s1 GEOMETRY
|
||||
|
||||
The spectrometer consists of two detector arms
|
||||
(see B5DetectorConstruction). One arm provides
|
||||
position and timing information of the incident particle while the
|
||||
other collects position, timing and energy information of the particle
|
||||
after it has been deflected by a magnetic field centered at the
|
||||
spectrometer pivot point.
|
||||
|
||||
- First arm: box filled with air, also containing:
|
||||
- 1 hodoscope (15 vertical strips of plastic scintillator)
|
||||
- 1 drift chamber (5 horizontal argon gas layers with a
|
||||
"virtual wire" at the center of each layer)
|
||||
|
||||
- Second arm: box filled with air, also containing:
|
||||
- 1 hodoscope (25 vertical strips of plastic scintillator)
|
||||
- 1 drift chamber (5 horizontal argon gas layers with a
|
||||
"virtual wire" at the center of each layer)
|
||||
- 1 electromagnetic calorimeter:
|
||||
a box sub-divided along x,y and z
|
||||
axes into cells of CsI
|
||||
- 1 hadronic calorimeter:
|
||||
a box sub-divided along x,y, and z axes
|
||||
into cells of lead, with a layer of
|
||||
plastic scintillator placed at the center
|
||||
of each cell
|
||||
|
||||
- Magnetic field region: air-filled cylinder which contains
|
||||
the field (see B5MagneticField)
|
||||
|
||||
The maximum step limit in the magnetic field region is also set
|
||||
via the G4UserLimits class in a similar way as in Example B2
|
||||
(see \ref B2_s6 in B2 example documentation).
|
||||
|
||||
The rotation angle of the second arm and the magnetic field value
|
||||
can be set via the interactive commands defined using the G4GenericMessenger
|
||||
class.
|
||||
|
||||
\section B5_s2 PHYSICS
|
||||
|
||||
This example uses the reference hadronic physics list, FTFP_BERT,
|
||||
and also adds the G4StepLimiter process.
|
||||
|
||||
\section B5_s3 ACTION INITALIZATION
|
||||
|
||||
B5ActionInitialization class
|
||||
instantiates and registers to Geant4 kernel all user action classes.
|
||||
|
||||
While in sequential mode the action classes are instatiated just once,
|
||||
via invoking the method:
|
||||
B5ActionInitialization::Build()
|
||||
in multi-threading mode the same method is invoked for each thread worker
|
||||
and so all user action classes are defined thread-local.
|
||||
|
||||
A run action class is instantiated both thread-local
|
||||
and global that's why its instance is created also in the method
|
||||
B5ActionInitialization::BuildForMaster()
|
||||
which is invoked only in multi-threading mode.
|
||||
|
||||
\section B5_s4 PRIMARY GENERATOR
|
||||
|
||||
The primary generator action class employs the G4ParticleGun.
|
||||
The primary kinematics consists of a single particle which is
|
||||
is sent in the direction of the first spectrometer arm.
|
||||
|
||||
The type of the particle and its several properties can be changed
|
||||
via the G4 built-in commands of the G4ParticleGun class or
|
||||
this example command defined using the G4GenericMessenger class.
|
||||
|
||||
|
||||
\section B5_s5 EVENT
|
||||
|
||||
An event consists of the generation of a single particle which is
|
||||
transported through the first spectrometer arm. Here, a scintillator
|
||||
hodoscope records the reference time of the particle before it passes
|
||||
through a drift chamber where the particle position is measured.
|
||||
Momentum analysis is performed as the particle passes through a magnetic
|
||||
field at the spectrometer pivot and then into the second spectrometer
|
||||
arm. In the second arm, the particle passes through another hodoscope
|
||||
and drift chamber before interacting in the electromagnetic calorimeter.
|
||||
Here it is likely that particles will induce electromagnetic showers.
|
||||
The shower energy is recorded in a three-dimensional array of CsI
|
||||
crystals. Secondary particles from the shower, as well as primary
|
||||
particles which do not interact in the CsI crystals, pass into the
|
||||
hadronic calorimeter. Here, the remaining energy is collected in a
|
||||
three-dimensional array of scintillator-lead sandwiches.
|
||||
|
||||
Several aspects of the event may be changed interactively by the user:
|
||||
- angle of the second spectrometer arm
|
||||
- strength of magnetic field
|
||||
- initial particle type
|
||||
- initial momentum and angle
|
||||
- momentum and angle spreads
|
||||
- type of initial particle may be randomized
|
||||
|
||||
The initial particle type can be changed using the G4ParticleGun command:
|
||||
\verbatim
|
||||
/gun/particle particleName
|
||||
\endverbatim
|
||||
|
||||
The UI commands specific to this example are available in /B5 command
|
||||
directory:
|
||||
\verbatim
|
||||
/B5/detector/armAngle angle unit
|
||||
/B5/field/value field unit
|
||||
/B5/generator/momentum value unit
|
||||
/B5/generator/sigmaMomentum value unit
|
||||
/B5/generator/sigmaAngle value unit
|
||||
/B5/generator/randomizePrimary [true|false]
|
||||
\endverbatim
|
||||
|
||||
They are implemented in
|
||||
- B5DetectorConstruction::DefineCommands(),
|
||||
- B5MagneticField::DefineCommands() and
|
||||
- B5PrimaryGeneratorAction::DefineCommands() methods
|
||||
using G4GenericMessenger class.
|
||||
|
||||
In first execution of B5EventAction::BeginOfEventAction()
|
||||
the hits collections identifiers are saved in data members of the class
|
||||
and used in B5EventAction::EndOfEventAction() for accessing
|
||||
the hists collections and filling the accounted information in defined
|
||||
histograms and ntuples and printing its summary in a log file.
|
||||
The frequency of printing can be tuned with the built-in command
|
||||
\verbatim
|
||||
/run/printProgress frequency
|
||||
\endverbatim
|
||||
|
||||
\section B5_s6 DETECTOR RESPONSE
|
||||
|
||||
All the information required to simulate and analyze an event is
|
||||
recorded in hits. This information is recorded in the following
|
||||
sensitive detectors:
|
||||
|
||||
- hodoscope:
|
||||
- particle time
|
||||
- strip ID, position and rotation
|
||||
- see B5HodoscopeSD, B5HodoscopeHit
|
||||
|
||||
- drift chamber:
|
||||
- particle time
|
||||
- particle position
|
||||
- layer ID
|
||||
- see B5DriftChamberSD, B5DriftChamberHit classes
|
||||
|
||||
- electromagnetic calorimeter:
|
||||
- energy deposited in cell
|
||||
- cell ID, position and rotation
|
||||
- see B5EmCalorimeterSD, B5EmCalorimeterHit classes
|
||||
|
||||
- hadronic calorimeter:
|
||||
- energy deposited in cell
|
||||
- cell column ID and row ID, position and rotation
|
||||
- see B5HadCalorimeterSD, B5HadCalorimeterHit classes
|
||||
|
||||
The hit classes include methods GetAttDefs and CreateAttValues to define
|
||||
and then fill extra "HepRep-style" Attributes that the visualization system
|
||||
can use to present extra information about the hits.
|
||||
For example, if you pick a B5HadCalorimeterHit in OpenGL or a HepRep viewer,
|
||||
you will be shown the hit's "Hit Type", "Column ID", "Row ID",
|
||||
"Energy Deposited" and "Position".
|
||||
These attributes are essentially arbitrary extra pieces of information
|
||||
(integers, doubles or strings) that are carried through the visualization.
|
||||
Each attribute is defined once in G4AttDef object and then is filled for
|
||||
each hit in a G4AttValue object.
|
||||
These attributes can also be used by commands to filter which hits are drawn:
|
||||
/vis/filtering/hits/drawByAttribute
|
||||
Detector Geometry and trajectories also carry HepRep-style attributes,
|
||||
but these are filled automatically in the base classes.
|
||||
HepRep is further described at the
|
||||
<a href="http://www.slac.stanford.edu/~perl/heprep/"> HepRep Home Page </a>
|
||||
|
||||
\section B5_s7 ANALYSIS
|
||||
|
||||
The analysis tools are used to accumulate statistics.
|
||||
Histograms and an ntuple are created in B5RunAction::B5RunAction()
|
||||
constructor for the following quantities:
|
||||
|
||||
- 1D histograms:
|
||||
- Number of hits in Chamber 1
|
||||
- Number of hits in Chamber 2
|
||||
|
||||
- 2D histograms:
|
||||
- Drift Chamber 1 X vs Y positions
|
||||
- Drift Chamber 2 X vs Y positions
|
||||
- Total energy deposit vs time of flight
|
||||
|
||||
- Ntuple:
|
||||
- Number of hits in Chamber 1
|
||||
- Number of hits in Chamber 2
|
||||
- Total energy deposit in EM calorimeter
|
||||
- Total energy deposit in Hadronic calorimeter
|
||||
- Time of flight in Hodoscope 1
|
||||
- Time of flight in Hodoscope 2
|
||||
|
||||
The histograms and ntuple are saved in the output file in a format
|
||||
according to a technology selected in B5Analysis.hh.
|
||||
|
||||
When running in multi-threading mode, the histograms accumulated on threads are
|
||||
automatically merged in a single output file, while the ntuple is written
|
||||
in files per thread.
|
||||
|
||||
<hr>
|
||||
|
||||
The following paragraphs are common to all basic examples
|
||||
|
||||
\section B5_A VISUALISATION
|
||||
|
||||
The visualization manager is set via the G4VisExecutive class
|
||||
in the main () function in exampleB5.cc.
|
||||
The initialisation of the drawing is done via a set of /vis/ commands
|
||||
in the macro vis.mac. This macro is automatically read from
|
||||
the main function when the example is used in interactive running mode.
|
||||
|
||||
By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
|
||||
The user can change the initial viewer by commenting out this line
|
||||
and instead uncommenting one of the other /vis/open statements, such as
|
||||
HepRepFile or DAWNFILE (which produce files that can be viewed with the
|
||||
HepRApp and DAWN viewers, respectively). Note that one can always
|
||||
open new viewers at any time from the command line. For example, if
|
||||
you already have a view in, say, an OpenGL window with a name
|
||||
"viewer-0", then
|
||||
\verbatim
|
||||
/vis/open DAWNFILE
|
||||
\endverbatim
|
||||
then to get the same view
|
||||
\verbatim
|
||||
/vis/viewer/copyView viewer-0
|
||||
\endverbatim
|
||||
or to get the same view *plus* scene-modifications
|
||||
\verbatim
|
||||
/vis/viewer/set/all viewer-0
|
||||
\endverbatim
|
||||
then to see the result
|
||||
\verbatim
|
||||
/vis/viewer/flush
|
||||
\endverbatim
|
||||
|
||||
The DAWNFILE, HepRepFile drivers are always available
|
||||
(since they require no external libraries), but the OGL driver requires
|
||||
that the Geant4 libraries have been built with the OpenGL option.
|
||||
|
||||
vis.mac has additional commands that demonstrate additional functionality
|
||||
of the vis system, such as displaying text, axes, scales, date, logo and
|
||||
shows how to change viewpoint and style.
|
||||
To see even more commands use help or ls or browse the available UI commands
|
||||
in the Application Developers Guide.
|
||||
|
||||
For more information on visualization, including information on how to
|
||||
install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
|
||||
for example,\n
|
||||
- <a href="http://geant4.slac.stanford.edu/Presentations/vis/G4OpenGLTutorial/G4OpenGLTutorial.html">
|
||||
OpenGL Tutorial </a>
|
||||
- <a href="http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html">
|
||||
DAWN Tutorial </a>
|
||||
- <a href="http://geant4.slac.stanford.edu/Presentations/vis/G4HepRAppTutorial/G4HepRAppTutorial.html">
|
||||
HepRApp Tutorial </a>
|
||||
|
||||
The tracks are automatically drawn at the end of each event, accumulated
|
||||
for all events and erased at the beginning of the next run.
|
||||
|
||||
|
||||
\section B5_B USER INTERFACES
|
||||
|
||||
The user command interface is set via the G4UIExecutive class
|
||||
in the main() function in exampleB5.cc
|
||||
The selection of the user command interface is then done automatically
|
||||
according to the Geant4 configuration or it can be done explicitly via
|
||||
the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
|
||||
|
||||
\section B5_C HOW TO RUN
|
||||
|
||||
- Execute exampleB5 in the 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% exampleB5
|
||||
and type in the commands from run1.mac line by line:
|
||||
Idle> /control/verbose 2
|
||||
Idle> /tracking/verbose 1
|
||||
Idle> /run/beamOn 10
|
||||
Idle> ...
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
or
|
||||
\verbatim
|
||||
Idle> /control/execute run1.mac
|
||||
....
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
- Execute exampleB5 in the 'batch' mode from macro files
|
||||
(without visualization)
|
||||
\verbatim
|
||||
% exampleB5 run2.mac
|
||||
% exampleB5 exampleB5.in > exampleB5.out
|
||||
\endverbatim
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
project(B5)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find Geant4 package, activating all available UI and Vis drivers by default
|
||||
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
|
||||
# to build a batch mode only executable
|
||||
#
|
||||
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
|
||||
if(WITH_GEANT4_UIVIS)
|
||||
find_package(Geant4 REQUIRED ui_all vis_all)
|
||||
else()
|
||||
find_package(Geant4 REQUIRED)
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup Geant4 include directories and compile definitions
|
||||
# Setup include directory for this project
|
||||
#
|
||||
include(${Geant4_USE_FILE})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate sources and headers for this project
|
||||
# NB: headers are included so they will show up in IDEs
|
||||
#
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${Geant4_INCLUDE_DIR})
|
||||
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
|
||||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the executable, and link it to the Geant4 libraries
|
||||
#
|
||||
add_executable(exampleB5 exampleB5.cc ${sources} ${headers})
|
||||
target_link_libraries(exampleB5 ${Geant4_LIBRARIES})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build B5. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(B5_SCRIPTS
|
||||
exampleB5.in
|
||||
exampleB5.out
|
||||
icons.mac
|
||||
gui.mac
|
||||
run.png
|
||||
init.mac
|
||||
init_vis.mac
|
||||
run1.mac
|
||||
run2.mac
|
||||
vis.mac
|
||||
)
|
||||
|
||||
foreach(_script ${B5_SCRIPTS})
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/${_script}
|
||||
${PROJECT_BINARY_DIR}/${_script}
|
||||
COPYONLY
|
||||
)
|
||||
endforeach()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add program to the project targets
|
||||
# (this avoids the need of typing the program name after make)
|
||||
#
|
||||
add_custom_target(B5 DEPENDS exampleB5)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
install(TARGETS exampleB5 DESTINATION bin)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# $Id: GNUmakefile 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for examples module
|
||||
# --------------------------------------------------------------
|
||||
|
||||
name := exampleB5
|
||||
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,293 @@
|
||||
$Id: History 78054 2013-12-03 08:26:31Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Example B5 History file
|
||||
------------------------
|
||||
This file should be used by the G4 example coordinator to briefly
|
||||
summarize all major modifications introduced in the code and keep
|
||||
track of all tags.
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
02 December 2013 Ivana Hrivnacova
|
||||
- Fixed gui.mac:
|
||||
corrected wireframe parameter, removed run2.mac from gui
|
||||
|
||||
28 November 2013 Ivana Hrivnacova (exampleB5-V09-06-11)
|
||||
- Added macros for GUI
|
||||
- Fixed range for selection rundomnly particle type
|
||||
- Improved documentation
|
||||
|
||||
26 November 2013 Makoto Asai (exampleB5-V09-06-10)
|
||||
- Changed the way G4GenericMessenger declares UI commands that take units.
|
||||
|
||||
26 November 2013 Ivana Hrivnacova (exampleB5-V09-06-09)
|
||||
- Fixed deleting magnetic field and its manager with use of G4AutoDelete
|
||||
utility
|
||||
|
||||
22 November 2013 Joseph Perl (exampleB5-V09-06-08)
|
||||
- Added paragraph about HepRep attributes in README
|
||||
|
||||
22 November 2013 Ivana Hrivnacova
|
||||
- Changed step limit size to 1 m (more sutable for demonstration
|
||||
of the smooth trajectory visualization option)
|
||||
- Added paragraph about this limit in README
|
||||
|
||||
15 November 2013 Ivana Hrivnacova (exampleB5-V09-06-07)
|
||||
- Changed magnetic tube material to G4_Air (was G4_Galactic)
|
||||
Resolves issue of low-energy electrons spinning forever in vacuum.
|
||||
(By John Apostolakis.)
|
||||
|
||||
02 November 2013 Ivana Hrivnacova (exampleB5-V09-06-06)
|
||||
- New tag for testing, no changes in the example
|
||||
|
||||
31 October 2013 Ivana Hrivnacova (exampleB5-V09-06-05)
|
||||
- SetDefaultValue arguments passed in generic messenger commands
|
||||
must be of G4Stringg type.
|
||||
(This fixes compilation warnings.)
|
||||
|
||||
30 October 2013 Ivana Hrivnacova (exampleB5-V09-06-04)
|
||||
- Replaced messenger classes with use of G4GenericMessenger
|
||||
- Removed SetNumberOfThreads from main
|
||||
- Updated macros and README
|
||||
|
||||
10 October 2013 Ivana Hrivnacova (exampleB5-V09-06-03)
|
||||
- Fixed compiler warning from B5EventAction
|
||||
- Added class descriptions
|
||||
- Code clean-up
|
||||
|
||||
08 October 2013 Ivana Hrivnacova (exampleB5-V09-06-02)
|
||||
- Migration to MT
|
||||
- Removed Edep vs Tof histogram (remained empty),
|
||||
adjusted min max in Chamber1[2] XY histograms
|
||||
- Less verbose output from exampleB5.in and run2.mac
|
||||
- Code clean-up
|
||||
|
||||
03 October 2013 Ivana Hrivnacova (exampleB5-V09-06-01)
|
||||
- A new tag co-working with a fix in ctest.
|
||||
|
||||
03 October 2013 Ivana Hrivnacova (exampleB5-V09-06-00)
|
||||
- The first tagged version of the new B5 example created from
|
||||
extended/analysis/A01.
|
||||
|
||||
05 June 2013 Ivana Hrivnacova (exampleA01-V09-06-04)
|
||||
- Updated .README for changes in README
|
||||
- Applied coding guidelines (data members initialization)
|
||||
- Removed unnecessary inline keyword
|
||||
- Fixed compilation with G4ANALYSIS_USE
|
||||
|
||||
28 May 2013 Joseph Perl (exampleA01-V09-06-03)
|
||||
- Update README
|
||||
|
||||
28 May 2013 Joseph Perl (exampleA01-V09-06-02)
|
||||
- Apply coding guidelines
|
||||
|
||||
01 April 2013 Andrea Dotti (exampleA01-V09-06-01)
|
||||
- New G4VUserPhysicsList interface
|
||||
|
||||
18 December 2012 Michael Kelsey (exampleA01-V09-06-00)
|
||||
- Replace G4AntiProtonAnnihiliationAtRest with G4AntiProtonAbsorptionFritiof.
|
||||
|
||||
16 November 2012 Ivana Hrivnacova (exampleA01-V09-05-03)
|
||||
- Fixed .README file for artefacts from Markdown support
|
||||
|
||||
31 August 2012 Ivana Hrivnacova (exampleA01-V09-05-02)
|
||||
- Minor fixes in CMakeList.txt
|
||||
|
||||
24 August 2012 Ivana Hrivnacova (exampleA01-V09-05-01)
|
||||
- README.JAIDA replaced with more general README.AIDA (revised
|
||||
by Guy Barrand)
|
||||
- Added README.OpenScientist (previously AnaEx03/UseOpenScientist.txt)
|
||||
- Added .README files for Doxygen documentation
|
||||
- Added file descriptions for all .hh and .cc
|
||||
- Fixed functions names in B5AnalysisManager (to get example
|
||||
compiling)
|
||||
- Adding support for building example with AIDA in CMake build
|
||||
|
||||
19 June 2012 Joseph Perl (exampleA01-V09-05-00)
|
||||
- Corrected order of filling x and y for Cloud2D
|
||||
|
||||
20 April 2012 Joseph Perl
|
||||
- Apply coding guidelines
|
||||
|
||||
28 October 2011 Joseph Perl (exampleA01-V09-04-00)
|
||||
- Corrected order of filling x and y for Cloud2D
|
||||
|
||||
4 June 2010 Joseph Perl (exampleA01-V09-03-00)
|
||||
- Updated vis usage.
|
||||
|
||||
2 Dec 2009 Joseph Perl (exampleA01-V09-02-02)
|
||||
- B5MuonPhysics: change hMultipleScattering to MuMultipleScattering.
|
||||
|
||||
20 Mov 2009 Joseph Perl (exampleA01-V09-02-01)
|
||||
- B5DetectorConstruction, B5MagneticField: improve handing of field.
|
||||
Resolves bug 1012.
|
||||
- B5Trajectory: removed. Example uses G4Trajectory.
|
||||
- Update to new multiple scattering classes.
|
||||
- README: General update.
|
||||
Remove references to obsolete SLAC Geant4 tutorial CD.
|
||||
|
||||
14 Mov 2009 John Allison (exampleA01-V09-02-00)
|
||||
- exampleA01.cc: Introduced G4UIExecutive.
|
||||
|
||||
5 March 2009 Guy Barrand
|
||||
- GNUmakefile : remove the G4ANALYSIS_USE logic found in this file, since
|
||||
it is handled already in the config/analysis.gmk.
|
||||
This avoids a duplication in the compilation and link commands
|
||||
of the aida-config options.
|
||||
|
||||
17 May 2007 - Mark Donszelmann (exampleA01-V08-03-01)
|
||||
- Fixed memory leak for plotter
|
||||
|
||||
16 May 2007 - Mark Donszelmann
|
||||
- Fixed warning message about JAS-JAIDA window on exit.
|
||||
|
||||
13 November 2006 - Joseph Perl (exampleA01-V08-01-02)
|
||||
- Remove unused attributes from hit classes.
|
||||
|
||||
10 November 2006 - Mark Donszelmann (exampleA01-V08-01-01)
|
||||
- Fixed Makefile
|
||||
- Fixed limits on histogram
|
||||
|
||||
6 November 2006 - John Allison (exampleA01-V08-01-00)
|
||||
- Change "Bookkeeping" to "Physics" in G4AttDefs.
|
||||
- Removed tracking action. Use "/vis/scene/add/trajectories rich", etc.
|
||||
- Invoke G4UIterminal(new G4UItcsh) if G4UI_USE_TCSH set.
|
||||
|
||||
1 June 2006 - Joseph Perl (exampleA01-V08-00-01)
|
||||
- Add Time attribute to Hit classes.
|
||||
|
||||
2 June 2005 - Joseph Perl (exampleA01-V07-00-05)
|
||||
- Add G4Atts to the four hit classes.
|
||||
|
||||
1 June 2005 - Mark Donszelmann (exampleA01-V07-00-04)
|
||||
- Updated documentation for the use of Binary HepRep.
|
||||
|
||||
31st May 2005 - Mark Donszelmann (exampleA01-V07-00-03)
|
||||
- Added setting of initial viewpoint to macro files for heprep and bheprep.
|
||||
|
||||
26th May 2005 - Mark Donszelmann (exampleA01-V07-00-02)
|
||||
- Fixed filling of hit histograms.
|
||||
|
||||
16th May 2005 - Mark Donszelmann (exampleA01-V07-00-01)
|
||||
- Added bheprep example files.
|
||||
|
||||
3rd May 2005 John Allison (examples-V07-00-03)
|
||||
- Replaced vis manager with G4VisExecutive.
|
||||
|
||||
31 March 2005 Mark Donszelmann (exampleA01-V07-00-00)
|
||||
- Fixed linking problem with AIDA by replacing LOADLIBS with LDLIBS
|
||||
which is not touched by the replacement strategy in binmake.gmk
|
||||
for WIN32-VC.
|
||||
|
||||
13th December 2004 Gabriele Cosmo (exampleA01-V06-02-03)
|
||||
- Modified hadlists.gmk to new phys-lists structure.
|
||||
|
||||
3rd December 2004 Gabriele Cosmo (exampleA01-V06-02-02)
|
||||
- Implemented migration to <cmath>.
|
||||
|
||||
23rd November 2004 Mark Donszelmann (exampleA01-V06-02-01)
|
||||
- Removed dependency from user hadronics lists
|
||||
|
||||
14th July 2004 Gabriele Cosmo (exampleA01-V06-02-00)
|
||||
- hadlist.gmk: removed unnecessary kernel libraries list.
|
||||
Fixes problem report #647.
|
||||
|
||||
27th May 2004 Mark Donszelmann (exampleA01-V06-01-01)
|
||||
- Updated Mac file to write separate geometry.
|
||||
|
||||
26th May 2004 Mark Donszelmann (exampleA01-V06-01-00)
|
||||
- Updated mac files for HepRep2 driver to set zoom factor and coordinate system.
|
||||
|
||||
9th February 2004 Makoto Asai (exampleA01-V06-00-00)
|
||||
- Fix EM part of the physics list to use the new
|
||||
processes introduced at 6.0.
|
||||
- Reference output is updated accordingly.
|
||||
|
||||
1st December 2003 Joseph Perl
|
||||
- Removed endOfEventAction.mac since new vis policy provides such a flush
|
||||
automatically.
|
||||
- Updated README to include more information about HepRep2 macros.
|
||||
|
||||
17th November 2003 Makoto Asai (exampleA01-V05-02-00)
|
||||
- Introducing test.in macro for batch mode testing and its reference output.
|
||||
|
||||
13th November 2003 John Allison
|
||||
- Removed OPACS from Vis Manager.
|
||||
|
||||
15th October 2003 Mark Donszelmann
|
||||
- Updated README.JAIDA to refer to the proper versions of JAIDA and AIDAJNI.
|
||||
Also changed compilation instructions to use aida-config.
|
||||
- Made sure G4HadronPhysics is compiled without optmization on Darwin-g++,
|
||||
Darwin-g++2 and Darwin-g++3 (MacOS X).
|
||||
|
||||
14th October 2003 Mark Donszelmann
|
||||
- Added clear statement to GNUmakefile that G4HadronPhysics is compiled
|
||||
without optimization.
|
||||
- Made sure G4HadronPhysics is compiled without optimization on Linux-g++,
|
||||
Linux-g++2 and Linux-g++3.
|
||||
|
||||
14th October 2003 Joseph Perl
|
||||
- Remove SetForceWireFrame(false) from three hit classes since these
|
||||
are redundant to the SetForceSolid(true) statements already there.
|
||||
|
||||
14th October 2003 Joseph Perl
|
||||
- Remove SetForceWireFrame(true) statements from B5DetectorConstruction.cc.
|
||||
The user can instead control this at runtime using /vis/viewer/set/style
|
||||
|
||||
13th October 2003 Mark Donszelmann
|
||||
- Re-included B5EventActionMessenger in general (non G4ANALYSIS_USE) compilation
|
||||
for use with B5EventACtion, see comment below.
|
||||
- Removed all include/AIDA include files and changed the GNUmakefile.
|
||||
To compile/link with G4ANALYSIS_USE you will need an AIDA 3.0 compliant
|
||||
implementation, such as AIDAJNI. The makefile will execute aida-config
|
||||
to find the include files and the libraries to link with.
|
||||
- setup-analysis.csh/sh/win32 now only sets up G4 specific flags to compile
|
||||
in the AIDA analysis framework.
|
||||
|
||||
13th October 2003 Joseph Perl
|
||||
- Minor changes to README's sections on vis and analysis.
|
||||
|
||||
12th October 2003 Makoto Asai
|
||||
- Move G4ANALYSIS_USE ifdef blocks so that event summary is printed out
|
||||
regardless of this flag. Only the AIDA part in B5EventAction is
|
||||
blocked.
|
||||
|
||||
12th October 2003 Joseph Perl
|
||||
- Modify G4TrackingAction to use G4Trajectory rather than B5Trajectory.
|
||||
This allows trajectories to pick up physics attributes.
|
||||
Left B5Trajectory in place as alternative to get color coding by
|
||||
particle type, but no physics attributes.
|
||||
Will later come up with a good scheme to make choice of one or the other
|
||||
or both of these choices at run time.
|
||||
- Renamed visualization macro heprep.mac to vis.mac
|
||||
|
||||
20th August 2003 Mark Donszelmann
|
||||
- Updated code to run with AIDAJNI 3.0.3 release, which adds compilation
|
||||
under g++ 3.2.
|
||||
- Added aida.mac example file.
|
||||
|
||||
14th August 2003 Mark Donszelmann
|
||||
- Code will only compile AIDA parts if G4ANALYSIS_USE is set.
|
||||
|
||||
11th July 2003 Mark Donszelmann
|
||||
- Fixed all warnings under g++ 2.95.3.
|
||||
|
||||
3rd April 2003 Mark Donszelmann (examples-analysis-B5-V05-00-00)
|
||||
- Added 2 more histograms to the example
|
||||
- Fixed NullPointerException by letting SDManager delete the detectors created in
|
||||
DetectorConstruction.cc
|
||||
- Added comment when quitting Geant4 that JAS window still needs closing.
|
||||
|
||||
26th November 2002 Mark Donszelmann
|
||||
- Fixed DrifChamberHit to have a reasonable screensize (2) rather than 0.1
|
||||
- Fixed minimum value for EmCalHit color to be visible (0.4).
|
||||
|
||||
14th November 2002 Mark Donszelmann
|
||||
- Added B5 example to repository
|
||||
@@ -0,0 +1,284 @@
|
||||
$Id: README 78001 2013-12-02 08:24:53Z gcosmo $
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Extended Example B5
|
||||
--------------------
|
||||
|
||||
Example B5 implements a double-arm spectrometer with wire chambers,
|
||||
hodoscopes and calorimeters. Event simulation and collection are
|
||||
enabled, as well as event display and analysis.
|
||||
|
||||
|
||||
1- GEOMETRY
|
||||
|
||||
The spectrometer consists of two detector arms
|
||||
(see B5DetectorConstruction). One arm provides
|
||||
position and timing information of the incident particle while the
|
||||
other collects position, timing and energy information of the particle
|
||||
after it has been deflected by a magnetic field centered at the
|
||||
spectrometer pivot point.
|
||||
|
||||
- First arm: box filled with air, also containing:
|
||||
|
||||
1 hodoscope (15 vertical strips of plastic scintillator)
|
||||
1 drift chamber (5 horizontal argon gas layers with a
|
||||
"virtual wire" at the center of each layer)
|
||||
|
||||
- Second arm: box filled with air, also containing:
|
||||
|
||||
1 hodoscope (25 vertical strips of plastic scintillator)
|
||||
1 drift chamber (5 horizontal argon gas layers with a
|
||||
"virtual wire" at the center of each layer)
|
||||
1 electromagnetic calorimeter:
|
||||
a box sub-divided along x,y and z
|
||||
axes into cells of CsI
|
||||
1 hadronic calorimeter:
|
||||
a box sub-divided along x,y, and z axes
|
||||
into cells of lead, with a layer of
|
||||
plastic scintillator placed at the center
|
||||
of each cell
|
||||
|
||||
- Magnetic field region: air-filled cylinder which contains
|
||||
the field (see B5MagneticField)
|
||||
|
||||
The maximum step limit in the magnetic field region is also set
|
||||
via the G4UserLimits class in a similar way as in Example B2.
|
||||
|
||||
The rotation angle of the second arm and the magnetic field value
|
||||
can be set via the interactive command defined using the G4GenericMessenger
|
||||
class.
|
||||
|
||||
2- PHYSICS
|
||||
|
||||
This example uses the reference hadronic physics list, FTFP_BERT,
|
||||
and also adds the G4StepLimiter process.
|
||||
|
||||
|
||||
3- ACTION INITALIZATION
|
||||
|
||||
B5ActionInitialization class
|
||||
instantiates and registers to Geant4 kernel all user action classes.
|
||||
|
||||
While in sequential mode the action classes are instatiated just once,
|
||||
via invoking the method:
|
||||
B5ActionInitialization::Build()
|
||||
in multi-threading mode the same method is invoked for each thread worker
|
||||
and so all user action classes are defined thread-local.
|
||||
|
||||
A run action class is instantiated both thread-local
|
||||
and global that's why its instance is created also in the method
|
||||
B5ActionInitialization::BuildForMaster()
|
||||
which is invoked only in multi-threading mode.
|
||||
|
||||
4- PRIMARY GENERATOR
|
||||
|
||||
The primary generator action class employs the G4ParticleGun.
|
||||
The primary kinematics consists of a single particle which is
|
||||
is sent in the direction of the first spectrometer arm.
|
||||
|
||||
The type of the particle and its several properties can be changed
|
||||
via the G4 built-in commands of the G4ParticleGun class or
|
||||
this example command defined using the G4GenericMessenger class.
|
||||
|
||||
|
||||
5- EVENT
|
||||
|
||||
An event consists of the generation of a single particle which is
|
||||
transported through the first spectrometer arm. Here, a scintillator
|
||||
hodoscope records the reference time of the particle before it passes
|
||||
through a drift chamber where the particle position is measured.
|
||||
Momentum analysis is performed as the particle passes through a magnetic
|
||||
field at the spectrometer pivot and then into the second spectrometer
|
||||
arm. In the second arm, the particle passes through another hodoscope
|
||||
and drift chamber before interacting in the electromagnetic calorimeter.
|
||||
Here it is likely that particles will induce electromagnetic showers.
|
||||
The shower energy is recorded in a three-dimensional array of CsI
|
||||
crystals. Secondary particles from the shower, as well as primary
|
||||
particles which do not interact in the CsI crystals, pass into the
|
||||
hadronic calorimeter. Here, the remaining energy is collected in a
|
||||
three-dimensional array of scintillator-lead sandwiches.
|
||||
|
||||
Several aspects of the event may be changed interactively by the user:
|
||||
- angle of the second spectrometer arm
|
||||
- strength of magnetic field
|
||||
- initial particle type
|
||||
- initial momentum and angle
|
||||
- momentum and angle spreads
|
||||
- type of initial particle may be randomized
|
||||
|
||||
The initial particle type can be changed using the G4ParticleGun command:
|
||||
/gun/particle particleName
|
||||
|
||||
The UI commands specific to this example are available in /B5 command
|
||||
directory:
|
||||
/B5/detector/armAngle angle unit
|
||||
/B5/field/value field unit
|
||||
/B5/generator/momentum value unit
|
||||
/B5/generator/sigmaMomentum value unit
|
||||
/B5/generator/sigmaAngle value unit
|
||||
/B5/generator/randomizePrimary [true|false]
|
||||
|
||||
They are implemented in
|
||||
B5DetectorConstruction::DefineCommands(),
|
||||
B5MagneticField::DefineCommands() and
|
||||
B5PrimaryGeneratorAction::DefineCommands() methods
|
||||
using G4GenericMessenger class.
|
||||
|
||||
In first execution of BeginOfEventAction()
|
||||
the hits collections identifiers are saved in data members of the class
|
||||
and used in EndOfEventAction() for accessing
|
||||
the hists collections and filling the accounted information in defined
|
||||
histograms and ntuples and printing its summary in a log file.
|
||||
The frequency of printing can be tuned with the built-in command
|
||||
/run/printProgress frequency
|
||||
|
||||
4. DETECTOR RESPONSE:
|
||||
|
||||
All the information required to simulate and analyze an event is
|
||||
recorded in hits. This information is recorded in the following
|
||||
sensitive detectors:
|
||||
|
||||
- hodoscope:
|
||||
particle time
|
||||
strip ID, position and rotation
|
||||
(see B5HodoscopeSD, B5HodoscopeHit classes)
|
||||
|
||||
- drift chamber:
|
||||
particle time
|
||||
particle position
|
||||
layer ID
|
||||
(see B5DriftChamberSD, B5DriftChamberHit classes)
|
||||
|
||||
- electromagnetic calorimeter:
|
||||
energy deposited in cell
|
||||
cell ID, position and rotation
|
||||
(see B5EMCalorimeterSD, B5EMCalorimeterHit classes)
|
||||
|
||||
- hadronic calorimeter:
|
||||
energy deposited in cell
|
||||
cell column ID and row ID, position and rotation
|
||||
(see B5HadCalorimeterSD, B5HadCalorimeterHit classes)
|
||||
|
||||
The hit classes include methods GetAttDefs and CreateAttValues to define
|
||||
and then fill extra "HepRep-style" Attributes that the visualization system
|
||||
can use to present extra information about the hits.
|
||||
For example, if you pick a B5HadCalorimeterHit in OpenGL or a HepRep viewer,
|
||||
you will be shown the hit's "Hit Type", "Column ID", "Row ID",
|
||||
"Energy Deposited" and "Position".
|
||||
These attributes are essentially arbitrary extra pieces of information
|
||||
(integers, doubles or strings) that are carried through the visualization.
|
||||
Each attribute is defined once in G4AttDef object and then is filled for
|
||||
each hit in a G4AttValue object.
|
||||
These attributes can also be used by commands to filter which hits are drawn:
|
||||
/vis/filtering/hits/drawByAttribute
|
||||
Detector Geometry and trajectories also carry HepRep-style attributes,
|
||||
but these are filled automatically in the base classes.
|
||||
HepRep is further described at: http://www.slac.stanford.edu/~perl/heprep/
|
||||
|
||||
5. ANALYSIS:
|
||||
|
||||
The analysis tools are used to accumulate statistics.
|
||||
Histograms and an ntuple are created in B5RunAction::B5RunAction()
|
||||
constructor for the following quantities:
|
||||
|
||||
1D histograms:
|
||||
- Number of hits in Chamber 1
|
||||
- Number of hits in Chamber 2
|
||||
|
||||
2D histograms:
|
||||
- Drift Chamber 1 X vs Y positions
|
||||
- Drift Chamber 2 X vs Y positions
|
||||
- Total energy deposit vs time of flight
|
||||
|
||||
Ntuple:
|
||||
- Number of hits in Chamber 1
|
||||
- Number of hits in Chamber 2
|
||||
- Total energy deposit in EM calorimeter
|
||||
- Total energy deposit in Hadronic calorimeter
|
||||
- Time of flight in Hodoscope 1
|
||||
- Time of flight in Hodoscope 2
|
||||
|
||||
The histograms and ntuple are saved in the output file in a format
|
||||
according to a technology selected in B5Analysis.hh.
|
||||
|
||||
When running in multi-threading mode, the histograms accumulated on threads are
|
||||
automatically merged in a single output file, while the ntuple is written
|
||||
in files per thread.
|
||||
|
||||
The following paragraphs are common to all basic examples
|
||||
|
||||
A- VISUALISATION
|
||||
|
||||
The visualization manager is set via the G4VisExecutive class
|
||||
in the main() function in exampleB5.cc.
|
||||
The initialisation of the drawing is done via a set of /vis/ commands
|
||||
in the macro vis.mac. This macro is automatically read from
|
||||
the main function when the example is used in interactive running mode.
|
||||
|
||||
By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
|
||||
The user can change the initial viewer by commenting out this line
|
||||
and instead uncommenting one of the other /vis/open statements, such as
|
||||
HepRepFile or DAWNFILE (which produce files that can be viewed with the
|
||||
HepRApp and DAWN viewers, respectively). Note that one can always
|
||||
open new viewers at any time from the command line. For example, if
|
||||
you already have a view in, say, an OpenGL window with a name
|
||||
"viewer-0", then
|
||||
/vis/open DAWNFILE
|
||||
then to get the same view
|
||||
/vis/viewer/copyView viewer-0
|
||||
or to get the same view *plus* scene-modifications
|
||||
/vis/viewer/set/all viewer-0
|
||||
then to see the result
|
||||
/vis/viewer/flush
|
||||
|
||||
The DAWNFILE, HepRepFile drivers are always available
|
||||
(since they require no external libraries), but the OGL driver requires
|
||||
that the Geant4 libraries have been built with the OpenGL option.
|
||||
|
||||
vis.mac has additional commands that demonstrate additional functionality
|
||||
of the vis system, such as displaying text, axes, scales, date, logo and
|
||||
shows how to change viewpoint and style.
|
||||
To see even more commands use help or ls or browse the available UI commands
|
||||
in the Application Developers Guide.
|
||||
|
||||
For more information on visualization, including information on how to
|
||||
install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
|
||||
for example,
|
||||
http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
|
||||
(where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
|
||||
|
||||
The tracks are automatically drawn at the end of each event, accumulated
|
||||
for all events and erased at the beginning of the next run.
|
||||
|
||||
B- USER INTERFACES
|
||||
|
||||
The user command interface is set via the G4UIExecutive class
|
||||
in the main() function in exampleB5.cc
|
||||
The selection of the user command interface is then done automatically
|
||||
according to the Geant4 configuration or it can be done explicitly via
|
||||
the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
|
||||
|
||||
C- HOW TO RUN
|
||||
|
||||
- Execute exampleB5 in the 'interactive mode' with visualization:
|
||||
% ./exampleB5
|
||||
and type in the commands from run1.mac line by line:
|
||||
Idle> /control/verbose 2
|
||||
Idle> /tracking/verbose 1
|
||||
Idle> /run/beamOn 10
|
||||
Idle> ...
|
||||
Idle> exit
|
||||
or
|
||||
Idle> /control/execute run1.mac
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
- Execute exampleB5 in the 'batch' mode from macro files
|
||||
(without visualization)
|
||||
% ./exampleB5 run2.mac
|
||||
% ./exampleB5 exampleB5.in > exampleB5.out
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: exampleB5.cc 70284 2013-05-28 17:26:43Z perl $
|
||||
//
|
||||
/// \file exampleB5.cc
|
||||
/// \brief Main program of the analysis/B5 example
|
||||
|
||||
#include "B5DetectorConstruction.hh"
|
||||
#include "B5ActionInitialization.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#else
|
||||
#include "G4RunManager.hh"
|
||||
#endif
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "G4StepLimiterPhysics.hh"
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
#include "G4VisExecutive.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4UI_USE
|
||||
#include "G4UIExecutive.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// Construct the default run manager
|
||||
//
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager* runManager = new G4MTRunManager;
|
||||
#else
|
||||
G4RunManager* runManager = new G4RunManager;
|
||||
#endif
|
||||
|
||||
// Mandatory user initialization classes
|
||||
runManager->SetUserInitialization(new B5DetectorConstruction);
|
||||
|
||||
G4VModularPhysicsList* physicsList = new FTFP_BERT;
|
||||
physicsList->RegisterPhysics(new G4StepLimiterPhysics());
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
// User action initialization
|
||||
runManager->SetUserInitialization(new B5ActionInitialization());
|
||||
|
||||
// Initialize Geant4 kernel
|
||||
runManager->Initialize();
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
// Visualization manager construction
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
// G4VisManager* visManager = new G4VisExecutive("Quiet");
|
||||
visManager->Initialize();
|
||||
#endif
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
if (argc>1) {
|
||||
// execute an argument macro file if exist
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
}
|
||||
else {
|
||||
// start interactive session
|
||||
#ifdef G4UI_USE
|
||||
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
|
||||
#ifdef G4VIS_USE
|
||||
UImanager->ApplyCommand("/control/execute init_vis.mac");
|
||||
#else
|
||||
UImanager->ApplyCommand("/control/execute init.mac");
|
||||
#endif
|
||||
if (ui->IsGUI())
|
||||
UImanager->ApplyCommand("/control/execute gui.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not be deleted
|
||||
// in the main() program !
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
delete visManager;
|
||||
#endif
|
||||
delete runManager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# Test macro file for exampleB5
|
||||
#
|
||||
|
||||
# Turn off randomization
|
||||
/B5/generator/randomizePrimary false
|
||||
/B5/generator/sigmaMomentum 0.
|
||||
/B5/generator/sigmaAngle 0.
|
||||
/run/printProgress 5
|
||||
#
|
||||
/B5/detector/armAngle 30. deg
|
||||
/gun/particle proton
|
||||
/B5/generator/momentum 100. GeV
|
||||
/B5/field/value 100. tesla
|
||||
/run/beamOn 5
|
||||
#
|
||||
/B5/detector/armAngle 60. deg
|
||||
/gun/particle pi+
|
||||
/B5/generator/momentum 100. GeV
|
||||
/B5/field/value 200. tesla
|
||||
/run/beamOn 5
|
||||
#
|
||||
/gun/particle e+
|
||||
/B5/detector/armAngle 30. deg
|
||||
/B5/generator/momentum 100. GeV
|
||||
/B5/field/value 100. tesla
|
||||
/run/beamOn 5
|
||||
#
|
||||
/B5/detector/armAngle 30. deg
|
||||
/gun/particle proton
|
||||
/B5/generator/momentum 10. GeV
|
||||
/B5/field/value 10. tesla
|
||||
/run/beamOn 5
|
||||
#
|
||||
/B5/detector/armAngle 60. deg
|
||||
/gun/particle pi+
|
||||
/B5/generator/momentum 10. GeV
|
||||
/B5/field/value 20. tesla
|
||||
/run/beamOn 5
|
||||
#
|
||||
/gun/particle e+
|
||||
/B5/detector/armAngle 30. deg
|
||||
/B5/generator/momentum 10. GeV
|
||||
/B5/field/value 10. tesla
|
||||
/run/beamOn 5
|
||||
#
|
||||
#
|
||||
/B5/detector/armAngle 30. deg
|
||||
/gun/particle proton
|
||||
/B5/generator/momentum 1. GeV
|
||||
/B5/field/value 1. tesla
|
||||
/run/beamOn 5
|
||||
#
|
||||
/B5/detector/armAngle 60. deg
|
||||
/gun/particle pi+
|
||||
/B5/generator/momentum 1. GeV
|
||||
/B5/field/value 2. tesla
|
||||
/run/beamOn 5
|
||||
#
|
||||
/gun/particle e+
|
||||
/B5/detector/armAngle 30. deg
|
||||
/B5/generator/momentum 1. GeV
|
||||
/B5/field/value 1. tesla
|
||||
/run/beamOn 5
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# This file permits to customize, with commands,
|
||||
# the menu bar of the G4UIXm, G4UIQt, G4UIWin32 sessions.
|
||||
# It has no effect with G4UIterminal.
|
||||
#
|
||||
#
|
||||
# Add icons of general interest
|
||||
#
|
||||
/control/execute icons.mac
|
||||
#
|
||||
# File menu :
|
||||
/gui/addMenu file File
|
||||
/gui/addButton file Quit exit
|
||||
#
|
||||
# Run menu :
|
||||
/gui/addMenu run Run
|
||||
/gui/addButton run "beamOn 1" "/run/beamOn 1"
|
||||
/gui/addButton run run1 "/control/execute run1.mac"
|
||||
#
|
||||
# Gun menu :
|
||||
/gui/addMenu gun Gun
|
||||
/gui/addButton gun "50 MeV" "/gun/energy 50 MeV"
|
||||
/gui/addButton gun "1 GeV" "/gun/energy 1 GeV"
|
||||
/gui/addButton gun "10 GeV" "/gun/energy 10 GeV"
|
||||
/gui/addButton gun "e-" "/gun/particle e-"
|
||||
/gui/addButton gun "pi0" "/gun/particle pi0"
|
||||
/gui/addButton gun "pi+" "/gun/particle pi+"
|
||||
/gui/addButton gun "neutron" "/gun/particle neutron"
|
||||
/gui/addButton gun "proton" "/gun/particle proton"
|
||||
#
|
||||
# Field menu :
|
||||
/gui/addMenu field Field
|
||||
/gui/addButton field "off" "/globalField/setValue 0 0 0 tesla"
|
||||
/gui/addButton field "0.2 tesla" "/globalField/setValue 0.2 0 0 tesla"
|
||||
/gui/addButton field "2.0 tesla" "/globalField/setValue 2.0 0 0 tesla"
|
||||
#
|
||||
# Viewer menu :
|
||||
/gui/addMenu viewer Viewer
|
||||
/gui/addButton viewer "Set style surface" "/vis/viewer/set/style surface"
|
||||
/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wireframe"
|
||||
/gui/addButton viewer "Refresh viewer" "/vis/viewer/refresh"
|
||||
/gui/addButton viewer "Update viewer (interaction or end-of-file)" "/vis/viewer/update"
|
||||
/gui/addButton viewer "Flush viewer (= refresh + update)" "/vis/viewer/flush"
|
||||
/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
|
||||
#
|
||||
# User defined icon :
|
||||
/gui/addIcon "Run beam on" user_icon "/run/beamOn 1" run.png
|
||||
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# This file permits to customize, with commands,
|
||||
# the icon menu bar of the G4UIQt sessions not yet implemented other UI drivers (geant4-09-05-ref-09)
|
||||
# It has no effect with G4UIterminal.
|
||||
|
||||
# open/save icons
|
||||
/gui/addIcon "Open macro file" open /control/execute
|
||||
/gui/addIcon "Save viewer state" save /vis/viewer/save
|
||||
|
||||
# Cursors style icons
|
||||
/gui/addIcon "Move" move
|
||||
/gui/addIcon "Pick" pick
|
||||
/gui/addIcon "Zoom out" zoom_out
|
||||
/gui/addIcon "Zoom in" zoom_in
|
||||
/gui/addIcon "Rotate" rotate
|
||||
|
||||
# Surface Style icons
|
||||
# Surface Style icons
|
||||
/gui/addIcon "Hidden line removal" hidden_line_removal
|
||||
/gui/addIcon "Hidden line and hidden surface removal" hidden_line_and_surface_removal
|
||||
/gui/addIcon "Surfaces" solid
|
||||
/gui/addIcon "Wireframe" wireframe
|
||||
|
||||
# Perspective/Ortho icons
|
||||
/gui/addIcon "Perspective" perspective
|
||||
/gui/addIcon "Orthographic" ortho
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5ActionInitialization.hh 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file B5ActionInitialization.hh
|
||||
/// \brief Definition of the B5ActionInitialization class
|
||||
|
||||
#ifndef B5ActionInitialization_h
|
||||
#define B5ActionInitialization_h 1
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
/// Action initialization class.
|
||||
|
||||
class B5ActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
B5ActionInitialization();
|
||||
virtual ~B5ActionInitialization();
|
||||
|
||||
virtual void BuildForMaster() const;
|
||||
virtual void Build() const;
|
||||
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5Analysis.hh 66536 2012-12-19 14:32:36Z ihrivnac $
|
||||
//
|
||||
/// \file B5Analysis.hh
|
||||
/// \brief Selection of the analysis technology
|
||||
|
||||
#ifndef B5Analysis_h
|
||||
#define B5Analysis_h 1
|
||||
|
||||
#include "g4root.hh"
|
||||
//#include "g4xml.hh"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5CellParameterisation.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5CellParameterisation.hh
|
||||
/// \brief Definition of the B5CellParameterisation class
|
||||
|
||||
#ifndef B5CellParameterisation_H
|
||||
#define B5CellParameterisation_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VPVParameterisation.hh"
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
/// EM Calorimeter cell parameterisation
|
||||
|
||||
class B5CellParameterisation : public G4VPVParameterisation
|
||||
{
|
||||
public:
|
||||
B5CellParameterisation();
|
||||
virtual ~B5CellParameterisation();
|
||||
|
||||
virtual void ComputeTransformation(
|
||||
const G4int copyNo,G4VPhysicalVolume *physVol) const;
|
||||
|
||||
private:
|
||||
G4double fXCell[80];
|
||||
G4double fYCell[80];
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5DetectorConstruction.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5DetectorConstruction.hh
|
||||
/// \brief Definition of the B5DetectorConstruction class
|
||||
|
||||
#ifndef B5DetectorConstruction_h
|
||||
#define B5DetectorConstruction_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class B5MagneticField;
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4Material;
|
||||
class G4VSensitiveDetector;
|
||||
class G4VisAttributes;
|
||||
class G4GenericMessenger;
|
||||
|
||||
/// Detector construction
|
||||
|
||||
class B5DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
B5DetectorConstruction();
|
||||
virtual ~B5DetectorConstruction();
|
||||
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
virtual void ConstructSDandField();
|
||||
|
||||
void SetArmAngle(G4double val);
|
||||
G4double GetArmAngle() { return fArmAngle; }
|
||||
|
||||
void ConstructMaterials();
|
||||
|
||||
private:
|
||||
void DefineCommands();
|
||||
|
||||
G4GenericMessenger* fMessenger;
|
||||
|
||||
static G4ThreadLocal B5MagneticField* fMagneticField;
|
||||
static G4ThreadLocal G4FieldManager* fFieldMgr;
|
||||
|
||||
G4LogicalVolume* fHodoscope1Logical;
|
||||
G4LogicalVolume* fHodoscope2Logical;
|
||||
G4LogicalVolume* fWirePlane1Logical;
|
||||
G4LogicalVolume* fWirePlane2Logical;
|
||||
G4LogicalVolume* fCellLogical;
|
||||
G4LogicalVolume* fHadCalScintiLogical;
|
||||
G4LogicalVolume* fMagneticLogical;
|
||||
|
||||
std::vector<G4VisAttributes*> fVisAttributes;
|
||||
|
||||
G4double fArmAngle;
|
||||
G4RotationMatrix* fArmRotation;
|
||||
G4VPhysicalVolume* fSecondArmPhys;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5DriftChamberHit.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5DriftChamberHit.hh
|
||||
/// \brief Definition of the B5DriftChamberHit class
|
||||
|
||||
#ifndef B5DriftChamberHit_h
|
||||
#define B5DriftChamberHit_h 1
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
class G4AttDef;
|
||||
class G4AttValue;
|
||||
|
||||
/// Drift chamber hit
|
||||
///
|
||||
/// It records:
|
||||
/// - the layer ID
|
||||
/// - the particle time
|
||||
/// - the particle local and global positions
|
||||
|
||||
class B5DriftChamberHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
B5DriftChamberHit();
|
||||
B5DriftChamberHit(G4int z);
|
||||
B5DriftChamberHit(const B5DriftChamberHit &right);
|
||||
virtual ~B5DriftChamberHit();
|
||||
|
||||
const B5DriftChamberHit& operator=(const B5DriftChamberHit &right);
|
||||
int operator==(const B5DriftChamberHit &right) const;
|
||||
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void *aHit);
|
||||
|
||||
virtual void Draw();
|
||||
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
|
||||
virtual std::vector<G4AttValue>* CreateAttValues() const;
|
||||
virtual void Print();
|
||||
|
||||
void SetLayerID(G4int z) { fLayerID = z; }
|
||||
G4int GetLayerID() const { return fLayerID; }
|
||||
|
||||
void SetTime(G4double t) { fTime = t; }
|
||||
G4double GetTime() const { return fTime; }
|
||||
|
||||
void SetLocalPos(G4ThreeVector xyz) { fLocalPos = xyz; }
|
||||
G4ThreeVector GetLocalPos() const { return fLocalPos; }
|
||||
|
||||
void SetWorldPos(G4ThreeVector xyz) { fWorldPos = xyz; }
|
||||
G4ThreeVector GetWorldPos() const { return fWorldPos; }
|
||||
|
||||
private:
|
||||
G4int fLayerID;
|
||||
G4double fTime;
|
||||
G4ThreeVector fLocalPos;
|
||||
G4ThreeVector fWorldPos;
|
||||
};
|
||||
|
||||
typedef G4THitsCollection<B5DriftChamberHit> B5DriftChamberHitsCollection;
|
||||
|
||||
extern G4ThreadLocal G4Allocator<B5DriftChamberHit>* B5DriftChamberHitAllocator;
|
||||
|
||||
inline void* B5DriftChamberHit::operator new(size_t)
|
||||
{
|
||||
if (!B5DriftChamberHitAllocator)
|
||||
B5DriftChamberHitAllocator = new G4Allocator<B5DriftChamberHit>;
|
||||
return (void*)B5DriftChamberHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void B5DriftChamberHit::operator delete(void* aHit)
|
||||
{
|
||||
B5DriftChamberHitAllocator->FreeSingle((B5DriftChamberHit*) aHit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5DriftChamberSD.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5DriftChamberSD.hh
|
||||
/// \brief Definition of the B5DriftChamberSD class
|
||||
|
||||
#ifndef B5DriftChamberSD_h
|
||||
#define B5DriftChamberSD_h 1
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
#include "B5DriftChamberHit.hh"
|
||||
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
/// Drift chamber sensitive detector
|
||||
|
||||
class B5DriftChamberSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
B5DriftChamberSD(G4String name);
|
||||
virtual ~B5DriftChamberSD();
|
||||
|
||||
virtual void Initialize(G4HCofThisEvent*HCE);
|
||||
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist);
|
||||
|
||||
private:
|
||||
B5DriftChamberHitsCollection* fHitsCollection;
|
||||
G4int fHCID;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5EmCalorimeterHit.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5EmCalorimeterHit.hh
|
||||
/// \brief Definition of the B5EmCalorimeterHit class
|
||||
|
||||
#ifndef B5EmCalorimeterHit_h
|
||||
#define B5EmCalorimeterHit_h 1
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
class G4AttDef;
|
||||
class G4AttValue;
|
||||
|
||||
/// EM Calorimeter hit
|
||||
///
|
||||
/// It records:
|
||||
/// - the cell ID
|
||||
/// - the energy deposit
|
||||
/// - the cell logical volume, its position and rotation
|
||||
|
||||
class B5EmCalorimeterHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
B5EmCalorimeterHit();
|
||||
B5EmCalorimeterHit(G4int z);
|
||||
B5EmCalorimeterHit(const B5EmCalorimeterHit &right);
|
||||
virtual ~B5EmCalorimeterHit();
|
||||
|
||||
const B5EmCalorimeterHit& operator=(const B5EmCalorimeterHit &right);
|
||||
int operator==(const B5EmCalorimeterHit &right) const;
|
||||
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void *aHit);
|
||||
|
||||
virtual void Draw();
|
||||
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
|
||||
virtual std::vector<G4AttValue>* CreateAttValues() const;
|
||||
virtual void Print();
|
||||
|
||||
void SetCellID(G4int z) { fCellID = z; }
|
||||
G4int GetCellID() const { return fCellID; }
|
||||
|
||||
void SetEdep(G4double de) { fEdep = de; }
|
||||
void AddEdep(G4double de) { fEdep += de; }
|
||||
G4double GetEdep() const { return fEdep; }
|
||||
|
||||
void SetPos(G4ThreeVector xyz) { fPos = xyz; }
|
||||
G4ThreeVector GetPos() const { return fPos; }
|
||||
|
||||
void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
|
||||
G4RotationMatrix GetRot() const { return fRot; }
|
||||
|
||||
void SetLogV(G4LogicalVolume* val) { fPLogV = val; }
|
||||
const G4LogicalVolume* GetLogV() const { return fPLogV; }
|
||||
|
||||
private:
|
||||
G4int fCellID;
|
||||
G4double fEdep;
|
||||
G4ThreeVector fPos;
|
||||
G4RotationMatrix fRot;
|
||||
const G4LogicalVolume* fPLogV;
|
||||
};
|
||||
|
||||
typedef G4THitsCollection<B5EmCalorimeterHit> B5EmCalorimeterHitsCollection;
|
||||
|
||||
extern G4ThreadLocal G4Allocator<B5EmCalorimeterHit>* B5EmCalorimeterHitAllocator;
|
||||
|
||||
inline void* B5EmCalorimeterHit::operator new(size_t)
|
||||
{
|
||||
if (!B5EmCalorimeterHitAllocator)
|
||||
B5EmCalorimeterHitAllocator = new G4Allocator<B5EmCalorimeterHit>;
|
||||
return (void*)B5EmCalorimeterHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void B5EmCalorimeterHit::operator delete(void* aHit)
|
||||
{
|
||||
B5EmCalorimeterHitAllocator->FreeSingle((B5EmCalorimeterHit*) aHit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5EmCalorimeterSD.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5EmCalorimeterSD.hh
|
||||
/// \brief Definition of the B5EmCalorimeterSD class
|
||||
|
||||
#ifndef B5EmCalorimeterSD_h
|
||||
#define B5EmCalorimeterSD_h 1
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
#include "B5EmCalorimeterHit.hh"
|
||||
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
/// EM calorimeter sensitive detector
|
||||
|
||||
class B5EmCalorimeterSD : public G4VSensitiveDetector
|
||||
{
|
||||
|
||||
public:
|
||||
B5EmCalorimeterSD(G4String name);
|
||||
virtual ~B5EmCalorimeterSD();
|
||||
|
||||
virtual void Initialize(G4HCofThisEvent*HCE);
|
||||
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
|
||||
|
||||
private:
|
||||
B5EmCalorimeterHitsCollection* fHitsCollection;
|
||||
G4int fHCID;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5EventAction.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5EventAction.hh
|
||||
/// \brief Definition of the B5EventAction class
|
||||
|
||||
#ifndef B5EventAction_h
|
||||
#define B5EventAction_h 1
|
||||
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
/// Event action
|
||||
|
||||
class B5EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
B5EventAction();
|
||||
virtual ~B5EventAction();
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event*);
|
||||
virtual void EndOfEventAction(const G4Event*);
|
||||
|
||||
private:
|
||||
G4int fHHC1ID;
|
||||
G4int fHHC2ID;
|
||||
G4int fDHC1ID;
|
||||
G4int fDHC2ID;
|
||||
G4int fECHCID;
|
||||
G4int fHCHCID;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5HadCalorimeterHit.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5HadCalorimeterHit.hh
|
||||
/// \brief Definition of the B5HadCalorimeterHit class
|
||||
|
||||
#ifndef B5HadCalorimeterHit_h
|
||||
#define B5HadCalorimeterHit_h 1
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
class G4AttDef;
|
||||
class G4AttValue;
|
||||
|
||||
/// Hadron Calorimeter hit
|
||||
///
|
||||
/// It records:
|
||||
/// - the cell column ID and row ID
|
||||
/// - the energy deposit
|
||||
/// - the cell position and rotation
|
||||
|
||||
class B5HadCalorimeterHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
B5HadCalorimeterHit();
|
||||
B5HadCalorimeterHit(G4int iCol,G4int iRow);
|
||||
B5HadCalorimeterHit(const B5HadCalorimeterHit &right);
|
||||
virtual ~B5HadCalorimeterHit();
|
||||
|
||||
const B5HadCalorimeterHit& operator=(const B5HadCalorimeterHit &right);
|
||||
int operator==(const B5HadCalorimeterHit &right) const;
|
||||
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void *aHit);
|
||||
|
||||
virtual void Draw();
|
||||
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
|
||||
virtual std::vector<G4AttValue>* CreateAttValues() const;
|
||||
virtual void Print();
|
||||
|
||||
void SetColumnID(G4int z) { fColumnID = z; }
|
||||
G4int GetColumnID() const { return fColumnID; }
|
||||
|
||||
void SetRowID(G4int z) { fRowID = z; }
|
||||
G4int GetRowID() const { return fRowID; }
|
||||
|
||||
void SetEdep(G4double de) { fEdep = de; }
|
||||
void AddEdep(G4double de) { fEdep += de; }
|
||||
G4double GetEdep() const { return fEdep; }
|
||||
|
||||
void SetPos(G4ThreeVector xyz) { fPos = xyz; }
|
||||
G4ThreeVector GetPos() const { return fPos; }
|
||||
|
||||
void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
|
||||
G4RotationMatrix GetRot() const { return fRot; }
|
||||
|
||||
private:
|
||||
G4int fColumnID;
|
||||
G4int fRowID;
|
||||
G4double fEdep;
|
||||
G4ThreeVector fPos;
|
||||
G4RotationMatrix fRot;
|
||||
};
|
||||
|
||||
typedef G4THitsCollection<B5HadCalorimeterHit> B5HadCalorimeterHitsCollection;
|
||||
|
||||
extern G4ThreadLocal G4Allocator<B5HadCalorimeterHit>* B5HadCalorimeterHitAllocator;
|
||||
|
||||
inline void* B5HadCalorimeterHit::operator new(size_t)
|
||||
{
|
||||
if (!B5HadCalorimeterHitAllocator)
|
||||
B5HadCalorimeterHitAllocator = new G4Allocator<B5HadCalorimeterHit>;
|
||||
return (void*)B5HadCalorimeterHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void B5HadCalorimeterHit::operator delete(void* aHit)
|
||||
{
|
||||
B5HadCalorimeterHitAllocator->FreeSingle((B5HadCalorimeterHit*) aHit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5HadCalorimeterSD.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5HadCalorimeterSD.hh
|
||||
/// \brief Definition of the B5HadCalorimeterSD class
|
||||
|
||||
#ifndef B5HadCalorimeterSD_h
|
||||
#define B5HadCalorimeterSD_h 1
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
#include "B5HadCalorimeterHit.hh"
|
||||
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
/// Hadron calorimeter sensitive detector
|
||||
|
||||
class B5HadCalorimeterSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
B5HadCalorimeterSD(G4String name);
|
||||
virtual ~B5HadCalorimeterSD();
|
||||
|
||||
virtual void Initialize(G4HCofThisEvent*HCE);
|
||||
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
|
||||
|
||||
private:
|
||||
B5HadCalorimeterHitsCollection* fHitsCollection;
|
||||
G4int fHCID;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5HodoscopeHit.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5HodoscopeHit.hh
|
||||
/// \brief Definition of the B5HodoscopeHit class
|
||||
|
||||
#ifndef B5HodoscopeHit_h
|
||||
#define B5HodoscopeHit_h 1
|
||||
|
||||
#include "G4VHit.hh"
|
||||
#include "G4THitsCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
class G4AttDef;
|
||||
class G4AttValue;
|
||||
|
||||
/// Hodoscope hit
|
||||
///
|
||||
/// It records:
|
||||
/// - the strip ID
|
||||
/// - the particle time
|
||||
/// - the strip logical volume, its position and rotation
|
||||
|
||||
class B5HodoscopeHit : public G4VHit
|
||||
{
|
||||
public:
|
||||
B5HodoscopeHit(G4int i,G4double t);
|
||||
B5HodoscopeHit(const B5HodoscopeHit &right);
|
||||
virtual ~B5HodoscopeHit();
|
||||
|
||||
const B5HodoscopeHit& operator=(const B5HodoscopeHit &right);
|
||||
int operator==(const B5HodoscopeHit &right) const;
|
||||
|
||||
inline void *operator new(size_t);
|
||||
inline void operator delete(void*aHit);
|
||||
|
||||
void Draw();
|
||||
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const;
|
||||
virtual std::vector<G4AttValue>* CreateAttValues() const;
|
||||
void Print();
|
||||
|
||||
G4int GetID() const { return fId; }
|
||||
|
||||
void SetTime(G4double val) { fTime = val; }
|
||||
G4double GetTime() const { return fTime; }
|
||||
|
||||
void SetPos(G4ThreeVector xyz) { fPos = xyz; }
|
||||
G4ThreeVector GetPos() const { return fPos; }
|
||||
|
||||
void SetRot(G4RotationMatrix rmat) { fRot = rmat; }
|
||||
G4RotationMatrix GetRot() const { return fRot; }
|
||||
|
||||
void SetLogV(G4LogicalVolume* val) { fPLogV = val; }
|
||||
const G4LogicalVolume* GetLogV() const { return fPLogV; }
|
||||
|
||||
private:
|
||||
G4int fId;
|
||||
G4double fTime;
|
||||
G4ThreeVector fPos;
|
||||
G4RotationMatrix fRot;
|
||||
const G4LogicalVolume* fPLogV;
|
||||
};
|
||||
|
||||
typedef G4THitsCollection<B5HodoscopeHit> B5HodoscopeHitsCollection;
|
||||
|
||||
extern G4ThreadLocal G4Allocator<B5HodoscopeHit>* B5HodoscopeHitAllocator;
|
||||
|
||||
inline void* B5HodoscopeHit::operator new(size_t)
|
||||
{
|
||||
if (!B5HodoscopeHitAllocator)
|
||||
B5HodoscopeHitAllocator = new G4Allocator<B5HodoscopeHit>;
|
||||
return (void*)B5HodoscopeHitAllocator->MallocSingle();
|
||||
}
|
||||
|
||||
inline void B5HodoscopeHit::operator delete(void*aHit)
|
||||
{
|
||||
B5HodoscopeHitAllocator->FreeSingle((B5HodoscopeHit*) aHit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5HodoscopeSD.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5HodoscopeSD.hh
|
||||
/// \brief Definition of the B5HodoscopeSD class
|
||||
|
||||
#ifndef B5HodoscopeSD_h
|
||||
#define B5HodoscopeSD_h 1
|
||||
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "B5HodoscopeHit.hh"
|
||||
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
/// Hodoscope sensitive detector
|
||||
|
||||
class B5HodoscopeSD : public G4VSensitiveDetector
|
||||
{
|
||||
public:
|
||||
B5HodoscopeSD(G4String name);
|
||||
virtual ~B5HodoscopeSD();
|
||||
|
||||
virtual void Initialize(G4HCofThisEvent*HCE);
|
||||
virtual G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
|
||||
|
||||
private:
|
||||
B5HodoscopeHitsCollection* fHitsCollection;
|
||||
G4int fHCID;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5MagneticField.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5MagneticField.hh
|
||||
/// \brief Definition of the B5MagneticField class
|
||||
|
||||
#ifndef B5MagneticField_H
|
||||
#define B5MagneticField_H 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4MagneticField.hh"
|
||||
|
||||
class G4GenericMessenger;
|
||||
|
||||
/// Magnetic field
|
||||
|
||||
class B5MagneticField : public G4MagneticField
|
||||
{
|
||||
public:
|
||||
B5MagneticField();
|
||||
virtual ~B5MagneticField();
|
||||
|
||||
virtual void GetFieldValue(const G4double point[4],double* bField ) const;
|
||||
|
||||
void SetField(G4double val) { fBy = val; }
|
||||
G4double GetField() const { return fBy; }
|
||||
|
||||
private:
|
||||
void DefineCommands();
|
||||
|
||||
G4GenericMessenger* fMessenger;
|
||||
G4double fBy;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5PrimaryGeneratorAction.hh 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the B5PrimaryGeneratorAction class
|
||||
|
||||
#ifndef B5PrimaryGeneratorAction_h
|
||||
#define B5PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4GenericMessenger;
|
||||
class G4Event;
|
||||
class G4ParticleDefinition;
|
||||
|
||||
/// Primary generator
|
||||
///
|
||||
/// A single particle is generated.
|
||||
/// User can select
|
||||
/// - the initial momentum and angle
|
||||
/// - the momentum and angle spreads
|
||||
/// - random selection of a particle type from proton, kaon+, pi+, muon+, e+
|
||||
|
||||
|
||||
class B5PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
B5PrimaryGeneratorAction();
|
||||
virtual ~B5PrimaryGeneratorAction();
|
||||
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
|
||||
void SetMomentum(G4double val) { fMomentum = val; }
|
||||
G4double GetMomentum() const { return fMomentum; }
|
||||
|
||||
void SetSigmaMomentum(G4double val) { fSigmaMomentum = val; }
|
||||
G4double GetSigmaMomentum() const { return fSigmaMomentum; }
|
||||
|
||||
void SetSigmaAngle(G4double val) { fSigmaAngle = val; }
|
||||
G4double GetSigmaAngle() const { return fSigmaAngle; }
|
||||
|
||||
void SetRandomize(G4bool val) { fRandomizePrimary = val; }
|
||||
G4bool GetRandomize() const { return fRandomizePrimary; }
|
||||
|
||||
private:
|
||||
void DefineCommands();
|
||||
|
||||
G4ParticleGun* fParticleGun;
|
||||
G4GenericMessenger* fMessenger;
|
||||
G4ParticleDefinition* fPositron;
|
||||
G4ParticleDefinition* fMuon;
|
||||
G4ParticleDefinition* fPion;
|
||||
G4ParticleDefinition* fKaon;
|
||||
G4ParticleDefinition* fProton;
|
||||
G4double fMomentum;
|
||||
G4double fSigmaMomentum;
|
||||
G4double fSigmaAngle;
|
||||
G4bool fRandomizePrimary;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5RunAction.hh 74204 2013-10-01 07:04:43Z ihrivnac $
|
||||
//
|
||||
/// \file B5RunAction.hh
|
||||
/// \brief Definition of the B5RunAction class
|
||||
|
||||
#ifndef B5RunAction_h
|
||||
#define B5RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Run;
|
||||
|
||||
/// Run action class
|
||||
|
||||
class B5RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
B5RunAction();
|
||||
virtual ~B5RunAction();
|
||||
|
||||
virtual void BeginOfRunAction(const G4Run*);
|
||||
virtual void EndOfRunAction(const G4Run*);
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Macro file for the initialization phase of example B5
|
||||
# when running in interactive mode without visualization
|
||||
#
|
||||
# Set some default verbose
|
||||
/control/verbose 2
|
||||
/control/saveHistory
|
||||
/run/verbose 2
|
||||
@@ -0,0 +1,11 @@
|
||||
# Macro file for the initialization phase of example B5
|
||||
# when running in interactive mode with visualization
|
||||
#
|
||||
# Set some default verbose
|
||||
#
|
||||
/control/verbose 2
|
||||
/control/saveHistory
|
||||
/run/verbose 2
|
||||
#
|
||||
# Visualization setting
|
||||
/control/execute vis.mac
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,26 @@
|
||||
# Macro file for example B5
|
||||
#
|
||||
# Can be run in batch, without graphic
|
||||
# or interactively: Idle> /control/execute run1.mac
|
||||
#
|
||||
# Defaults:
|
||||
# armAngle 30. deg
|
||||
# field value: 1.0*tesla
|
||||
/run/beamOn 3
|
||||
#
|
||||
/B5/detector/armAngle 0. deg
|
||||
/B5/field/value 0. tesla
|
||||
/run/beamOn 3
|
||||
#
|
||||
/B5/detector/armAngle 60. deg
|
||||
/B5/field/value 2. tesla
|
||||
/run/beamOn 3
|
||||
#
|
||||
/B5/detector/armAngle 30. deg
|
||||
/B5/field/value 1. tesla
|
||||
/B5/generator/momentum 2. GeV
|
||||
/B5/generator/sigmaMomentum 0.
|
||||
/B5/generator/sigmaAngle 0.
|
||||
/B5/generator/sigmaAngle 2. deg
|
||||
/run/beamOn 3
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# Macro file for example B5
|
||||
#
|
||||
# To be run preferably in batch, without graphics:
|
||||
# % exampleB5 run2.mac
|
||||
#
|
||||
# turn off randomization
|
||||
#
|
||||
/B5/generator/randomizePrimary FALSE
|
||||
/B5/generator/sigmaMomentum 0.
|
||||
/B5/generator/sigmaAngle 0.
|
||||
/run/verbose 1
|
||||
/run/printProgress 0
|
||||
#
|
||||
/B5/detector/armAngle 30. deg
|
||||
/gun/particle proton
|
||||
/B5/generator/momentum 100. GeV
|
||||
/B5/field/value 100. tesla
|
||||
/analysis/setFileName B5_proton
|
||||
/run/beamOn 30
|
||||
#
|
||||
/B5/detector/armAngle 60. deg
|
||||
/gun/particle pi+
|
||||
/B5/generator/momentum 100. GeV
|
||||
/B5/field/value 200. tesla
|
||||
/analysis/setFileName B5_pi+
|
||||
/run/beamOn 30
|
||||
#
|
||||
/gun/particle e+
|
||||
/B5/detector/armAngle 30. deg
|
||||
/B5/generator/momentum 100. GeV
|
||||
/B5/field/value 100. tesla
|
||||
/analysis/setFileName B5_e+
|
||||
/run/beamOn 30
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5ActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file B5ActionInitialization.cc
|
||||
/// \brief Implementation of the B5ActionInitialization class
|
||||
|
||||
#include "B5ActionInitialization.hh"
|
||||
#include "B5PrimaryGeneratorAction.hh"
|
||||
#include "B5RunAction.hh"
|
||||
#include "B5EventAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5ActionInitialization::B5ActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5ActionInitialization::~B5ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(new B5RunAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new B5PrimaryGeneratorAction);
|
||||
SetUserAction(new B5RunAction);
|
||||
SetUserAction(new B5EventAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5CellParameterisation.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5CellParameterisation.cc
|
||||
/// \brief Implementation of the B5CellParameterisation class
|
||||
|
||||
#include "B5CellParameterisation.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5CellParameterisation::B5CellParameterisation()
|
||||
: G4VPVParameterisation()
|
||||
{
|
||||
for (G4int copyNo=0;copyNo<80;copyNo++)
|
||||
{
|
||||
G4int column = copyNo / 4;
|
||||
G4int row = copyNo % 4;
|
||||
fXCell[copyNo] = (column-9)*15.*cm - 7.5*cm;
|
||||
fYCell[copyNo] = (row-1)*15*cm - 7.5*cm;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5CellParameterisation::~B5CellParameterisation()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5CellParameterisation::ComputeTransformation
|
||||
(const G4int copyNo,G4VPhysicalVolume *physVol) const
|
||||
{
|
||||
physVol->SetTranslation(G4ThreeVector(fXCell[copyNo],fYCell[copyNo],0.));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,497 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5DetectorConstruction.cc 77656 2013-11-27 08:52:57Z gcosmo $
|
||||
//
|
||||
/// \file B5DetectorConstruction.cc
|
||||
/// \brief Implementation of the B5DetectorConstruction class
|
||||
|
||||
#include "B5DetectorConstruction.hh"
|
||||
#include "B5MagneticField.hh"
|
||||
#include "B5CellParameterisation.hh"
|
||||
#include "B5HodoscopeSD.hh"
|
||||
#include "B5DriftChamberSD.hh"
|
||||
#include "B5EmCalorimeterSD.hh"
|
||||
#include "B5HadCalorimeterSD.hh"
|
||||
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4Mag_UsualEqRhs.hh"
|
||||
#include "G4AutoDelete.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
#include "G4UserLimits.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal B5MagneticField* B5DetectorConstruction::fMagneticField = 0;
|
||||
G4ThreadLocal G4FieldManager* B5DetectorConstruction::fFieldMgr = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DetectorConstruction::B5DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fMessenger(0),
|
||||
fHodoscope1Logical(0), fHodoscope2Logical(0),
|
||||
fWirePlane1Logical(0), fWirePlane2Logical(0),
|
||||
fCellLogical(0), fHadCalScintiLogical(0),
|
||||
fMagneticLogical(0),
|
||||
fVisAttributes(),
|
||||
fArmAngle(30.*deg), fArmRotation(0), fSecondArmPhys(0)
|
||||
|
||||
{
|
||||
fArmRotation = new G4RotationMatrix();
|
||||
fArmRotation->rotateY(fArmAngle);
|
||||
|
||||
// define commands for this class
|
||||
DefineCommands();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DetectorConstruction::~B5DetectorConstruction()
|
||||
{
|
||||
delete fArmRotation;
|
||||
delete fMessenger;
|
||||
|
||||
for (G4int i=0; i<G4int(fVisAttributes.size()); ++i)
|
||||
{
|
||||
delete fVisAttributes[i];
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* B5DetectorConstruction::Construct()
|
||||
{
|
||||
// Construct materials
|
||||
ConstructMaterials();
|
||||
G4Material* air = G4Material::GetMaterial("G4_AIR");
|
||||
//G4Material* argonGas = G4Material::GetMaterial("B5_Ar");
|
||||
G4Material* argonGas = G4Material::GetMaterial("G4_Ar");
|
||||
G4Material* scintillator
|
||||
= G4Material::GetMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
|
||||
G4Material* csI = G4Material::GetMaterial("G4_CESIUM_IODIDE");
|
||||
G4Material* lead = G4Material::GetMaterial("G4_Pb");
|
||||
|
||||
// Option to switch on/off checking of volumes overlaps
|
||||
//
|
||||
G4bool checkOverlaps = true;
|
||||
|
||||
// geometries --------------------------------------------------------------
|
||||
// experimental hall (world volume)
|
||||
G4VSolid* worldSolid
|
||||
= new G4Box("worldBox",10.*m,3.*m,10.*m);
|
||||
G4LogicalVolume* worldLogical
|
||||
= new G4LogicalVolume(worldSolid,air,"worldLogical");
|
||||
G4VPhysicalVolume* worldPhysical
|
||||
= new G4PVPlacement(0,G4ThreeVector(),worldLogical,"worldPhysical",0,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// Tube with Local Magnetic field
|
||||
|
||||
G4VSolid* magneticSolid
|
||||
= new G4Tubs("magneticTubs",0.,1.*m,1.*m,0.,360.*deg);
|
||||
|
||||
fMagneticLogical
|
||||
= new G4LogicalVolume(magneticSolid, air, "magneticLogical");
|
||||
|
||||
// placement of Tube
|
||||
|
||||
G4RotationMatrix* fieldRot = new G4RotationMatrix();
|
||||
fieldRot->rotateX(90.*deg);
|
||||
new G4PVPlacement(fieldRot,G4ThreeVector(),fMagneticLogical,
|
||||
"magneticPhysical",worldLogical,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// set step limit in tube with magnetic field
|
||||
G4UserLimits* userLimits = new G4UserLimits(1*m);
|
||||
fMagneticLogical->SetUserLimits(userLimits);
|
||||
|
||||
// first arm
|
||||
G4VSolid* firstArmSolid
|
||||
= new G4Box("firstArmBox",1.5*m,1.*m,3.*m);
|
||||
G4LogicalVolume* firstArmLogical
|
||||
= new G4LogicalVolume(firstArmSolid,air,"firstArmLogical");
|
||||
new G4PVPlacement(0,G4ThreeVector(0.,0.,-5.*m),firstArmLogical,
|
||||
"firstArmPhysical",worldLogical,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// second arm
|
||||
G4VSolid* secondArmSolid
|
||||
= new G4Box("secondArmBox",2.*m,2.*m,3.5*m);
|
||||
G4LogicalVolume* secondArmLogical
|
||||
= new G4LogicalVolume(secondArmSolid,air,"secondArmLogical");
|
||||
G4double x = -5.*m * std::sin(fArmAngle);
|
||||
G4double z = 5.*m * std::cos(fArmAngle);
|
||||
fSecondArmPhys
|
||||
= new G4PVPlacement(fArmRotation,G4ThreeVector(x,0.,z),secondArmLogical,
|
||||
"fSecondArmPhys",worldLogical,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// hodoscopes in first arm
|
||||
G4VSolid* hodoscope1Solid
|
||||
= new G4Box("hodoscope1Box",5.*cm,20.*cm,0.5*cm);
|
||||
fHodoscope1Logical
|
||||
= new G4LogicalVolume(hodoscope1Solid,scintillator,"hodoscope1Logical");
|
||||
for (G4int i=0;i<15;i++)
|
||||
{
|
||||
G4double x1 = (i-7)*10.*cm;
|
||||
new G4PVPlacement(0,G4ThreeVector(x1,0.,-1.5*m),fHodoscope1Logical,
|
||||
"hodoscope1Physical",firstArmLogical,
|
||||
false,i,checkOverlaps);
|
||||
}
|
||||
|
||||
// drift chambers in first arm
|
||||
G4VSolid* chamber1Solid
|
||||
= new G4Box("chamber1Box",1.*m,30.*cm,1.*cm);
|
||||
G4LogicalVolume* chamber1Logical
|
||||
= new G4LogicalVolume(chamber1Solid,argonGas,"chamber1Logical");
|
||||
for (G4int i=0;i<5;i++)
|
||||
{
|
||||
G4double z1 = (i-2)*0.5*m;
|
||||
new G4PVPlacement(0,G4ThreeVector(0.,0.,z1),chamber1Logical,
|
||||
"chamber1Physical",firstArmLogical,
|
||||
false,i,checkOverlaps);
|
||||
}
|
||||
|
||||
// "virtual" wire plane
|
||||
G4VSolid* wirePlane1Solid
|
||||
= new G4Box("wirePlane1Box",1.*m,30.*cm,0.1*mm);
|
||||
fWirePlane1Logical
|
||||
= new G4LogicalVolume(wirePlane1Solid,argonGas,"wirePlane1Logical");
|
||||
new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),fWirePlane1Logical,
|
||||
"wirePlane1Physical",chamber1Logical,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// hodoscopes in second arm
|
||||
G4VSolid* hodoscope2Solid
|
||||
= new G4Box("hodoscope2Box",5.*cm,20.*cm,0.5*cm);
|
||||
fHodoscope2Logical
|
||||
= new G4LogicalVolume(hodoscope2Solid,scintillator,"hodoscope2Logical");
|
||||
for (G4int i=0;i<25;i++)
|
||||
{
|
||||
G4double x2 = (i-12)*10.*cm;
|
||||
new G4PVPlacement(0,G4ThreeVector(x2,0.,0.),fHodoscope2Logical,
|
||||
"hodoscope2Physical",secondArmLogical,
|
||||
false,i,checkOverlaps);
|
||||
}
|
||||
|
||||
// drift chambers in second arm
|
||||
G4VSolid* chamber2Solid
|
||||
= new G4Box("chamber2Box",1.5*m,30.*cm,1.*cm);
|
||||
G4LogicalVolume* chamber2Logical
|
||||
= new G4LogicalVolume(chamber2Solid,argonGas,"chamber2Logical");
|
||||
for (G4int i=0;i<5;i++)
|
||||
{
|
||||
G4double z2 = (i-2)*0.5*m - 1.5*m;
|
||||
new G4PVPlacement(0,G4ThreeVector(0.,0.,z2),chamber2Logical,
|
||||
"chamber2Physical",secondArmLogical,
|
||||
false,i,checkOverlaps);
|
||||
}
|
||||
|
||||
// "virtual" wire plane
|
||||
G4VSolid* wirePlane2Solid
|
||||
= new G4Box("wirePlane2Box",1.5*m,30.*cm,0.1*mm);
|
||||
fWirePlane2Logical
|
||||
= new G4LogicalVolume(wirePlane2Solid,argonGas,"wirePlane2Logical");
|
||||
new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),fWirePlane2Logical,
|
||||
"wirePlane2Physical",chamber2Logical,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// CsI calorimeter
|
||||
G4VSolid* emCalorimeterSolid
|
||||
= new G4Box("EMcalorimeterBox",1.5*m,30.*cm,15.*cm);
|
||||
G4LogicalVolume* emCalorimeterLogical
|
||||
= new G4LogicalVolume(emCalorimeterSolid,csI,"EMcalorimeterLogical");
|
||||
new G4PVPlacement(0,G4ThreeVector(0.,0.,2.*m),emCalorimeterLogical,
|
||||
"EMcalorimeterPhysical",secondArmLogical,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// EMcalorimeter cells
|
||||
G4VSolid* cellSolid
|
||||
= new G4Box("cellBox",7.5*cm,7.5*cm,15.*cm);
|
||||
fCellLogical
|
||||
= new G4LogicalVolume(cellSolid,csI,"cellLogical");
|
||||
G4VPVParameterisation* cellParam = new B5CellParameterisation();
|
||||
new G4PVParameterised("cellPhysical",fCellLogical,emCalorimeterLogical,
|
||||
kXAxis,80,cellParam);
|
||||
|
||||
// hadron calorimeter
|
||||
G4VSolid* hadCalorimeterSolid
|
||||
= new G4Box("HadCalorimeterBox",1.5*m,30.*cm,50.*cm);
|
||||
G4LogicalVolume* hadCalorimeterLogical
|
||||
= new G4LogicalVolume(hadCalorimeterSolid,lead,"HadCalorimeterLogical");
|
||||
new G4PVPlacement(0,G4ThreeVector(0.,0.,3.*m),hadCalorimeterLogical,
|
||||
"HadCalorimeterPhysical",secondArmLogical,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// hadron calorimeter column
|
||||
G4VSolid* HadCalColumnSolid
|
||||
= new G4Box("HadCalColumnBox",15.*cm,30.*cm,50.*cm);
|
||||
G4LogicalVolume* HadCalColumnLogical
|
||||
= new G4LogicalVolume(HadCalColumnSolid,lead,"HadCalColumnLogical");
|
||||
new G4PVReplica("HadCalColumnPhysical",HadCalColumnLogical,
|
||||
hadCalorimeterLogical,kXAxis,10,30.*cm);
|
||||
|
||||
// hadron calorimeter cell
|
||||
G4VSolid* HadCalCellSolid
|
||||
= new G4Box("HadCalCellBox",15.*cm,15.*cm,50.*cm);
|
||||
G4LogicalVolume* HadCalCellLogical
|
||||
= new G4LogicalVolume(HadCalCellSolid,lead,"HadCalCellLogical");
|
||||
new G4PVReplica("HadCalCellPhysical",HadCalCellLogical,
|
||||
HadCalColumnLogical,kYAxis,2,30.*cm);
|
||||
|
||||
// hadron calorimeter layers
|
||||
G4VSolid* HadCalLayerSolid
|
||||
= new G4Box("HadCalLayerBox",15.*cm,15.*cm,2.5*cm);
|
||||
G4LogicalVolume* HadCalLayerLogical
|
||||
= new G4LogicalVolume(HadCalLayerSolid,lead,"HadCalLayerLogical");
|
||||
new G4PVReplica("HadCalLayerPhysical",HadCalLayerLogical,
|
||||
HadCalCellLogical,kZAxis,20,5.*cm);
|
||||
|
||||
// scintillator plates
|
||||
G4VSolid* HadCalScintiSolid
|
||||
= new G4Box("HadCalScintiBox",15.*cm,15.*cm,0.5*cm);
|
||||
fHadCalScintiLogical
|
||||
= new G4LogicalVolume(HadCalScintiSolid,scintillator,
|
||||
"HadCalScintiLogical");
|
||||
new G4PVPlacement(0,G4ThreeVector(0.,0.,2.*cm),fHadCalScintiLogical,
|
||||
"HadCalScintiPhysical",HadCalLayerLogical,
|
||||
false,0,checkOverlaps);
|
||||
|
||||
// visualization attributes ------------------------------------------------
|
||||
|
||||
G4VisAttributes* visAttributes = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
visAttributes->SetVisibility(false);
|
||||
worldLogical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(0.9,0.9,0.9)); // LightGray
|
||||
fMagneticLogical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
visAttributes->SetVisibility(false);
|
||||
firstArmLogical->SetVisAttributes(visAttributes);
|
||||
secondArmLogical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(0.8888,0.0,0.0));
|
||||
fHodoscope1Logical->SetVisAttributes(visAttributes);
|
||||
fHodoscope2Logical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
|
||||
chamber1Logical->SetVisAttributes(visAttributes);
|
||||
chamber2Logical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(0.0,0.8888,0.0));
|
||||
visAttributes->SetVisibility(false);
|
||||
fWirePlane1Logical->SetVisAttributes(visAttributes);
|
||||
fWirePlane2Logical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(0.8888,0.8888,0.0));
|
||||
visAttributes->SetVisibility(false);
|
||||
emCalorimeterLogical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(0.9,0.9,0.0));
|
||||
fCellLogical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9));
|
||||
hadCalorimeterLogical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
visAttributes = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9));
|
||||
visAttributes->SetVisibility(false);
|
||||
HadCalColumnLogical->SetVisAttributes(visAttributes);
|
||||
HadCalCellLogical->SetVisAttributes(visAttributes);
|
||||
HadCalLayerLogical->SetVisAttributes(visAttributes);
|
||||
fHadCalScintiLogical->SetVisAttributes(visAttributes);
|
||||
fVisAttributes.push_back(visAttributes);
|
||||
|
||||
// return the world physical volume ----------------------------------------
|
||||
|
||||
return worldPhysical;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
// sensitive detectors -----------------------------------------------------
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
G4String SDname;
|
||||
|
||||
G4VSensitiveDetector* hodoscope1
|
||||
= new B5HodoscopeSD(SDname="/hodoscope1");
|
||||
SDman->AddNewDetector(hodoscope1);
|
||||
fHodoscope1Logical->SetSensitiveDetector(hodoscope1);
|
||||
|
||||
G4VSensitiveDetector* hodoscope2
|
||||
= new B5HodoscopeSD(SDname="/hodoscope2");
|
||||
SDman->AddNewDetector(hodoscope2);
|
||||
fHodoscope2Logical->SetSensitiveDetector(hodoscope2);
|
||||
|
||||
G4VSensitiveDetector* chamber1
|
||||
= new B5DriftChamberSD(SDname="/chamber1");
|
||||
SDman->AddNewDetector(chamber1);
|
||||
fWirePlane1Logical->SetSensitiveDetector(chamber1);
|
||||
|
||||
G4VSensitiveDetector* chamber2
|
||||
= new B5DriftChamberSD(SDname="/chamber2");
|
||||
SDman->AddNewDetector(chamber2);
|
||||
fWirePlane2Logical->SetSensitiveDetector(chamber2);
|
||||
|
||||
G4VSensitiveDetector* emCalorimeter
|
||||
= new B5EmCalorimeterSD(SDname="/EMcalorimeter");
|
||||
SDman->AddNewDetector(emCalorimeter);
|
||||
fCellLogical->SetSensitiveDetector(emCalorimeter);
|
||||
|
||||
G4VSensitiveDetector* hadCalorimeter
|
||||
= new B5HadCalorimeterSD(SDname="/HadCalorimeter");
|
||||
SDman->AddNewDetector(hadCalorimeter);
|
||||
fHadCalScintiLogical->SetSensitiveDetector(hadCalorimeter);
|
||||
|
||||
// magnetic field ----------------------------------------------------------
|
||||
fMagneticField = new B5MagneticField();
|
||||
fFieldMgr = new G4FieldManager();
|
||||
fFieldMgr->SetDetectorField(fMagneticField);
|
||||
fFieldMgr->CreateChordFinder(fMagneticField);
|
||||
G4bool forceToAllDaughters = true;
|
||||
fMagneticLogical->SetFieldManager(fFieldMgr, forceToAllDaughters);
|
||||
|
||||
// Register the field and its manager for deleting
|
||||
G4AutoDelete::Register(fMagneticField);
|
||||
G4AutoDelete::Register(fFieldMgr);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DetectorConstruction::ConstructMaterials()
|
||||
{
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
|
||||
// Air
|
||||
nistManager->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
// Argon gas
|
||||
nistManager->FindOrBuildMaterial("G4_Ar");
|
||||
// With a density different from the one defined in NIST
|
||||
// G4double density = 1.782e-03*g/cm3;
|
||||
// nistManager->BuildMaterialWithNewDensity("B5_Ar","G4_Ar",density);
|
||||
// !! cases segmentation fault
|
||||
|
||||
// Scintillator
|
||||
// (PolyVinylToluene, C_9H_10)
|
||||
nistManager->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE");
|
||||
|
||||
// CsI
|
||||
nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
|
||||
|
||||
// Lead
|
||||
nistManager->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
// Vacuum "Galactic"
|
||||
// nistManager->FindOrBuildMaterial("G4_Galactic");
|
||||
|
||||
// Vacuum "Air with low density"
|
||||
// G4Material* air = G4Material::GetMaterial("G4_AIR");
|
||||
// G4double density = 1.0e-5*air->GetDensity();
|
||||
// nistManager
|
||||
// ->BuildMaterialWithNewDensity("Air_lowDensity", "G4_AIR", density);
|
||||
|
||||
G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DetectorConstruction::SetArmAngle(G4double val)
|
||||
{
|
||||
if (!fSecondArmPhys)
|
||||
{
|
||||
G4cerr << "Detector has not yet been constructed." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
fArmAngle = val;
|
||||
*fArmRotation = G4RotationMatrix(); // make it unit vector
|
||||
fArmRotation->rotateY(fArmAngle);
|
||||
G4double x = -5.*m * std::sin(fArmAngle);
|
||||
G4double z = 5.*m * std::cos(fArmAngle);
|
||||
fSecondArmPhys->SetTranslation(G4ThreeVector(x,0.,z));
|
||||
|
||||
// tell G4RunManager that we change the geometry
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DetectorConstruction::DefineCommands()
|
||||
{
|
||||
// Define /B5/detector command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/B5/detector/",
|
||||
"Detector control");
|
||||
|
||||
// armAngle command
|
||||
G4GenericMessenger::Command& armAngleCmd
|
||||
= fMessenger->DeclareMethodWithUnit("armAngle","deg",
|
||||
&B5DetectorConstruction::SetArmAngle,
|
||||
"Set rotation angle of the second arm.");
|
||||
armAngleCmd.SetParameterName("angle", true);
|
||||
armAngleCmd.SetRange("angle>=0. && angle<180.");
|
||||
armAngleCmd.SetDefaultValue("30.");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5DriftChamberHit.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5DriftChamberHit.cc
|
||||
/// \brief Implementation of the B5DriftChamberHit class
|
||||
|
||||
#include "B5DriftChamberHit.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<B5DriftChamberHit>* B5DriftChamberHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberHit::B5DriftChamberHit()
|
||||
: G4VHit(), fLayerID(-1), fTime(0.), fLocalPos(0), fWorldPos(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberHit::B5DriftChamberHit(G4int z)
|
||||
: G4VHit(), fLayerID(z), fTime(0.), fLocalPos(0), fWorldPos(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberHit::~B5DriftChamberHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberHit::B5DriftChamberHit(const B5DriftChamberHit &right)
|
||||
: G4VHit() {
|
||||
fLayerID = right.fLayerID;
|
||||
fWorldPos = right.fWorldPos;
|
||||
fLocalPos = right.fLocalPos;
|
||||
fTime = right.fTime;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const B5DriftChamberHit& B5DriftChamberHit::operator=(const B5DriftChamberHit &right)
|
||||
{
|
||||
fLayerID = right.fLayerID;
|
||||
fWorldPos = right.fWorldPos;
|
||||
fLocalPos = right.fLocalPos;
|
||||
fTime = right.fTime;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int B5DriftChamberHit::operator==(const B5DriftChamberHit &/*right*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DriftChamberHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(fWorldPos);
|
||||
circle.SetScreenSize(2);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1.,1.,0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* B5DriftChamberHit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("B5DriftChamberHit",isNew);
|
||||
|
||||
if (isNew) {
|
||||
(*store)["HitType"]
|
||||
= G4AttDef("HitType","Hit Type","Physics","","G4String");
|
||||
|
||||
(*store)["ID"]
|
||||
= G4AttDef("ID","ID","Physics","","G4int");
|
||||
|
||||
(*store)["Time"]
|
||||
= G4AttDef("Time","Time","Physics","G4BestUnit","G4double");
|
||||
|
||||
(*store)["Pos"]
|
||||
= G4AttDef("Pos", "Position", "Physics","G4BestUnit","G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* B5DriftChamberHit::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values
|
||||
->push_back(G4AttValue("HitType","DriftChamberHit",""));
|
||||
values
|
||||
->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fLayerID),""));
|
||||
values
|
||||
->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
|
||||
values
|
||||
->push_back(G4AttValue("Pos",G4BestUnit(fWorldPos,"Length"),""));
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DriftChamberHit::Print()
|
||||
{
|
||||
G4cout << " Layer[" << fLayerID << "] : time " << fTime/ns
|
||||
<< " (nsec) --- local (x,y) " << fLocalPos.x()
|
||||
<< ", " << fLocalPos.y() << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5DriftChamberSD.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5DriftChamberSD.cc
|
||||
/// \brief Implementation of the B5DriftChamber class
|
||||
|
||||
#include "B5DriftChamberSD.hh"
|
||||
#include "B5DriftChamberHit.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberSD::B5DriftChamberSD(G4String name)
|
||||
: G4VSensitiveDetector(name), fHitsCollection(0), fHCID(-1)
|
||||
{
|
||||
collectionName.insert("driftChamberColl");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5DriftChamberSD::~B5DriftChamberSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5DriftChamberSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fHitsCollection
|
||||
= new B5DriftChamberHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
if (fHCID<0)
|
||||
{ fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection); }
|
||||
hce->AddHitsCollection(fHCID,fHitsCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5DriftChamberSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
{
|
||||
G4double charge = step->GetTrack()->GetDefinition()->GetPDGCharge();
|
||||
if (charge==0.) return true;
|
||||
|
||||
G4StepPoint* preStepPoint = step->GetPreStepPoint();
|
||||
|
||||
G4TouchableHistory* touchable
|
||||
= (G4TouchableHistory*)(step->GetPreStepPoint()->GetTouchable());
|
||||
G4VPhysicalVolume* motherPhysical = touchable->GetVolume(1); // mother
|
||||
G4int copyNo = motherPhysical->GetCopyNo();
|
||||
|
||||
G4ThreeVector worldPos = preStepPoint->GetPosition();
|
||||
G4ThreeVector localPos
|
||||
= touchable->GetHistory()->GetTopTransform().TransformPoint(worldPos);
|
||||
|
||||
B5DriftChamberHit* hit = new B5DriftChamberHit(copyNo);
|
||||
hit->SetWorldPos(worldPos);
|
||||
hit->SetLocalPos(localPos);
|
||||
hit->SetTime(preStepPoint->GetGlobalTime());
|
||||
|
||||
fHitsCollection->insert(hit);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,177 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5EmCalorimeterHit.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5EmCalorimeterHit.cc
|
||||
/// \brief Implementation of the B5EmCalorimeterHit class
|
||||
|
||||
#include "B5EmCalorimeterHit.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<B5EmCalorimeterHit>* B5EmCalorimeterHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterHit::B5EmCalorimeterHit()
|
||||
: G4VHit(), fCellID(-1), fEdep(0.), fPos(0), fPLogV(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterHit::B5EmCalorimeterHit(G4int z)
|
||||
: G4VHit(), fCellID(z), fEdep(0.), fPos(0), fPLogV(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterHit::~B5EmCalorimeterHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterHit::B5EmCalorimeterHit(const B5EmCalorimeterHit &right)
|
||||
: G4VHit() {
|
||||
fCellID = right.fCellID;
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
fPLogV = right.fPLogV;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const B5EmCalorimeterHit& B5EmCalorimeterHit::operator=(const B5EmCalorimeterHit
|
||||
&right)
|
||||
{
|
||||
fCellID = right.fCellID;
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
fPLogV = right.fPLogV;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int B5EmCalorimeterHit::operator==(const B5EmCalorimeterHit &right) const
|
||||
{
|
||||
return (fCellID==right.fCellID);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EmCalorimeterHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if (pVVisManager&&(fEdep>0.))
|
||||
{
|
||||
// Draw a calorimeter cell with a color corresponding to its energy deposit
|
||||
G4Transform3D trans(fRot.inverse(),fPos);
|
||||
G4VisAttributes attribs;
|
||||
const G4VisAttributes* pVA = fPLogV->GetVisAttributes();
|
||||
if (pVA) attribs = *pVA;
|
||||
G4double rcol = fEdep/(0.7*GeV);
|
||||
if (rcol>1.) rcol = 1.;
|
||||
if (rcol<0.4) rcol = 0.4;
|
||||
G4Colour colour(rcol,0.,0.);
|
||||
attribs.SetColour(colour);
|
||||
attribs.SetForceSolid(true);
|
||||
pVVisManager->Draw(*fPLogV,attribs,trans);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* B5EmCalorimeterHit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("B5EmCalorimeterHit",isNew);
|
||||
|
||||
if (isNew) {
|
||||
(*store)["HitType"]
|
||||
= G4AttDef("HitType","Hit Type","Physics","","G4String");
|
||||
|
||||
(*store)["ID"]
|
||||
= G4AttDef("ID","ID","Physics","","G4int");
|
||||
|
||||
(*store)["Energy"]
|
||||
= G4AttDef("Energy", "Energy Deposited", "Physics", "G4BestUnit",
|
||||
"G4double");
|
||||
|
||||
(*store)["Pos"]
|
||||
= G4AttDef("Pos", "Position", "Physics","G4BestUnit",
|
||||
"G4ThreeVector");
|
||||
|
||||
(*store)["LVol"]
|
||||
= G4AttDef("LVol","Logical Volume","Physics","","G4String");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* B5EmCalorimeterHit::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values
|
||||
->push_back(G4AttValue("HitType","EmCalorimeterHit",""));
|
||||
values
|
||||
->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fCellID),""));
|
||||
values
|
||||
->push_back(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
|
||||
values
|
||||
->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
|
||||
|
||||
if (fPLogV)
|
||||
values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
|
||||
else
|
||||
values->push_back(G4AttValue("LVol"," ",""));
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EmCalorimeterHit::Print()
|
||||
{
|
||||
G4cout << " Cell[" << fCellID << "] " << fEdep/MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5EmCalorimeterSD.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5EmCalorimeterSD.cc
|
||||
/// \brief Implementation of the B5EmCalorimeterSD class
|
||||
|
||||
#include "B5EmCalorimeterSD.hh"
|
||||
#include "B5EmCalorimeterHit.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterSD::B5EmCalorimeterSD(G4String name)
|
||||
: G4VSensitiveDetector(name), fHitsCollection(0), fHCID(-1)
|
||||
{
|
||||
collectionName.insert("EMcalorimeterColl");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EmCalorimeterSD::~B5EmCalorimeterSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EmCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fHitsCollection
|
||||
= new B5EmCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
if (fHCID<0)
|
||||
{ fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection); }
|
||||
hce->AddHitsCollection(fHCID,fHitsCollection);
|
||||
|
||||
// fill calorimeter hits with zero energy deposition
|
||||
for (G4int i=0;i<80;i++)
|
||||
{
|
||||
B5EmCalorimeterHit* hit = new B5EmCalorimeterHit(i);
|
||||
fHitsCollection->insert(hit);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5EmCalorimeterSD::ProcessHits(G4Step*step, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = step->GetTotalEnergyDeposit();
|
||||
if (edep==0.) return true;
|
||||
|
||||
G4TouchableHistory* touchable
|
||||
= (G4TouchableHistory*)(step->GetPreStepPoint()->GetTouchable());
|
||||
G4VPhysicalVolume* physical = touchable->GetVolume();
|
||||
G4int copyNo = physical->GetCopyNo();
|
||||
|
||||
B5EmCalorimeterHit* hit = (*fHitsCollection)[copyNo];
|
||||
// check if it is first touch
|
||||
if (!(hit->GetLogV()))
|
||||
{
|
||||
// fill volume information
|
||||
hit->SetLogV(physical->GetLogicalVolume());
|
||||
G4AffineTransform transform
|
||||
= touchable->GetHistory()->GetTopTransform();
|
||||
transform.Invert();
|
||||
hit->SetRot(transform.NetRotation());
|
||||
hit->SetPos(transform.NetTranslation());
|
||||
}
|
||||
// add energy deposition
|
||||
hit->AddEdep(edep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,270 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5EventAction.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5EventAction.cc
|
||||
/// \brief Implementation of the B5EventAction class
|
||||
|
||||
#include "B5EventAction.hh"
|
||||
#include "B5HodoscopeHit.hh"
|
||||
#include "B5DriftChamberHit.hh"
|
||||
#include "B5EmCalorimeterHit.hh"
|
||||
#include "B5HadCalorimeterHit.hh"
|
||||
#include "B5Analysis.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EventAction::B5EventAction()
|
||||
: G4UserEventAction(),
|
||||
fHHC1ID(-1),
|
||||
fHHC2ID(-1),
|
||||
fDHC1ID(-1),
|
||||
fDHC2ID(-1),
|
||||
fECHCID(-1),
|
||||
fHCHCID(-1)
|
||||
{
|
||||
// set printing per each event
|
||||
G4RunManager::GetRunManager()->SetPrintProgress(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5EventAction::~B5EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EventAction::BeginOfEventAction(const G4Event*)
|
||||
{
|
||||
if (fHHC1ID==-1) {
|
||||
G4SDManager* sdManager = G4SDManager::GetSDMpointer();
|
||||
fHHC1ID = sdManager->GetCollectionID("hodoscope1/hodoscopeColl");
|
||||
fHHC2ID = sdManager->GetCollectionID("hodoscope2/hodoscopeColl");
|
||||
fDHC1ID = sdManager->GetCollectionID("chamber1/driftChamberColl");
|
||||
fDHC2ID = sdManager->GetCollectionID("chamber2/driftChamberColl");
|
||||
fECHCID = sdManager->GetCollectionID("EMcalorimeter/EMcalorimeterColl");
|
||||
fHCHCID = sdManager->GetCollectionID("HadCalorimeter/HadCalorimeterColl");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5EventAction::EndOfEventAction(const G4Event* event)
|
||||
{
|
||||
G4HCofThisEvent* hce = event->GetHCofThisEvent();
|
||||
if (!hce)
|
||||
{
|
||||
G4ExceptionDescription msg;
|
||||
msg << "No hits collection of this event found.\n";
|
||||
G4Exception("B5EventAction::EndOfEventAction()",
|
||||
"B5Code001", JustWarning, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Get hits collections
|
||||
B5HodoscopeHitsCollection* hHC1
|
||||
= static_cast<B5HodoscopeHitsCollection*>(hce->GetHC(fHHC1ID));
|
||||
|
||||
B5HodoscopeHitsCollection* hHC2
|
||||
= static_cast<B5HodoscopeHitsCollection*>(hce->GetHC(fHHC2ID));
|
||||
|
||||
B5DriftChamberHitsCollection* dHC1
|
||||
= static_cast<B5DriftChamberHitsCollection*>(hce->GetHC(fDHC1ID));
|
||||
|
||||
B5DriftChamberHitsCollection* dHC2
|
||||
= static_cast<B5DriftChamberHitsCollection*>(hce->GetHC(fDHC2ID));
|
||||
|
||||
B5EmCalorimeterHitsCollection* ecHC
|
||||
= static_cast<B5EmCalorimeterHitsCollection*>(hce->GetHC(fECHCID));
|
||||
|
||||
B5HadCalorimeterHitsCollection* hcHC
|
||||
= static_cast<B5HadCalorimeterHitsCollection*>(hce->GetHC(fHCHCID));
|
||||
|
||||
if ( (!hHC1) || (!hHC2) || (!dHC1) || (!dHC2) || (!ecHC) || (!hcHC) )
|
||||
{
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Some of hits collections of this event not found.\n";
|
||||
G4Exception("B5EventAction::EndOfEventAction()",
|
||||
"B5Code001", JustWarning, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Fill histograms & ntuple
|
||||
//
|
||||
|
||||
// Get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Fill histograms
|
||||
|
||||
G4int n_hit = dHC1->entries();
|
||||
analysisManager->FillH1(0, n_hit);
|
||||
|
||||
for (G4int i=0;i<n_hit;i++)
|
||||
{
|
||||
B5DriftChamberHit* hit = (*dHC1)[i];
|
||||
G4ThreeVector localPos = hit->GetLocalPos();
|
||||
analysisManager->FillH2(0, localPos.x(), localPos.y());
|
||||
}
|
||||
|
||||
n_hit = dHC2->entries();
|
||||
analysisManager->FillH1(1, n_hit);
|
||||
|
||||
for (G4int i=0;i<n_hit;i++)
|
||||
{
|
||||
B5DriftChamberHit* hit = (*dHC2)[i];
|
||||
G4ThreeVector localPos = hit->GetLocalPos();
|
||||
analysisManager->FillH2(1, localPos.x(), localPos.y());
|
||||
}
|
||||
|
||||
|
||||
// Fill ntuple
|
||||
|
||||
// Dc1Hits
|
||||
analysisManager->FillNtupleIColumn(0, dHC1->entries());
|
||||
// Dc2Hits
|
||||
analysisManager->FillNtupleIColumn(1, dHC1->entries());
|
||||
|
||||
// ECEnergy
|
||||
G4int totalEmHit = 0;
|
||||
G4double totalEmE = 0.;
|
||||
for (G4int i=0;i<80;i++)
|
||||
{
|
||||
B5EmCalorimeterHit* hit = (*ecHC)[i];
|
||||
G4double eDep = hit->GetEdep();
|
||||
if (eDep>0.)
|
||||
{
|
||||
totalEmHit++;
|
||||
totalEmE += eDep;
|
||||
}
|
||||
}
|
||||
analysisManager->FillNtupleDColumn(2, totalEmE);
|
||||
|
||||
// HCEnergy
|
||||
G4int totalHadHit = 0;
|
||||
G4double totalHadE = 0.;
|
||||
for (G4int i=0;i<20;i++)
|
||||
{
|
||||
B5HadCalorimeterHit* hit = (*hcHC)[i];
|
||||
G4double eDep = hit->GetEdep();
|
||||
if (eDep>0.)
|
||||
{
|
||||
totalHadHit++;
|
||||
totalHadE += eDep;
|
||||
}
|
||||
}
|
||||
analysisManager->FillNtupleDColumn(3, totalHadE);
|
||||
|
||||
// Time 1
|
||||
for (G4int i=0;i<hHC1->entries();i++)
|
||||
{
|
||||
analysisManager->FillNtupleDColumn(4,(*hHC1)[i]->GetTime());
|
||||
}
|
||||
|
||||
// Time 2
|
||||
for (G4int i=0;i<hHC2->entries();i++)
|
||||
{
|
||||
analysisManager->FillNtupleDColumn(5,(*hHC2)[i]->GetTime());
|
||||
}
|
||||
|
||||
analysisManager->AddNtupleRow();
|
||||
|
||||
//
|
||||
// Print diagnostics
|
||||
//
|
||||
|
||||
G4int printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
|
||||
if ( printModulo==0 || event->GetEventID() % printModulo != 0) return;
|
||||
|
||||
G4PrimaryParticle* primary = event->GetPrimaryVertex(0)->GetPrimary(0);
|
||||
G4cout << G4endl
|
||||
<< ">>> Event " << event->GetEventID() << " >>> Simulation truth : "
|
||||
<< primary->GetG4code()->GetParticleName()
|
||||
<< " " << primary->GetMomentum() << G4endl;
|
||||
|
||||
// Hodoscope 1
|
||||
n_hit = hHC1->entries();
|
||||
G4cout << "Hodoscope 1 has " << n_hit << " hits." << G4endl;
|
||||
for (G4int i=0;i<n_hit;i++)
|
||||
{
|
||||
B5HodoscopeHit* hit = (*hHC1)[i];
|
||||
hit->Print();
|
||||
}
|
||||
|
||||
// Hodoscope 2
|
||||
n_hit = hHC2->entries();
|
||||
G4cout << "Hodoscope 2 has " << n_hit << " hits." << G4endl;
|
||||
for (G4int i=0;i<n_hit;i++)
|
||||
{
|
||||
B5HodoscopeHit* hit = (*hHC2)[i];
|
||||
hit->Print();
|
||||
}
|
||||
|
||||
// Drift chamber 1
|
||||
n_hit = dHC1->entries();
|
||||
G4cout << "Drift Chamber 1 has " << n_hit << " hits." << G4endl;
|
||||
for (G4int i2=0;i2<5;i2++)
|
||||
{
|
||||
for (G4int i=0;i<n_hit;i++)
|
||||
{
|
||||
B5DriftChamberHit* hit = (*dHC1)[i];
|
||||
if (hit->GetLayerID()==i2) hit->Print();
|
||||
}
|
||||
}
|
||||
|
||||
// Drift chamber 2
|
||||
n_hit = dHC2->entries();
|
||||
G4cout << "Drift Chamber 2 has " << n_hit << " hits." << G4endl;
|
||||
for (G4int i2=0;i2<5;i2++)
|
||||
{
|
||||
for (G4int i=0;i<n_hit;i++)
|
||||
{
|
||||
B5DriftChamberHit* hit = (*dHC2)[i];
|
||||
if (hit->GetLayerID()==i2) hit->Print();
|
||||
}
|
||||
}
|
||||
|
||||
// EM calorimeter
|
||||
G4cout << "EM Calorimeter has " << totalEmHit << " hits. Total Edep is "
|
||||
<< totalEmE/MeV << " (MeV)" << G4endl;
|
||||
|
||||
// Had calorimeter
|
||||
G4cout << "Hadron Calorimeter has " << totalHadHit << " hits. Total Edep is "
|
||||
<< totalHadE/MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,174 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5HadCalorimeterHit.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5HadCalorimeterHit.cc
|
||||
/// \brief Implementation of the B5HadCalorimeterHit class
|
||||
|
||||
#include "B5HadCalorimeterHit.hh"
|
||||
#include "B5DetectorConstruction.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<B5HadCalorimeterHit>* B5HadCalorimeterHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterHit::B5HadCalorimeterHit()\
|
||||
: G4VHit(), fColumnID(-1), fRowID(-1), fEdep(0.), fPos(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterHit::B5HadCalorimeterHit(G4int iCol,G4int iRow)
|
||||
: G4VHit(), fColumnID(iCol), fRowID(iRow), fEdep(0.), fPos(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterHit::~B5HadCalorimeterHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterHit::B5HadCalorimeterHit(const B5HadCalorimeterHit &right)
|
||||
: G4VHit() {
|
||||
fColumnID = right.fColumnID;
|
||||
fRowID = right.fRowID;
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const B5HadCalorimeterHit& B5HadCalorimeterHit::operator=(const
|
||||
B5HadCalorimeterHit &right)
|
||||
{
|
||||
fColumnID = right.fColumnID;
|
||||
fRowID = right.fRowID;
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int B5HadCalorimeterHit::operator==(const B5HadCalorimeterHit &right) const
|
||||
{
|
||||
return (fColumnID==right.fColumnID&&fRowID==right.fRowID);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HadCalorimeterHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if (pVVisManager&&(fEdep>0.))
|
||||
{
|
||||
// Draw a calorimeter cell with depth propotional to the energy deposition
|
||||
G4Transform3D trans(fRot.inverse(),fPos);
|
||||
G4VisAttributes attribs;
|
||||
G4Colour colour(1.,0.,0.);
|
||||
attribs.SetColour(colour);
|
||||
attribs.SetForceSolid(true);
|
||||
G4Box box("dummy",15.*cm,15.*cm,1.*m*fEdep/(0.1*GeV));
|
||||
pVVisManager->Draw(box,attribs,trans);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* B5HadCalorimeterHit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("B5HadCalorimeterHit",isNew);
|
||||
|
||||
if (isNew) {
|
||||
(*store)["HitType"]
|
||||
= G4AttDef("HitType","Hit Type","Physics","","G4String");
|
||||
|
||||
(*store)["Column"]
|
||||
= G4AttDef("Column","Column ID","Physics","","G4int");
|
||||
|
||||
(*store)["Row"]
|
||||
= G4AttDef("Row","Row ID","Physics","","G4int");
|
||||
|
||||
(*store)["Energy"]
|
||||
= G4AttDef("Energy","Energy Deposited","Physics","G4BestUnit",
|
||||
"G4double");
|
||||
|
||||
(*store)["Pos"]
|
||||
= G4AttDef("Pos", "Position", "Physics","G4BestUnit",
|
||||
"G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* B5HadCalorimeterHit::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values
|
||||
->push_back(G4AttValue("HitType","HadCalorimeterHit",""));
|
||||
values
|
||||
->push_back(G4AttValue("Column",G4UIcommand::ConvertToString(fColumnID),
|
||||
""));
|
||||
values
|
||||
->push_back(G4AttValue("Row",G4UIcommand::ConvertToString(fRowID),""));
|
||||
values
|
||||
->push_back(G4AttValue("Energy",G4BestUnit(fEdep,"Energy"),""));
|
||||
values
|
||||
->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HadCalorimeterHit::Print()
|
||||
{
|
||||
G4cout << " Cell[" << fRowID << ", " << fColumnID << "] "
|
||||
<< fEdep/MeV << " (MeV) " << fPos << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5HadCalorimeterSD.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5HadCalorimeterSD.cc
|
||||
/// \brief Implementation of the B5HadCalorimeterSD class
|
||||
|
||||
#include "B5HadCalorimeterSD.hh"
|
||||
#include "B5HadCalorimeterHit.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterSD::B5HadCalorimeterSD(G4String name)
|
||||
: G4VSensitiveDetector(name), fHitsCollection(0), fHCID(-1)
|
||||
{
|
||||
collectionName.insert("HadCalorimeterColl");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HadCalorimeterSD::~B5HadCalorimeterSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HadCalorimeterSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fHitsCollection
|
||||
= new B5HadCalorimeterHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
if (fHCID<0)
|
||||
{ fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection); }
|
||||
hce->AddHitsCollection(fHCID,fHitsCollection);
|
||||
|
||||
// fill calorimeter hits with zero energy deposition
|
||||
for (G4int iColumn=0;iColumn<10;iColumn++)
|
||||
for (G4int iRow=0;iRow<2;iRow++)
|
||||
{
|
||||
B5HadCalorimeterHit* hit = new B5HadCalorimeterHit();
|
||||
fHitsCollection->insert(hit);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5HadCalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = step->GetTotalEnergyDeposit();
|
||||
if (edep==0.) return true;
|
||||
|
||||
G4TouchableHistory* touchable
|
||||
= (G4TouchableHistory*)(step->GetPreStepPoint()->GetTouchable());
|
||||
|
||||
G4VPhysicalVolume* cellPhysical = touchable->GetVolume(2);
|
||||
G4int rowNo = cellPhysical->GetCopyNo();
|
||||
|
||||
G4VPhysicalVolume* columnPhysical = touchable->GetVolume(3);
|
||||
G4int columnNo = columnPhysical->GetCopyNo();
|
||||
|
||||
G4int hitID = 2*columnNo+rowNo;
|
||||
B5HadCalorimeterHit* hit = (*fHitsCollection)[hitID];
|
||||
|
||||
// check if it is first touch
|
||||
if (hit->GetColumnID()<0)
|
||||
{
|
||||
hit->SetColumnID(columnNo);
|
||||
hit->SetRowID(rowNo);
|
||||
G4int depth = touchable->GetHistory()->GetDepth();
|
||||
G4AffineTransform transform
|
||||
= touchable->GetHistory()->GetTransform(depth-2);
|
||||
transform.Invert();
|
||||
hit->SetRot(transform.NetRotation());
|
||||
hit->SetPos(transform.NetTranslation());
|
||||
}
|
||||
// add energy deposition
|
||||
hit->AddEdep(edep);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,165 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5HodoscopeHit.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5HodoscopeHit.cc
|
||||
/// \brief Implementation of the B5HodoscopeHit class
|
||||
|
||||
#include "B5HodoscopeHit.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal G4Allocator<B5HodoscopeHit>* B5HodoscopeHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeHit::B5HodoscopeHit(G4int i,G4double t)
|
||||
: G4VHit(), fId(i), fTime(t), fPos(0), fPLogV(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeHit::~B5HodoscopeHit()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeHit::B5HodoscopeHit(const B5HodoscopeHit &right)
|
||||
: G4VHit() {
|
||||
fId = right.fId;
|
||||
fTime = right.fTime;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
fPLogV = right.fPLogV;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const B5HodoscopeHit& B5HodoscopeHit::operator=(const B5HodoscopeHit &right)
|
||||
{
|
||||
fId = right.fId;
|
||||
fTime = right.fTime;
|
||||
fPos = right.fPos;
|
||||
fRot = right.fRot;
|
||||
fPLogV = right.fPLogV;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int B5HodoscopeHit::operator==(const B5HodoscopeHit &/*right*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HodoscopeHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if (pVVisManager)
|
||||
{
|
||||
G4Transform3D trans(fRot.inverse(),fPos);
|
||||
G4VisAttributes attribs;
|
||||
const G4VisAttributes* pVA = fPLogV->GetVisAttributes();
|
||||
if (pVA) attribs = *pVA;
|
||||
G4Colour colour(0.,1.,1.);
|
||||
attribs.SetColour(colour);
|
||||
attribs.SetForceSolid(true);
|
||||
pVVisManager->Draw(*fPLogV,attribs,trans);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* B5HodoscopeHit::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("B5HodoscopeHit",isNew);
|
||||
|
||||
if (isNew) {
|
||||
(*store)["HitType"]
|
||||
= G4AttDef("HitType","Hit Type","Physics","","G4String");
|
||||
|
||||
(*store)["ID"]
|
||||
= G4AttDef("ID","ID","Physics","","G4int");
|
||||
|
||||
(*store)["Time"]
|
||||
= G4AttDef("Time","Time","Physics","G4BestUnit","G4double");
|
||||
|
||||
(*store)["Pos"]
|
||||
= G4AttDef("Pos","Position","Physics","G4BestUnit","G4ThreeVector");
|
||||
|
||||
(*store)["LVol"]
|
||||
= G4AttDef("LVol","Logical Volume","Physics","","G4String");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
std::vector<G4AttValue>* B5HodoscopeHit::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values
|
||||
->push_back(G4AttValue("HitType","HodoscopeHit",""));
|
||||
values
|
||||
->push_back(G4AttValue("ID",G4UIcommand::ConvertToString(fId),""));
|
||||
values
|
||||
->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
|
||||
values
|
||||
->push_back(G4AttValue("Pos",G4BestUnit(fPos,"Length"),""));
|
||||
|
||||
if (fPLogV)
|
||||
values->push_back(G4AttValue("LVol",fPLogV->GetName(),""));
|
||||
else
|
||||
values->push_back(G4AttValue("LVol"," ",""));
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HodoscopeHit::Print()
|
||||
{
|
||||
G4cout << " Hodoscope[" << fId << "] " << fTime/ns << " (nsec)" << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5HodoscopeSD.cc 76474 2013-11-11 10:36:34Z gcosmo $
|
||||
//
|
||||
/// \file B5HodoscopeSD.cc
|
||||
/// \brief Implementation of the B5HodoscopeSD class
|
||||
|
||||
#include "B5HodoscopeSD.hh"
|
||||
#include "B5HodoscopeHit.hh"
|
||||
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeSD::B5HodoscopeSD(G4String name)
|
||||
: G4VSensitiveDetector(name), fHitsCollection(0), fHCID(-1)
|
||||
{
|
||||
G4String HCname = "hodoscopeColl";
|
||||
collectionName.insert(HCname);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5HodoscopeSD::~B5HodoscopeSD()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5HodoscopeSD::Initialize(G4HCofThisEvent* hce)
|
||||
{
|
||||
fHitsCollection = new B5HodoscopeHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
if (fHCID<0)
|
||||
{ fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(fHitsCollection); }
|
||||
hce->AddHitsCollection(fHCID,fHitsCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool B5HodoscopeSD::ProcessHits(G4Step* step, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = step->GetTotalEnergyDeposit();
|
||||
if (edep==0.) return true;
|
||||
|
||||
G4StepPoint* preStepPoint = step->GetPreStepPoint();
|
||||
|
||||
G4TouchableHistory* touchable
|
||||
= (G4TouchableHistory*)(preStepPoint->GetTouchable());
|
||||
G4int copyNo = touchable->GetVolume()->GetCopyNo();
|
||||
G4double hitTime = preStepPoint->GetGlobalTime();
|
||||
|
||||
// check if this finger already has a hit
|
||||
G4int ix = -1;
|
||||
for (G4int i=0;i<fHitsCollection->entries();i++)
|
||||
{
|
||||
if ((*fHitsCollection)[i]->GetID()==copyNo)
|
||||
{
|
||||
ix = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ix>=0)
|
||||
// if it has, then take the earlier time
|
||||
{
|
||||
if ((*fHitsCollection)[ix]->GetTime()>hitTime)
|
||||
{ (*fHitsCollection)[ix]->SetTime(hitTime); }
|
||||
}
|
||||
else
|
||||
// if not, create a new hit and set it to the collection
|
||||
{
|
||||
B5HodoscopeHit* hit = new B5HodoscopeHit(copyNo,hitTime);
|
||||
G4VPhysicalVolume* physical = touchable->GetVolume();
|
||||
hit->SetLogV(physical->GetLogicalVolume());
|
||||
G4AffineTransform transform
|
||||
= touchable->GetHistory()->GetTopTransform();
|
||||
transform.Invert();
|
||||
hit->SetRot(transform.NetRotation());
|
||||
hit->SetPos(transform.NetTranslation());
|
||||
fHitsCollection->insert(hit);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5MagneticField.cc 77656 2013-11-27 08:52:57Z gcosmo $
|
||||
//
|
||||
/// \file B5MagneticField.cc
|
||||
/// \brief Implementation of the B5MagneticField class
|
||||
|
||||
#include "B5MagneticField.hh"
|
||||
|
||||
#include "G4GenericMessenger.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5MagneticField::B5MagneticField()
|
||||
: G4MagneticField(), fMessenger(0), fBy(1.0*tesla)
|
||||
{
|
||||
// define commands for this class
|
||||
DefineCommands();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5MagneticField::~B5MagneticField()
|
||||
{
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
void B5MagneticField::GetFieldValue(const G4double [4],double *bField) const
|
||||
{
|
||||
bField[0] = 0.;
|
||||
bField[1] = fBy;
|
||||
bField[2] = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5MagneticField::DefineCommands()
|
||||
{
|
||||
// Define /B5/field command directory using generic messenger class
|
||||
fMessenger = new G4GenericMessenger(this,
|
||||
"/B5/field/",
|
||||
"Field control");
|
||||
|
||||
// fieldValue command
|
||||
G4GenericMessenger::Command& valueCmd
|
||||
= fMessenger->DeclareMethodWithUnit("value","tesla",
|
||||
&B5MagneticField::SetField,
|
||||
"Set field strength.");
|
||||
valueCmd.SetParameterName("field", true);
|
||||
valueCmd.SetDefaultValue("1.");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,175 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5PrimaryGeneratorAction.cc 77781 2013-11-28 07:54:07Z gcosmo $
|
||||
//
|
||||
/// \file B5PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B5PrimaryGeneratorAction class
|
||||
|
||||
#include "B5PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4GenericMessenger.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5PrimaryGeneratorAction::B5PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0), fMessenger(0),
|
||||
fPositron(0), fMuon(0), fPion(0), fKaon(0), fProton(0),
|
||||
fMomentum(1000.*MeV),
|
||||
fSigmaMomentum(50.*MeV),
|
||||
fSigmaAngle(2.*deg),
|
||||
fRandomizePrimary(true)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
fPositron = particleTable->FindParticle(particleName="e+");
|
||||
fMuon = particleTable->FindParticle(particleName="mu+");
|
||||
fPion = particleTable->FindParticle(particleName="pi+");
|
||||
fKaon = particleTable->FindParticle(particleName="kaon+");
|
||||
fProton = particleTable->FindParticle(particleName="proton");
|
||||
|
||||
// default particle kinematics
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,-8.*m));
|
||||
fParticleGun->SetParticleDefinition(fPositron);
|
||||
|
||||
// define commands for this class
|
||||
DefineCommands();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5PrimaryGeneratorAction::~B5PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5PrimaryGeneratorAction::GeneratePrimaries(G4Event* event)
|
||||
{
|
||||
G4ParticleDefinition* particle;
|
||||
|
||||
if (fRandomizePrimary)
|
||||
{
|
||||
G4int i = (int)(5.*G4UniformRand());
|
||||
switch(i)
|
||||
{
|
||||
case 0:
|
||||
particle = fPositron;
|
||||
break;
|
||||
case 1:
|
||||
particle = fMuon;
|
||||
break;
|
||||
case 2:
|
||||
particle = fPion;
|
||||
break;
|
||||
case 3:
|
||||
particle = fKaon;
|
||||
break;
|
||||
default:
|
||||
particle = fProton;
|
||||
break;
|
||||
}
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
}
|
||||
else
|
||||
{
|
||||
particle = fParticleGun->GetParticleDefinition();
|
||||
}
|
||||
|
||||
G4double pp = fMomentum + (G4UniformRand()-0.5)*fSigmaMomentum;
|
||||
G4double mass = particle->GetPDGMass();
|
||||
G4double Ekin = std::sqrt(pp*pp+mass*mass)-mass;
|
||||
fParticleGun->SetParticleEnergy(Ekin);
|
||||
|
||||
G4double angle = (G4UniformRand()-0.5)*fSigmaAngle;
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(std::sin(angle),0.,
|
||||
std::cos(angle)));
|
||||
|
||||
fParticleGun->GeneratePrimaryVertex(event);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5PrimaryGeneratorAction::DefineCommands()
|
||||
{
|
||||
// Define /B5/generator command directory using generic messenger class
|
||||
fMessenger
|
||||
= new G4GenericMessenger(this,
|
||||
"/B5/generator/",
|
||||
"Primary generator control");
|
||||
|
||||
// momentum command
|
||||
G4GenericMessenger::Command& momentumCmd
|
||||
= fMessenger->DeclarePropertyWithUnit("momentum", "GeV", fMomentum,
|
||||
"Mean momentum of primaries.");
|
||||
momentumCmd.SetParameterName("p", true);
|
||||
momentumCmd.SetRange("p>=0.");
|
||||
momentumCmd.SetDefaultValue("1.");
|
||||
// ok
|
||||
//momentumCmd.SetParameterName("p", true);
|
||||
//momentumCmd.SetRange("p>=0.");
|
||||
|
||||
// sigmaMomentum command
|
||||
G4GenericMessenger::Command& sigmaMomentumCmd
|
||||
= fMessenger->DeclarePropertyWithUnit("sigmaMomentum",
|
||||
"MeV", fSigmaMomentum, "Sigma momentum of primaries.");
|
||||
sigmaMomentumCmd.SetParameterName("sp", true);
|
||||
sigmaMomentumCmd.SetRange("sp>=0.");
|
||||
sigmaMomentumCmd.SetDefaultValue("50.");
|
||||
|
||||
// sigmaAngle command
|
||||
G4GenericMessenger::Command& sigmaAngleCmd
|
||||
= fMessenger->DeclarePropertyWithUnit("sigmaAngle", "deg", fSigmaAngle,
|
||||
"Sigma angle divergence of primaries.");
|
||||
sigmaAngleCmd.SetParameterName("t", true);
|
||||
sigmaAngleCmd.SetRange("t>=0.");
|
||||
sigmaAngleCmd.SetDefaultValue("2.");
|
||||
|
||||
// randomizePrimary command
|
||||
G4GenericMessenger::Command& randomCmd
|
||||
= fMessenger->DeclareProperty("randomizePrimary", fRandomizePrimary);
|
||||
G4String guidance
|
||||
= "Boolean flag for randomizing primary particle types.\n";
|
||||
guidance
|
||||
+= "In case this flag is false, you can select the primary particle\n";
|
||||
guidance += " with /gun/particle command.";
|
||||
randomCmd.SetGuidance(guidance);
|
||||
randomCmd.SetParameterName("flg", true);
|
||||
randomCmd.SetDefaultValue("true");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: B5RunAction.cc 74204 2013-10-01 07:04:43Z ihrivnac $
|
||||
//
|
||||
/// \file B5RunAction.cc
|
||||
/// \brief Implementation of the B5RunAction class
|
||||
|
||||
#include "B5RunAction.hh"
|
||||
#include "B5Analysis.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5RunAction::B5RunAction()
|
||||
: G4UserRunAction()
|
||||
{
|
||||
// Create analysis manager
|
||||
// The choice of analysis technology is done via selectin of a namespace
|
||||
// in B5Analysis.hh
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
|
||||
// Default settings
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetFileName("B5");
|
||||
|
||||
// Book histograms, ntuple
|
||||
//
|
||||
|
||||
// Creating 1D histograms
|
||||
analysisManager
|
||||
->CreateH1("Chamber1","Drift Chamber 1 # Hits", 50, 0., 50); // h1 Id = 0
|
||||
analysisManager
|
||||
->CreateH1("Chamber2","Drift Chamber 2 # Hits", 50, 0., 50); // h1 Id = 1
|
||||
|
||||
// Creating 2D histograms
|
||||
analysisManager
|
||||
->CreateH2("Chamber1 XY","Drift Chamber 1 X vs Y", // h2 Id = 0
|
||||
50, -1000., 1000, 50, -300., 300.);
|
||||
analysisManager
|
||||
->CreateH2("Chamber2 XY","Drift Chamber 2 X vs Y", // h2 Id = 1
|
||||
50, -1500., 1500, 50, -300., 300.);
|
||||
|
||||
// Creating ntuple
|
||||
//
|
||||
analysisManager->CreateNtuple("B5", "Hits");
|
||||
analysisManager->CreateNtupleIColumn("Dc1Hits"); // column Id = 0
|
||||
analysisManager->CreateNtupleIColumn("Dc2Hits"); // column Id = 1
|
||||
analysisManager->CreateNtupleDColumn("ECEnergy"); // column Id = 2
|
||||
analysisManager->CreateNtupleDColumn("HCEnergy"); // column Id = 3
|
||||
analysisManager->CreateNtupleDColumn("Time1"); // column Id = 4
|
||||
analysisManager->CreateNtupleDColumn("Time2"); // column Id = 5
|
||||
analysisManager->FinishNtuple();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B5RunAction::~B5RunAction()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
//inform the runManager to save random number seed
|
||||
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
|
||||
// Get analysis manager
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Open an output file
|
||||
// The default file name is set in B5RunAction::B5RunAction(),
|
||||
// it can be overwritten in a macro
|
||||
analysisManager->OpenFile();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B5RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
// save histograms & ntuple
|
||||
//
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,79 @@
|
||||
#
|
||||
# Macro file for exampleB5
|
||||
#
|
||||
# Set verbosity
|
||||
#
|
||||
/control/verbose 2
|
||||
#
|
||||
# Use this open statement to create an OpenGL view:
|
||||
/vis/open OGL 600x600-0+0
|
||||
#
|
||||
# Use this open statement to create a .prim file suitable for
|
||||
# viewing in DAWN:
|
||||
#/vis/open DAWNFILE
|
||||
#
|
||||
# Use this open statement to create a .heprep file suitable for
|
||||
# viewing in HepRApp:
|
||||
#/vis/open HepRepFile
|
||||
#
|
||||
# Use this open statement to create a .wrl file suitable for
|
||||
# viewing in a VRML viewer:
|
||||
#/vis/open VRML2FILE
|
||||
#
|
||||
# Disable auto refresh and quieten vis messages whilst scene and
|
||||
# trajectories are established:
|
||||
/vis/viewer/set/autoRefresh false
|
||||
/vis/verbose errors
|
||||
#
|
||||
# Draw geometry:
|
||||
/vis/drawVolume
|
||||
#
|
||||
# Specify view angle:
|
||||
#/vis/viewer/set/viewpointThetaPhi 90. 0.
|
||||
#
|
||||
# Specify zoom value:
|
||||
/vis/viewer/zoom 1.6
|
||||
#
|
||||
# Specify style (surface or wireframe):
|
||||
#/vis/viewer/set/style wireframe
|
||||
#
|
||||
# Draw coordinate axes:
|
||||
#/vis/scene/add/axes 0 0 0 1 m
|
||||
#
|
||||
# Draw smooth trajectories at end of event, showing trajectory points
|
||||
# as markers 2 pixels wide:
|
||||
/vis/scene/add/trajectories smooth
|
||||
/vis/modeling/trajectories/create/drawByCharge
|
||||
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
|
||||
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2
|
||||
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
|
||||
#
|
||||
# Draw hits at end of event:
|
||||
#/vis/scene/add/hits
|
||||
#
|
||||
# To draw only gammas:
|
||||
#/vis/filtering/trajectories/create/particleFilter
|
||||
#/vis/filtering/trajectories/particleFilter-0/add gamma
|
||||
#
|
||||
# To invert the above, drawing all particles except gammas,
|
||||
# keep the above two lines but also add:
|
||||
#/vis/filtering/trajectories/particleFilter-0/invert true
|
||||
#
|
||||
# Many other options are available with /vis/modeling and /vis/filtering.
|
||||
# For example, to select colour by particle ID:
|
||||
#/vis/modeling/trajectories/create/drawByParticleID
|
||||
#/vis/modeling/trajectories/drawByParticleID-0/set e- blue
|
||||
#
|
||||
# To superimpose all of the events from a given run:
|
||||
#/vis/scene/endOfEventAction accumulate
|
||||
#
|
||||
# Re-establish auto refreshing and verbosity:
|
||||
/vis/viewer/set/autoRefresh true
|
||||
/vis/verbose warnings
|
||||
#
|
||||
# For file-based drivers, use this to create an empty detector view:
|
||||
#/vis/viewer/flush
|
||||
#
|
||||
# Set visualization to accumulate events into one picture
|
||||
#
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
Reference in New Issue
Block a user