Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -1,73 +0,0 @@
///\file "analysis/AnaEx03/.README.AIDA.txt"
///\brief Example AnaEx03 README.AIDA page
/*! \page ExampleAnaEx03AIDA Example AnaEx03 - Install AIDA
To use histograms, at least one of the AIDA implementations should be
available.
You can use various file formats to write histograms (hbook, root, AIDA-XML).
\section ExampleAnaEx03AIDA_s1 OpenScientist (lal/in2p3)
OpenScientist is available at http://OpenScientist.lal.in2p3.fr.
osc_batch is a small package ( ~ 6MB), easy to install.
It provides an AIDA interface to write files in ROOT or HBOOK formats.
See the specific \link ExampleAnaEx03OpenScientist README.OpenScientist \endlink
page for more.
\section ExampleAnaEx03AIDA_s2 RAIDA (desy)
It is a ROOT based AIDA interface. It can be downloaded from
http://ilcsoft.desy.de/portal/software_packages/raida/index_eng.html
\section ExampleAnaEx03AIDA_s3 iAIDA
Another package including AIDA (an evolution of the former cern PI project)
is the iAIDA package: http://iaida.dynalias.net
Once you have installed iAIDA in a specified local area $MYIAIDA, it is
required to add the installation path to $PATH, i.e. for example, for
release 1.0.11 of iAIDA:
\verbatim
setenv PATH ${PATH}:$MYIAIDA/bin
\endverbatim
Before running the example the command should be issued:
\verbatim
eval `aida-config --runtime csh`
\endverbatim
\section ExampleAnaEx03AIDA_s4 JAIDA (slac)
JAIDA is an implementation of AIDA in Java. To use it, one needs Java
as well as AIDAJNI, a connector between AIDA-C++ and AIDA-Java.
Available for: Linux-g++2, Linux-g++3, WIN32-VC, SUN-CC,
Darwin-g++2, Darwin-g++3
To compile and link with JAIDA using AIDAJNI, make sure you have:
-# JAIDA: see http://java.freehep.org/jaida
-# set enviroment variable JAIDA_HOME to your JAIDA installation
-# source the aida-setup script $JAIDA_HOME/bin/aida-setup.[sh|csh|win32] \n\n
-# AIDAJNI: see http://java.freehep.org/aidajni
-# set environment variable AIDAJNI_HOME to your AIDAJNI installation
-# set environment variable JDK_HOME to your Java Standard Development Kit (1.4.x or up).
-# source the aidajni-setup script $AIDAJNI_HOME/bin/$G4SYSTEM/aidajni-setup.[sh|csh|win32]
Last tested versions (with Geant4 examples): JAIDA 3.2.0, AIDAJNI 3.2.0.
Now execute:
\verbatim
source setup-analysis (.csh, .sh, .win32)
gmake clean
gmake
\endverbatim
*/
@@ -1,55 +0,0 @@
///\file "analysis/AnaEx03/.README.OpenScientist.txt"
///\brief Example AnaEx03 README.OpenScientist page
/*! \page ExampleAnaEx03OpenScientist Example AnaEx03 - Working with the OpenScientist packages
To create the analysis file, you can install the light "osc_batch"
binary kit (See http://OpenScientist.lal.in2p3.fr ). For example
from a UNIX sh flavoured shell :
\verbatim
sh> cd /usr/local
sh> <arrange to be su>
sh> <get an osc_batch binary kit>
sh> unzip -q osc_batch<platform>.zip
sh> cd osc_batch/<version>
sh> ./install
\endverbatim
Then before building the example you have to source the OpenScientist
environment with :
\verbatim
<create another terminal>
sh> . /usr/local/osc_batch/<version>/aida-setup.sh
or
csh> source /usr/local/osc_batch/<version>/aida-setup.csh
\endverbatim
Depending of the file format, you can visualize the produced
file with various interactive tools (CERN/PAW, CERN/ROOT, jas).
But if installing also an OpenScientist osc_vis binary kit,
you shall be able to visualize all formats by using
the osc-plot program. To install an osc_vis kit :
\verbatim
sh> cd /usr/local
sh> <arrange to be su>
sh> <get an osc_vis binary kit>
sh> unzip -q osc_vis<platform>.zip
sh> cd osc_vis/<version>
sh> ./install
\endverbatim
Then to browse the AnaEx03.[format] file (for exa from an UNIX sh shell) :
\verbatim
<create another terminal>
sh> . /usr/local/osc_vis/<version>/setup.sh
sh> <setenv DISPLAY if needed>
sh> osc-plot AnaEx03.[aida,root,hbook]
\endverbatim
The OpenScientist URL is :
- http://OpenScientist.lal.in2p3.fr.
Note that OpenScientist is installed on CERN/lxplus under :
- /afs/cern.ch/sw/contrib/[osc_batch,osc_vis].
*/
@@ -1,160 +0,0 @@
///\file "analysis/AnaEx03/.README.txt"
///\brief Example AnaEx03 README page
/*! \page ExampleAnaEx03 Example AnaEx03
Examples AnaEx01, AnaEx02 and AnaEx03 show the usage of histogram and tuple
manipulations using G4Analysis, ROOT and AIDA compliant systems on the same
scenario. All analysis manipulations (histo booking, filling, saving histos
in a file, etc...) are located in one class : HistoManager, implementation of
which is different in each example. All the other classes are same in all
three examples.
This example shows the usage of histogram and tuple manipulations using
an AIDA compliant system.
The example is an adaptation of examples/novice/N03. It describes a simple
sampling calorimeter setup.
\section AnaEx03_s1 Detector description
The calorimeter is a box made of a given number of layers. A layer
consists of an absorber plate and of a detection gap. The layer is
replicated.
Six parameters define the calorimeter :
- the material of the absorber,
- the thickness of an absorber plate,
- the material of the detection gap,
- the thickness of a gap,
- the number of layers,
- the transverse size of the calorimeter (the input face is a square).
The default geometry is constructed in DetectorConstruction class,
but all of the above parameters can be modified interactively via
the commands defined in the DetectorMessenger class.
<pre>
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
| | | |
==========================================================================
|| | || | || | ||
|| | || | || | ||
beam || absorber | gap || absorber | gap || absorber | gap ||
======> || | || | || | ||
|| | || | || | ||
==========================================================================
</pre>
\section AnaEx03_s2 Physics list
The particle's type and the physic processes which will be available
in this example are set in the FTFP_BERT physics list.
\section AnaEx03_s3 Action Initialization
A newly introduced class, ActionInitialization,
instantiates and registers to Geant4 kernel all user action classes
which are defined thread-local and a run action class
which is defined both thread-local and global.
The thread-local action classes are defined in
ActionInitialization::Build()
and the global run action class is defined in
ActionInitialization::BuildForMaster().
Note that ActionInitialization::Build() is also used to
instatiate user action clasess in sequential mode.
\section AnaEx03_s4 An event : PrimaryGeneratorAction
The primary kinematic consists of a single particle which hits the
calorimeter perpendicular to the input face. The type of the particle
and its energy are set in the PrimaryGeneratorAction class, and can
be changed via the G4 build-in commands of ParticleGun class.
\section AnaEx03_s5 Histograms
To produce histograms, at least one of the AIDA implementations should be
available. See the file InstallAida.txt
AnaEx03 can produce 4 histograms :
- EAbs : total energy deposit in absorber per event
- EGap : total energy deposit in gap per event
- LAbs : total track length of charged particles in absorber per event
- LGap : total track length of charged particles in gap per event
And 2 Ntuples :
- Ntuple1:
- one row per event : EnergyAbs EnergyGap
- Ntuple2:
- one row per event : TrackLAbs TrackLGap
These histos and ntuples are booked in HistoManager and filled from
EventAction.
One can control the name of the histograms file and its format:
- default name : AnaEx03
Possible formats : hbook root (default) xml
See HistoManager constructor
Note that, by default, histograms are disabled. To activate them, uncomment
the flag G4ANALYSIS_USE in GNUmakefile, *before* compilation.
\section AnaEx03_s6 AIDA and OpenScientist
See the pages \link ExampleAnaEx03AIDA README.AIDA \endlink and
\link ExampleAnaEx03OpenScientist README.OpenScientist \endlink
for more indications how to use this system to visualize and handle
histogram files.
\section AnaEx02_s7 How to build
An additional step is needed when building the example with GNUmake
due to using the extra shared directory:
\verbatim
% cd path_to_AnaEx03/AnaEx03
% gmake setup
% gmake
\endverbatim
This will copy the files from shared in the example include and src;
to remove these files:
\verbatim
% gmake clean_setup
\endverbatim
\section AnaEx03_s8 HOW TO RUN
- Execute AnaEx03 in the 'interactive mode' with visualization
\verbatim
% ./AnaEx03
and type in the commands from run.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 run.mac
....
Idle> exit
\endverbatim
- Execute AnaEx03 in the 'batch' mode from macro files
(without visualization)
\verbatim
% ./AnaEx03 run.mac
% ./AnaEx03 run.mac > run.out
\endverbatim
The AnaEx03.in macro is used in Geant4 testing.
*/
@@ -1,125 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file analysis/AnaEx03/AnaEx03.cc
/// \brief Main program of the analysis/AnaEx03 example
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "HistoManager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
// Detect interactive mode (if no arguments) and define UI session
//
G4UIExecutive* ui = 0;
if ( argc == 1 ) {
ui = new G4UIExecutive(argc, argv);
}
// Construct the default run manager
//
auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
// Set mandatory initialization classes
//
DetectorConstruction* detector = new DetectorConstruction;
runManager->SetUserInitialization(detector);
//
runManager->SetUserInitialization(new FTFP_BERT);
// set an HistoManager
//
HistoManager* histo = new HistoManager();
// Set user action classes
//
PrimaryGeneratorAction* gen_action =
new PrimaryGeneratorAction(detector);
runManager->SetUserAction(gen_action);
//
RunAction* run_action = new RunAction(histo);
runManager->SetUserAction(run_action);
//
EventAction* event_action = new EventAction(run_action,histo);
runManager->SetUserAction(event_action);
//
SteppingAction* stepping_action =
new SteppingAction(detector, event_action);
runManager->SetUserAction(stepping_action);
// Initialize G4 kernel
//
runManager->Initialize();
// Initialize visualization
//
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
// Get the pointer to the User Interface manager
//
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if ( ! ui ) {
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else {
// interactive mode
UImanager->ApplyCommand("/control/execute init_vis.mac");
ui->SessionStart();
delete ui;
}
// Job termination
delete visManager;
delete histo;
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,28 +0,0 @@
#
# Macro file for the test of AnaEx03 example
#
# reduce output in MT
/control/cout/ignoreThreadsExcept 0
# initialize
/run/initialize
# e- 500MeV
/gun/particle e-
/gun/energy 500 MeV
/run/beamOn 1000
# Test commands defined in this example
/control/verbose 2
#
/det/setAbsMat G4_Al
/det/setGapMat G4_Air
/det/setAbsThick 20. mm
/det/setGapThick 10. mm
/det/setSizeYZ 30. mm
/det/setNbOfLayers 20
#
/run/beamOn 1
@@ -1,73 +0,0 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.12...3.20)
project(AnaEx03)
#----------------------------------------------------------------------------
# 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
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Find AIDA (required package)
#
find_package(AIDA REQUIRED)
# Following lines should not be needed
if(NOT AIDA_FOUND)
message(STATUS "G4 Examples: AIDA package not found. AnaEx03 disabled.")
return()
endif()
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/shared/include
${Geant4_INCLUDE_DIR}
${AIDA_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc
${PROJECT_SOURCE_DIR}/shared/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh
${PROJECT_SOURCE_DIR}/shared/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(AnaEx03 AnaEx03.cc ${sources} ${headers})
target_link_libraries(AnaEx03 ${Geant4_LIBRARIES} ${AIDA_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build AnaEx03. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(AnaEx03_SCRIPTS
AnaEx03.in run.mac init_vis.mac vis.mac
)
foreach(_script ${AnaEx03_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS AnaEx03 DESTINATION bin)
@@ -1,33 +0,0 @@
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := AnaEx03
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: setup clean_setup all
all: lib bin
setup:
@echo "Copying files from shared"
@./shared/scripts/copy_files.sh shared
clean_setup:
@echo "Removing files copied from shared"
@./shared/scripts/clean_files.sh shared
#### G4ANALYSIS_USE := true
include $(G4INSTALL)/config/binmake.gmk
visclean:
rm -f g4*.prim g4*.eps g4*.wrl
rm -f .DAWN_*
histclean:
rm ${G4WORKDIR}/tmp/${G4SYSTEM}/${G4TARGET}/HistoManager.o
-193
View File
@@ -1,193 +0,0 @@
--------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example AnaEx03 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 *
----------------------------------------------------------
13-11-20 B. Morgan (AnaEx03-V10-06-01)
- Enforce use of Serial RunManager.
10-11-20 B. Morgan (AnaEx03-V10-06-00)
- Migration to G4RunManagerFactory.
26-11-19 I. Hrivnacova (AnaEx03-V10-05-00)
- Fixed Doxygen warning
15-10-18 G. Cosmo (AnaEx03-V10-04-01)
- Added missing include of G4SteateManager.hh in DetectorConstruction source.
05-07-18 I. Hrivnacova (AnaEx03-V10-04-00)
- Macro & commands review:
- Removed obsolete /N03 top command directory
- Added protection against warnings issued from ReinitializeGeometry() if
called in PreInit phase
- Added test for all commands defined in this example in AnaEx01.in
- Updated README files
27-07-17 I. Hrivnacova (AnaEx03-V10-03-00)
- Coding guidelines: removed redundant empty lines
26-10-16 I. Hrivnacova (AnaEx03-V10-02-02)
- Updated main program according to basic examples
04-07-16 I. Hrivnacova (AnaEx03-V10-02-01)
- Fixes for Doxygen documentation
01-07-16 I. Hrivnacova (AnaEx03-V10-02-00)
- Coding guidelines (function, members names)
30-08-15 I. Hrivnacova (AnaEx03-V10-01-02)
- Corrected previous update which caused compilation error
28-08-15 I. Hrivnacova (AnaEx03-V10-01-01)
- Fixed compilation on Windows
27-08-15 I. Hrivnacova (AnaEx03-V10-01-00)
- Introduced meaningful histograms and ntuple names instead of numbers
in all AnaEx0N examples and use histogram ids starting from 0
- Simplified HistoManager classes and fixed function names to follow
coding guidelines
- Removed G4ANALYSIS_USE ifdefs from AnaEx03, as this example is now build
only with AIDA
06-11-14 I. Hrivnacova (AnaEx03-V10-00-04)
- Updated for moving script in shared (analysisShared-V10-00-01)
- Updated README - commented special compilation (via make setup)
05-11-14 I. Hrivnacova (AnaEx03-V10-00-03)
- Including shared directory directly in the example
to avoid out-of-project sources
- based on analysisShared-V10-00-00
- Adding utility scripts for GNUmake build (much simpler replacement
for scripts from common) \
- based on analysisScripts-V10-00-00
13-08-14 mma (AnaEx03-V10-00-02)
- update Readme and .Readme again
12-08-14 mma (AnaEx03-V10-00-01)
- restaure calorimeter drawing in Readme and .Readme
11-06-14 I. Hrivnacova (AnaEx03-V10-00-00)
- Fixed path to copy_files.sh, clean_files.sh in GNUmalefile
(this makes GNUmake build working with Geant4 installation via
CMake)
- Fixed SharedFilesList.txt - removed PhysicList class
28-05-14 I. Hrivnacova
- Use Geant4 physics list (FTFP_BERT) in AnaEx01,02,03,
removed PhysicList class from shared
(tag in examples/analysis)
13-11-12 I. Hrivnacova (AnaEx03-V09-05-05)
- Fixed order of instatiating G4VisExecutive and G4UIExecutive
(required when Qt driver is activated).
03-09-12 I. Hrivnacova (AnaEx03-V09-05-04)
- New tag to be synchronized with the update in tests/ctest;
no changes in the example itself
31-08-12 I. Hrivnacova (AnaEx03-V09-05-03)
- Updated CMakeLists.tx:
adding install target, minor fixes
- Added .README
- UseOpenScientist.txt, InstallAida.txt moved in A01
(as README.AIDA, README.OpenScientist)
21 June 2012 Ivana Hrivnacova (AnaEx03-V09-05-02)
- Updated CMakeLists.txt to get FindAIDA.cmake module found
by CMake automatically
21 June 2012 Ivana Hrivnacova (AnaEx03-V09-05-01)
- Added AIDA support in CMake build
15 June 2012 Gabriele Cosmo (AnaEx03-V09-05-00)
- Fixed compilation warnings in case analysis is not used...
16 April 2012 Ivana Hrivnacova
- Restored AnaEx01 example with AIDA under new name AnaEx03.
07 June 2011 mma (AnaEx01-V09-04-01)
- PhysicsList migrated to new scheme G4PhysListHelper
03 February 2011 mma (AnaEx01-V09-04-00)
- delete subdirectory analysis
08 November 2010 Michel Maire (AnaEx01-V09-03-00)
- revised version of example :
class HistoManager to replace AnaEx01AnalysisManager
13 May 2009 Guy Barrand (AnaEx01-V09-02-00)
- Tagged all changes.
13 May 2009 Guy Barrand
- update the README.
- remove the content of the analysis/[Falsetto,jas,Lab] directories.
In fact the analysis directory should not be distributed anymore.
- have a run.mac in the main example directory.
- AnaEx01AnalysisManager : arrange to have histo and tuple name
as interger in case of hbook file format.
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.
16th August 2006 Gabriele Cosmo (AnaEx01-V08-01-00)
- Corrected text in README for AIDA setup.
6th December 2005 Gabriele Cosmo
- Trivial change in main() for support of CLHEP-2.0.X series.
15th November 2005 Guy Barrand (AnaEx01-V07-01-01)
- Tagged all changes.
25th October 2005 Guy Barrand
- Have .aida as a default file format.
24th October 2005 Guy Barrand
- Put AIDA_createAnalysisFactory() in the main in order
to be able to instrumenet easily this example with G4Lab::UIOnX.
31th August 2005 Guy Barrand
- Update README, analyis/Lab/AnaEx01.py to work with OpenScientist-v14r0.
3rd May 2005 John Allison (examples-V07-00-03)
- Replaced vis manager with G4VisExecutive.
3rd December 2003 Gabriele Cosmo (AnaEx01-V05-02-01)
- Fixed minor compilation warnings and added 'aida-config' in
GNUmakefile, activated through G4ANALYSIS_USE.
17th October 2003 Guy Barrand
- AnaEx01VisManager: removed OPACS driver.
20th June 2003 Guy Barrand (AnaEx01-V05-02-00)
- * : AIDA-3.0 compliant. Usage of AIDA namespace, etc...
03th December 2001 Guy Barrand (AnaEx01-V03-02-01)
- Change README : Explain CMTSITE setup for Lab usage.
19th November 2001 Guy Barrand
- Change README : G4ANALYSIS_USE_AIDA -> G4ANALYSIS_USE.
16rd November 2001 Guy Barrand
- * : AIDA 2.2 compliant code. Usage of tuple.
20 June 2001, Guy Barrand :
- AnaEx01SteppingVerbose.cc : replace "entries" to "size" in order
to compile with 03-00-ref-03 kernel.
14 September 2000, Guy Barrand :
- Birth.
-153
View File
@@ -1,153 +0,0 @@
--------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
AnaEx03
-------
Examples AnaEx01, AnaEx02 and AnaEx03 show the usage of histogram and tuple
manipulations using G4Analysis, ROOT and AIDA compliant systems on the same
scenario. All analysis manipulations (histo booking, filling, saving histos
in a file, etc...) are located in one class : HistoManager, implementation of
which is different in each example. All the other classes are same in all
three examples.
This example shows the usage of histogram and tuple manipulations using
an AIDA compliant system.
The example is an adaptation of examples/novice/N03. It describes a simple
sampling calorimeter setup.
1- Detector description
-----------------------
The calorimeter is a box made of a given number of layers. A layer
consists of an absorber plate and of a detection gap. The layer is
replicated.
Six parameters define the calorimeter :
- the material of the absorber,
- the thickness of an absorber plate,
- the material of the detection gap,
- the thickness of a gap,
- the number of layers,
- the transverse size of the calorimeter (the input face is a square).
The default geometry is constructed in DetectorConstruction class,
but all of the above parameters can be modified interactively via
the commands defined in the DetectorMessenger class.
|<----layer 0---------->|<----layer 1---------->|<----layer 2---------->|
| | | |
==========================================================================
|| | || | || | ||
|| | || | || | ||
beam || absorber | gap || absorber | gap || absorber | gap ||
======> || | || | || | ||
|| | || | || | ||
==========================================================================
2- Physics list
---------------
The particle's type and the physic processes which will be available
in this example are set in the FTFP_BERT physics list.
3- Action Initialization
------------------------
A newly introduced class, ActionInitialization,
instantiates and registers to Geant4 kernel all user action classes
which are defined thread-local and a run action class
which is defined both thread-local and global.
The thread-local action classes are defined in
ActionInitialization::Build()
and the global run action class is defined in
ActionInitialization::BuildForMaster().
Note that ActionInitialization::Build() is also used to
instatiate user action clasess in sequential mode.
4- An event : PrimaryGeneratorAction
------------------------------------
The primary kinematic consists of a single particle which hits the
calorimeter perpendicular to the input face. The type of the particle
and its energy are set in the PrimaryGeneratorAction class, and can
be changed via the G4 build-in commands of ParticleGun class.
5- Histograms
-------------
To produce histograms, at least one of the AIDA implementations should be
available. See the file InstallAida.txt
AnaEx03 can produce 4 histograms :
histo 1 : total energy deposit in absorber per event
histo 2 : total energy deposit in gap per event
histo 3 : total track length of charged particles in absorber per event
histo 4 : total track length of charged particles in gap per event
And 2 Ntuples :
- ntuple 1:
- one row per event : EnergyAbs EnergyGap
- ntuple 1:
- one row per event : TrackLAbs TrackLGap
These histos and ntuples are booked in HistoManager and filled from
EventAction.
One can control the name of the histograms file and its format:
default name : AnaEx03
possible formats : hbook root (default) xml
See HistoManager constructor
Note that, by default, histograms are disabled. To activate them, uncomment
the flag G4ANALYSIS_USE in GNUmakefile, *before* compilation.
6- OpenScientist
----------------
See the files README.AIDA and README.OpenScientist for more indications
how to use this system to visualize and handle histogram files.
7- How to build
---------------
An additional step is needed when building the example with GNUmake
due to using the extra shared directory:
% cd path_to_AnaEx03/AnaEx03
% gmake setup
% gmake
This will copy the files from shared in the example include and src;
to remove these files:
% gmake clean_setup
7- How to run
--------------
- Execute AnaEx03 in the 'interactive mode' with visualization:
% ./AnaEx03
and type in the commands from run.mac line by line:
Idle> /control/verbose 2
Idle> /tracking/verbose 1
Idle> /run/beamOn 10
Idle> ...
Idle> exit
or
Idle> /control/execute run.mac
....
Idle> exit
- Execute AnaEx03 in the 'batch' mode from macro files
(without visualization)
% ./AnaEx03 run.mac
% ./AnaEx03 run.mac > run.out
The AnaEx03.in macro is used in Geant4 testing.
@@ -1,68 +0,0 @@
-----------------------------------------------------------
--------------
Install AIDA
--------------
To use histograms, at least one of the AIDA implementations should be
available.
You can use various file formats to write histograms (hbook, root, AIDA-XML).
1 - OpenScientist (lal/in2p3)
-------------------------
OpenScientist is available at http://OpenScientist.lal.in2p3.fr.
osc_batch is a small package ( ~ 6MB), easy to install.
It provides an AIDA interface to write files in ROOT or HBOOK formats.
See the specific UseOpenScientist.txt file for more.
2 - RAIDA (desy)
------------
It is a ROOT based AIDA interface. It can be downloaded from
http://ilcsoft.desy.de/portal/software_packages/raida/index_eng.html
3 - iAIDA
-----
Another package including AIDA (an evolution of the former cern PI project)
is the iAIDA package: http://iaida.dynalias.net
Once you have installed iAIDA in a specified local area $MYIAIDA, it is
required to add the installation path to $PATH, i.e. for example, for
release 1.0.11 of iAIDA:
setenv PATH ${PATH}:$MYIAIDA/bin
Before running the example the command should be issued:
eval `aida-config --runtime csh`
4 - JAIDA (slac)
------------
JAIDA is an implementation of AIDA in Java. To use it, one needs Java
as well as AIDAJNI, a connector between AIDA-C++ and AIDA-Java.
Available for: Linux-g++2, Linux-g++3, WIN32-VC, SUN-CC,
Darwin-g++2, Darwin-g++3
To compile and link with JAIDA using AIDAJNI, make sure you have:
1. JAIDA version 3.2.0, see http://java.freehep.org/jaida
2. set enviroment variable JAIDA_HOME to your JAIDA installation
3. source the aida-setup script $JAIDA_HOME/bin/aida-setup.[sh|csh|win32]
4. AIDAJNI version 3.0.4 or 3.2.0, or better: see http://java.freehep.org/aidajni
5. set environment variable AIDAJNI_HOME to your AIDAJNI installation
6. set environment variable JDK_HOME to your Java Standard Development Kit (1.4.x or up).
7. source the aidajni-setup script $AIDAJNI_HOME/bin/$G4SYSTEM/aidajni-setup.[sh|csh|win32]
Last tested versions (with Geant4 examples): JAIDA 3.2.0, AIDAJNI 3.2.0.
Now execute:
source setup-analysis (.csh, .sh, .win32)
gmake clean
gmake
@@ -1,44 +0,0 @@
Working with the OpenScientist packages :
---------------------------------------
To create the analysis file, you can install the light "osc_batch"
binary kit (See http://OpenScientist.lal.in2p3.fr ). For example
from a UNIX sh flavoured shell :
sh> cd /usr/local
sh> <arrange to be su>
sh> <get an osc_batch binary kit>
sh> unzip -q osc_batch<platform>.zip
sh> cd osc_batch/<version>
sh> ./install
Then before building the example you have to source the OpenScientist
environment with :
<create another terminal>
sh> . /usr/local/osc_batch/<version>/aida-setup.sh
or
csh> source /usr/local/osc_batch/<version>/aida-setup.csh
Depending of the file format, you can visualize the produced
file with various interactive tools (CERN/PAW, CERN/ROOT, jas).
But if installing also an OpenScientist osc_vis binary kit,
you shall be able to visualize all formats by using
the osc-plot program. To install an osc_vis kit :
sh> cd /usr/local
sh> <arrange to be su>
sh> <get an osc_vis binary kit>
sh> unzip -q osc_vis<platform>.zip
sh> cd osc_vis/<version>
sh> ./install
Then to browse the AnaEx03.<format> file (for exa from an UNIX sh shell) :
<create another terminal>
sh> . /usr/local/osc_vis/<version>/setup.sh
sh> <setenv DISPLAY if needed>
sh> osc-plot AnaEx03.[aida,root,hbook]
The OpenScientist URL is :
http://OpenScientist.lal.in2p3.fr.
Note that OpenScientist is installed on CERN/lxplus under :
/afs/cern.ch/sw/contrib/[osc_batch,osc_vis].
@@ -1,80 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file analysis/AnaEx03/include/HistoManager.hh
/// \brief Definition of the HistoManager class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef HistoManager_h
#define HistoManager_h 1
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
namespace AIDA {
class IAnalysisFactory;
class ITree;
class IHistogram1D;
class ITuple;
}
const G4int kMaxHisto = 4;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class HistoManager
{
public:
HistoManager();
~HistoManager();
void Book();
void Save();
void FillHisto(G4int id, G4double bin, G4double weight = 1.0);
void Normalize(G4int id, G4double fac);
void FillNtuple(G4double EnergyAbs, G4double EnergyGap,
G4double TrackLAbs, G4double TrackLGap);
void PrintStatistic();
private:
AIDA::IAnalysisFactory* fAF;
AIDA::ITree* fTree;
AIDA::IHistogram1D* fHisto[kMaxHisto];
AIDA::ITuple* fNtuple1;
AIDA::ITuple* fNtuple2;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,16 +0,0 @@
# Macro file for the initialization of example B1
# in interactive session
#
# Set some default verbose
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
# Change the default number of threads (in multi-threaded mode)
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize
#
# Visualization setting
/control/execute vis.mac
@@ -1,20 +0,0 @@
{
gROOT->Reset();
// Draw histos filled by Geant4 simulation
//
TFile f = TFile("AnaEx03.root");
TCanvas* c1 = new TCanvas("c1", " ");
TH1D* hist1 = (TH1D*)f.Get("1");
hist1->Draw("HIST");
TH1D* hist2 = (TH1D*)f.Get("2");
hist2->Draw("HIST");
TH1D* hist3 = (TH1D*)f.Get("3");
c1->SetLogy(1);
c1->cd();
c1->Update();
hist3->Draw("HIST");
}
@@ -1,17 +0,0 @@
#
# Macro file for "AnaEx03.cc"
#
# can be run in batch, without graphic
# or interactively: Idle> /control/execute run.mac
#
/control/verbose 2
/run/verbose 2
/event/verbose 0
/tracking/verbose 0
#
# initialize
/run/initialize
#
/gun/particle e-
/gun/energy 500 MeV
/run/beamOn 1000
@@ -1,43 +0,0 @@
--------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
analysis/shared 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 *
----------------------------------------------------------
15-10-18 G. Cosmo (analysisShared-V10-04-02)
- Added missing include of G4SteateManager.hh in DetectorConstruction source.
04-07-18 I. Hrivnacova (analysisShared-V10-04-01)
- Fixed compilation error introduced in previous tag
03-07-18 I. Hrivnacova (analysisShared-V10-04-00)
- Macro & commands review:
- Removed obsolete /N03 top command directory
- Added protection against warnings issued from ReinitializeGeometry() if
called in PreInit phase
04-07-16 I. Hrivnacova (analysisShared-V10-02-01)
- Fixes for Doxygen documentation
01-07-16 I. Hrivnacova (analysisShared-V10-02-00)
- Coding guidelines (function names)
27-08-15 I. Hrivnacova (analysisShared-V10-01-00)
- Updated histogram ids in FillHiso (now starting from 0);
updated for changed function names in HistoManager classes
06-11-14 I. Hrivnacova (analysisShared-V10-00-01)
- Moved scripts from upper directory in shared
05-11-14 I. Hrivnacova (analysisShared-V10-00-00)
- Tagged version which will be included in AnaEx0N examples
@@ -1,55 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef ActionInitialization_h
#define ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
class DetectorConstruction;
/// Action initialization class.
///
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization(DetectorConstruction* detector);
virtual ~ActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
private:
DetectorConstruction* fDetector;
};
#endif
@@ -1,153 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
virtual ~DetectorConstruction();
public:
void SetAbsorberMaterial (G4String);
void SetAbsorberThickness(G4double);
void SetGapMaterial (G4String);
void SetGapThickness(G4double);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers (G4int);
virtual G4VPhysicalVolume* Construct();
public:
void PrintCalorParameters();
G4double GetWorldSizeX() {return fWorldSizeX;};
G4double GetWorldSizeYZ() {return fWorldSizeYZ;};
G4double GetCalorThickness() {return fCalorThickness;};
G4double GetCalorSizeYZ() {return fCalorSizeYZ;};
G4int GetNbOfLayers() {return fNbOfLayers;};
G4Material* GetAbsorberMaterial() {return fAbsorberMaterial;};
G4double GetAbsorberThickness() {return fAbsorberThickness;};
G4Material* GetGapMaterial() {return fGapMaterial;};
G4double GetGapThickness() {return fGapThickness;};
const G4VPhysicalVolume* GetphysiWorld() {return fPhysiWorld;};
const G4VPhysicalVolume* GetAbsorber() {return fPhysiAbsorber;};
const G4VPhysicalVolume* GetGap() {return fPhysiGap;};
private:
G4Material* fAbsorberMaterial;
G4double fAbsorberThickness;
G4Material* fGapMaterial;
G4double fGapThickness;
G4int fNbOfLayers;
G4double fLayerThickness;
G4double fCalorSizeYZ;
G4double fCalorThickness;
G4Material* fDefaultMaterial;
G4double fWorldSizeYZ;
G4double fWorldSizeX;
G4Box* fSolidWorld; //pointer to the solid World
G4LogicalVolume* fLogicWorld; //pointer to the logical World
G4VPhysicalVolume* fPhysiWorld; //pointer to the physical World
G4Box* fSolidCalor; //pointer to the solid Calor
G4LogicalVolume* fLogicCalor; //pointer to the logical Calor
G4VPhysicalVolume* fPhysiCalor; //pointer to the physical Calor
G4Box* fSolidLayer; //pointer to the solid Layer
G4LogicalVolume* fLogicLayer; //pointer to the logical Layer
G4VPhysicalVolume* fPhysiLayer; //pointer to the physical Layer
G4Box* fSolidAbsorber; //pointer to the solid Absorber
G4LogicalVolume* fLogicAbsorber; //pointer to the logical Absorber
G4VPhysicalVolume* fPhysiAbsorber; //pointer to the physical Absorber
G4Box* fSolidGap; //pointer to the solid Gap
G4LogicalVolume* fLogicGap; //pointer to the logical Gap
G4VPhysicalVolume* fPhysiGap; //pointer to the physical Gap
DetectorMessenger* fDetectorMessenger; //pointer to the Messenger
private:
void DefineMaterials();
void ComputeCalorParameters();
G4VPhysicalVolume* ConstructCalorimeter();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
inline void DetectorConstruction::ComputeCalorParameters()
{
// Compute derived parameters of the calorimeter
fLayerThickness = fAbsorberThickness + fGapThickness;
fCalorThickness = fNbOfLayers*fLayerThickness;
fWorldSizeX = 1.2*fCalorThickness; fWorldSizeYZ = 1.2*fCalorSizeYZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,74 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorMessenger.hh
/// \brief Definition of the DetectorMessenger class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
virtual ~DetectorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
DetectorConstruction* fDetector;
G4UIdirectory* fDetDir;
G4UIcmdWithAString* fAbsMaterCmd;
G4UIcmdWithAString* fGapMaterCmd;
G4UIcmdWithADoubleAndUnit* fAbsThickCmd;
G4UIcmdWithADoubleAndUnit* fGapThickCmd;
G4UIcmdWithADoubleAndUnit* fSizeYZCmd;
G4UIcmdWithAnInteger* fNbLayersCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,73 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file EventAction.hh
/// \brief Definition of the EventAction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class RunAction;
class HistoManager;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventAction : public G4UserEventAction
{
public:
EventAction(RunAction*, HistoManager*);
virtual ~EventAction();
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
void AddAbs(G4double de, G4double dl) {fEnergyAbs += de; fTrackLAbs += dl;};
void AddGap(G4double de, G4double dl) {fEnergyGap += de; fTrackLGap += dl;};
private:
RunAction* fRunAct;
HistoManager* fHistoManager;
G4double fEnergyAbs, fEnergyGap;
G4double fTrackLAbs, fTrackLGap;
G4int fPrintModulo;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,65 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
class DetectorConstruction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
virtual ~PrimaryGeneratorAction();
virtual void GeneratePrimaries(G4Event*);
private:
G4ParticleGun* fParticleGun; //pointer a to G4 class
DetectorConstruction* fDetector; //pointer to the geometry
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,71 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunAction.hh
/// \brief Definition of the RunAction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4Run;
class HistoManager;
class RunAction : public G4UserRunAction
{
public:
RunAction(HistoManager*);
virtual ~RunAction();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
void FillPerEvent(G4double, G4double, G4double, G4double);
private:
HistoManager* fHistoManager;
G4double fSumEAbs, fSum2EAbs;
G4double fSumEGap, fSum2EGap;
G4double fSumLAbs, fSum2LAbs;
G4double fSumLGap, fSum2LGap;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,61 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file SteppingAction.hh
/// \brief Definition of the SteppingAction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef SteppingAction_h
#define SteppingAction_h 1
#include "G4UserSteppingAction.hh"
class DetectorConstruction;
class EventAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(DetectorConstruction*, EventAction*);
virtual ~SteppingAction();
virtual void UserSteppingAction(const G4Step*);
private:
DetectorConstruction* fDetector;
EventAction* fEventAction;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,18 +0,0 @@
--------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
analysis/scripts 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 *
----------------------------------------------------------
05-11-14 I. Hrivnacova (analysisScripts-V10-00-00)
- Tagged version which will be included in AnaEx0N examples
@@ -1,18 +0,0 @@
#!/bin/sh
# Script to remove classes copied from shared directory into include and src
# via copy_files.sh
#
# By I. Hrivnacova, IPN Orsay
DIRNAME=$1
for FILE in `ls $DIRNAME/include`; do
rm -f include/$FILE
done
for FILE in `ls $DIRNAME/src`; do
rm -f src/$FILE
done
echo "... clean_files.sh from $1 finished"
@@ -1,15 +0,0 @@
#!/bin/sh
# Script to copy classes from shared directory into include and src
# as it is required by GNUmake build.
# Usage: copy_files.sh directoryName
#
# By I. Hrivnacova, IPN Orsay
DIRNAME=$1
cp -rp $DIRNAME/include/* include
cp -rp $DIRNAME/src/* src
echo "... copy_files.sh from $1 finished"
@@ -1,81 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file ActionInitialization.cc
/// \brief Implementation of the ActionInitialization class
#include "ActionInitialization.hh"
#include "HistoManager.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::ActionInitialization(DetectorConstruction* detector)
: G4VUserActionInitialization(),
fDetector(detector)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ActionInitialization::~ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const
{
// Histo manager
HistoManager* histo = new HistoManager();
// Actions
SetUserAction(new RunAction(histo));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::Build() const
{
// Histo manager
HistoManager* histo = new HistoManager();
// Actions
//
SetUserAction(new PrimaryGeneratorAction(fDetector));
RunAction* runAction = new RunAction(histo);
SetUserAction(runAction);
EventAction* eventAction = new EventAction(runAction, histo);
SetUserAction(eventAction);
SteppingAction* steppingAction = new SteppingAction(fDetector, eventAction);
SetUserAction(steppingAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,348 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorConstruction.cc
/// \brief Implementation of the DetectorConstruction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4StateManager.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4SystemOfUnits.hh"
#include "G4RunManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::DetectorConstruction()
:G4VUserDetectorConstruction(),
fAbsorberMaterial(0),fGapMaterial(0),fDefaultMaterial(0),
fSolidWorld(0),fLogicWorld(0),fPhysiWorld(0),
fSolidCalor(0),fLogicCalor(0),fPhysiCalor(0),
fSolidLayer(0),fLogicLayer(0),fPhysiLayer(0),
fSolidAbsorber(0),fLogicAbsorber(0),fPhysiAbsorber(0),
fSolidGap (0),fLogicGap (0),fPhysiGap (0),
fDetectorMessenger(0)
{
// default parameter values of the calorimeter
fAbsorberThickness = 10.*mm;
fGapThickness = 5.*mm;
fNbOfLayers = 10;
fCalorSizeYZ = 10.*cm;
ComputeCalorParameters();
// materials
DefineMaterials();
SetAbsorberMaterial("G4_Pb");
SetGapMaterial("G4_lAr");
// create commands for interactive definition of the calorimeter
fDetectorMessenger = new DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorConstruction::~DetectorConstruction()
{ delete fDetectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructCalorimeter();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::DefineMaterials()
{
// use G4-NIST materials data base
//
G4NistManager* man = G4NistManager::Instance();
fDefaultMaterial = man->FindOrBuildMaterial("G4_Galactic");
man->FindOrBuildMaterial("G4_Pb");
man->FindOrBuildMaterial("G4_lAr");
// print table
//
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
{
// Clean old geometry, if any
//
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
// complete the Calor parameters definition
ComputeCalorParameters();
//
// World
//
fSolidWorld = new G4Box("World", //its name
fWorldSizeX/2,fWorldSizeYZ/2,fWorldSizeYZ/2); //its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, //its solid
fDefaultMaterial, //its material
"World"); //its name
fPhysiWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicWorld, //its logical volume
"World", //its name
0, //its mother volume
false, //no boolean operation
0); //copy number
//
// Calorimeter
//
fSolidCalor=0; fLogicCalor=0; fPhysiCalor=0;
fSolidLayer=0; fLogicLayer=0; fPhysiLayer=0;
if (fCalorThickness > 0.)
{ fSolidCalor = new G4Box("Calorimeter", //its name
fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);//size
fLogicCalor = new G4LogicalVolume(fSolidCalor, //its solid
fDefaultMaterial, //its material
"Calorimeter"); //its name
fPhysiCalor = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicCalor, //its logical volume
"Calorimeter", //its name
fLogicWorld, //its mother volume
false, //no boolean operation
0); //copy number
//
// Layer
//
fSolidLayer = new G4Box("Layer", //its name
fLayerThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2); //size
fLogicLayer = new G4LogicalVolume(fSolidLayer, //its solid
fDefaultMaterial, //its material
"Layer"); //its name
if (fNbOfLayers > 1)
fPhysiLayer = new G4PVReplica("Layer", //its name
fLogicLayer, //its logical volume
fLogicCalor, //its mother
kXAxis, //axis of replication
fNbOfLayers, //number of replica
fLayerThickness); //witdth of replica
else
fPhysiLayer = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
fLogicLayer, //its logical volume
"Layer", //its name
fLogicCalor, //its mother volume
false, //no boolean operation
0); //copy number
}
//
// Absorber
//
fSolidAbsorber=0; fLogicAbsorber=0; fPhysiAbsorber=0;
if (fAbsorberThickness > 0.)
{ fSolidAbsorber = new G4Box("Absorber", //its name
fAbsorberThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, //its solid
fAbsorberMaterial, //its material
fAbsorberMaterial->GetName());//name
fPhysiAbsorber = new G4PVPlacement(0, //no rotation
G4ThreeVector(-fGapThickness/2,0.,0.), //its position
fLogicAbsorber, //its logical volume
fAbsorberMaterial->GetName(), //its name
fLogicLayer, //its mother
false, //no boulean operat
0); //copy number
}
//
// Gap
//
fSolidGap=0; fLogicGap=0; fPhysiGap=0;
if (fGapThickness > 0.)
{ fSolidGap = new G4Box("Gap",
fGapThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
fLogicGap = new G4LogicalVolume(fSolidGap,
fGapMaterial,
fGapMaterial->GetName());
fPhysiGap = new G4PVPlacement(0, //no rotation
G4ThreeVector(fAbsorberThickness/2,0.,0.), //its position
fLogicGap, //its logical volume
fGapMaterial->GetName(), //its name
fLogicLayer, //its mother
false, //no boulean operat
0); //copy number
}
PrintCalorParameters();
//
// Visualization attributes
//
fLogicWorld->SetVisAttributes (G4VisAttributes::GetInvisible());
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxVisAtt->SetVisibility(true);
fLogicCalor->SetVisAttributes(simpleBoxVisAtt);
//
//always return the physical World
//
return fPhysiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n------------------------------------------------------------"
<< "\n---> The calorimeter is " << fNbOfLayers << " layers of: [ "
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName()
<< " + "
<< fGapThickness/mm << "mm of " << fGapMaterial->GetName() << " ] "
<< "\n------------------------------------------------------------\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial =
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (pttoMaterial)
{
fAbsorberMaterial = pttoMaterial;
if ( fLogicAbsorber )
{
fLogicAbsorber->SetMaterial(fAbsorberMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetGapMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial =
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
if (pttoMaterial)
{
fGapMaterial = pttoMaterial;
if ( fLogicGap )
{
fLogicGap->SetMaterial(fGapMaterial);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetAbsorberThickness(G4double val)
{
// change Absorber thickness and recompute the calorimeter parameters
fAbsorberThickness = val;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetGapThickness(G4double val)
{
// change Gap thickness and recompute the calorimeter parameters
fGapThickness = val;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetCalorSizeYZ(G4double val)
{
// change the transverse size and recompute the calorimeter parameters
fCalorSizeYZ = val;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetNbOfLayers(G4int val)
{
fNbOfLayers = val;
if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,137 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file DetectorMessenger.cc
/// \brief Implementation of the DetectorMessenger class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
: G4UImessenger(),
fDetector(Det),
fDetDir(0),
fAbsMaterCmd(0),
fGapMaterCmd(0),
fAbsThickCmd(0),
fGapThickCmd(0),
fSizeYZCmd(0),
fNbLayersCmd(0)
{
G4bool broadcast = false;
fDetDir = new G4UIdirectory("/det/",broadcast);
fDetDir->SetGuidance("Detector control");
fAbsMaterCmd = new G4UIcmdWithAString("/det/setAbsMat",this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("choice",false);
fAbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fGapMaterCmd = new G4UIcmdWithAString("/det/setGapMat",this);
fGapMaterCmd->SetGuidance("Select Material of the Gap.");
fGapMaterCmd->SetParameterName("choice",false);
fGapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setAbsThick",this);
fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
fAbsThickCmd->SetParameterName("Size",false);
fAbsThickCmd->SetRange("Size>=0.");
fAbsThickCmd->SetUnitCategory("Length");
fAbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fGapThickCmd = new G4UIcmdWithADoubleAndUnit("/det/setGapThick",this);
fGapThickCmd->SetGuidance("Set Thickness of the Gap");
fGapThickCmd->SetParameterName("Size",false);
fGapThickCmd->SetRange("Size>=0.");
fGapThickCmd->SetUnitCategory("Length");
fGapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSizeYZCmd = new G4UIcmdWithADoubleAndUnit("/det/setSizeYZ",this);
fSizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
fSizeYZCmd->SetParameterName("Size",false);
fSizeYZCmd->SetRange("Size>0.");
fSizeYZCmd->SetUnitCategory("Length");
fSizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNbLayersCmd = new G4UIcmdWithAnInteger("/det/setNbOfLayers",this);
fNbLayersCmd->SetGuidance("Set number of layers.");
fNbLayersCmd->SetParameterName("NbLayers",false);
fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
fNbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
DetectorMessenger::~DetectorMessenger()
{
delete fNbLayersCmd;
delete fAbsMaterCmd; delete fGapMaterCmd;
delete fAbsThickCmd; delete fGapThickCmd;
delete fSizeYZCmd;
delete fDetDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fAbsMaterCmd ) {
fDetector->SetAbsorberMaterial(newValue);
}
else if( command == fGapMaterCmd ) {
fDetector->SetGapMaterial(newValue);
}
else if( command == fAbsThickCmd ) {
fDetector
->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));
}
else if( command == fGapThickCmd ) {
fDetector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));
}
else if( command == fSizeYZCmd ) {
fDetector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));
}
else if( command == fNbLayersCmd ) {
fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,92 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file EventAction.cc
/// \brief Implementation of the EventAction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EventAction.hh"
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4Event.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(RunAction* run, HistoManager* histo)
:G4UserEventAction(),
fRunAct(run),fHistoManager(histo),
fEnergyAbs(0.), fEnergyGap(0.),
fTrackLAbs(0.), fTrackLGap(0.),
fPrintModulo(0)
{
fPrintModulo = 100; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::~EventAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0)
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
// initialisation per event
fEnergyAbs = fEnergyGap = 0.;
fTrackLAbs = fTrackLGap = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EventAction::EndOfEventAction(const G4Event*)
{
//accumulates statistic
//
fRunAct->FillPerEvent(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
//fill histograms
//
fHistoManager->FillHisto(0, fEnergyAbs);
fHistoManager->FillHisto(1, fEnergyGap);
fHistoManager->FillHisto(2, fTrackLAbs);
fHistoManager->FillHisto(3, fTrackLGap);
//fill ntuple
//
fHistoManager->FillNtuple(fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,86 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the PrimaryGeneratorAction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0),
fDetector(DC)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="e-");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
fParticleGun->SetParticleEnergy(500.*MeV);
G4double position = -0.5*(fDetector->GetWorldSizeX());
fParticleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,136 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file RunAction.cc
/// \brief Implementation of the RunAction class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "RunAction.hh"
#include "HistoManager.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(HistoManager* histo)
: G4UserRunAction(),
fHistoManager(histo),
fSumEAbs(0.), fSum2EAbs(0.),
fSumEGap(0.), fSum2EGap(0.),
fSumLAbs(0.), fSum2LAbs(0.),
fSumLGap(0.), fSum2LGap(0.)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::~RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
//initialize cumulative quantities
//
fSumEAbs = fSum2EAbs =fSumEGap = fSum2EGap = 0.;
fSumLAbs = fSum2LAbs =fSumLGap = fSum2LGap = 0.;
//histograms
//
fHistoManager->Book();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::FillPerEvent(G4double EAbs, G4double EGap,
G4double LAbs, G4double LGap)
{
//accumulate statistic
//
fSumEAbs += EAbs; fSum2EAbs += EAbs*EAbs;
fSumEGap += EGap; fSum2EGap += EGap*EGap;
fSumLAbs += LAbs; fSum2LAbs += LAbs*LAbs;
fSumLGap += LGap; fSum2LGap += LGap*LGap;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RunAction::EndOfRunAction(const G4Run* aRun)
{
G4int NbOfEvents = aRun->GetNumberOfEvent();
if (NbOfEvents == 0) return;
//compute statistics: mean and rms
//
fSumEAbs /= NbOfEvents; fSum2EAbs /= NbOfEvents;
G4double rmsEAbs = fSum2EAbs - fSumEAbs*fSumEAbs;
if (rmsEAbs >0.) rmsEAbs = std::sqrt(rmsEAbs); else rmsEAbs = 0.;
fSumEGap /= NbOfEvents; fSum2EGap /= NbOfEvents;
G4double rmsEGap = fSum2EGap - fSumEGap*fSumEGap;
if (rmsEGap >0.) rmsEGap = std::sqrt(rmsEGap); else rmsEGap = 0.;
fSumLAbs /= NbOfEvents; fSum2LAbs /= NbOfEvents;
G4double rmsLAbs = fSum2LAbs - fSumLAbs*fSumLAbs;
if (rmsLAbs >0.) rmsLAbs = std::sqrt(rmsLAbs); else rmsLAbs = 0.;
fSumLGap /= NbOfEvents; fSum2LGap /= NbOfEvents;
G4double rmsLGap = fSum2LGap - fSumLGap*fSumLGap;
if (rmsLGap >0.) rmsLGap = std::sqrt(rmsLGap); else rmsLGap = 0.;
//print
//
G4cout
<< "\n--------------------End of Run------------------------------\n"
<< "\n mean Energy in Absorber : " << G4BestUnit(fSumEAbs,"Energy")
<< " +- " << G4BestUnit(rmsEAbs,"Energy")
<< "\n mean Energy in Gap : " << G4BestUnit(fSumEGap,"Energy")
<< " +- " << G4BestUnit(rmsEGap,"Energy")
<< G4endl;
G4cout
<< "\n mean trackLength in Absorber : " << G4BestUnit(fSumLAbs,"Length")
<< " +- " << G4BestUnit(rmsLAbs,"Length")
<< "\n mean trackLength in Gap : " << G4BestUnit(fSumLGap,"Length")
<< " +- " << G4BestUnit(rmsLGap,"Length")
<< "\n------------------------------------------------------------\n"
<< G4endl;
//save histograms
//
fHistoManager->PrintStatistic();
fHistoManager->Save();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,74 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file SteppingAction.cc
/// \brief Implementation of the SteppingAction class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingAction.hh"
#include "DetectorConstruction.hh"
#include "EventAction.hh"
#include "G4Step.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det,
EventAction* evt)
: G4UserSteppingAction(),
fDetector(det), fEventAction(evt)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::~SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* aStep)
{
// get volume of the current step
G4VPhysicalVolume* volume
= aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
// collect energy and track length step by step
G4double edep = aStep->GetTotalEnergyDeposit();
G4double stepl = 0.;
if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.)
stepl = aStep->GetStepLength();
if (volume == fDetector->GetAbsorber()) fEventAction->AddAbs(edep,stepl);
if (volume == fDetector->GetGap()) fEventAction->AddGap(edep,stepl);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,219 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file analysis/AnaEx03/src/HistoManager.cc
/// \brief Implementation of the HistoManager class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "HistoManager.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "AIDA/AIDA.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::HistoManager()
:fAF(0),fTree(0), fNtuple1(0), fNtuple2(0)
{
// Creating the analysis factory
//
fAF = AIDA_createAnalysisFactory();
if(!fAF) {
G4cout << " HistoManager::HistoManager :"
<< " problem creating the AIDA analysis factory."
<< G4endl;
}
// histograms
for (G4int k=0; k<kMaxHisto; k++) fHisto[k] = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
HistoManager::~HistoManager()
{
delete fAF;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::Book()
{
if (! fAF) return;
// Creating a tree container to handle histograms and ntuples.
// This tree is associated to an output file.
//
G4String fileName = "AnaEx03";
G4String fileType = "root"; // hbook root xml
G4String fileOption = " ";
//// G4String fileOption = "uncompress compress=no"; //for xml
//// G4String fileOption = "--noErrors"; //for hbook
fileName = fileName + "." + fileType;
G4bool readOnly = false;
G4bool createNew = true;
AIDA::ITreeFactory* tf = fAF->createTreeFactory();
fTree = tf->create(fileName, fileType, readOnly, createNew, fileOption);
delete tf;
if(!fTree) {
G4cout << " HistoManager::book :"
<< " problem creating the AIDA tree with "
<< " storeName = " << fileName
<< " storeType = " << fileType
<< " readOnly = " << readOnly
<< " createNew = " << createNew
<< " options = " << fileOption
<< G4endl;
return;
}
// Creating a histogram factory, whose histograms will be handled by the tree
//
AIDA::IHistogramFactory* hf = fAF->createHistogramFactory(*fTree);
// create histos in subdirectory "histograms"
//
fTree->mkdir("histograms");
fTree->cd("histograms");
// id = 0
fHisto[0] = hf->createHistogram1D("EAbs", "EAbs: Edep in absorber", 100, 0., 800*MeV);
// id = 1
fHisto[1] = hf->createHistogram1D("EGap", "EGap: Edep in gap", 100, 0., 100*MeV);
// id = 2
fHisto[2] = hf->createHistogram1D("LAbs", "LAbs: trackL in absorber", 100, 0., 1*m);
// id = 3
fHisto[3] = hf->createHistogram1D("LGap", "LGap: trackL in gap", 100, 0., 50*cm);
for ( G4int i=0; i<kMaxHisto; ++i ) {
if (! fHisto[i]) G4cout << "\n can't create histo " << i << G4endl;
}
delete hf;
fTree->cd("..");
// Creating a ntuple factory, handled by the tree
//
AIDA::ITupleFactory* ntf = fAF->createTupleFactory(*fTree);
// create 1 ntuple in subdirectory "tuples"
//
fTree->mkdir("tuples");
fTree->cd("tuples");
fNtuple1 = ntf->create("Ntuple1", "Edep", "double Eabs, Egap");
fNtuple2 = ntf->create("Ntuple2", "TrackL", "double Labs, Lgap");
delete ntf;
fTree->cd("..");
G4cout << "\n----> Output file is open in " << fileName << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::Save()
{
if (! (fAF && fTree)) return;
fTree->commit(); // Writing the histograms to the file
fTree->close(); // and closing the tree (and the file)
G4cout << "\n----> Histograms and ntuples are saved\n" << G4endl;
delete fTree;
fTree = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::FillHisto(G4int ih, G4double xbin, G4double weight)
{
if (ih >= kMaxHisto) {
G4cout << "---> warning from HistoManager::FillHisto() : histo " << ih
<< " does not exist. (xbin=" << xbin << " weight=" << weight << ")"
<< G4endl;
return;
}
if (fHisto[ih]) fHisto[ih]->fill(xbin, weight);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::Normalize(G4int ih, G4double fac)
{
if (ih >= kMaxHisto) {
G4cout << "---> warning from HistoManager::Normalize() : histo " << ih
<< " does not exist. (fac=" << fac << ")" << G4endl;
return;
}
if (fHisto[ih]) fHisto[ih]->scale(fac);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void HistoManager::FillNtuple(G4double energyAbs, G4double energyGap,
G4double trackLAbs, G4double trackLGap)
{
if (fNtuple1) {
fNtuple1->fill(0, energyAbs);
fNtuple1->fill(1, energyGap);
fNtuple1->addRow();
}
if (fNtuple2) {
fNtuple2->fill(0, trackLAbs);
fNtuple2->fill(1, trackLGap);
fNtuple2->addRow();
}
}
void HistoManager::PrintStatistic()
{
G4cout << "\n ----> print histograms statistic \n" << G4endl;
for ( G4int i=0; i<kMaxHisto; ++i ) {
AIDA::IHistogram1D* h1 = fHisto[i];
G4String title = h1->title();
// extract name as first 4 characters from title, as aida seems not to keep
// histogram name
const G4String name = title(0,4);
G4String unitCategory;
if (name[0] == 'E' ) unitCategory = "Energy";
if (name[0] == 'L' ) unitCategory = "Length";
G4cout << name
<< ": mean = " << G4BestUnit(h1->mean(), unitCategory)
<< " rms = " << G4BestUnit(h1->rms(), unitCategory )
<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,76 +0,0 @@
# Macro file for the initialization phase of "exampleN03.cc"
# when running in interactive mode
#
# Sets some default verbose
#
/control/verbose 2
/run/verbose 2
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
#
# Use this open statement to create a .prim file suitable for
# viewing in DAWN:
#/vis/open DAWNFILE
#
# Use this open statement to create a .heprep file suitable for
# viewing in HepRApp:
#/vis/open HepRepFile
#
# Use this open statement to create a .wrl file suitable for
# viewing in a VRML viewer:
#/vis/open VRML2FILE
#
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established:
/vis/viewer/set/autoRefresh false
/vis/verbose errors
#
# Draw geometry:
/vis/drawVolume
#
# Specify view angle:
#/vis/viewer/set/viewpointThetaPhi 90. 0.
#
# Specify zoom value:
#/vis/viewer/zoom 2.
#
# 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