Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -0,0 +1,24 @@
//$Id$
///\file "eventgenerator/pythia/.README"
///\brief Examples pythia README page
/*! \page Examples_pythia Category "eventgenerator/pythia"
Examples for Pythia-Geant4 interface.
This directory contains examples for using Pythia as Monte Carlo event
generator, interfaced with Geant4, and showing how to implement an external
decayer.
\section pythia_s1 Requirements for external software packages
\subsection pythia_sub_s11 PYTHIA
- Tested version 6.4.28
- URL: http://www.thep.lu.se/~torbjorn/Pythia.html
\section pythia_s2 Example decayer6
The \link Exampledecayer6 decayer6 \endlink example demonstrates the use
of Pythia6 as an external decayer.
*/
@@ -9,5 +9,8 @@ decayer.
Requirements for external software packages
-------------------------------------------
PYTHIA
Tested version 6.4.18
Tested version 6.4.28
URL: http://www.thep.lu.se/~torbjorn/Pythia.html
Example decayer6
This example demonstrates the use of Pythia6 as an external decayer.
@@ -0,0 +1,101 @@
$Id$
///\file "eventgenerator/pythia/decayer6/.README"
///\brief Example decayer6 page
/*! \page Exampledecayer6 Example decayer6
This is an example of the external decayer implementation
with PYTHIA6.
The complete PYTHIA6 documentation can be found at:
http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
The PYTHIA6 external decayer was originally developed within
the AliRoot framework, by Andreas Morsch (CERN). \n
The dependence on the ALICE software was taken off
by Christian Holm Christensen. \n
The dependence on the Root framework and the integration in
the Geant4 framework was done by Ivana Hrivnacova (IPN Orsay).
<hr>
The use of the external decayer is demonstrated with using the
classes from common examples repository, see below their complete
list.
The G4Pythia6Decayer class provides the implementation of the
G4VExternalDecayer interface with using PYTHIA6. In order
to be able to use PYTHIA6, which is written in FORTRAN,
a C++ interface class Pythia6 is provided. This class
interfaces only the PYTHIA6 functions relevant to decay.
The G4Pythia6Decayer is instantiated in the
P6DExtDecayerPhysics::ConstructProcess() function where the external
decayer is set to G4Decay process for all particles.
To demonstrate the decay with external decayer,
the B- meson is defined in ExG4PrimaryGeneratorAction01,
as it has no own decay table defined within Geant4.
With PYTHIA6, it is possible to force a selected decay
type. This selection can be chosen interactively via
the implemented Geant4 UI command:
\verbatim
/pythia6Decayer/forceDecayType decayType
\endverbatim
where the available decay types are listed in the EDecayType
enumaration.
The classes Pythia6, G4Pythia6Decayer, G4Pythia6DecayerMessenger
are independent from the example classes and can be reused
in another user application.
Installation:
- 1. Download the PYTHIA6 source file from the PYTHIA6 download site:\n
http://www.hepforge.org/downloads/pythia6
- 2A. With CMake: Build pythia6 library
For a convenience a CMake file for building Pythia6 library from
the source is provided in
examples/extended/eventgenerator/CMakeLists.txt.pythia6.
Build the pythia6 library following the instructions in this file
and then define the environment variables:
\verbatim
PYTHIA6 the path where pythia6 library is installed
PYTHIA6_VERSION the pythia version
\endverbatim
- 2B. With GNUmake: Define the environment variables: \n
\verbatim
PYTHIA6 the path to pythia-versionX.f source code
PYTHIA6_VERSION the pythia version
\endverbatim
e.g. If you download pythia-6.4.26.f.gz and unzip it in $HOME,
then you have to set:
export PYTHIA6=$HOME
export PYTHIA6_VERSION="6.4.26"
pythia6 will be then compiled together with example code.
- 3. Compilation:\n
Then the example is compiled in a standard way, see \ref README_HowToRun. \n
Note that with GNUmake build, an additional step 'gmake setup' is
needed before 'gmake'.
- 4. Execution:
\verbatim
% pythia6_decayer pythia6_decayer.in
\endverbatim
The list of classes used from common:
- ExG4DetectorConstruction01
- ExG4DetectorConstruction01Messenger
- ExG4PrimaryGeneratorAction01
- ExG4EventAction01
- ExG4EventAction01Messenger
- ExG4RunAction01
- ExG4RunAction01Messenger
*/
@@ -0,0 +1,89 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(decayer6)
#----------------------------------------------------------------------------
# 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 Pythia6 (required package)
#
find_package(Pythia6 QUIET)
if(NOT PYTHIA6_FOUND)
message(STATUS "G4 Examples: Pythia6 package not found. --> decayer6 example disabled")
return()
endif()
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/../../../common/detectorConstruction/include
${PROJECT_SOURCE_DIR}/../../../common/userActions/include
${PROJECT_SOURCE_DIR}/../../../common/primaryGenerator/include
${Geant4_INCLUDE_DIR}
${PYTHIA6_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc ${PROJECT_SOURCE_DIR}/src/*.c)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Get examples sources from common and shared
#
list(APPEND sources
${PROJECT_SOURCE_DIR}/../../../common/detectorConstruction/src/ExG4DetectorConstruction01.cc
${PROJECT_SOURCE_DIR}/../../../common/detectorConstruction/src/ExG4DetectorConstruction01Messenger.cc
${PROJECT_SOURCE_DIR}/../../../common/userActions/src/ExG4EventAction01.cc
${PROJECT_SOURCE_DIR}/../../../common/userActions/src/ExG4EventAction01Messenger.cc
${PROJECT_SOURCE_DIR}/../../../common/userActions/src/ExG4RunAction01.cc
${PROJECT_SOURCE_DIR}/../../../common/userActions/src/ExG4RunAction01Messenger.cc
${PROJECT_SOURCE_DIR}/../../../common/primaryGenerator/src/ExG4PrimaryGeneratorAction01.cc)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(pythia6_decayer pythia6_decayer.cc ${sources} ${headers})
target_link_libraries(pythia6_decayer ${Geant4_LIBRARIES} ${PYTHIA6_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build decayer6. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(decayer6_SCRIPTS
init.mac init_vis.mac pythia6_decayer.in pythia6_decayer.out vis.mac
)
foreach(_script ${decayer6_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# Add program to the project targets
# (this avoids the need of typing the program name after make)
#
add_custom_target(decayer6 DEPENDS pythia6_decayer)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS pythia6_decayer DESTINATION bin)
@@ -11,12 +11,20 @@ ifndef G4INSTALL
G4INSTALL = ../../../../..
endif
.PHONY: all
.PHONY: setup clean_setup all
all: pythia6 lib bin
EXTRALIBS = $(G4TMPDIR)/libPythia6.so
setup:
@echo "Copying files from common"
@$(G4INSTALL)/examples/extended/common/scripts/copy_files.sh
clean_setup:
@echo "Removing files copied from common"
@$(G4INSTALL)/examples/extended/common/scripts/clean_files.sh
include $(G4INSTALL)/config/binmake.gmk
CCFLAGS += -c
@@ -14,6 +14,26 @@ modifications introduced in the code and keep track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
24/08/2012 - I.Hrivnacova (p6decayer-V09-05-02)
- Fixed documentation files
05/06/2012 - I.Hrivnacova (p6decayer-V09-05-01)
-------------------------
- Updated pythia6_decayer.in macro:
- added initialization (now required)
- added call to /pythia6Decayer/verbose
- Fixed SharedFilesList.txt
- Limited G4Pythia6Decayer verbose levels to 0, 1
- Updated reference output
- Updated Pythia6 version in README file
11/04/2012 - I.Hrivnacova (p6decayer-V09-05-00)
-------------------------
- Introduced use of classes from common
- Introduced a physics builder for adding the external decayer to
an existing physics list
- Applied coding guidelines
02/12/2010 - I.Hrivnacova (p6decayer-V09-03-02)
-------------------------
- Migrated to use particle-based multiple-scattering.
@@ -1,13 +1,13 @@
$Id: README,v 1.2 2010-10-21 09:21:41 ivana Exp $
------------------------------------------------------------
Example of the external decayer implementation with Pythia6
===========================================================
Example of the external decayer implementation with PYTHIA6
-----------------------------------------------------------
The complete Pythia6 documentation can be found at:
The complete PYTHIA6 documentation can be found at:
http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
The Pythia6 external decayer was originally developed within
The PYTHIA6 external decayer was originally developed within
the AliRoot framework, by Andreas Morsch (CERN).
The dependence on the ALICE software was taken off
by Christian Holm Christensen,
@@ -16,22 +16,23 @@
------------------------------------------------------------
The use of the external decayer is demonstrated on the modified
novice N03 example.
The use of the external decayer is demonstrated with using the
classes from common examples repository, see below their complete list.
The G4Pythia6Decayer class provides the implementation of the
G4VExternalDecayer interface with using Pythia6. In order
to be able to use Pythia6, which is written in FORTRAN,
G4VExternalDecayer interface with using PYTHIA6. In order
to be able to use PYTHIA6, which is written in FORTRAN,
a C++ interface class Pythia6 is provided. This class
interfaces only the Pythia6 functions relevant to decay.
interfaces only the PYTHIA6 functions relevant to decay.
The G4Pythia6Decayer is instantiated in the ExN03PhysicsList class,
in the ConstructDecay() function.
The G4Pythia6Decayer is instantiated in the P6DExtDecayerPhysics builder,
in the ConstructProcess() function where the external decayer is set
to G4Decay process for all particles.
To demonstrate the decay with external decayer,
the B- meson is defined in ExN03PrimaryGeneratorAction,
the B- meson is defined in ExG4PrimaryGeneratorAction01,
as it has no own decay table defined within Geant4.
With Pythia6, it is possible to force a selected decay
With PYTHIA6, it is possible to force a selected decay
type. This selection can be chosen interactively via
the implemented Geant4 UI command:
@@ -46,23 +47,47 @@
Installation:
1. Download the Pythia6 source file from the Pythia6 download site:
1. Download the PYTHIA6 source file from the PYTHIA6 download site:
http://www.hepforge.org/downloads/pythia6
2. Define the environment variables:
PYTHIA6 the path to pythia-vesrinX.f source code
2A.) With CMake: Build pythia6 library
For a convenience a CMake file for building Pythia6 library from
the source is provided in
examples/extended/eventgenerator/CMakeLists.txt.pythia6.
Build the pythia6 library following the instructions in this file
and then define the environment variables:
PYTHIA6 the path where pythia6 library is installed
PYTHIA6_VERSION the pythia version
2B.) With GNUmake: Define the environment variables:
PYTHIA6 the path to pythia-versionX.f source code
PYTHIA6_VERSION the pythia version
e.g. If you download pythia-6.4.23.f.gz and unzip it in $HOME,
e.g. If you download pythia-6.4.26.f.gz and unzip it in $HOME,
then you have to set:
export PYTHIA6=$HOME
export PYTHIA6_VERSION="6.4.23"
export PYTHIA6_VERSION="6.4.26"
3. cd $G4INSTALL/example/extended/eventgenerator/pythia/decayer6
make
Pythia6 will be then compiled together with example code.
3. Compilation:
Then the example is compiled in a standard way, see examples/README_HowToRun.
Note that with GNUmake build, an additional step 'gmake setup' is
needed before 'gmake'.
Execution:
% pythia6_decayer pythia6_decayer.in
The list of classes used from common:
ExG4DetectorConstruction01
ExG4DetectorConstruction01Messenger
ExG4PrimaryGeneratorAction01
ExG4EventAction01
ExG4EventAction01Messenger
ExG4RunAction01
ExG4RunAction01Messenger
@@ -0,0 +1,10 @@
EXAMPLE extended/eventgenerator/pythia/decayer6
COMMON_CLASSES_PATH ../../../common
COMMON_CLASSES_LIST
ExG4DetectorConstruction01
ExG4DetectorConstruction01Messenger
ExG4PrimaryGeneratorAction01
ExG4EventAction01
ExG4EventAction01Messenger
ExG4RunAction01
ExG4RunAction01Messenger
@@ -1,157 +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. *
// ********************************************************************
//
//
// $Id: DetectorConstruction.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4UniformMagField;
class DetectorMessenger;
// ----------------------------------------------------------------------------
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction();
public:
void SetAbsorberMaterial (G4String);
void SetAbsorberThickness(G4double);
void SetGapMaterial (G4String);
void SetGapThickness(G4double);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers (G4int);
void SetMagField(G4double);
G4VPhysicalVolume* Construct();
void UpdateGeometry();
public:
void PrintCalorParameters();
G4double GetWorldSizeX() {return WorldSizeX;};
G4double GetWorldSizeYZ() {return WorldSizeYZ;};
G4double GetCalorThickness() {return CalorThickness;};
G4double GetCalorSizeYZ() {return CalorSizeYZ;};
G4int GetNbOfLayers() {return NbOfLayers;};
G4Material* GetAbsorberMaterial() {return AbsorberMaterial;};
G4double GetAbsorberThickness() {return AbsorberThickness;};
G4Material* GetGapMaterial() {return GapMaterial;};
G4double GetGapThickness() {return GapThickness;};
const G4VPhysicalVolume* GetphysiWorld() {return physiWorld;};
const G4VPhysicalVolume* GetAbsorber() {return physiAbsorber;};
const G4VPhysicalVolume* GetGap() {return physiGap;};
private:
G4Material* AbsorberMaterial;
G4double AbsorberThickness;
G4Material* GapMaterial;
G4double GapThickness;
G4int NbOfLayers;
G4double LayerThickness;
G4double CalorSizeYZ;
G4double CalorThickness;
G4Material* defaultMaterial;
G4double WorldSizeYZ;
G4double WorldSizeX;
G4Box* solidWorld; //pointer to the solid World
G4LogicalVolume* logicWorld; //pointer to the logical World
G4VPhysicalVolume* physiWorld; //pointer to the physical World
G4Box* solidCalor; //pointer to the solid Calor
G4LogicalVolume* logicCalor; //pointer to the logical Calor
G4VPhysicalVolume* physiCalor; //pointer to the physical Calor
G4Box* solidLayer; //pointer to the solid Layer
G4LogicalVolume* logicLayer; //pointer to the logical Layer
G4VPhysicalVolume* physiLayer; //pointer to the physical Layer
G4Box* solidAbsorber; //pointer to the solid Absorber
G4LogicalVolume* logicAbsorber; //pointer to the logical Absorber
G4VPhysicalVolume* physiAbsorber; //pointer to the physical Absorber
G4Box* solidGap; //pointer to the solid Gap
G4LogicalVolume* logicGap; //pointer to the logical Gap
G4VPhysicalVolume* physiGap; //pointer to the physical Gap
G4UniformMagField* magField; //pointer to the magnetic field
DetectorMessenger* detectorMessenger; //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
LayerThickness = AbsorberThickness + GapThickness;
CalorThickness = NbOfLayers*LayerThickness;
WorldSizeX = 1.2*CalorThickness; WorldSizeYZ = 1.2*CalorSizeYZ;
}
// ----------------------------------------------------------------------------
#endif
@@ -1,76 +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. *
// ********************************************************************
//
//
// $Id: DetectorMessenger.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#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;
// ----------------------------------------------------------------------------
class DetectorMessenger: public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction* );
~DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
DetectorConstruction* Detector;
G4UIdirectory* decDir;
G4UIdirectory* detDir;
G4UIcmdWithAString* AbsMaterCmd;
G4UIcmdWithAString* GapMaterCmd;
G4UIcmdWithADoubleAndUnit* AbsThickCmd;
G4UIcmdWithADoubleAndUnit* GapThickCmd;
G4UIcmdWithADoubleAndUnit* SizeYZCmd;
G4UIcmdWithAnInteger* NbLayersCmd;
G4UIcmdWithADoubleAndUnit* MagFieldCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
// ----------------------------------------------------------------------------
#endif
@@ -23,18 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: EDecayType.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// According to EDecayType enum in TPythia6Decayer class in Root:
// http://root.cern.ch/
// see http://root.cern.ch/root/License.html
// ----------------------------------------------------------------------------
/// \file eventgenerator/pythia/decayer6/include/EDecayType.hh
/// \brief Definition of the EDecayType enumeration
#ifndef E_DECAY_TYPE_H
#define E_DECAY_TYPE_H
// Enum of decay mode types
/// Enum of decay mode types
///
/// According to EDecayType enum in TPythia6Decayer class in Root:
/// http://root.cern.ch/
/// see http://root.cern.ch/root/License.html
/// ----------------------------------------------------------------------------
enum EDecayType
{
@@ -1,75 +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. *
// ********************************************************************
//
//
// $Id: EventAction.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#ifndef EventAction_h
#define EventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class RunAction;
class EventActionMessenger;
// ----------------------------------------------------------------------------
class EventAction : public G4UserEventAction
{
public:
EventAction(RunAction*);
~EventAction();
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
void AddAbs(G4double de, G4double dl) {EnergyAbs += de; TrackLAbs += dl;}
void AddGap(G4double de, G4double dl) {EnergyGap += de; TrackLGap += dl;}
void SetPrintModulo(G4int val) {printModulo = val;};
private:
RunAction* runAct;
G4double EnergyAbs, EnergyGap;
G4double TrackLAbs, TrackLGap;
G4int printModulo;
EventActionMessenger* eventMessenger;
};
// ----------------------------------------------------------------------------
#endif
@@ -24,16 +24,11 @@
// ********************************************************************
//
//
// $Id: G4Pythia6Decayer.hh,v 1.2 2008-12-18 12:56:36 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Implements the G4VExtDecayer abstract class using the Pythia6 interface.
/// \file eventgenerator/pythia/decayer6/include/G4Pythia6Decayer.hh
/// \brief Definition of the G4Pythia6Decayer class
//
// According to TPythia6Decayer class in Root:
// http://root.cern.ch/
// see http://root.cern.ch/root/License.html
// ----------------------------------------------------------------------------
#ifndef G4_PYTHIA6_DECAYER_H
#define G4_PYTHIA6_DECAYER_H
@@ -48,7 +43,12 @@ class Pythia6Particle;
class G4Track;
class G4DecayProducts;
// ----------------------------------------------------------------------------
/// Pythia6 decayer
///
/// Implements the G4VExtDecayer abstract class using the Pythia6 interface.
/// According to TPythia6Decayer class in Root:
/// http://root.cern.ch/
/// see http://root.cern.ch/root/License.html
class G4Pythia6Decayer : public G4VExtDecayer
{
@@ -24,15 +24,10 @@
// ********************************************************************
//
//
// $Id: G4Pythia6DecayerMessenger.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Messenger class that defines commands for G4Pythia6Decayer.
//
// Implements command
// - /pythia6Decayer/verbose [level]
// - /pythia6Decayer/forceDecayType [decayType]
// ----------------------------------------------------------------------------
/// \file eventgenerator/pythia/decayer6/include/G4Pythia6DecayerMessenger.hh
/// \brief Definition of the G4Pythia6DecayerMessenger class
#ifndef G4_PYTHIA6_DECAYER_MESSENGER_H
#define G4_PYTHIA6_DECAYER_MESSENGER_H
@@ -46,7 +41,11 @@ class G4UIdirectory;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
// ----------------------------------------------------------------------------
/// Messenger class that defines commands for G4Pythia6Decayer.
///
/// Implements command
/// - /pythia6Decayer/verbose [level]
/// - /pythia6Decayer/forceDecayType [decayType]
class G4Pythia6DecayerMessenger : public G4UImessenger
{
@@ -23,41 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: EventActionMessenger.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
// ----------------------------------------------------------------------------
/// \file eventgenerator/pythia/decayer6/include/P6DExtDecayerPhysics.hh
/// \brief Definition of the P6DExtDecayerPhysics class
///
/// \author I. Hrivnacova; IPN Orsay
#ifndef EventActionMessenger_h
#define EventActionMessenger_h 1
#ifndef P6D_EXT_DECAYER_PHYSICS_H
#define P6D_EXT_DECAYER_PHYSICS_H
#include "G4VPhysicsConstructor.hh"
#include "globals.hh"
#include "G4UImessenger.hh"
class EventAction;
class G4UIdirectory;
class G4UIcmdWithAnInteger;
class G4Decay;
// ----------------------------------------------------------------------------
/// The builder for external decayer.
///
/// The external decayer is added to all instantiated decay
/// processes
///
/// \author I. Hrivnacova; IPN Orsay
class EventActionMessenger: public G4UImessenger
class P6DExtDecayerPhysics: public G4VPhysicsConstructor
{
public:
P6DExtDecayerPhysics(const G4String& name = "ExtDecayer");
virtual ~P6DExtDecayerPhysics();
EventActionMessenger(EventAction*);
~EventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
protected:
// methods
// construct particle and physics
virtual void ConstructParticle();
virtual void ConstructProcess();
private:
EventAction* eventAction;
G4UIdirectory* eventDir;
G4UIcmdWithAnInteger* PrintCmd;
/// Not implemented
P6DExtDecayerPhysics(const P6DExtDecayerPhysics& right);
/// Not implemented
P6DExtDecayerPhysics& operator=(const P6DExtDecayerPhysics& right);
};
// ----------------------------------------------------------------------------
#endif //P6D_EXT_DECAYER_PHYSICS_H
#endif
@@ -23,33 +23,31 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
// $Id: PhysicsList.hh,v 1.2 2010-10-21 09:21:41 ivana Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
/// \file eventgenerator/pythia/decayer6/include/P6DPhysicsList.hh
/// \brief Definition of the P6DPhysicsList class
#ifndef PhysicsList_h
#define PhysicsList_h 1
#ifndef P6DPhysicsList_h
#define P6DPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
// ----------------------------------------------------------------------------
/// The physics list class with Pythia6 decayer
class PhysicsList: public G4VUserPhysicsList
class P6DPhysicsList: public G4VUserPhysicsList
{
public:
PhysicsList();
~PhysicsList();
P6DPhysicsList();
~P6DPhysicsList();
// Construct particle and physics
void ConstructParticle();
void ConstructProcess();
virtual void ConstructParticle();
virtual void ConstructProcess();
void SetCuts();
virtual void SetCuts();
private:
@@ -1,69 +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. *
// ********************************************************************
//
//
// $Id: PrimaryGeneratorAction.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
class DetectorConstruction;
class PrimaryGeneratorMessenger;
// ----------------------------------------------------------------------------
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
~PrimaryGeneratorAction();
void GeneratePrimaries(G4Event*);
void SetRndmFlag(G4String val) { rndmFlag = val;}
private:
G4ParticleGun* particleGun; // pointer a to G4 class
DetectorConstruction* Detector; // pointer to the geometry
PrimaryGeneratorMessenger* gunMessenger; // messenger of this class
G4String rndmFlag; // flag for a rndm impact point
};
// ----------------------------------------------------------------------------
#endif
@@ -1,63 +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. *
// ********************************************************************
//
//
// $Id: PrimaryGeneratorMessenger.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// ----------------------------------------------------------------------------
#ifndef PrimaryGeneratorMessenger_h
#define PrimaryGeneratorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class PrimaryGeneratorAction;
class G4UIdirectory;
class G4UIcmdWithAString;
// ----------------------------------------------------------------------------
class PrimaryGeneratorMessenger : public G4UImessenger
{
public:
PrimaryGeneratorMessenger(PrimaryGeneratorAction*);
~PrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
PrimaryGeneratorAction* Action;
G4UIdirectory* gunDir;
G4UIcmdWithAString* RndmCmd;
};
// ----------------------------------------------------------------------------
#endif
@@ -23,17 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: Pythia6.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// According to TPythia6 class from Root:
// (The TPythia6 class is an interface class to F77 routines in Pythia6 //
// CERNLIB event generators, written by T.Sjostrand.)
// http://root.cern.ch/
// see http://root.cern.ch/root/License.html
//
// The complete Pythia6 documentation can be found at:
// http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
/// \file eventgenerator/pythia/decayer6/include/Pythia6.hh
/// \brief Definition of the Pythia6 class
//
// ----------------------------------------------------------------------------
@@ -93,6 +87,7 @@
int const KNDCAY = 8000; //should be 4000 for pythia61
/// PYJETS common-block
struct Pyjets_t
{
int N;
@@ -102,6 +97,7 @@ struct Pyjets_t
double V[5][4000];
};
/// PYDAT1 common-block
struct Pydat1_t
{
int MSTU[200];
@@ -110,6 +106,7 @@ struct Pydat1_t
double PARJ[200];
};
/// PYDAT3 common-block
struct Pydat3_t
{
int MDCY[3][500];
@@ -118,6 +115,7 @@ struct Pydat3_t
int KFDP[5][KNDCAY];
};
/// Structure for Pythia6 particle properties
struct Pythia6Particle
{
Pythia6Particle(
@@ -150,6 +148,18 @@ struct Pythia6Particle
typedef std::vector<Pythia6Particle*> ParticleVector;
/// The C++ interface class to Pythia6
///
/// According to TPythia6 class from Root:
/// (The TPythia6 class is an interface class to F77 routines in Pythia6 //
/// CERNLIB event generators, written by T.Sjostrand.)
/// http://root.cern.ch/
/// see http://root.cern.ch/root/License.html
///
/// The complete Pythia6 documentation can be found at:
/// http://home.thep.lu.se/~torbjorn/pythiaaux/recent.html
///
class Pythia6
{
public:
@@ -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. *
// ********************************************************************
//
//
// $Id: RunAction.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// ----------------------------------------------------------------------------
#ifndef RunAction_h
#define RunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
// ----------------------------------------------------------------------------
class G4Run;
class RunAction : public G4UserRunAction
{
public:
RunAction();
~RunAction();
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
void fillPerEvent(G4double, G4double, G4double, G4double);
private:
G4double sumEAbs, sum2EAbs;
G4double sumEGap, sum2EGap;
G4double sumLAbs, sum2LAbs;
G4double sumLGap, sum2LGap;
};
// ----------------------------------------------------------------------------
#endif
@@ -1,60 +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. *
// ********************************************************************
//
//
// $Id: SteppingAction.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#ifndef SteppingAction_h
#define SteppingAction_h 1
#include "G4UserSteppingAction.hh"
class DetectorConstruction;
class EventAction;
// ----------------------------------------------------------------------------
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(DetectorConstruction*, EventAction*);
~SteppingAction();
void UserSteppingAction(const G4Step*);
private:
DetectorConstruction* detector;
EventAction* eventaction;
};
// ----------------------------------------------------------------------------
#endif
@@ -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. *
// ********************************************************************
//
//
// $Id: SteppingVerbose.hh,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
class SteppingVerbose;
#ifndef SteppingVerbose_h
#define SteppingVerbose_h 1
#include "G4SteppingVerbose.hh"
// ----------------------------------------------------------------------------
class SteppingVerbose : public G4SteppingVerbose
{
public:
SteppingVerbose();
~SteppingVerbose();
void StepInfo();
void TrackingStarted();
};
// ----------------------------------------------------------------------------
#endif
@@ -0,0 +1,8 @@
# Macro file for the initialization phase of "pythia6Decayer" example
# when running in interactive mode without visualization
#
# Sets some default verbose
#
/control/verbose 1
/control/saveHistory
/run/verbose 1
@@ -0,0 +1,11 @@
# Macro file for the initialization phase of "pythia6Decayer"
# when running in interactive mode with visualization
#
# Sets some default verbose
#
/control/verbose 1
/control/saveHistory
/run/verbose 1
# Visualization setting
/control/execute vis.mac
@@ -23,26 +23,27 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
// $Id: pythia6_decayer.cc,v 1.2 2010-05-12 13:30:38 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
/// \file eventgenerator/pythia/decayer6/pythia6_decayer.cc
/// \brief Main program of the pythia6Decayer example
#include "P6DExtDecayerPhysics.hh"
//#include "P6DPhysicsList.hh"
#include "ExG4DetectorConstruction01.hh"
#include "ExG4PrimaryGeneratorAction01.hh"
#include "ExG4RunAction01.hh"
#include "ExG4EventAction01.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4ThreeVector.hh"
#include "QGSP_BERT.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"
#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
#endif
@@ -51,73 +52,68 @@
#include "G4UIExecutive.hh"
#endif
// ----------------------------------------------------------------------------
int main(int argc,char** argv)
{
// Choose the Random engine
//
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
// User Verbose output class
//
G4VSteppingVerbose::SetInstance(new SteppingVerbose);
// Construct the default run manager
//
G4RunManager * runManager = new G4RunManager;
// Set mandatory initialization classes
//
DetectorConstruction* detector = new DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new ExG4DetectorConstruction01);
//
G4VUserPhysicsList* physics = new PhysicsList;
/*
G4VUserPhysicsList* physics = new P6DPhysicsList;
runManager->SetUserInitialization(physics);
*/
G4VModularPhysicsList* physicsList = new QGSP_BERT;
physicsList->RegisterPhysics(new P6DExtDecayerPhysics());
runManager->SetUserInitialization(physicsList);
// Set user action classes
//
G4VUserPrimaryGeneratorAction* gen_action =
new PrimaryGeneratorAction(detector);
runManager->SetUserAction(gen_action);
runManager->SetUserAction(
new ExG4PrimaryGeneratorAction01("B-", 50.*MeV));
// B- meson has not defined decay in Geant4
runManager->SetUserAction(new ExG4RunAction01);
runManager->SetUserAction(new ExG4EventAction01);
//
RunAction* run_action = new RunAction;
runManager->SetUserAction(run_action);
//
EventAction* event_action = new EventAction(run_action);
runManager->SetUserAction(event_action);
//
G4UserSteppingAction* stepping_action =
new SteppingAction(detector, event_action);
runManager->SetUserAction(stepping_action);
// Initialize G4 kernel
//
runManager->Initialize();
//G4UserSteppingAction* stepping_action =
// new SteppingAction(detector, event_action);
//runManager->SetUserAction(stepping_action);
// Get the pointer to the User Interface manager
//
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if (argc!=1) // batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else
{ // interactive mode : define UI session
if (argc!=1) {
// batch mode{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
}
else { // interactive mode : define UI session
#ifdef G4UI_USE
#ifdef G4VIS_USE
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
#endif
UImanager->ApplyCommand("/control/execute vis.mac");
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
ui->SessionStart();
delete ui;
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
#ifdef G4VIS_USE
delete visManager;
UImanager->ApplyCommand("/control/execute init_vis.mac");
#else
UImanager->ApplyCommand("/control/execute init.mac");
#endif
ui->SessionStart();
delete ui;
#ifdef G4VIS_USE
delete visManager;
#endif
#endif
}
@@ -130,5 +126,3 @@ int main(int argc,char** argv)
return 0;
}
// ----------------------------------------------------------------------------
@@ -1,3 +1,6 @@
# initialize Geant4
/run/initialize
# B- meson with default Pythia6 decay
/tracking/verbose 1
/run/beamOn 1
@@ -6,3 +9,8 @@
/pythia6Decayer/forceDecayType 0
/tracking/verbose 1
/run/beamOn 1
# Switch off verbose mode
/pythia6Decayer/verbose 0
/tracking/verbose 0
/run/beamOn 1
File diff suppressed because it is too large Load Diff
@@ -1,448 +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. *
// ********************************************************************
//
//
// $Id: DetectorConstruction.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4UniformMagField.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4RunManager.hh"
// ----------------------------------------------------------------------------
DetectorConstruction::DetectorConstruction()
: AbsorberMaterial(0),GapMaterial(0),defaultMaterial(0),
solidWorld(0),logicWorld(0),physiWorld(0),
solidCalor(0),logicCalor(0),physiCalor(0),
solidLayer(0),logicLayer(0),physiLayer(0),
solidAbsorber(0),logicAbsorber(0),physiAbsorber(0),
solidGap (0),logicGap (0),physiGap (0),
magField(0)
{
// default parameter values of the calorimeter
AbsorberThickness = 10.*mm;
GapThickness = 5.*mm;
NbOfLayers = 10;
CalorSizeYZ = 10.*cm;
ComputeCalorParameters();
// materials
DefineMaterials();
SetAbsorberMaterial("Lead");
SetGapMaterial("liquidArgon");
// create commands for interactive definition of the calorimeter
detectorMessenger = new DetectorMessenger(this);
}
// ----------------------------------------------------------------------------
DetectorConstruction::~DetectorConstruction()
{ delete detectorMessenger;}
// ----------------------------------------------------------------------------
G4VPhysicalVolume* DetectorConstruction::Construct()
{
return ConstructCalorimeter();
}
// ----------------------------------------------------------------------------
void DetectorConstruction::DefineMaterials()
{
//This function illustrates the possible ways to define materials
G4String symbol; //a=mass of a mole;
G4double a, z, density; //z=mean number of protons;
G4int iz, n; //iz=number of protons in an isotope;
// n=number of nucleons in an isotope;
G4int ncomponents, natoms;
G4double abundance, fractionmass;
//
// define Elements
//
G4Element* H = new G4Element("Hydrogen",symbol="H", z= 1., a= 1.01*g/mole);
G4Element* C = new G4Element("Carbon" ,symbol="C", z= 6., a= 12.01*g/mole);
G4Element* N = new G4Element("Nitrogen",symbol="N", z= 7., a= 14.01*g/mole);
G4Element* O = new G4Element("Oxygen" ,symbol="O", z= 8., a= 16.00*g/mole);
G4Element* Si = new G4Element("Silicon",symbol="Si", z= 14., a= 28.09*g/mole);
//
// define an Element from isotopes, by relative abundance
//
G4Isotope* U5 = new G4Isotope("U235", iz=92, n=235, a=235.01*g/mole);
G4Isotope* U8 = new G4Isotope("U238", iz=92, n=238, a=238.03*g/mole);
G4Element* U = new G4Element("enriched Uranium",symbol="U",ncomponents=2);
U->AddIsotope(U5, abundance= 90.*perCent);
U->AddIsotope(U8, abundance= 10.*perCent);
//
// define simple materials
//
new G4Material("Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3);
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
new G4Material("Lead" , z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
//
// define a material from elements. case 1: chemical molecule
//
G4Material* H2O =
new G4Material("Water", density= 1.000*g/cm3, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
// overwrite computed meanExcitationEnergy with ICRU recommended value
H2O->GetIonisation()->SetMeanExcitationEnergy(75.0*eV);
G4Material* Sci =
new G4Material("Scintillator", density= 1.032*g/cm3, ncomponents=2);
Sci->AddElement(C, natoms=9);
Sci->AddElement(H, natoms=10);
G4Material* Myl =
new G4Material("Mylar", density= 1.397*g/cm3, ncomponents=3);
Myl->AddElement(C, natoms=10);
Myl->AddElement(H, natoms= 8);
Myl->AddElement(O, natoms= 4);
G4Material* SiO2 =
new G4Material("quartz",density= 2.200*g/cm3, ncomponents=2);
SiO2->AddElement(Si, natoms=1);
SiO2->AddElement(O , natoms=2);
//
// define a material from elements. case 2: mixture by fractional mass
//
G4Material* Air =
new G4Material("Air" , density= 1.290*mg/cm3, ncomponents=2);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
//
// define a material from elements and/or others materials
// (mixture of mixtures)
//
G4Material* Aerog =
new G4Material("Aerogel", density= 0.200*g/cm3, ncomponents=3);
Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent);
Aerog->AddMaterial(H2O , fractionmass=37.4*perCent);
Aerog->AddElement (C , fractionmass= 0.1*perCent);
//
// examples of gas in non STP conditions
//
G4Material* CO2 =
new G4Material("CarbonicGas", density= 27.*mg/cm3, ncomponents=2,
kStateGas, 325.*kelvin, 50.*atmosphere);
CO2->AddElement(C, natoms=1);
CO2->AddElement(O, natoms=2);
G4Material* steam =
new G4Material("WaterSteam", density= 0.3*mg/cm3, ncomponents=1,
kStateGas, 500.*kelvin, 2.*atmosphere);
steam->AddMaterial(H2O, fractionmass=1.);
//
// examples of vacuum
//
G4Material* Vacuum =
new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
kStateGas, 2.73*kelvin, 3.e-18*pascal);
G4Material* beam =
new G4Material("Beam", density= 1.e-5*g/cm3, ncomponents=1,
kStateGas, STP_Temperature, 2.e-2*bar);
beam->AddMaterial(Air, fractionmass=1.);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//default materials of the World
defaultMaterial = Vacuum;
}
// ----------------------------------------------------------------------------
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
//
solidWorld = new G4Box("World", //its name
WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //its size
logicWorld = new G4LogicalVolume(solidWorld, //its solid
defaultMaterial, //its material
"World"); //its name
physiWorld = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicWorld, //its logical volume
"World", //its name
0, //its mother volume
false, //no boolean operation
0); //copy number
//
// Calorimeter
//
solidCalor=0; logicCalor=0; physiCalor=0;
solidLayer=0; logicLayer=0; physiLayer=0;
if (CalorThickness > 0.)
{ solidCalor = new G4Box("Calorimeter", //its name
CalorThickness/2,CalorSizeYZ/2,CalorSizeYZ/2);//size
logicCalor = new G4LogicalVolume(solidCalor, //its solid
defaultMaterial, //its material
"Calorimeter"); //its name
physiCalor = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicCalor, //its logical volume
"Calorimeter", //its name
logicWorld, //its mother volume
false, //no boolean operation
0); //copy number
//
// Layer
//
solidLayer = new G4Box("Layer", //its name
LayerThickness/2,CalorSizeYZ/2,CalorSizeYZ/2); //size
logicLayer = new G4LogicalVolume(solidLayer, //its solid
defaultMaterial, //its material
"Layer"); //its name
if (NbOfLayers > 1)
physiLayer = new G4PVReplica("Layer", //its name
logicLayer, //its logical volume
logicCalor, //its mother
kXAxis, //axis of replication
NbOfLayers, //number of replica
LayerThickness); //witdth of replica
else
physiLayer = new G4PVPlacement(0, //no rotation
G4ThreeVector(), //at (0,0,0)
logicLayer, //its logical volume
"Layer", //its name
logicCalor, //its mother volume
false, //no boolean operation
0); //copy number
}
//
// Absorber
//
solidAbsorber=0; logicAbsorber=0; physiAbsorber=0;
if (AbsorberThickness > 0.)
{ solidAbsorber = new G4Box("Absorber", //its name
AbsorberThickness/2,CalorSizeYZ/2,CalorSizeYZ/2);
logicAbsorber = new G4LogicalVolume(solidAbsorber, //its solid
AbsorberMaterial, //its material
AbsorberMaterial->GetName()); //name
physiAbsorber = new G4PVPlacement(0, //no rotation
G4ThreeVector(-GapThickness/2,0.,0.), //its position
logicAbsorber, //its logical volume
AbsorberMaterial->GetName(), //its name
logicLayer, //its mother
false, //no boulean operat
0); //copy number
}
//
// Gap
//
solidGap=0; logicGap=0; physiGap=0;
if (GapThickness > 0.)
{ solidGap = new G4Box("Gap",
GapThickness/2,CalorSizeYZ/2,CalorSizeYZ/2);
logicGap = new G4LogicalVolume(solidGap,
GapMaterial,
GapMaterial->GetName());
physiGap = new G4PVPlacement(0, //no rotation
G4ThreeVector(AbsorberThickness/2,0.,0.), //its position
logicGap, //its logical volume
GapMaterial->GetName(), //its name
logicLayer, //its mother
false, //no boulean operat
0); //copy number
}
PrintCalorParameters();
//
// Visualization attributes
//
logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxVisAtt->SetVisibility(true);
logicCalor->SetVisAttributes(simpleBoxVisAtt);
//
//always return the physical World
//
return physiWorld;
}
// ----------------------------------------------------------------------------
void DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n------------------------------------------------------------"
<< "\n---> The calorimeter is " << NbOfLayers << " layers of: [ "
<< AbsorberThickness/mm << "mm of " << AbsorberMaterial->GetName()
<< " + "
<< GapThickness/mm << "mm of " << GapMaterial->GetName() << " ] "
<< "\n------------------------------------------------------------\n";
}
// ----------------------------------------------------------------------------
void DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial) AbsorberMaterial = pttoMaterial;
}
// ----------------------------------------------------------------------------
void DetectorConstruction::SetGapMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial) GapMaterial = pttoMaterial;
}
// ----------------------------------------------------------------------------
void DetectorConstruction::SetAbsorberThickness(G4double val)
{
// change Absorber thickness and recompute the calorimeter parameters
AbsorberThickness = val;
}
// ----------------------------------------------------------------------------
void DetectorConstruction::SetGapThickness(G4double val)
{
// change Gap thickness and recompute the calorimeter parameters
GapThickness = val;
}
// ----------------------------------------------------------------------------
void DetectorConstruction::SetCalorSizeYZ(G4double val)
{
// change the transverse size and recompute the calorimeter parameters
CalorSizeYZ = val;
}
// ----------------------------------------------------------------------------
void DetectorConstruction::SetNbOfLayers(G4int val)
{
NbOfLayers = val;
}
// ----------------------------------------------------------------------------
void DetectorConstruction::SetMagField(G4double fieldValue)
{
//apply a global uniform magnetic field along Z axis
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
if(magField) delete magField; //delete the existing magn field
if(fieldValue!=0.) // create a new one if non nul
{ magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
fieldMgr->SetDetectorField(magField);
fieldMgr->CreateChordFinder(magField);
} else {
magField = 0;
fieldMgr->SetDetectorField(magField);
}
}
// ----------------------------------------------------------------------------
void DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
}
// ----------------------------------------------------------------------------
@@ -1,146 +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. *
// ********************************************************************
//
//
// $Id: DetectorMessenger.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
// ----------------------------------------------------------------------------
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det )
: Detector(Det)
{
decDir = new G4UIdirectory("/decayer/");
decDir->SetGuidance("UI commands of this example");
detDir = new G4UIdirectory("/decayer/det/");
detDir->SetGuidance("detector control");
AbsMaterCmd = new G4UIcmdWithAString("/decayer/det/setAbsMat",this);
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
AbsMaterCmd->SetParameterName("choice",false);
AbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
GapMaterCmd = new G4UIcmdWithAString("/decayer/det/setGapMat",this);
GapMaterCmd->SetGuidance("Select Material of the Gap.");
GapMaterCmd->SetParameterName("choice",false);
GapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/decayer/det/setAbsThick",this);
AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
AbsThickCmd->SetParameterName("Size",false);
AbsThickCmd->SetRange("Size>=0.");
AbsThickCmd->SetUnitCategory("Length");
AbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
GapThickCmd = new G4UIcmdWithADoubleAndUnit("/decayer/det/setGapThick",this);
GapThickCmd->SetGuidance("Set Thickness of the Gap");
GapThickCmd->SetParameterName("Size",false);
GapThickCmd->SetRange("Size>=0.");
GapThickCmd->SetUnitCategory("Length");
GapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/decayer/det/setSizeYZ",this);
SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
SizeYZCmd->SetParameterName("Size",false);
SizeYZCmd->SetRange("Size>0.");
SizeYZCmd->SetUnitCategory("Length");
SizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
NbLayersCmd = new G4UIcmdWithAnInteger("/decayer/det/setNbOfLayers",this);
NbLayersCmd->SetGuidance("Set number of layers.");
NbLayersCmd->SetParameterName("NbLayers",false);
NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
NbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/decayer/det/update",this);
UpdateCmd->SetGuidance("Update calorimeter geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(G4State_Idle);
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/decayer/det/setField",this);
MagFieldCmd->SetGuidance("Define magnetic field.");
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
MagFieldCmd->SetParameterName("Bz",false);
MagFieldCmd->SetUnitCategory("Magnetic flux density");
MagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
// ----------------------------------------------------------------------------
DetectorMessenger::~DetectorMessenger()
{
delete NbLayersCmd;
delete AbsMaterCmd; delete GapMaterCmd;
delete AbsThickCmd; delete GapThickCmd;
delete SizeYZCmd; delete UpdateCmd;
delete MagFieldCmd;
delete detDir;
delete decDir;
}
// ----------------------------------------------------------------------------
void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == AbsMaterCmd )
{ Detector->SetAbsorberMaterial(newValue);}
if( command == GapMaterCmd )
{ Detector->SetGapMaterial(newValue);}
if( command == AbsThickCmd )
{ Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));}
if( command == GapThickCmd )
{ Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));}
if( command == SizeYZCmd )
{ Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
if( command == NbLayersCmd )
{ Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
if( command == UpdateCmd )
{ Detector->UpdateGeometry(); }
if( command == MagFieldCmd )
{ Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
}
// ----------------------------------------------------------------------------
@@ -1,105 +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. *
// ********************************************************************
//
//
// $Id: EventAction.cc,v 1.2 2010-06-06 04:52:12 perl Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#include "EventAction.hh"
#include "RunAction.hh"
#include "EventActionMessenger.hh"
#include "G4Event.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
#include <iomanip>
// ----------------------------------------------------------------------------
EventAction::EventAction(RunAction* run)
: runAct(run),printModulo(1),eventMessenger(0)
{
eventMessenger = new EventActionMessenger(this);
}
// ----------------------------------------------------------------------------
EventAction::~EventAction()
{
delete eventMessenger;
}
// ----------------------------------------------------------------------------
void EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
{
G4cout << "\n---> Begin of event: " << evtNb << G4endl;
CLHEP::HepRandom::showEngineStatus();
}
// initialisation per event
//
EnergyAbs = EnergyGap = 0.;
TrackLAbs = TrackLGap = 0.;
}
// ----------------------------------------------------------------------------
void EventAction::EndOfEventAction(const G4Event* evt)
{
// accumulates statistic
//
runAct->fillPerEvent(EnergyAbs, EnergyGap, TrackLAbs, TrackLGap);
// print per event (modulo n)
//
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
{
G4cout << "---> End of event: " << evtNb << G4endl;
G4cout
<< " Absorber: total energy: " << std::setw(7)
<< G4BestUnit(EnergyAbs,"Energy")
<< " total track length: " << std::setw(7)
<< G4BestUnit(TrackLAbs,"Length")
<< G4endl
<< " Gap: total energy: " << std::setw(7)
<< G4BestUnit(EnergyGap,"Energy")
<< " total track length: " << std::setw(7)
<< G4BestUnit(TrackLGap,"Length")
<< G4endl;
}
}
// ----------------------------------------------------------------------------
@@ -1,72 +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. *
// ********************************************************************
//
//
// $Id: EventActionMessenger.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#include "EventActionMessenger.hh"
#include "EventAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "globals.hh"
// ----------------------------------------------------------------------------
EventActionMessenger::EventActionMessenger(EventAction* EvAct)
: eventAction(EvAct)
{
eventDir = new G4UIdirectory("/decayer/event/");
eventDir->SetGuidance("event control");
PrintCmd = new G4UIcmdWithAnInteger("/decayer/event/printModulo",this);
PrintCmd->SetGuidance("Print events modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
}
// ----------------------------------------------------------------------------
EventActionMessenger::~EventActionMessenger()
{
delete PrintCmd;
delete eventDir;
}
// ----------------------------------------------------------------------------
void EventActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if(command == PrintCmd)
{
eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));
}
}
// ----------------------------------------------------------------------------
@@ -23,10 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
// $Id: G4Pythia6Decayer.cc,v 1.4 2010-10-21 09:21:41 ivana Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
/// \file eventgenerator/pythia/decayer6/src/G4Pythia6Decayer.cc
/// \brief Implementation of the G4Pythia6Decayer class
// ----------------------------------------------------------------------------
// According to TPythia6Decayer class in Root:
// http://root.cern.ch/
// see http://root.cern.ch/root/License.html
@@ -40,6 +42,7 @@
#include "G4DecayTable.hh"
#include "G4ParticleTable.hh"
#include "G4Track.hh"
#include "G4SystemOfUnits.hh"
#include <CLHEP/Vector/LorentzVector.h>
@@ -47,7 +50,8 @@
const EDecayType G4Pythia6Decayer::fgkDefaultDecayType = kAll;
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Pythia6Decayer::G4Pythia6Decayer()
: G4VExtDecayer("G4Pythia6Decayer"),
fMessenger(this),
@@ -62,7 +66,8 @@ G4Pythia6Decayer::G4Pythia6Decayer()
ForceDecay(fDecayType);
}
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Pythia6Decayer::~G4Pythia6Decayer()
{
/// Destructor
@@ -75,7 +80,8 @@ G4Pythia6Decayer::~G4Pythia6Decayer()
//
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParticleDefinition* G4Pythia6Decayer::
GetParticleDefinition(const Pythia6Particle* particle, G4bool warn) const
{
@@ -100,7 +106,8 @@ GetParticleDefinition(const Pythia6Particle* particle, G4bool warn) const
return particleDefinition;
}
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4DynamicParticle*
G4Pythia6Decayer::CreateDynamicParticle(const Pythia6Particle* particle) const
{
@@ -120,8 +127,8 @@ G4Pythia6Decayer::CreateDynamicParticle(const Pythia6Particle* particle) const
return dynamicParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//_____________________________________________________________________________
G4ThreeVector G4Pythia6Decayer::GetParticlePosition(
const Pythia6Particle* particle) const
{
@@ -134,8 +141,8 @@ G4ThreeVector G4Pythia6Decayer::GetParticlePosition(
return position;
}
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreeVector G4Pythia6Decayer::GetParticleMomentum(
const Pythia6Particle* particle) const
{
@@ -148,18 +155,21 @@ G4ThreeVector G4Pythia6Decayer::GetParticleMomentum(
return momentum;
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4Pythia6Decayer::CountProducts(G4int channel, G4int particle)
{
/// Count number of decay products
G4int np = 0;
for ( G4int i=1; i<=5; i++ )
if ( std::abs(Pythia6::Instance()->GetKFDP(channel,i) ) == particle ) np++;
if ( std::abs(Pythia6::Instance()->GetKFDP(channel,i) ) == particle )
np++;
return np;
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
G4Pythia6Decayer::ForceParticleDecay(G4int particle, G4int product, G4int mult)
{
@@ -184,7 +194,8 @@ G4Pythia6Decayer::ForceParticleDecay(G4int particle, G4int product, G4int mult)
}
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Pythia6Decayer::ForceParticleDecay(G4int particle, G4int* products,
G4int* mult, G4int npart)
{
@@ -210,7 +221,8 @@ void G4Pythia6Decayer::ForceParticleDecay(G4int particle, G4int* products,
}
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Pythia6Decayer::ForceHadronicD()
{
/// Force golden D decay modes
@@ -271,7 +283,8 @@ void G4Pythia6Decayer::ForceHadronicD()
} // hadrons
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Pythia6Decayer::ForceOmega()
{
/// Force Omega -> Lambda K- Decay
@@ -297,7 +310,8 @@ void G4Pythia6Decayer::ForceOmega()
} // decay channels
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Pythia6Decayer::ForceDecay(EDecayType decayType)
{
/// Force a particle decay mode
@@ -498,7 +512,8 @@ void G4Pythia6Decayer::ForceDecay(EDecayType decayType)
}
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Pythia6Decayer::Decay(G4int pdg, const CLHEP::HepLorentzVector& p)
{
/// Decay a particle of type IDPART (PDG code) and momentum P.
@@ -506,7 +521,8 @@ void G4Pythia6Decayer::Decay(G4int pdg, const CLHEP::HepLorentzVector& p)
Pythia6::Instance()->Py1ent(0, pdg, p.e(), p.theta(), p.phi());
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4Pythia6Decayer::ImportParticles(ParticleVector* particles)
{
/// Get the decay products into the passed PARTICLES vector
@@ -518,7 +534,8 @@ G4int G4Pythia6Decayer::ImportParticles(ParticleVector* particles)
// public methods
//
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4DecayProducts* G4Pythia6Decayer::ImportDecayProducts(const G4Track& track)
{
/// Import decay products
@@ -544,7 +561,7 @@ G4DecayProducts* G4Pythia6Decayer::ImportDecayProducts(const G4Track& track)
Decay(pdgEncoding, p);
G4int nofParticles = ImportParticles(fDecayProductsArray);
if ( fVerboseLevel > 1 ) {
if ( fVerboseLevel > 0 ) {
G4cout << "nofParticles: " << nofParticles << G4endl;
}
@@ -566,7 +583,7 @@ G4DecayProducts* G4Pythia6Decayer::ImportDecayProducts(const G4Track& track)
// pass to tracking final particles only;
// skip neutrinos
if ( fVerboseLevel > 1 ) {
if ( fVerboseLevel > 0 ) {
G4cout << " " << i << "th particle PDG: " << pdg << " ";
}
@@ -576,7 +593,7 @@ G4DecayProducts* G4Pythia6Decayer::ImportDecayProducts(const G4Track& track)
if (dynamicParticle) {
if ( fVerboseLevel > 1 ) {
if ( fVerboseLevel > 0 ) {
G4cout << " G4 particle name: "
<< dynamicParticle->GetDefinition()->GetParticleName()
<< G4endl;
@@ -589,14 +606,15 @@ G4DecayProducts* G4Pythia6Decayer::ImportDecayProducts(const G4Track& track)
}
}
}
if ( fVerboseLevel > 1 ) {
if ( fVerboseLevel > 0 ) {
G4cout << "nofParticles for tracking: " << counter << G4endl;
}
return decayProducts;
}
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Pythia6Decayer::ForceDecayType(EDecayType decayType)
{
/// Force a given decay type
@@ -23,10 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
// $Id: G4Pythia6DecayerMessenger.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
/// \file eventgenerator/pythia/decayer6/src/G4Pythia6DecayerMessenger.cc
/// \brief Implementation of the G4Pythia6DecayerMessenger class
// ----------------------------------------------------------------------------
// Messenger class that defines commands for G4Pythia6Decayer.
//
// Implements command
@@ -43,7 +45,8 @@
#include <sstream>
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Pythia6DecayerMessenger::G4Pythia6DecayerMessenger(
G4Pythia6Decayer* pythia6Decayer)
: G4UImessenger(),
@@ -57,23 +60,26 @@ G4Pythia6DecayerMessenger::G4Pythia6DecayerMessenger(
fDirectory = new G4UIdirectory("/pythia6Decayer/");
fDirectory->SetGuidance("G4Pythia6Decayer control commands.");
fVerboseCmd = new G4UIcmdWithAnInteger("/pythia6Decayer/verbose", this);
fVerboseCmd
= new G4UIcmdWithAnInteger("/pythia6Decayer/verbose", this);
fVerboseCmd->SetGuidance("Set Pythia6Decayer verbose level");
fVerboseCmd->SetParameterName("VerboseLevel", false);
fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 5");
fVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 1");
fVerboseCmd->AvailableForStates(G4State_Idle);
fDecayTypeCmd = new G4UIcmdWithAnInteger("/pythia6Decayer/forceDecayType", this);
fDecayTypeCmd
= new G4UIcmdWithAnInteger("/pythia6Decayer/forceDecayType", this);
fDecayTypeCmd->SetGuidance("Force the specified decay type");
fDecayTypeCmd->SetParameterName("DecayType", false);
std::ostringstream os;
os << "DecayType >= " << kSemiElectronic
<< " && DecayType <= " << kMaxDecay;
fDecayTypeCmd->SetRange(os.str().c_str());
fDecayTypeCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
fDecayTypeCmd->AvailableForStates(G4State_Idle);
}
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Pythia6DecayerMessenger::~G4Pythia6DecayerMessenger()
{
/// Destructor
@@ -87,7 +93,8 @@ G4Pythia6DecayerMessenger::~G4Pythia6DecayerMessenger()
// public methods
//
//_____________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4Pythia6DecayerMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
@@ -102,3 +109,5 @@ void G4Pythia6DecayerMessenger::SetNewValue(G4UIcommand* command,
->ForceDecayType(EDecayType(fDecayTypeCmd->GetNewIntValue(newValue)));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
//
/// \file eventgenerator/pythia/decayer6/src/P6DExtDecayerPhysics.cc
/// \brief Implementation of the P6DExtDecayerPhysics class
///
/// \author I. Hrivnacova; IPN, Orsay
#include "P6DExtDecayerPhysics.hh"
#include "G4Pythia6Decayer.hh"
#include <G4ParticleDefinition.hh>
#include <G4ProcessManager.hh>
#include <G4Decay.hh>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
P6DExtDecayerPhysics::P6DExtDecayerPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{
/// Standard constructor
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
P6DExtDecayerPhysics::~P6DExtDecayerPhysics()
{
/// Destructor
}
//
// protected methods
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void P6DExtDecayerPhysics::ConstructParticle()
{
/// Nothing to be done here
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void P6DExtDecayerPhysics::ConstructProcess()
{
/// Loop over all particles instantiated and add external decayer
/// to all decay processes if External decayer is set
// Create Geant4 external decayer
G4Pythia6Decayer* extDecayer = new G4Pythia6Decayer();
extDecayer->SetVerboseLevel(1);
// The extDecayer will be deleted in G4Decay destructor
theParticleIterator->reset();
while ((*theParticleIterator)())
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if ( verboseLevel > 1 ) {
G4cout << "Setting ext decayer for: "
<< theParticleIterator->value()->GetParticleName()
<< G4endl;
}
G4ProcessVector* processVector = pmanager->GetProcessList();
for (G4int i=0; i<processVector->length(); i++) {
G4Decay* decay = dynamic_cast<G4Decay*>((*processVector)[i]);
if ( decay ) decay->SetExtDecayer(extDecayer);
}
}
if ( verboseLevel > 0 ) {
G4cout << "External decayer physics constructed." << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,14 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: PhysicsList.cc,v 1.2 2010-10-21 09:21:41 ivana Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
// ----------------------------------------------------------------------------
/// \file eventgenerator/pythia/decayer6/src/P6DPhysicsList.cc
/// \brief Implementation of the P6DPhysicsList class
#include "PhysicsList.hh"
#include "P6DPhysicsList.hh"
#include "G4ProcessManager.hh"
@@ -41,47 +39,26 @@
#include "G4BaryonConstructor.hh"
#include "G4IonConstructor.hh"
/// REMOVE
/*
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4Pythia6Decayer.hh"
#include "G4SystemOfUnits.hh"
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4Decay.hh"
*/
// ----------------------------------------------------------------------------
PhysicsList::PhysicsList(): G4VUserPhysicsList()
P6DPhysicsList::P6DPhysicsList()
: G4VUserPhysicsList()
{
defaultCutValue = 1.0*mm;
SetVerboseLevel(1);
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::~PhysicsList()
P6DPhysicsList::~P6DPhysicsList()
{
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructParticle()
void P6DPhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
@@ -104,16 +81,16 @@ void PhysicsList::ConstructParticle()
pIonConstructor.ConstructParticle();
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::ConstructProcess()
void P6DPhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructDecay();
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
@@ -136,7 +113,7 @@ void PhysicsList::ConstructProcess()
#include "G4ionIonisation.hh"
void PhysicsList::ConstructEM()
void P6DPhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
@@ -201,12 +178,12 @@ void PhysicsList::ConstructEM()
}
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Decay.hh"
#include "G4Pythia6Decayer.hh"
void PhysicsList::ConstructDecay()
void P6DPhysicsList::ConstructDecay()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
@@ -232,13 +209,13 @@ void PhysicsList::ConstructDecay()
}
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void PhysicsList::SetCuts()
void P6DPhysicsList::SetCuts()
{
if (verboseLevel >0)
{
G4cout << "PhysicsList::SetCuts:";
G4cout << "P6DPhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
@@ -253,5 +230,6 @@ void PhysicsList::SetCuts()
if (verboseLevel>0) DumpCutValuesTable();
}
// ----------------------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,96 +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. *
// ********************************************************************
//
//
// $Id: PrimaryGeneratorAction.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
// ----------------------------------------------------------------------------
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
: Detector(DC), rndmFlag("off")
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
//create a messenger for this class
gunMessenger = new PrimaryGeneratorMessenger(this);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
//G4ParticleDefinition* particle
// = particleTable->FindParticle(particleName="e-");
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="B-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
particleGun->SetParticleEnergy(50.*MeV);
G4double position = -0.5*(Detector->GetWorldSizeX());
particleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
}
// ----------------------------------------------------------------------------
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
// ----------------------------------------------------------------------------
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
G4double x0 = -0.5*(Detector->GetWorldSizeX());
G4double y0 = 0.*cm, z0 = 0.*cm;
if (rndmFlag == "on")
{
y0 = (Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5);
z0 = (Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5);
}
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
}
// ----------------------------------------------------------------------------
@@ -1,75 +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. *
// ********************************************************************
//
//
// $Id: PrimaryGeneratorMessenger.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#include "PrimaryGeneratorMessenger.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
// ----------------------------------------------------------------------------
PrimaryGeneratorMessenger::
PrimaryGeneratorMessenger(PrimaryGeneratorAction* Gun)
: Action(Gun)
{
gunDir = new G4UIdirectory("/decayer/gun/");
gunDir->SetGuidance("PrimaryGenerator control");
RndmCmd = new G4UIcmdWithAString("/decayer/gun/rndm",this);
RndmCmd->SetGuidance("Shoot randomly the incident particle.");
RndmCmd->SetGuidance(" Choice : on(default), off");
RndmCmd->SetParameterName("choice",true);
RndmCmd->SetDefaultValue("on");
RndmCmd->SetCandidates("on off");
RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
// ----------------------------------------------------------------------------
PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger()
{
delete RndmCmd;
delete gunDir;
}
// ----------------------------------------------------------------------------
void
PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == RndmCmd )
{
Action->SetRndmFlag(newValue);
}
}
// ----------------------------------------------------------------------------
@@ -23,9 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: Pythia6.cc,v 1.2 2010-10-21 09:21:41 ivana Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
/// \file eventgenerator/pythia/decayer6/src/Pythia6.cc
/// \brief Implementation of the Pythia6 class
// ----------------------------------------------------------------------------
// According to TPythia6 class from Root:
// (The TPythia6 class is an interface class to F77 routines in Pythia6 //
// CERNLIB event generators, written by T.Sjostrand.)
@@ -109,7 +112,8 @@ extern "C" {
Pythia6* Pythia6::fgInstance = 0;
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Pythia6* Pythia6::Instance()
{
/// Static access method
@@ -119,14 +123,17 @@ Pythia6* Pythia6::Instance()
return fgInstance;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//______________________________________________________________________________
Pythia6::Pythia6()
: fParticles(0)
: fParticles(0),
fPyjets(0),
fPydat1(0),
fPydat3(0)
{
/// Pythia6 constructor: creates a vector of Pythia6Particle in which it will store all
/// particles. Note that there may be only one functional Pythia6 object
/// at a time, so it's not use to create more than one instance of it.
/// Pythia6 constructor: creates a vector of Pythia6Particle in which it will
/// store all particles. Note that there may be only one functional Pythia6
/// object at a time, so it's not use to create more than one instance of it.
// Protect against multiple objects. All access should be via the
// Instance member function.
@@ -143,10 +150,12 @@ Pythia6::Pythia6()
fPydat3 = (Pydat3_t*) pythia6_common_address("PYDAT3");
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Pythia6::~Pythia6()
{
/// Destroy the object, delete and dispose all Pythia6Particles currently on list.
/// Destroy the object, delete and dispose all Pythia6Particles currently on
/// list.
if ( fParticles ) {
ParticleVector::const_iterator it;
@@ -156,7 +165,8 @@ Pythia6::~Pythia6()
}
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int Pythia6::Pycomp(int kf)
{
/// Interface with fortran routine pycomp
@@ -164,7 +174,8 @@ int Pythia6::Pycomp(int kf)
return pycomp(&kf);
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Pythia6::Py1ent(int ip, int kf, double pe, double theta, double phi)
{
/// Add one entry to the event record, i.e. either a parton or a
@@ -188,7 +199,8 @@ void Pythia6::Py1ent(int ip, int kf, double pe, double theta, double phi)
py1ent(ip, kf, pe, theta, phi);
}
//______________________________________________________________________________
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int Pythia6::ImportParticles(ParticleVector* particles, const char* option)
{
/// Default primary creation method. It reads the /HEPEVT/ common block which
@@ -265,3 +277,5 @@ int Pythia6::ImportParticles(ParticleVector* particles, const char* option)
return nparts;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,123 +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. *
// ********************************************************************
//
//
// $Id: RunAction.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// ----------------------------------------------------------------------------
#include "RunAction.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4UnitsTable.hh"
// ----------------------------------------------------------------------------
RunAction::RunAction()
{
}
// ----------------------------------------------------------------------------
RunAction::~RunAction()
{
}
// ----------------------------------------------------------------------------
void RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// inform the runManager to save random number seed
//
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
// initialize cumulative quantities
//
sumEAbs = sum2EAbs =sumEGap = sum2EGap = 0.;
sumLAbs = sum2LAbs =sumLGap = sum2LGap = 0.;
}
// ----------------------------------------------------------------------------
void RunAction::fillPerEvent(G4double EAbs, G4double EGap,
G4double LAbs, G4double LGap)
{
// accumulate statistic
//
sumEAbs += EAbs; sum2EAbs += EAbs*EAbs;
sumEGap += EGap; sum2EGap += EGap*EGap;
sumLAbs += LAbs; sum2LAbs += LAbs*LAbs;
sumLGap += LGap; sum2LGap += LGap*LGap;
}
// ----------------------------------------------------------------------------
void RunAction::EndOfRunAction(const G4Run* aRun)
{
G4int NbOfEvents = aRun->GetNumberOfEvent();
if (NbOfEvents == 0) return;
// compute statistics: mean and rms
//
sumEAbs /= NbOfEvents; sum2EAbs /= NbOfEvents;
G4double rmsEAbs = sum2EAbs - sumEAbs*sumEAbs;
if (rmsEAbs >0.) rmsEAbs = std::sqrt(rmsEAbs); else rmsEAbs = 0.;
sumEGap /= NbOfEvents; sum2EGap /= NbOfEvents;
G4double rmsEGap = sum2EGap - sumEGap*sumEGap;
if (rmsEGap >0.) rmsEGap = std::sqrt(rmsEGap); else rmsEGap = 0.;
sumLAbs /= NbOfEvents; sum2LAbs /= NbOfEvents;
G4double rmsLAbs = sum2LAbs - sumLAbs*sumLAbs;
if (rmsLAbs >0.) rmsLAbs = std::sqrt(rmsLAbs); else rmsLAbs = 0.;
sumLGap /= NbOfEvents; sum2LGap /= NbOfEvents;
G4double rmsLGap = sum2LGap - sumLGap*sumLGap;
if (rmsLGap >0.) rmsLGap = std::sqrt(rmsLGap); else rmsLGap = 0.;
// print
//
G4cout
<< "\n--------------------End of Run------------------------------\n"
<< "\n mean Energy in Absorber : " << G4BestUnit(sumEAbs,"Energy")
<< " +- " << G4BestUnit(rmsEAbs,"Energy")
<< "\n mean Energy in Gap : " << G4BestUnit(sumEGap,"Energy")
<< " +- " << G4BestUnit(rmsEGap,"Energy")
<< G4endl;
G4cout
<< "\n mean trackLength in Absorber : " << G4BestUnit(sumLAbs,"Length")
<< " +- " << G4BestUnit(rmsLAbs,"Length")
<< "\n mean trackLength in Gap : " << G4BestUnit(sumLGap,"Length")
<< " +- " << G4BestUnit(rmsLGap,"Length")
<< "\n------------------------------------------------------------\n"
<< G4endl;
}
// ----------------------------------------------------------------------------
@@ -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. *
// ********************************************************************
//
//
// $Id: SteppingAction.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// ----------------------------------------------------------------------------
#include "SteppingAction.hh"
#include "DetectorConstruction.hh"
#include "EventAction.hh"
#include "G4Step.hh"
// ----------------------------------------------------------------------------
SteppingAction::SteppingAction(DetectorConstruction* det, EventAction* evt)
: detector(det), eventaction(evt)
{
}
// ----------------------------------------------------------------------------
SteppingAction::~SteppingAction()
{
}
// ----------------------------------------------------------------------------
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 == detector->GetAbsorber()) { eventaction->AddAbs(edep,stepl); }
if (volume == detector->GetGap()) { eventaction->AddGap(edep,stepl); }
}
// ----------------------------------------------------------------------------
@@ -1,195 +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. *
// ********************************************************************
//
//
// $Id: SteppingVerbose.cc,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// ----------------------------------------------------------------------------
#include "SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.hh"
// ----------------------------------------------------------------------------
SteppingVerbose::SteppingVerbose()
{
}
// ----------------------------------------------------------------------------
SteppingVerbose::~SteppingVerbose()
{
}
// ----------------------------------------------------------------------------
void SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 )
{
if( verboseLevel >= 4 ) { VerboseTrack(); }
if( verboseLevel >= 3 )
{
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
}
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< " ";
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 )
{
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
}
else
{
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0)
{
G4cout << " "
<< std::setw(10)
<< fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
}
else
{
G4cout << " UserLimit";
}
G4cout << G4endl;
if( verboseLevel == 2 )
{
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0)
{
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++)
{
G4cout << " : "
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< std::setw(10)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
// ----------------------------------------------------------------------------
void SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 )
{
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< " ";
if(fTrack->GetNextVolume())
{
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
}
else
{
G4cout << "OutOfWorld";
}
G4cout << " initStep" << G4endl;
}
G4cout.precision(prec);
}
// ----------------------------------------------------------------------------
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: pythia6_common_address.c,v 1.1 2008-11-03 11:48:35 gcosmo Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// According to pythia6_common_address.c provided in Root
// Pythia6 distribution: