Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -0,0 +1,533 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: cexmc.cc
*
* Description: main
*
* Version: 1.0
* Created: 10.10.2009 23:24:39
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#include <set>
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/algorithm/string.hpp>
#include <boost/archive/archive_exception.hpp>
#ifdef CEXMC_USE_CUSTOM_FILTER
#include <boost/variant/get.hpp>
#endif
#endif
#include <G4Version.hh>
#include <G4UImanager.hh>
#include <G4String.hh>
#ifdef G4UI_USE
#include <G4UIsession.hh>
#include <G4UIterminal.hh>
#ifdef G4UI_USE_TCSH
#include <G4UItcsh.hh>
#endif
#ifdef G4UI_USE_QT
#include <G4UIQt.hh>
#endif
#endif
#ifdef G4VIS_USE
#include <G4VisExecutive.hh>
#endif
#include "CexmcRunManager.hh"
#ifdef CEXMC_USE_ROOT
#include "CexmcHistoManager.hh"
#endif
#include "CexmcSetup.hh"
#include "CexmcPhysicsList.hh"
#include "CexmcPhysicsManager.hh"
#include "CexmcPrimaryGeneratorAction.hh"
#include "CexmcTrackingAction.hh"
#include "CexmcSteppingAction.hh"
#include "CexmcEventAction.hh"
#include "CexmcRunAction.hh"
#include "CexmcMessenger.hh"
#include "CexmcException.hh"
#include "CexmcBasicPhysicsSettings.hh"
#include "CexmcCommon.hh"
namespace
{
const G4String CexmcVisManagerVerboseLevel( "errors" );
}
struct CexmcCmdLineData
{
CexmcCmdLineData() : isInteractive( false ), startQtSession( false ),
preinitMacro( "" ), initMacro( "" ), rProject( "" ),
wProject( "" ), overrideExistingProject( false ),
customFilter( "" )
{}
G4bool isInteractive;
G4bool startQtSession;
G4String preinitMacro;
G4String initMacro;
G4String rProject;
G4String wProject;
G4bool overrideExistingProject;
CexmcOutputDataTypeSet outputData;
G4String customFilter;
};
void printUsage( void )
{
#ifdef CEXMC_PROG_NAME
const char * progName( CEXMC_PROG_NAME );
#else
const char * progName( "cexmc" );
#endif
G4cout << "Usage: " << progName << " [-i] "
#ifdef G4UI_USE_QT
"[-g] "
#endif
"[-p preinit_macro] [-m init_macro] "
#ifdef CEXMC_USE_PERSISTENCY
"[[-y] -w project]" << G4endl <<
" [-r project "
#ifdef CEXMC_USE_CUSTOM_FILTER
"[-f filter_script] "
#endif
"[-o list]]"
#endif
<< G4endl;
G4cout << "or " << progName << " [--help | -h]" << G4endl;
G4cout << " -i - run in interactive mode" << G4endl;
#ifdef G4UI_USE_QT
G4cout << " -g - start graphical interface (Qt), implies "
"interactive mode " << G4endl;
#endif
G4cout << " -p - use specified preinit macro file " << G4endl;
G4cout << " -m - use specified init macro file " << G4endl;
#ifdef CEXMC_USE_PERSISTENCY
G4cout << " -w - save data in specified project files" << G4endl;
G4cout << " -r - read data from specified project files" <<
G4endl;
#ifdef CEXMC_USE_CUSTOM_FILTER
G4cout << " -f - use specified custom filter script" << G4endl;
#endif
G4cout << " -o - comma-separated list of data to output, "
"possible values:" << G4endl <<
" run, geom, events" << G4endl;
G4cout << " -y - force project override" << G4endl;
#endif
G4cout << " --help | -h - print this message and exit " << G4endl;
}
G4bool parseArgs( int argc, char ** argv, CexmcCmdLineData & cmdLineData )
{
if ( argc < 2 )
return false;
for ( G4int i( 1 ); i < argc; ++i )
{
do
{
if ( G4String( argv[ i ] ) == "--help" )
{
return false;
}
if ( G4String( argv[ i ] ) == "-h" )
{
return false;
}
if ( G4String( argv[ i ], 2 ) == "-i" )
{
cmdLineData.isInteractive = true;
break;
}
#ifdef G4UI_USE_QT
if ( G4String( argv[ i ], 2 ) == "-g" )
{
cmdLineData.isInteractive = true;
cmdLineData.startQtSession = true;
break;
}
#endif
if ( G4String( argv[ i ], 2 ) == "-p" )
{
cmdLineData.preinitMacro = argv[ i ] + 2;
if ( cmdLineData.preinitMacro == "" )
{
if ( ++i >= argc )
throw CexmcException( CexmcCmdLineParseException );
cmdLineData.preinitMacro = argv[ i ];
}
break;
}
if ( G4String( argv[ i ], 2 ) == "-m" )
{
cmdLineData.initMacro = argv[ i ] + 2;
if ( cmdLineData.initMacro == "" )
{
if ( ++i >= argc )
throw CexmcException( CexmcCmdLineParseException );
cmdLineData.initMacro = argv[ i ];
}
break;
}
#ifdef CEXMC_USE_PERSISTENCY
if ( G4String( argv[ i ], 2 ) == "-w" )
{
cmdLineData.wProject = argv[ i ] + 2;
if ( cmdLineData.wProject == "" )
{
if ( ++i >= argc )
throw CexmcException( CexmcCmdLineParseException );
cmdLineData.wProject = argv[ i ];
}
break;
}
if ( G4String( argv[ i ], 2 ) == "-r" )
{
cmdLineData.rProject = argv[ i ] + 2;
if ( cmdLineData.rProject == "" )
{
if ( ++i >= argc )
throw CexmcException( CexmcCmdLineParseException );
cmdLineData.rProject = argv[ i ];
}
break;
}
if ( G4String( argv[ i ], 2 ) == "-y" )
{
cmdLineData.overrideExistingProject = true;
break;
}
if ( G4String( argv[ i ], 2 ) == "-o" )
{
std::string outputData( argv[ i ] + 2 );
if ( outputData == "" )
{
if ( ++i >= argc )
throw CexmcException( CexmcCmdLineParseException );
outputData = argv[ i ];
}
std::set< std::string > tokens;
boost::split( tokens, outputData, boost::is_any_of( "," ) );
for ( std::set< std::string >::iterator k( tokens.begin() );
k != tokens.end(); ++k )
{
do
{
if ( *k == "run" )
{
cmdLineData.outputData.insert( CexmcOutputRun );
break;
}
if ( *k == "geom" )
{
cmdLineData.outputData.insert(
CexmcOutputGeometry );
break;
}
if ( *k == "events" )
{
cmdLineData.outputData.insert( CexmcOutputEvents );
break;
}
throw CexmcException( CexmcCmdLineParseException );
} while ( false );
}
break;
}
#ifdef CEXMC_USE_CUSTOM_FILTER
if ( G4String( argv[ i ], 2 ) == "-f" )
{
cmdLineData.customFilter = argv[ i ] + 2;
if ( cmdLineData.customFilter == "" )
{
if ( ++i >= argc )
throw CexmcException( CexmcCmdLineParseException );
cmdLineData.customFilter = argv[ i ];
}
break;
}
#endif
#endif
throw CexmcException( CexmcCmdLineParseException );
} while ( false );
}
return true;
}
int main( int argc, char ** argv )
{
#ifdef G4UI_USE
G4UIsession * session( NULL );
#endif
CexmcCmdLineData cmdLineData;
#ifdef CEXMC_USE_PERSISTENCY
G4bool outputDataOnly( false );
#endif
try
{
if ( ! parseArgs( argc, argv, cmdLineData ) )
{
printUsage();
return 0;
}
#ifdef CEXMC_USE_PERSISTENCY
if ( cmdLineData.rProject != "" &&
cmdLineData.rProject == cmdLineData.wProject )
throw CexmcException( CexmcCmdLineParseException );
if ( cmdLineData.rProject == "" && ! cmdLineData.outputData.empty() )
throw CexmcException( CexmcCmdLineParseException );
#ifdef CEXMC_USE_CUSTOM_FILTER
if ( cmdLineData.rProject == "" && ! cmdLineData.customFilter.empty() )
throw CexmcException( CexmcCmdLineParseException );
#endif
if ( cmdLineData.wProject != "" && ! cmdLineData.outputData.empty() )
throw CexmcException( CexmcCmdLineParseException );
outputDataOnly = ! cmdLineData.outputData.empty();
#endif
}
catch ( CexmcException & e )
{
G4cout << e.what() << G4endl;
return 1;
}
catch ( ... )
{
G4cout << "Unknown exception caught when parsing args" << G4endl;
return 1;
}
CexmcRunManager * runManager( NULL );
#ifdef G4VIS_USE
G4VisManager * visManager( NULL );
#endif
CexmcMessenger::Instance();
#ifdef CEXMC_USE_ROOT
CexmcHistoManager::Instance();
#endif
try
{
runManager = new CexmcRunManager( cmdLineData.wProject,
cmdLineData.rProject,
cmdLineData.overrideExistingProject );
#ifdef CEXMC_USE_PERSISTENCY
#ifdef CEXMC_USE_CUSTOM_FILTER
runManager->SetCustomFilter( cmdLineData.customFilter );
#endif
if ( outputDataOnly )
{
/* we will need an arbitrary physics list to get access to particle
* table if events output was ordered */
CexmcOutputDataTypeSet::const_iterator found(
cmdLineData.outputData.find( CexmcOutputEvents ) );
if ( found != cmdLineData.outputData.end() )
runManager->SetUserInitialization(
CexmcChargeExchangePMFactory::
Create( CexmcPionZeroProduction ) );
runManager->PrintReadData( cmdLineData.outputData );
delete runManager;
return 0;
}
#endif
G4UImanager * uiManager( G4UImanager::GetUIpointer() );
if ( cmdLineData.preinitMacro != "" )
uiManager->ApplyCommand( "/control/execute " +
cmdLineData.preinitMacro );
CexmcProductionModelType productionModelType(
runManager->GetProductionModelType() );
if ( productionModelType == CexmcUnknownProductionModel )
throw CexmcException( CexmcPreinitException );
G4VUserPhysicsList * physicsList( CexmcChargeExchangePMFactory::
Create( productionModelType ) );
CexmcPhysicsManager * physicsManager(
dynamic_cast< CexmcPhysicsManager * >( physicsList ) );
CexmcProductionModel * productionModel(
physicsManager->GetProductionModel() );
if ( ! productionModel )
throw CexmcException( CexmcWeirdException );
G4cout << CEXMC_LINE_START << "Production model '" <<
productionModel->GetName() << "' instantiated" << G4endl;
runManager->SetUserInitialization( physicsList );
CexmcSetup * setup( new CexmcSetup( runManager->GetGdmlFileName(),
runManager->ShouldGdmlFileBeValidated() ) );
runManager->SetUserInitialization( setup );
runManager->Initialize();
runManager->SetPhysicsManager( physicsManager );
runManager->SetUserAction( new CexmcPrimaryGeneratorAction(
physicsManager ) );
runManager->SetUserAction( new CexmcEventAction( physicsManager ) );
runManager->SetUserAction( new CexmcRunAction( physicsManager ) );
runManager->SetUserAction( new CexmcTrackingAction( physicsManager ) );
runManager->SetUserAction( new CexmcSteppingAction( physicsManager ) );
#ifdef CEXMC_USE_ROOT
CexmcHistoManager::Instance()->Initialize();
#endif
#ifdef G4VIS_USE
if ( cmdLineData.isInteractive )
{
#if G4VERSION_NUMBER < 940
visManager = new G4VisExecutive;
#else
visManager = new G4VisExecutive( CexmcVisManagerVerboseLevel );
#endif
visManager->Initialize();
}
#endif
#ifdef CEXMC_USE_PERSISTENCY
if ( runManager->ProjectIsRead() )
{
runManager->ReadProject();
runManager->PrintReadRunData();
}
#endif
if ( cmdLineData.initMacro != "" )
uiManager->ApplyCommand( "/control/execute " +
cmdLineData.initMacro );
if ( cmdLineData.isInteractive )
{
productionModel->PrintInitialData();
}
#ifdef G4UI_USE
if ( cmdLineData.isInteractive )
{
if ( cmdLineData.startQtSession )
{
#ifdef G4UI_USE_QT
session = new G4UIQt( argc, argv );
const G4String & guiMacroName( runManager->GetGuiMacroName() );
if ( guiMacroName != "" )
uiManager->ApplyCommand( "/control/execute " +
guiMacroName );
#ifdef CEXMC_USE_ROOTQT
runManager->EnableLiveHistograms();
#endif
#endif
}
else
{
#ifdef G4UI_USE_TCSH
session = new G4UIterminal( new G4UItcsh );
#else
session = new G4UIterminal;
#endif
}
if ( session )
session->SessionStart();
}
#endif
#ifdef CEXMC_USE_PERSISTENCY
if ( runManager->ProjectIsSaved() )
{
runManager->SaveProject();
}
#endif
}
catch ( CexmcException & e )
{
G4cout << e.what() << G4endl;
}
#ifdef CEXMC_USE_PERSISTENCY
catch ( boost::archive::archive_exception & e )
{
G4cout << CEXMC_LINE_START << "Serialization error: " << e.what() <<
G4endl;
}
#ifdef CEXMC_USE_CUSTOM_FILTER
catch ( boost::bad_get & e )
{
G4cout << CEXMC_LINE_START << "Custom filter error: " << e.what() <<
G4endl;
}
#endif
#endif
catch ( ... )
{
G4cout << "Unknown exception caught" << G4endl;
}
#ifdef CEXMC_USE_ROOT
CexmcHistoManager::Destroy();
#endif
CexmcMessenger::Destroy();
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
#ifdef G4UI_USE
delete session;
#endif
return 0;
}
@@ -0,0 +1,101 @@
name := ChargeExchangeMC
G4TARGET := $(name)
G4EXLIB := true
CPPFLAGS += -DCEXMC_PROG_NAME=\"$(name)\"
# if CEXMC_USE_PERSISTENCY is 'yes' then run and events data can be read and
# written; requires boost::serialize headers and library
CEXMC_USE_PERSISTENCY := yes
# if CEXMC_USE_CUSTOM_FILTER is 'yes' then Custom filter can be used for
# existing events data; requires boost::spirit 2.x headers. Notice: if
# CEXMC_USE_PERSISTENCY is not 'yes' then Custom Filter will not be used anyway
CEXMC_USE_CUSTOM_FILTER := no
# if CEXMC_DEBUG_CUSTOM_FILTER is 'yes' then AST trees will be printed out
CEXMC_DEBUG_CUSTOM_FILTER := no
# if CEXMC_USE_HISTOGRAMING is 'yes' then ROOT histograming framework will be
# compiled. Notice: if ROOT CERN is not installed in tour system then the
# histograming module won't compile anyway
CEXMC_USE_HISTOGRAMING := yes
# if CEXMC_USE_QGSP_BIC_EMY is 'yes' then QGSP_BIC_EMY will be used as basic
# physics, otherwise - QGSP_BERT
CEXMC_USE_QGSP_BIC_EMY := no
# if CEXMC_USE_GENBOD is 'yes' then original FORTRAN routine GENBOD() will be
# used as phase space generator
CEXMC_USE_GENBOD := no
# if CEXMC_DEBUG_TP is 'yes' then additional info will be printed on track
# points data
CEXMC_DEBUG_TP := no
ifndef G4INSTALL
G4INSTALL = ../../..
endif
ifdef BOOST_INCLUDE_PATH
CPPFLAGS += -I$(BOOST_INCLUDE_PATH)
endif
ifdef BOOST_LIBRARY_PATH
EXTRALIBS += -L$(BOOST_LIBRARY_PATH)
endif
ifeq ($(CEXMC_USE_GENBOD),yes)
CPPFLAGS += -DCEXMC_USE_GENBOD
EXTRALIBS += `cernlib geant321 phtools packlib kernlib`
GCC_VERSION := $(shell gcc --version | head -1 | awk '{ printf $$3 }' | \
awk -F"." '{ printf $$1 }')
ifdef CEXMC_FORTRAN_LIB
EXTRALIBS += $(CEXMC_FORTRAN_LIB)
else
# try to setup fortran lib automatically
# WARNING: the following is not robust check because cernlib can be built
# against libg2c even when using gcc-4 series
# Please define CEXMC_FORTRAN_LIB if the check fails
ifeq ($(GCC_VERSION),3)
EXTRALIBS += -lg2c
else
EXTRALIBS += -lgfortran
endif
endif
endif
ifeq ($(CEXMC_USE_PERSISTENCY),yes)
EXTRALIBS += -lboost_serialization
CPPFLAGS += -DCEXMC_USE_PERSISTENCY
ifeq ($(CEXMC_USE_CUSTOM_FILTER),yes)
CPPFLAGS += -DCEXMC_USE_CUSTOM_FILTER
ifeq ($(CEXMC_DEBUG_CUSTOM_FILTER),yes)
CPPFLAGS += -DCEXMC_DEBUG_CF
endif
endif
endif
ifeq ($(CEXMC_USE_HISTOGRAMING),yes)
# try to determine if ROOT will be used automatically
USE_ROOT := $(shell which root-config 2>/dev/null)
ifneq ($(USE_ROOT)),)
CPPFLAGS += -I`root-config --incdir`
EXTRALIBS += `root-config --libs`
CPPFLAGS += -DCEXMC_USE_ROOT
# try to determine if ROOT-Qt binding will be used automatically
USE_ROOTQT := $(shell root-config --features | grep qt)
ifneq ($(USE_ROOTQT),)
EXTRALIBS += -lGQt
CPPFLAGS += -DCEXMC_USE_ROOTQT
endif
endif
endif
ifeq ($(CEXMC_USE_QGSP_BIC_EMY),yes)
CPPFLAGS += -DCEXMC_USE_QGSP_BIC_EMY
endif
ifeq ($(CEXMC_DEBUG_TP),yes)
CPPFLAGS += -DCEXMC_DEBUG_TP
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
@@ -0,0 +1,22 @@
-------------------------------------------------------------------------------
History File, 2010/11/18 G.A.P. Cirrone, Created
cirrone@lns.infn.it
-------------------------------------------------------------------------------
====================================================
History file of the ChargeExchangeMC application
====================================================
23.11.2010, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-03-03
- Possibility to remove the boost dependence
- Documentation updated
- README updated
18.11.2010, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-03-02
- Corrected tag name erroneously assigned
18.11.2010, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-03-01
- General code revision and update
18.11.2010, G.A.P. Cirrone, Tag: ChargeExchangeMC-V09-03-00
- First tag of the example
+106
View File
@@ -0,0 +1,106 @@
=====================================================================
Geant4 - Cexmc advanced example
=====================================================================
README
-----------------------
Author: A. Radkov (alexey.radkov@gmail.com)
------> Introduction
Cexmc stands for Charge EXchange Monte Carlo. The program was used to simulate
real experiments in Petersburg Nuclear Physics Institute (PNPI, Russia).
Detailed User's Manual and explanatory images of the experimental setup can be
found in directory doc/ of this example.
------> Compilation
Basic modules of Cexmc must compile with Geant4 version 9.4. Cexmc won't compile
with Geant4 version 9.3 (if you still need to build the program against this
version then remove qualifier const in the first argument of prototype of
CexmcSetup::ReadTransforms()). Cexmc contains several optional modules which can
be enabled or disabled in the makefile by setting dedicated macros: most of them
are listed in the beginning of the makefile and well commented. Modules may
involve additional dependencies. In the following table the dependencies and
related modules are shown.
Dependency Requirement Makefile Macro / Module Comment
--------------------------------------------------------------------------------
boost::serialize Optional CEXMC_USE_PERSISTENCY / used when
Persistency (de)serialization of
events and run data
boost::split Optional CEXMC_USE_PERSISTENCY / used when parsing
Main command line
arguments related to
persistency module
boost::spirit Optional CEXMC_USE_CUSTOM_FILTER / used in custom
Custom filter filter engine
cernlib Optional CEXMC_USE_GENBOD / Main user can choose
native GENBOD() as
phase space
generator
CERN ROOT Optional CEXMC_USE_ROOT / used in histograming
Histograming
CERN ROOT / Qt Optional CEXMC_USE_ROOTQT / used for live
binding Histograming histograms in Qt
sessions
--------------------------------------------------------------------------------
The persistency module is compatible with a pretty old boost::serialize version
(compilation was tested under Scientific Linux 4.8 with gcc 3.4.6 and boost
version 1.32). Custom filter requires a newer boost as far as it uses modern
boost::spirit library which requires boost version 1.37 and higher.
Presence of CERN ROOT libraries is tested automatically in the makefile, but it
is possible to disable or enable the histograming framework manually using flag
CEXMC_USE_HISTOGRAMING in the makefile.
Compilation of visualization modules and interactive sessions depends on whether
standard Geant4 macros like G4VIS_USE, G4UI_USE, G4UI_USE_TCSH and G4UI_USE_QT
have been set.
If boost is installed in a special path in your system then you may need to
properly set environment variables BOOST_INCLUDE_PATH and BOOST_LIBRARY_PATH
which denote directories where boost include files and libraries are located.
------> Run modes
Run modes are set from command-line options. To see available command-line
options type in terminal 'cexmc -h' or just 'cexmc'. Some run modes can be
unavailable if certain modules were not compiled.
Here is list of run modes categorized by type of interaction with user:
1. Batch mode. The simplest mode without any interaction with user.
No command line option is required.
2. Interactive mode. The program provides an interactive shell.
To run in the interactive mode command line option -i must be specified.
3. Graphical Qt mode. This mode is specified by command line option -g.
List of run modes categorized by task:
1. Straight mode (or Monte Carlo mode). The program will read preinit and
init macros, then calculate acceptances and (optionally) save data in
project files. Project files are saved in a directory defined by
environment variable CEXMC_PROJECTS_DIR (or in the current directory if it
is not defined), name of the project is specified by option -w. Preinit
and init macros are set by options -p and -m respectively. In the straight
mode preinit macro must be specified explicitly, as far as desired
production model can be instantiated only in preinit phase.
2. Replay mode (or Read project mode). In this mode the program will not use
common Geant4's event loop. Instead, it will sequentially read event data
from an existing project and pass them into
CexmcEventAction::EndOfEventAction(). The read project is specified by
option -r. This mode is useful when user wants to recalculate data from an
existing project with different conditions (for example with different
reconstruction parameters) or apply a custom filter. The results of run
can be written again into another project.
3. Show results mode (or Output mode). The program will output various data
from an existing project (specified by option -r). Type(s) of data are
specified in option -o. For example, to show results of a run user can
specify -orun in command line. To show events, geometry and run results
user can specify -oevents,geom,run.
@@ -0,0 +1,39 @@
# I. EDT examples
# EDT: delete events when sum of absorbed energy in left calorimeter is more
# than specified value
#delete edt if Sum( clEDcol ) > 350 * MeV
# EDT: keep events if sum of absorbed energy in two specified crystals in left
# calorimeter is more than sum of absorbed energy in outer crystals of left
# calorimeter
#keep edt if clEDcol[2,2] + clEDcol[2,3] > Sum( Outer( clEDcol ) )
# EDT: delete events if sum of absorbed energy in inner crystals of right
# calorimeter is more than specified value
#delete edt if Sum( Inner( crEDcol ) ) > 200 * MeV
# II. TPT examples. Can be safely used only for rich event data sets
# TPT: make diagonal cut in monitor counter
delete tpt if bp_mon_posl[1] < bp_mon_posl[2]
# TPT: make target radius smaller
delete tpt if Sqrt(Sqr(op_tgt_posl[1]) + Sqr(op_tgt_posl[2]) + \
Sqr(op_tgt_posl[3])) > 2 * cm
# III. TPT examples. Can be safely used for any event data sets
# TPT: delete all events in angular range (0.0000, -1.0000)
#delete tpt if op_cosTh_SCM < 0
# TPT: delete all events with id less than 500
#delete tpt if event < 500
# TPT: delete all events when monitor was not triggered
#delete tpt if ! mon
# TPT: delete all events without TPT (i.e. false triggered events)
#delete tpt if ! tpt
@@ -0,0 +1,170 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcAST.hh
*
* Description: abstract syntax tree for custom filter scripting language
*
* Version: 1.0
* Created: 17.07.2010 14:39:37
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_AST_HH
#define CEXMC_AST_HH
#ifdef CEXMC_USE_CUSTOM_FILTER
#include <vector>
#include <boost/variant/recursive_variant.hpp>
namespace CexmcAST
{
using boost::variant;
using boost::recursive_wrapper;
enum OperatorType
{
Uninitialized,
Top,
UMinus,
Not,
Mult,
Div,
Plus,
Minus,
Less,
LessEq,
More,
MoreEq,
Eq,
NotEq,
And,
Or
};
struct Operator
{
Operator( OperatorType type = Uninitialized, int priority = 0,
bool hasRLAssoc = false ) :
type( type ), priority( priority ), hasRLAssoc( hasRLAssoc )
{}
OperatorType type;
int priority;
bool hasRLAssoc;
};
struct Variable
{
Variable() : index1 ( 0 ), index2( 0 ), addr( ( const int * ) NULL )
{}
std::string name;
int index1;
int index2;
variant< const int *, const double * > addr;
};
struct Subtree;
typedef std::string Function;
typedef variant< int, double > Constant;
typedef variant< Variable, Constant > Leaf;
typedef recursive_wrapper< Subtree > Tree;
typedef variant< Tree, Leaf > Node;
typedef variant< Operator, Function > NodeType;
struct Subtree
{
Subtree() : type ( Operator( Uninitialized ) )
{}
void Print( int level = 0 ) const;
void PrintLeaf( const Leaf * leaf, int level = 0 ) const;
std::vector< Node > children;
NodeType type;
static const int printIndent = 4;
};
class BasicEval
{
protected:
typedef variant< int, double > ScalarValueType;
protected:
virtual ~BasicEval();
public:
bool operator()( const Subtree & ast ) const;
protected:
ScalarValueType GetScalarValue( const Node & node ) const;
virtual ScalarValueType GetFunScalarValue( const Subtree & ast )
const;
virtual ScalarValueType GetVarScalarValue( const Variable & var )
const;
ScalarValueType GetBasicFunScalarValue(
const Subtree & ast, bool & result )
const;
};
}
#endif
#endif
@@ -0,0 +1,167 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcASTEval.hh
*
* Description: abstract syntax tree for custom filter eval
*
* Version: 1.0
* Created: 17.07.2010 15:43:09
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_AST_EVAL_HH
#define CEXMC_AST_EVAL_HH
#ifdef CEXMC_USE_CUSTOM_FILTER
#include <map>
#include <string>
#include <boost/variant/variant.hpp>
#include "CexmcAST.hh"
#include "CexmcEventSObject.hh"
#include "CexmcEventFastSObject.hh"
#include "CexmcException.hh"
#include "CexmcCommon.hh"
class CexmcASTEval : public CexmcAST::BasicEval
{
private:
typedef boost::variant< const CexmcEnergyDepositCalorimeterCollection *,
const bool * > VarAddr;
typedef std::map< std::string, VarAddr > VarAddrMap;
typedef std::pair< std::string, VarAddr > VarAddrMapData;
public:
explicit CexmcASTEval(
const CexmcEventFastSObject * evFastSObject = NULL,
const CexmcEventSObject * evSObject = NULL );
public:
void SetAddressedData(
const CexmcEventFastSObject * evFastSObject_ = NULL,
const CexmcEventSObject * evSObject_ = NULL );
void BindAddresses( CexmcAST::Subtree & ast );
void ResetAddressBinding( CexmcAST::Subtree & ast );
private:
ScalarValueType GetFunScalarValue( const CexmcAST::Subtree & ast )
const;
ScalarValueType GetVarScalarValue( const CexmcAST::Variable & var )
const;
void GetEDCollectionValue( const CexmcAST::Node & node,
CexmcEnergyDepositCalorimeterCollection & edCol ) const;
private:
const G4double * GetThreeVectorElementAddrByIndex(
const CexmcSimpleThreeVectorStore & vect,
G4int index ) const;
const G4double * GetLorentzVectorElementAddrByIndex(
const CexmcSimpleLorentzVectorStore & vect,
G4int index ) const;
private:
const CexmcEventFastSObject * evFastSObject;
const CexmcEventSObject * evSObject;
private:
VarAddrMap varAddrMap;
private:
static const G4double constants[];
};
inline void CexmcASTEval::SetAddressedData(
const CexmcEventFastSObject * evFastSObject_,
const CexmcEventSObject * evSObject_ )
{
varAddrMap.clear();
evFastSObject = evFastSObject_;
evSObject = evSObject_;
}
inline const G4double * CexmcASTEval::GetThreeVectorElementAddrByIndex(
const CexmcSimpleThreeVectorStore & vect,
G4int index ) const
{
switch ( index )
{
case 1 :
return &vect.x;
case 2 :
return &vect.y;
case 3 :
return &vect.z;
default :
throw CexmcException( CexmcCFUnexpectedVectorIndex );
return NULL;
}
}
inline const G4double * CexmcASTEval::GetLorentzVectorElementAddrByIndex(
const CexmcSimpleLorentzVectorStore & vect,
G4int index ) const
{
switch ( index )
{
case 1 :
return &vect.px;
case 2 :
return &vect.py;
case 3 :
return &vect.pz;
case 4 :
return &vect.e;
default :
throw CexmcException( CexmcCFUnexpectedVectorIndex );
return NULL;
}
}
#endif
#endif
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcAngularRange.hh
*
* Description: angular range object
*
* Version: 1.0
* Created: 01.12.2009 16:29:25
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_ANGULAR_RANGE_HH
#define CEXMC_ANGULAR_RANGE_HH
#include <vector>
#include <iosfwd>
#include <G4Types.hh>
struct CexmcAngularRange
{
CexmcAngularRange()
{}
CexmcAngularRange( G4double top, G4double bottom, G4int index ) :
top( top ), bottom( bottom ), index( index )
{}
G4double top;
G4double bottom;
G4int index;
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
};
typedef std::vector< CexmcAngularRange > CexmcAngularRangeList;
template < typename Archive >
inline void CexmcAngularRange::serialize( Archive & archive,
const unsigned int )
{
archive & top;
archive & bottom;
archive & index;
}
inline bool operator<( const CexmcAngularRange & left,
const CexmcAngularRange & right )
{
if ( left.top != right.top )
return left.top > right.top;
if ( left.bottom != right.bottom )
return left.bottom < right.bottom;
return false;
}
void GetNormalizedAngularRange( const CexmcAngularRangeList & src,
CexmcAngularRangeList & dst );
void GetAngularGaps( const CexmcAngularRangeList & src,
CexmcAngularRangeList & dst );
std::ostream & operator<<( std::ostream & out,
const CexmcAngularRange & angularRange );
std::ostream & operator<<( std::ostream & out,
const CexmcAngularRangeList & angularRanges );
#endif
@@ -0,0 +1,76 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcBasicPhysicsSettings.hh
*
* Description: basic typedefs etc. to build studied physics
*
* Version: 1.0
* Created: 28.11.2009 15:30:55
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_BASIC_PHYSICS_SETTINGS_HH
#define CEXMC_BASIC_PHYSICS_SETTINGS_HH
#ifdef CEXMC_USE_QGSP_BIC_EMY
/* this reference physics list promises higher accuracy for electrons, hadrons
* and ions tracking */
#include <QGSP_BIC_EMY.hh>
#else
/* standard reference physics list */
#include <QGSP_BERT.hh>
#endif
#include <G4PionMinus.hh>
#include "CexmcProductionModelFactory.hh"
#include "CexmcHadronicPhysics.hh"
#include "CexmcChargeExchangeProductionModel.hh"
#ifdef CEXMC_USE_QGSP_BIC_EMY
typedef QGSP_BIC_EMY CexmcBasePhysics;
#else
typedef QGSP_BERT CexmcBasePhysics;
#endif
typedef CexmcProductionModelFactory< CexmcBasePhysics,
CexmcHadronicPhysics,
CexmcChargeExchangeProductionModel >
CexmcChargeExchangePMFactory;
typedef CexmcChargeExchangePMFactory CexmcPMFactoryInstance;
#endif
@@ -0,0 +1,226 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcChargeExchangeProductionModel.hh
*
* Description: charge exchange physics itself
*
* Version: 1.0
* Created: 01.11.2009 00:30:46
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_CHARGE_EXCHANGE_PRODUCTION_MODEL_HH
#define CEXMC_CHARGE_EXCHANGE_PRODUCTION_MODEL_HH
#include <G4HadronicInteraction.hh>
#include <G4HadFinalState.hh>
#include <G4HadProjectile.hh>
#include <G4Nucleus.hh>
#include <G4Proton.hh>
#include <G4Neutron.hh>
#include "CexmcProductionModel.hh"
#include "CexmcGenbod.hh"
#include "CexmcReimplementedGenbod.hh"
#include "CexmcException.hh"
template < typename OutputParticle >
class CexmcChargeExchangeProductionModel : public G4HadronicInteraction,
public CexmcProductionModel
{
public:
CexmcChargeExchangeProductionModel();
~CexmcChargeExchangeProductionModel();
public:
G4HadFinalState * ApplyYourself( const G4HadProjectile & projectile,
G4Nucleus & targetNucleus );
private:
G4double nucleusParticleMass;
CexmcPhaseSpaceGenerator * phaseSpaceGenerator;
};
template < typename OutputParticle >
CexmcChargeExchangeProductionModel< OutputParticle >::
CexmcChargeExchangeProductionModel() :
G4HadronicInteraction( CexmcChargeExchangeInteractionName ),
CexmcProductionModel( CexmcChargeExchangeProductionModelName ),
nucleusParticleMass( 0 ), phaseSpaceGenerator( NULL )
{
incidentParticle = G4PionMinus::Definition();
nucleusParticle = G4Proton::Definition();
outputParticle = OutputParticle::Definition();
nucleusOutputParticle = G4Neutron::Definition();
nucleusParticleMass = nucleusParticle->GetPDGMass();
productionModelData.incidentParticle = incidentParticle;
productionModelData.nucleusParticle = nucleusParticle;
productionModelData.outputParticle = outputParticle;
productionModelData.nucleusOutputParticle = nucleusOutputParticle;
CexmcPhaseSpaceInVector inVec;
inVec.push_back( &productionModelData.incidentParticleSCM );
inVec.push_back( &productionModelData.nucleusParticleSCM );
CexmcPhaseSpaceOutVector outVec;
outVec.push_back( CexmcPhaseSpaceOutVectorElement(
&productionModelData.outputParticleSCM,
outputParticle->GetPDGMass() ) );
outVec.push_back( CexmcPhaseSpaceOutVectorElement(
&productionModelData.nucleusOutputParticleSCM,
nucleusOutputParticle->GetPDGMass() ) );
#ifdef CEXMC_USE_GENBOD
phaseSpaceGenerator = new CexmcGenbod;
#else
phaseSpaceGenerator = new CexmcReimplementedGenbod;
#endif
phaseSpaceGenerator->SetParticles( inVec, outVec );
}
template < typename OutputParticle >
CexmcChargeExchangeProductionModel< OutputParticle >::
~CexmcChargeExchangeProductionModel()
{
delete phaseSpaceGenerator;
}
template < typename OutputParticle >
G4HadFinalState * CexmcChargeExchangeProductionModel< OutputParticle >::
ApplyYourself( const G4HadProjectile & projectile,
G4Nucleus & targetNucleus )
{
theParticleChange.Clear();
G4double kinEnergy( projectile.GetKineticEnergy() );
G4HadProjectile & theProjectile( const_cast< G4HadProjectile & >(
projectile ) );
const G4LorentzRotation & projToLab(
const_cast< const G4LorentzRotation & >(
theProjectile.GetTrafoToLab() ) );
productionModelData.incidentParticleLAB = projectile.Get4Momentum();
productionModelData.incidentParticleLAB.transform( projToLab );
productionModelData.nucleusParticleLAB.setPx( 0 );
productionModelData.nucleusParticleLAB.setPy( 0 );
productionModelData.nucleusParticleLAB.setPz( 0 );
productionModelData.nucleusParticleLAB.setE( nucleusParticleMass );
if ( fermiMotionIsOn )
{
G4ThreeVector targetNucleusMomentum(
targetNucleus.GetFermiMomentum() );
G4double targetNucleusEnergy(
std::sqrt( targetNucleusMomentum.mag2() +
nucleusParticleMass * nucleusParticleMass ) );
productionModelData.nucleusParticleLAB = G4LorentzVector(
targetNucleusMomentum, targetNucleusEnergy );
}
productionModelData.nucleusParticleLAB.transform( projToLab );
G4LorentzVector lVecSum( productionModelData.incidentParticleLAB +
productionModelData.nucleusParticleLAB );
G4ThreeVector boostVec( lVecSum.boostVector() );
productionModelData.incidentParticleSCM =
productionModelData.incidentParticleLAB;
productionModelData.nucleusParticleSCM =
productionModelData.nucleusParticleLAB;
productionModelData.incidentParticleSCM.boost( -boostVec );
productionModelData.nucleusParticleSCM.boost( -boostVec );
triggeredAngularRanges.clear();
if ( ! phaseSpaceGenerator->CheckKinematics() )
{
theParticleChange.SetEnergyChange( kinEnergy );
theParticleChange.SetMomentumChange(
projectile.Get4Momentum().vect().unit());
return &theParticleChange;
}
do
{
phaseSpaceGenerator->Generate();
G4double cosTheta( productionModelData.outputParticleSCM.cosTheta() );
for ( CexmcAngularRangeList::iterator k( angularRanges.begin() );
k != angularRanges.end(); ++k )
{
if ( cosTheta <= k->top && cosTheta > k->bottom )
triggeredAngularRanges.push_back( CexmcAngularRange(
k->top, k->bottom, k->index ) );
}
} while ( triggeredAngularRanges.empty() );
productionModelData.outputParticleLAB =
productionModelData.outputParticleSCM;
productionModelData.nucleusOutputParticleLAB =
productionModelData.nucleusOutputParticleSCM;
productionModelData.outputParticleLAB.boost( boostVec );
productionModelData.nucleusOutputParticleLAB.boost( boostVec );
theParticleChange.SetStatusChange( stopAndKill );
theParticleChange.SetEnergyChange( 0.0 );
G4DynamicParticle * secOutParticle( new G4DynamicParticle(
outputParticle,
productionModelData.outputParticleLAB ) );
theParticleChange.AddSecondary( secOutParticle );
G4DynamicParticle * secNeutron( new G4DynamicParticle(
nucleusOutputParticle,
productionModelData.nucleusOutputParticleLAB ) );
theParticleChange.AddSecondary( secNeutron );
/* projectile->GetDefinition() shall always be identical to incidentParticle
* as far as CexmcHadronicProcess::IsApplicable() will check that only
* incidentParticle is allowed. Here is mostly unnecessary assignment. */
productionModelData.incidentParticle = projectile.GetDefinition();
return &theParticleChange;
}
#endif
@@ -0,0 +1,397 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcChargeExchangeReconstructor.hh
*
* Description: charge exchange reconstructor
*
* Version: 1.0
* Created: 02.12.2009 15:07:16
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_CHARGE_EXCHANGE_RECONSTRUCTOR_HH
#define CEXMC_CHARGE_EXCHANGE_RECONSTRUCTOR_HH
#include "CexmcReconstructor.hh"
#include "CexmcProductionModelData.hh"
class CexmcChargeExchangeReconstructorMessenger;
class CexmcEnergyDepositStore;
class CexmcProductionModel;
class CexmcParticleGun;
class CexmcChargeExchangeReconstructor : public CexmcReconstructor
{
public:
explicit CexmcChargeExchangeReconstructor(
const CexmcProductionModel * productionModel );
~CexmcChargeExchangeReconstructor();
public:
void Reconstruct( const CexmcEnergyDepositStore * edStore );
public:
G4double GetOutputParticleMass( void ) const;
G4double GetNucleusOutputParticleMass( void ) const;
const CexmcProductionModelData & GetProductionModelData( void ) const;
void UseTableMass( G4bool on );
void UseMassCut( G4bool on );
void SetMassCutOPCenter( G4double value );
void SetMassCutNOPCenter( G4double value );
void SetMassCutOPWidth( G4double value );
void SetMassCutNOPWidth( G4double value );
void SetMassCutEllipseAngle( G4double value );
void UseAbsorbedEnergyCut( G4bool on );
void SetAbsorbedEnergyCutCLCenter( G4double value );
void SetAbsorbedEnergyCutCRCenter( G4double value );
void SetAbsorbedEnergyCutCLWidth( G4double value );
void SetAbsorbedEnergyCutCRWidth( G4double value );
void SetAbsorbedEnergyCutEllipseAngle( G4double value );
void SetupBeamParticle( void );
G4bool IsTableMassUsed( void ) const;
G4bool IsMassCutUsed( void ) const;
G4double GetMassCutOPCenter( void ) const;
G4double GetMassCutNOPCenter( void ) const;
G4double GetMassCutOPWidth( void ) const;
G4double GetMassCutNOPWidth( void ) const;
G4double GetMassCutEllipseAngle( void ) const;
G4bool HasMassCutTriggered( void ) const;
G4bool IsAbsorbedEnergyCutUsed( void ) const;
G4double GetAbsorbedEnergyCutCLCenter( void ) const;
G4double GetAbsorbedEnergyCutCRCenter( void ) const;
G4double GetAbsorbedEnergyCutCLWidth( void ) const;
G4double GetAbsorbedEnergyCutCRWidth( void ) const;
G4double GetAbsorbedEnergyCutEllipseAngle( void ) const;
G4bool HasAbsorbedEnergyCutTriggered( void ) const;
G4bool HasFullTrigger( void ) const;
private:
G4double outputParticleMass;
G4double nucleusOutputParticleMass;
private:
CexmcProductionModelData productionModelData;
private:
G4bool useTableMass;
G4bool useMassCut;
G4double massCutOPCenter;
G4double massCutNOPCenter;
G4double massCutOPWidth;
G4double massCutNOPWidth;
G4double massCutEllipseAngle;
G4bool useAbsorbedEnergyCut;
G4double absorbedEnergyCutCLCenter;
G4double absorbedEnergyCutCRCenter;
G4double absorbedEnergyCutCLWidth;
G4double absorbedEnergyCutCRWidth;
G4double absorbedEnergyCutEllipseAngle;
private:
G4bool hasMassCutTriggered;
G4bool hasAbsorbedEnergyCutTriggered;
private:
G4bool beamParticleIsInitialized;
CexmcParticleGun * particleGun;
CexmcChargeExchangeReconstructorMessenger * messenger;
};
inline G4double CexmcChargeExchangeReconstructor::GetOutputParticleMass(
void ) const
{
return outputParticleMass;
}
inline G4double CexmcChargeExchangeReconstructor::GetNucleusOutputParticleMass(
void ) const
{
return nucleusOutputParticleMass;
}
inline const CexmcProductionModelData &
CexmcChargeExchangeReconstructor::GetProductionModelData( void ) const
{
return productionModelData;
}
inline void CexmcChargeExchangeReconstructor::UseTableMass( G4bool on )
{
useTableMass = on;
}
inline void CexmcChargeExchangeReconstructor::UseMassCut( G4bool on )
{
useMassCut = on;
}
inline void CexmcChargeExchangeReconstructor::SetMassCutOPCenter(
G4double value )
{
massCutOPCenter = value;
}
inline void CexmcChargeExchangeReconstructor::SetMassCutNOPCenter(
G4double value )
{
massCutNOPCenter = value;
}
inline void CexmcChargeExchangeReconstructor::SetMassCutOPWidth(
G4double value )
{
massCutOPWidth = value;
}
inline void CexmcChargeExchangeReconstructor::SetMassCutNOPWidth(
G4double value )
{
massCutNOPWidth = value;
}
inline void CexmcChargeExchangeReconstructor::SetMassCutEllipseAngle(
G4double value )
{
massCutEllipseAngle = value;
}
inline void CexmcChargeExchangeReconstructor::UseAbsorbedEnergyCut(
G4bool on )
{
useAbsorbedEnergyCut = on;
}
inline void CexmcChargeExchangeReconstructor::SetAbsorbedEnergyCutCLCenter(
G4double value )
{
absorbedEnergyCutCLCenter = value;
}
inline void CexmcChargeExchangeReconstructor::SetAbsorbedEnergyCutCRCenter(
G4double value )
{
absorbedEnergyCutCRCenter = value;
}
inline void CexmcChargeExchangeReconstructor::SetAbsorbedEnergyCutCLWidth(
G4double value )
{
absorbedEnergyCutCLWidth = value;
}
inline void CexmcChargeExchangeReconstructor::SetAbsorbedEnergyCutCRWidth(
G4double value )
{
absorbedEnergyCutCRWidth = value;
}
inline void CexmcChargeExchangeReconstructor::SetAbsorbedEnergyCutEllipseAngle(
G4double value )
{
absorbedEnergyCutEllipseAngle = value;
}
inline G4bool CexmcChargeExchangeReconstructor::IsTableMassUsed( void ) const
{
return useTableMass;
}
inline G4bool CexmcChargeExchangeReconstructor::IsMassCutUsed( void ) const
{
return useMassCut;
}
inline G4double CexmcChargeExchangeReconstructor::GetMassCutOPCenter( void )
const
{
return massCutOPCenter;
}
inline G4double CexmcChargeExchangeReconstructor::GetMassCutNOPCenter( void )
const
{
return massCutNOPCenter;
}
inline G4double CexmcChargeExchangeReconstructor::GetMassCutOPWidth( void )
const
{
return massCutOPWidth;
}
inline G4double CexmcChargeExchangeReconstructor::GetMassCutNOPWidth( void )
const
{
return massCutNOPWidth;
}
inline G4double CexmcChargeExchangeReconstructor::GetMassCutEllipseAngle(
void ) const
{
return massCutEllipseAngle;
}
inline G4bool CexmcChargeExchangeReconstructor::HasMassCutTriggered( void )
const
{
return hasMassCutTriggered;
}
inline G4bool CexmcChargeExchangeReconstructor::IsAbsorbedEnergyCutUsed( void )
const
{
return useAbsorbedEnergyCut;
}
inline G4double CexmcChargeExchangeReconstructor::GetAbsorbedEnergyCutCLCenter(
void ) const
{
return absorbedEnergyCutCLCenter;
}
inline G4double CexmcChargeExchangeReconstructor::GetAbsorbedEnergyCutCRCenter(
void ) const
{
return absorbedEnergyCutCRCenter;
}
inline G4double CexmcChargeExchangeReconstructor::GetAbsorbedEnergyCutCLWidth(
void ) const
{
return absorbedEnergyCutCLWidth;
}
inline G4double CexmcChargeExchangeReconstructor::GetAbsorbedEnergyCutCRWidth(
void ) const
{
return absorbedEnergyCutCRWidth;
}
inline G4double CexmcChargeExchangeReconstructor::
GetAbsorbedEnergyCutEllipseAngle( void ) const
{
return absorbedEnergyCutEllipseAngle;
}
inline G4bool CexmcChargeExchangeReconstructor::HasAbsorbedEnergyCutTriggered(
void ) const
{
return hasAbsorbedEnergyCutTriggered;
}
#endif
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcChargeExchangeReconstructorMessenger.hh
*
* Description: charge exchange reconstructor messenger
*
* Version: 1.0
* Created: 14.12.2009 17:49:15
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_CHARGE_EXCHANGE_RECONSTRUCTOR_MESSENGER_HH
#define CEXMC_CHARGE_EXCHANGE_RECONSTRUCTOR_MESSENGER_HH
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithADoubleAndUnit;
class G4String;
class CexmcChargeExchangeReconstructor;
class CexmcChargeExchangeReconstructorMessenger : public G4UImessenger
{
public:
explicit CexmcChargeExchangeReconstructorMessenger(
CexmcChargeExchangeReconstructor * reconstructor );
~CexmcChargeExchangeReconstructorMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcChargeExchangeReconstructor * reconstructor;
G4UIcmdWithABool * useTableMass;
G4UIcmdWithABool * useMassCut;
G4UIcmdWithADoubleAndUnit * mCutOPCenter;
G4UIcmdWithADoubleAndUnit * mCutNOPCenter;
G4UIcmdWithADoubleAndUnit * mCutOPWidth;
G4UIcmdWithADoubleAndUnit * mCutNOPWidth;
G4UIcmdWithADoubleAndUnit * mCutAngle;
G4UIcmdWithABool * useAbsorbedEnergyCut;
G4UIcmdWithADoubleAndUnit * aeCutCLCenter;
G4UIcmdWithADoubleAndUnit * aeCutCRCenter;
G4UIcmdWithADoubleAndUnit * aeCutCLWidth;
G4UIcmdWithADoubleAndUnit * aeCutCRWidth;
G4UIcmdWithADoubleAndUnit * aeCutAngle;
};
#endif
@@ -0,0 +1,189 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcCommon.hh
*
* Description: common declarations
*
* Version: 1.0
* Created: 01.11.2009 00:09:04
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_COMMON_HH
#define CEXMC_COMMON_HH
#include <vector>
#include <limits>
#include <G4String.hh>
#include <G4Types.hh>
#define CEXMC_LINE_START "--- Cexmc --- "
typedef std::vector< G4double > CexmcEnergyDepositCrystalRowCollection;
typedef std::vector< CexmcEnergyDepositCrystalRowCollection >
CexmcEnergyDepositCalorimeterCollection;
const G4double CexmcDblMax( std::numeric_limits< double >::max() );
const G4String CexmcStudiedProcessFirstName( "studiedProcess_" );
const G4String CexmcStudiedProcessLastName( "Cexmc" );
const G4String CexmcStudiedProcessFullName( CexmcStudiedProcessFirstName +
CexmcStudiedProcessLastName );
const G4String CexmcChargeExchangeProductionModelName( "ChargeExchange" );
const G4String CexmcChargeExchangeInteractionName( "Cexmc" +
CexmcChargeExchangeProductionModelName );
const G4String CexmcEDDigitizerName( "EDDig" );
const G4String CexmcTPDigitizerName( "TPDig" );
const G4double CexmcFwhmToStddev( 0.42466 );
const G4double CexmcInvalidCosTheta( 2.0 );
const G4int CexmcInvalidTrackId( -1 );
enum CexmcBasePhysicsUsed
{
CexmcNoBasePhysics,
Cexmc_QGSP_BERT,
Cexmc_QGSP_BIC_EMY
};
enum CexmcProductionModelType
{
CexmcUnknownProductionModel,
CexmcPionZeroProduction,
CexmcEtaProduction
};
enum CexmcTriggerType
{
CexmcTPT,
CexmcEDT,
CexmcRT
};
enum CexmcEventCountPolicy
{
CexmcCountAllEvents,
CexmcCountEventsWithInteraction,
CexmcCountEventsWithTrigger
};
enum CexmcTrackType
{
CexmcInsipidTrack,
CexmcBeamParticleTrack,
CexmcOutputParticleTrack,
CexmcNucleusParticleTrack,
CexmcOutputParticleDecayProductTrack
};
enum CexmcTrackTypeInfo
{
CexmcBasicTrackType,
CexmcIncidentParticleTrackType
};
enum CexmcSide
{
CexmcLeft,
CexmcRight
};
enum CexmcOuterCrystalsVetoAlgorithm
{
CexmcNoOuterCrystalsVeto,
CexmcMaximumEDInASingleOuterCrystalVeto,
CexmcFractionOfEDInOuterCrystalsVeto
};
enum CexmcCalorimeterTriggerAlgorithm
{
CexmcAllCrystalsMakeEDTriggerThreshold,
CexmcInnerCrystalsMakeEDTriggerThreshold
};
enum CexmcCalorimeterEntryPointDefinitionAlgorithm
{
CexmcEntryPointInTheCenter,
CexmcEntryPointInTheCenterOfCrystalWithMaxED,
CexmcEntryPointByLinearEDWeights,
CexmcEntryPointBySqrtEDWeights
};
enum CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
{
CexmcEntryPointDepthPlain,
CexmcEntryPointDepthSphere
};
enum CexmcCrystalSelectionAlgorithm
{
CexmcSelectAllCrystals,
CexmcSelectAdjacentCrystals
};
enum CexmcEventDataVerboseLevel
{
CexmcWriteNoEventData,
CexmcWriteEventDataOnEveryEDT,
CexmcWriteEventDataOnEveryTPT
};
enum CexmcOutputDataType
{
CexmcOutputRun,
CexmcOutputGeometry,
CexmcOutputEvents
};
#endif
@@ -0,0 +1,257 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcCustomFilter.hh
*
* Description: custom filter grammar and compiler
*
* Version: 1.0
* Created: 17.07.2010 15:31:43
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_CUSTOM_FILTER_HH
#define CEXMC_CUSTOM_FILTER_HH
#ifdef CEXMC_USE_CUSTOM_FILTER
#include <string>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_function.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include "CexmcAST.hh"
namespace CexmcCustomFilter
{
using namespace boost::spirit;
using namespace boost::spirit::qi;
using namespace boost::spirit::ascii;
using namespace boost::phoenix;
using namespace CexmcAST;
using boost::spirit::ascii::space;
using boost::spirit::ascii::space_type;
using boost::spirit::ascii::alpha;
using boost::spirit::ascii::alnum;
enum Action
{
KeepTPT,
KeepEDT,
DeleteTPT,
DeleteEDT
};
struct ParseResult
{
ParseResult() : action( KeepTPT )
{}
void Initialize( void )
{
action = KeepTPT;
expression.children.clear();
expression.type = Operator( Uninitialized );
}
Action action;
Subtree expression;
};
struct Compiler
{
template < typename A, typename B = boost::fusion::unused_type,
typename C = boost::fusion::unused_type,
typename D = boost::fusion::unused_type >
struct result { typedef void type; };
void operator()( ParseResult & parseResult, Action value ) const;
void operator()( ParseResult & parseResult, Subtree & value ) const;
void operator()( Subtree & ast, Node & node ) const;
void operator()( Node & self, Node & left, Node & right,
Operator value ) const;
void operator()( Node & self, Node & child, Operator value ) const;
void operator()( Node & self, Node & primary ) const;
void operator()( Node & self, Node & child, std::string & value )
const;
void operator()( Leaf & self, std::string & name ) const;
void operator()( Leaf & self, int value, size_t index ) const;
};
template < typename Iterator >
struct Grammar : grammar< Iterator, ParseResult(), space_type >
{
Grammar();
rule< Iterator, ParseResult(), space_type > statement;
rule< Iterator, Action(), space_type > action;
rule< Iterator, Subtree(), space_type > condition;
rule< Iterator, Node(), space_type > expression;
rule< Iterator, Node(), space_type > primary_expr;
rule< Iterator, Node(), space_type > function1;
rule< Iterator, std::string(), space_type > identifier;
rule< Iterator, Leaf(), space_type > leaf_operand;
rule< Iterator, Leaf(), space_type > constant;
rule< Iterator, Leaf(), space_type > variable;
rule< Iterator, Node(), space_type > or_expr;
rule< Iterator, Node(), space_type > and_expr;
rule< Iterator, Node(), space_type > relation;
rule< Iterator, Node(), space_type > addition;
rule< Iterator, Node(), space_type > multiplication;
rule< Iterator, Node(), space_type > unary_expr;
rule< Iterator, Operator(), space_type > unary_op;
rule< Iterator, Operator(), space_type > mult_op;
rule< Iterator, Operator(), space_type > add_op;
rule< Iterator, Operator(), space_type > rel_op;
real_parser< double, strict_real_policies< double > > strict_double;
function< Compiler > op;
};
template < typename Iterator >
Grammar< Iterator >::Grammar() : Grammar::base_type( statement )
{
statement = action[ op( _val, _1 ) ] >>
*( condition[ op( _val, _1 ) ] );
action = lit( "keep" ) >>
( lit( "tpt" )[ _val = KeepTPT ] |
lit( "edt" )[ _val = KeepEDT ] ) |
lit( "delete" ) >>
( lit ( "tpt" )[ _val = DeleteTPT ] |
lit ( "edt" )[ _val = DeleteEDT ] );
condition = lit( "if" ) >> expression[ op( _val, _1 ) ];
expression %= or_expr;
identifier %= lexeme[ alpha >> *( alnum | lit( '_' ) ) ];
primary_expr = function1[ _val = _1 ] |
lit( '(' ) >> expression[ op( _val, _1 ) ] >> lit( ')' ) |
leaf_operand[ _val = _1 ];
leaf_operand %= constant | variable;
constant %= strict_double | int_;
variable = identifier[ op( _val, _1 ) ] >>
-( lit( '[' ) >> ( uint_[ op( _val, _1, 0 ) ] - lit( '0' ) ) >>
-( lit( ',' ) >> ( uint_[ op( _val, _1, 1 ) ] -
lit( '0' ) ) ) >> lit( ']' ) );
function1 = ( identifier >> lit( '(' ) >> expression >> lit( ')' ) )
[ op( _val, _2, _1 ) ];
or_expr = ( and_expr >> lit( '|' ) >> or_expr )
[ op( _val, _1, _2, Operator( Or, 1 ) ) ] |
and_expr[ _val = _1 ];
and_expr = ( relation >> lit( '&' ) >> and_expr )
[ op( _val, _1, _2, Operator( And, 2 ) ) ] |
relation[ _val = _1 ];
relation = ( addition >> rel_op >> addition )
[ op( _val, _1, _3, _2 ) ] |
addition[ _val = _1 ];
addition = ( multiplication >> add_op >> addition )
[ op( _val, _1, _3, _2 ) ] |
multiplication[ _val = _1 ];
multiplication = ( unary_expr >> mult_op >> multiplication )
[ op( _val, _1, _3, _2 ) ] |
unary_expr[ _val = _1 ];
unary_expr = ( unary_op >> primary_expr )[ op( _val, _2, _1 ) ] |
primary_expr[ _val = _1 ];
unary_op = lit( '-' )[ _val = Operator( UMinus, 6, true ) ] |
lit( '!' )[ _val = Operator( Not, 6, true ) ];
mult_op = lit( '*' )[ _val = Operator( Mult, 5 ) ] |
lit( '/' )[ _val = Operator( Div, 5 ) ];
add_op = lit( '+' )[ _val = Operator( Plus, 4 ) ] |
lit( '-' )[ _val = Operator( Minus, 4 ) ];
rel_op = lit( "<=" )[ _val = Operator( LessEq, 3 ) ] |
lit( ">=" )[ _val = Operator( MoreEq, 3 ) ] |
lit( "!=" )[ _val = Operator( NotEq, 3 ) ] |
lit( '<' )[ _val = Operator( Less, 3 ) ] |
lit( '>' )[ _val = Operator( More, 3 ) ] |
lit( '=' )[ _val = Operator( Eq, 3 ) ];
}
}
#endif
#endif
@@ -0,0 +1,90 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcCustomFilterEval.hh
*
* Description: custom filter eval
*
* Version: 1.0
* Created: 17.07.2010 15:43:09
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_CUSTOM_FILTER_EVAL_HH
#define CEXMC_CUSTOM_FILTER_EVAL_HH
#ifdef CEXMC_USE_CUSTOM_FILTER
#include <vector>
#include <string>
#include "CexmcASTEval.hh"
#include "CexmcCustomFilter.hh"
class CexmcEventFastSObject;
class CexmcEventSObject;
class CexmcCustomFilterEval : public CexmcAST::BasicEval
{
private:
typedef std::vector< CexmcCustomFilter::ParseResult >
ParseResultVector;
public:
explicit CexmcCustomFilterEval( const G4String & sourceFileName,
const CexmcEventFastSObject * evFastSObject = NULL,
const CexmcEventSObject * evSObject = NULL );
public:
void SetAddressedData( const CexmcEventFastSObject * evFastSObject,
const CexmcEventSObject * evSObject );
bool EvalTPT( void ) const;
bool EvalEDT( void ) const;
private:
CexmcASTEval astEval;
ParseResultVector parseResultTPT;
ParseResultVector parseResultEDT;
CexmcCustomFilter::Grammar< std::string::const_iterator > grammar;
};
#endif
#endif
@@ -0,0 +1,605 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEnergyDepositDigitizer.hh
*
* Description: digitizes of energy deposit in a single event
*
* Version: 1.0
* Created: 23.11.2009 14:14:47
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_ENERGY_DEPOSIT_DIGITIZER_HH
#define CEXMC_ENERGY_DEPOSIT_DIGITIZER_HH
#include <iosfwd>
#include <G4VDigitizerModule.hh>
#include "CexmcEnergyDepositStore.hh"
#include "CexmcSimpleRangeWithValue.hh"
#include "CexmcException.hh"
#include "CexmcCommon.hh"
class G4String;
class CexmcEnergyDepositDigitizerMessenger;
class CexmcEnergyDepositDigitizer : public G4VDigitizerModule
{
public:
explicit CexmcEnergyDepositDigitizer( const G4String & name );
~CexmcEnergyDepositDigitizer();
public:
void Digitize( void );
public:
G4double GetMonitorED( void ) const;
G4double GetVetoCounterEDLeft( void ) const;
G4double GetVetoCounterEDRight( void ) const;
G4double GetCalorimeterEDLeft( void ) const;
G4double GetCalorimeterEDRight( void ) const;
G4int GetCalorimeterEDLeftMaxX( void ) const;
G4int GetCalorimeterEDLeftMaxY( void ) const;
G4int GetCalorimeterEDRightMaxX( void ) const;
G4int GetCalorimeterEDRightMaxY( void ) const;
const CexmcEnergyDepositCalorimeterCollection &
GetCalorimeterEDLeftCollection( void ) const;
const CexmcEnergyDepositCalorimeterCollection &
GetCalorimeterEDRightCollection( void ) const;
public:
G4bool MonitorHasTriggered( void ) const;
G4bool HasTriggered( void ) const;
public:
void SetMonitorThreshold( G4double value,
G4bool fromMessenger = true );
void SetVetoCounterLeftThreshold( G4double value,
G4bool fromMessenger = true );
void SetVetoCounterRightThreshold( G4double value,
G4bool fromMessenger = true );
void SetVetoCountersThreshold( G4double value );
void SetCalorimeterLeftThreshold( G4double value,
G4bool fromMessenger = true );
void SetCalorimeterRightThreshold( G4double value,
G4bool fromMessenger = true );
void SetCalorimetersThreshold( G4double value );
void SetCalorimeterTriggerAlgorithm(
CexmcCalorimeterTriggerAlgorithm value,
G4bool fromMessenger = true );
void SetOuterCrystalsVetoAlgorithm(
CexmcOuterCrystalsVetoAlgorithm value,
G4bool fromMessenger = true );
void SetOuterCrystalsVetoFraction( G4double value,
G4bool fromMessenger = true );
void ApplyFiniteCrystalResolution( G4bool value,
G4bool fromMessenger = true );
void AddCrystalResolutionRange( G4double bottom, G4double top,
G4double value,
G4bool fromMessenger = true );
void ClearCrystalResolutionData( G4bool fromMessenger = true );
void SetCrystalResolutionData(
const CexmcEnergyRangeWithDoubleValueList & data );
G4double GetMonitorThreshold( void ) const;
G4double GetVetoCounterLeftThreshold( void ) const;
G4double GetVetoCounterRightThreshold( void ) const;
G4double GetCalorimeterLeftThreshold( void ) const;
G4double GetCalorimeterRightThreshold( void ) const;
CexmcCalorimeterTriggerAlgorithm
GetCalorimeterTriggerAlgorithm( void ) const;
CexmcOuterCrystalsVetoAlgorithm
GetOuterCrystalsVetoAlgorithm( void ) const;
G4double GetOuterCrystalsVetoFraction( void ) const;
G4bool IsFiniteCrystalResolutionApplied( void ) const;
const CexmcEnergyRangeWithDoubleValueList &
GetCrystalResolutionData( void ) const;
public:
G4bool IsOuterCrystal( G4int column, G4int row ) const;
void TransformToAdjacentInnerCrystal( G4int & column,
G4int & row ) const;
private:
void InitializeData( void );
private:
G4double monitorED;
G4double vetoCounterEDLeft;
G4double vetoCounterEDRight;
CexmcEnergyDepositCalorimeterCollection calorimeterEDLeftCollection;
CexmcEnergyDepositCalorimeterCollection calorimeterEDRightCollection;
G4double calorimeterEDLeft;
G4double calorimeterEDRight;
G4int calorimeterEDLeftMaxX;
G4int calorimeterEDLeftMaxY;
G4int calorimeterEDRightMaxX;
G4int calorimeterEDRightMaxY;
G4bool monitorHasTriggered;
G4bool hasTriggered;
private:
G4double monitorEDThreshold;
G4double vetoCounterEDLeftThreshold;
G4double vetoCounterEDRightThreshold;
G4double calorimeterEDLeftThreshold;
G4double calorimeterEDRightThreshold;
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm;
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm;
G4double outerCrystalsVetoFraction;
G4double monitorEDThresholdRef;
G4double vetoCounterEDLeftThresholdRef;
G4double vetoCounterEDRightThresholdRef;
G4double calorimeterEDLeftThresholdRef;
G4double calorimeterEDRightThresholdRef;
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithmRef;
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithmRef;
G4double outerCrystalsVetoFractionRef;
private:
G4int nCrystalsInColumn;
G4int nCrystalsInRow;
private:
G4bool applyFiniteCrystalResolution;
CexmcEnergyRangeWithDoubleValueList crystalResolutionData;
private:
CexmcEnergyDepositDigitizerMessenger * messenger;
};
inline G4double CexmcEnergyDepositDigitizer::GetMonitorED( void ) const
{
return monitorED;
}
inline G4double CexmcEnergyDepositDigitizer::GetVetoCounterEDLeft( void ) const
{
return vetoCounterEDLeft;
}
inline G4double CexmcEnergyDepositDigitizer::GetVetoCounterEDRight( void )
const
{
return vetoCounterEDRight;
}
inline G4double CexmcEnergyDepositDigitizer::GetCalorimeterEDLeft( void ) const
{
return calorimeterEDLeft;
}
inline G4double CexmcEnergyDepositDigitizer::GetCalorimeterEDRight( void )
const
{
return calorimeterEDRight;
}
inline G4int CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftMaxX( void )
const
{
return calorimeterEDLeftMaxX;
}
inline G4int CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftMaxY( void )
const
{
return calorimeterEDLeftMaxY;
}
inline G4int CexmcEnergyDepositDigitizer::GetCalorimeterEDRightMaxX( void )
const
{
return calorimeterEDRightMaxX;
}
inline G4int CexmcEnergyDepositDigitizer::GetCalorimeterEDRightMaxY( void )
const
{
return calorimeterEDRightMaxY;
}
inline const CexmcEnergyDepositCalorimeterCollection &
CexmcEnergyDepositDigitizer::GetCalorimeterEDLeftCollection( void ) const
{
return calorimeterEDLeftCollection;
}
inline const CexmcEnergyDepositCalorimeterCollection &
CexmcEnergyDepositDigitizer::GetCalorimeterEDRightCollection( void ) const
{
return calorimeterEDRightCollection;
}
inline G4bool CexmcEnergyDepositDigitizer::MonitorHasTriggered( void ) const
{
return monitorHasTriggered;
}
inline G4bool CexmcEnergyDepositDigitizer::HasTriggered( void ) const
{
return hasTriggered;
}
inline void CexmcEnergyDepositDigitizer::SetMonitorThreshold(
G4double value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
value < monitorEDThresholdRef );
else
monitorEDThresholdRef = value;
monitorEDThreshold = value;
}
inline void CexmcEnergyDepositDigitizer::SetVetoCounterLeftThreshold(
G4double value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
value > vetoCounterEDLeftThresholdRef );
else
vetoCounterEDLeftThresholdRef = value;
vetoCounterEDLeftThreshold = value;
}
inline void CexmcEnergyDepositDigitizer::SetVetoCounterRightThreshold(
G4double value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
value > vetoCounterEDRightThresholdRef );
else
vetoCounterEDRightThresholdRef = value;
vetoCounterEDRightThreshold = value;
}
inline void CexmcEnergyDepositDigitizer::SetVetoCountersThreshold(
G4double value )
{
ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
value > vetoCounterEDLeftThresholdRef ||
value > vetoCounterEDRightThresholdRef );
vetoCounterEDLeftThreshold = value;
vetoCounterEDRightThreshold = value;
}
inline void CexmcEnergyDepositDigitizer::SetCalorimeterLeftThreshold(
G4double value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
value < calorimeterEDLeftThresholdRef );
else
calorimeterEDLeftThresholdRef = value;
calorimeterEDLeftThreshold = value;
}
inline void CexmcEnergyDepositDigitizer::SetCalorimeterRightThreshold(
G4double value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
value < calorimeterEDRightThresholdRef );
else
calorimeterEDRightThresholdRef = value;
calorimeterEDRightThreshold = value;
}
inline void CexmcEnergyDepositDigitizer::SetCalorimetersThreshold(
G4double value )
{
ThrowExceptionIfProjectIsRead( CexmcBadThreshold,
value < calorimeterEDLeftThresholdRef ||
value < calorimeterEDRightThresholdRef );
calorimeterEDLeftThreshold = value;
calorimeterEDRightThreshold = value;
}
inline void CexmcEnergyDepositDigitizer::SetCalorimeterTriggerAlgorithm(
CexmcCalorimeterTriggerAlgorithm value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcBadCalorimeterTriggerAlgorithm,
! ( calorimeterTriggerAlgorithmRef ==
CexmcAllCrystalsMakeEDTriggerThreshold ||
value == calorimeterTriggerAlgorithmRef ) );
else
calorimeterTriggerAlgorithmRef = value;
calorimeterTriggerAlgorithm = value;
}
inline void CexmcEnergyDepositDigitizer::SetOuterCrystalsVetoAlgorithm(
CexmcOuterCrystalsVetoAlgorithm value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcBadOCVetoAlgorithm,
! ( outerCrystalsVetoAlgorithmRef == CexmcNoOuterCrystalsVeto ||
value == outerCrystalsVetoAlgorithmRef ) );
else
outerCrystalsVetoAlgorithmRef = value;
outerCrystalsVetoAlgorithm = value;
}
inline void CexmcEnergyDepositDigitizer::SetOuterCrystalsVetoFraction(
G4double value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcBadOCVetoFraction,
value > outerCrystalsVetoFractionRef );
else
outerCrystalsVetoFractionRef = value;
outerCrystalsVetoFraction = value;
}
inline void CexmcEnergyDepositDigitizer::ApplyFiniteCrystalResolution(
G4bool value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
applyFiniteCrystalResolution = value;
}
inline void CexmcEnergyDepositDigitizer::AddCrystalResolutionRange(
G4double bottom, G4double top,
G4double value, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
/* range boundaries are given in GeV */
crystalResolutionData.push_back( CexmcEnergyRangeWithDoubleValue(
bottom * GeV, top * GeV, value ) );
}
inline void CexmcEnergyDepositDigitizer::ClearCrystalResolutionData(
G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
crystalResolutionData.clear();
}
inline void CexmcEnergyDepositDigitizer::SetCrystalResolutionData(
const CexmcEnergyRangeWithDoubleValueList & data )
{
ClearCrystalResolutionData( false );
crystalResolutionData = data;
}
inline G4bool CexmcEnergyDepositDigitizer::IsOuterCrystal( G4int column,
G4int row ) const
{
return column == 0 || column == nCrystalsInRow - 1 ||
row == 0 || row == nCrystalsInColumn - 1;
}
inline void CexmcEnergyDepositDigitizer::TransformToAdjacentInnerCrystal(
G4int & column, G4int & row ) const
{
if ( column == 0 )
++column;
if ( column == nCrystalsInRow - 1 )
--column;
if ( row == 0 )
++row;
if ( row == nCrystalsInColumn - 1 )
--row;
}
inline G4double CexmcEnergyDepositDigitizer::GetMonitorThreshold( void ) const
{
return monitorEDThreshold;
}
inline G4double CexmcEnergyDepositDigitizer::GetVetoCounterLeftThreshold(
void ) const
{
return vetoCounterEDLeftThreshold;
}
inline G4double CexmcEnergyDepositDigitizer::GetVetoCounterRightThreshold(
void ) const
{
return vetoCounterEDRightThreshold;
}
inline G4double CexmcEnergyDepositDigitizer::GetCalorimeterLeftThreshold(
void ) const
{
return calorimeterEDLeftThreshold;
}
inline G4double CexmcEnergyDepositDigitizer::GetCalorimeterRightThreshold(
void ) const
{
return calorimeterEDRightThreshold;
}
inline CexmcCalorimeterTriggerAlgorithm
CexmcEnergyDepositDigitizer::GetCalorimeterTriggerAlgorithm(
void ) const
{
return calorimeterTriggerAlgorithm;
}
inline CexmcOuterCrystalsVetoAlgorithm
CexmcEnergyDepositDigitizer::GetOuterCrystalsVetoAlgorithm(
void ) const
{
return outerCrystalsVetoAlgorithm;
}
inline G4double CexmcEnergyDepositDigitizer::GetOuterCrystalsVetoFraction(
void ) const
{
return outerCrystalsVetoFraction;
}
inline G4bool CexmcEnergyDepositDigitizer::IsFiniteCrystalResolutionApplied(
void ) const
{
return applyFiniteCrystalResolution;
}
inline const CexmcEnergyRangeWithDoubleValueList &
CexmcEnergyDepositDigitizer::GetCrystalResolutionData( void ) const
{
return crystalResolutionData;
}
std::ostream & operator<<( std::ostream & out,
const CexmcEnergyDepositCalorimeterCollection & edCollection );
#endif
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEnergyDepositDigitizerMessenger.hh
*
* Description: energy deposit digitizer messenger
*
* Version: 1.0
* Created: 29.11.2009 18:54:33
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_ENERGY_DEPOSIT_DIGITIZER_MESSENGER_HH
#define CEXMC_ENERGY_DEPOSIT_DIGITIZER_MESSENGER_HH
#include <G4UImessenger.hh>
class CexmcEnergyDepositDigitizer;
class G4UIcommand;
class G4UIcmdWithADouble;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
class G4UIcmdWith3Vector;
class G4UIcmdWithoutParameter;
class CexmcEnergyDepositDigitizerMessenger : public G4UImessenger
{
public:
explicit CexmcEnergyDepositDigitizerMessenger(
CexmcEnergyDepositDigitizer * energyDepositDigitiser );
~CexmcEnergyDepositDigitizerMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcEnergyDepositDigitizer * energyDepositDigitizer;
G4UIcmdWithADoubleAndUnit * setMonitorThreshold;
G4UIcmdWithADoubleAndUnit * setVetoCountersThreshold;
G4UIcmdWithADoubleAndUnit * setLeftVetoCounterThreshold;
G4UIcmdWithADoubleAndUnit * setRightVetoCounterThreshold;
G4UIcmdWithADoubleAndUnit * setCalorimetersThreshold;
G4UIcmdWithADoubleAndUnit * setLeftCalorimeterThreshold;
G4UIcmdWithADoubleAndUnit * setRightCalorimeterThreshold;
G4UIcmdWithAString * setCalorimeterTriggerAlgorithm;
G4UIcmdWithAString * setOuterCrystalsVetoAlgorithm;
G4UIcmdWithADouble * setOuterCrystalsVetoFraction;
G4UIcmdWithABool * applyFiniteCrystalResolution;
G4UIcmdWith3Vector * addCrystalResolutionRange;
G4UIcmdWithoutParameter * clearCrystalResolutionData;
};
#endif
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEnergyDepositInCalorimeter.hh
*
* Description: energy deposit scorer in calorimeters
*
* Version: 1.0
* Created: 14.11.2009 12:45:53
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_ENERGY_DEPOSIT_IN_CALORIMETER_HH
#define CEXMC_ENERGY_DEPOSIT_IN_CALORIMETER_HH
#include "CexmcEnergyDepositInLeftRightSet.hh"
class CexmcSetup;
class CexmcEnergyDepositInCalorimeter : public CexmcEnergyDepositInLeftRightSet
{
public:
CexmcEnergyDepositInCalorimeter( const G4String & name,
const CexmcSetup * setup );
public:
void PrintAll( void );
protected:
G4int GetIndex( G4Step * step );
public:
static G4int GetRow( G4int index );
static G4int GetColumn( G4int index );
static G4int GetCopyDepth1BitsOffset( void );
protected:
static G4int copyDepth1BitsOffset;
};
inline G4int CexmcEnergyDepositInCalorimeter::GetRow( G4int index )
{
index &= ( ( 1 << ( leftRightBitsOffset - 1 ) ) |
( ( 1 << ( leftRightBitsOffset - 1 ) ) - 1 ) );
return index >> copyDepth1BitsOffset;
}
inline G4int CexmcEnergyDepositInCalorimeter::GetColumn( G4int index )
{
return index & ( ( 1 << ( copyDepth1BitsOffset - 1 ) ) |
( ( 1 << ( copyDepth1BitsOffset - 1 ) ) - 1 ) );
}
inline G4int CexmcEnergyDepositInCalorimeter::GetCopyDepth1BitsOffset( void )
{
return copyDepth1BitsOffset;
}
#endif
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEnergyDepositInLeftRightSet.hh
*
* Description: energy deposit scorer in left/right detector sets
* (e.g. veto counters and calorimeters)
*
* Version: 1.0
* Created: 14.11.2009 12:45:53
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_ENERGY_DEPOSIT_IN_LEFT_RIGHT_SET_HH
#define CEXMC_ENERGY_DEPOSIT_IN_LEFT_RIGHT_SET_HH
#include "CexmcSimpleEnergyDeposit.hh"
#include "CexmcCommon.hh"
class CexmcSetup;
class CexmcEnergyDepositInLeftRightSet : public CexmcSimpleEnergyDeposit
{
public:
CexmcEnergyDepositInLeftRightSet( const G4String & name,
const CexmcSetup * setup );
public:
void PrintAll( void );
protected:
G4int GetIndex( G4Step * step );
protected:
const CexmcSetup * setup;
public:
static CexmcSide GetSide( G4int index );
static G4int GetLeftRightBitsOffset( void );
protected:
static G4int leftRightBitsOffset;
};
inline CexmcSide CexmcEnergyDepositInLeftRightSet::GetSide( G4int index )
{
if ( index >> leftRightBitsOffset == 1 )
return CexmcRight;
return CexmcLeft;
}
inline G4int CexmcEnergyDepositInLeftRightSet::GetLeftRightBitsOffset( void )
{
return leftRightBitsOffset;
}
#endif
@@ -0,0 +1,126 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEnergyDepositStore.hh
*
* Description: store energy deposit data and const references to
* energy deposit collections in calorimeters
*
* Version: 1.0
* Created: 25.11.2009 15:32:51
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_ENERGY_DEPOSIT_STORE_HH
#define CEXMC_ENERGY_DEPOSIT_STORE_HH
#include <G4Allocator.hh>
#include "CexmcCommon.hh"
struct CexmcEnergyDepositStore
{
CexmcEnergyDepositStore( G4double monitorED,
G4double vetoCounterEDLeft,
G4double vetoCounterEDRight,
G4double calorimeterEDLeft,
G4double calorimeterEDRight,
G4int calorimeterEDLeftMaxX,
G4int calorimeterEDLeftMaxY,
G4int calorimeterEDRightMaxX,
G4int calorimeterEDRightMaxY,
const CexmcEnergyDepositCalorimeterCollection &
calorimeterEDLeftCollection,
const CexmcEnergyDepositCalorimeterCollection &
calorimeterEDRightCollection ) :
monitorED( monitorED ), vetoCounterEDLeft( vetoCounterEDLeft ),
vetoCounterEDRight( vetoCounterEDRight ),
calorimeterEDLeft( calorimeterEDLeft ),
calorimeterEDRight( calorimeterEDRight ),
calorimeterEDLeftMaxX( calorimeterEDLeftMaxX ),
calorimeterEDLeftMaxY( calorimeterEDLeftMaxY ),
calorimeterEDRightMaxX( calorimeterEDRightMaxX ),
calorimeterEDRightMaxY( calorimeterEDRightMaxY ),
calorimeterEDLeftCollection( calorimeterEDLeftCollection ),
calorimeterEDRightCollection( calorimeterEDRightCollection )
{}
void * operator new( size_t size );
void operator delete( void * obj );
G4double monitorED;
G4double vetoCounterEDLeft;
G4double vetoCounterEDRight;
G4double calorimeterEDLeft;
G4double calorimeterEDRight;
G4int calorimeterEDLeftMaxX;
G4int calorimeterEDLeftMaxY;
G4int calorimeterEDRightMaxX;
G4int calorimeterEDRightMaxY;
const CexmcEnergyDepositCalorimeterCollection &
calorimeterEDLeftCollection;
const CexmcEnergyDepositCalorimeterCollection &
calorimeterEDRightCollection;
};
extern G4Allocator< CexmcEnergyDepositStore > energyDepositStoreAllocator;
inline void * CexmcEnergyDepositStore::operator new( size_t )
{
return energyDepositStoreAllocator.MallocSingle();
}
inline void CexmcEnergyDepositStore::operator delete( void * obj )
{
energyDepositStoreAllocator.FreeSingle(
reinterpret_cast< CexmcEnergyDepositStore * >( obj ) );
}
#endif
@@ -0,0 +1,194 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEventAction.hh
*
* Description: event action
*
* Version: 1.0
* Created: 27.10.2009 22:41:29
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_EVENT_ACTION_HH
#define CEXMC_EVENT_ACTION_HH
#include <G4UserEventAction.hh>
#include "CexmcAngularRange.hh"
class G4Event;
class CexmcPhysicsManager;
class CexmcEnergyDepositDigitizer;
class CexmcEnergyDepositStore;
class CexmcTrackPointsDigitizer;
class CexmcTrackPointsStore;
class CexmcEventActionMessenger;
class CexmcProductionModelData;
class CexmcChargeExchangeReconstructor;
class CexmcEventAction : public G4UserEventAction
{
public:
explicit CexmcEventAction( CexmcPhysicsManager * physicsManager,
G4int verbose = 0 );
virtual ~CexmcEventAction();
public:
void BeginOfEventAction( const G4Event * event );
void EndOfEventAction( const G4Event * event );
public:
void BeamParticleChangeHook( void );
void SetVerboseOnCexmcLevel( G4int verbose_ );
void SetVerboseDrawLevel( G4int verboseDraw_ );
void DrawTrajectoryMarkers( G4bool on );
CexmcChargeExchangeReconstructor * GetReconstructor( void );
private:
void PrintReconstructedData(
const CexmcAngularRangeList & angularRanges,
const CexmcAngularRange & angularGap ) const;
#ifdef CEXMC_USE_ROOT
void FillEDTHistos( const CexmcEnergyDepositStore * edStore,
const CexmcAngularRangeList & triggeredAngularRanges ) const;
void FillTPTHistos( const CexmcTrackPointsStore * tpStore,
const CexmcProductionModelData & pmData,
const CexmcAngularRangeList & triggeredAngularRanges ) const;
void FillRTHistos( G4bool reconstructorHasFullTrigger,
const CexmcEnergyDepositStore * edStore,
const CexmcTrackPointsStore * tpStore,
const CexmcProductionModelData & pmData,
const CexmcAngularRangeList & triggeredAngularRanges ) const;
#endif
void DrawTrajectories( const G4Event * event );
void DrawTrackPoints( const CexmcTrackPointsStore * tpStore ) const;
void DrawReconstructionData( void );
void UpdateRunHits( const CexmcAngularRangeList & aRangesReal,
const CexmcAngularRangeList & aRangesRec,
G4bool tpDigitizerHasTriggered,
G4bool edDigitizerHasTriggered,
G4bool edDigitizerMonitorHasTriggered,
G4bool reconstructorHasTriggered,
const CexmcAngularRange & aGap );
#ifdef CEXMC_USE_PERSISTENCY
void SaveEvent( const G4Event * event,
G4bool edDigitizerMonitorHasTriggered,
const CexmcEnergyDepositStore * edStore,
const CexmcTrackPointsStore * tpStore,
const CexmcProductionModelData & pmData );
void SaveEventFast( const G4Event * event,
G4bool tpDigitizerHasTriggered,
G4bool edDigitizerHasTriggered,
G4bool edDigitizerMonitorHasTriggered,
G4double opCosThetaSCM );
#endif
public:
static CexmcEnergyDepositStore * MakeEnergyDepositStore(
const CexmcEnergyDepositDigitizer * digitizer,
G4bool useInnerRefCrystal );
static CexmcTrackPointsStore * MakeTrackPointsStore(
const CexmcTrackPointsDigitizer * digitizer );
static void PrintEnergyDeposit(
const CexmcEnergyDepositStore * edStore );
static void PrintTrackPoints(
const CexmcTrackPointsStore * tpStore );
static void PrintProductionModelData(
const CexmcAngularRangeList & angularRanges,
const CexmcProductionModelData & pmData );
private:
CexmcPhysicsManager * physicsManager;
private:
CexmcChargeExchangeReconstructor * reconstructor;
private:
G4int verbose;
G4int verboseDraw;
G4bool drawTrajectoryMarkers;
CexmcEventActionMessenger * messenger;
};
inline void CexmcEventAction::SetVerboseOnCexmcLevel( G4int verbose_ )
{
verbose = verbose_;
}
inline void CexmcEventAction::SetVerboseDrawLevel( G4int verboseDraw_ )
{
verboseDraw = verboseDraw_;
}
inline void CexmcEventAction::DrawTrajectoryMarkers( G4bool on )
{
drawTrajectoryMarkers = on;
}
inline CexmcChargeExchangeReconstructor *
CexmcEventAction::GetReconstructor( void )
{
return reconstructor;
}
#endif
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEventActionMessenger.hh
*
* Description: event action messenger (verbose level etc.)
*
* Version: 1.0
* Created: 25.11.2009 14:38:55
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_EVENT_ACTION_MESSENGER_HH
#define CEXMC_EVENT_ACTION_MESSENGER_HH
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
class G4String;
class CexmcEventAction;
class CexmcEventActionMessenger : public G4UImessenger
{
public:
explicit CexmcEventActionMessenger( CexmcEventAction * eventAction );
~CexmcEventActionMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcEventAction * eventAction;
G4UIcmdWithAnInteger * setVerboseLevel;
G4UIcmdWithAnInteger * setVerboseDrawLevel;
G4UIcmdWithABool * drawTrajectoryMarkers;
};
#endif
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEventFastSObject.hh
*
* Description: event data serialization helper
*
* Version: 1.0
* Created: 02.01.2010 20:21:59
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_EVENT_FAST_SOBJECT_HH
#define CEXMC_EVENT_FAST_SOBJECT_HH
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include <G4Types.hh>
class CexmcEventFastSObject
{
friend class boost::serialization::access;
friend class CexmcRunManager;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
public:
CexmcEventFastSObject();
CexmcEventFastSObject( G4int eventId, G4double opCosThetaSCM,
G4bool edDigitizerHasTriggered,
G4bool edDigitizerMonitorHasTriggered );
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
private:
G4int eventId;
G4double opCosThetaSCM;
G4bool edDigitizerHasTriggered;
G4bool edDigitizerMonitorHasTriggered;
};
template < typename Archive >
void CexmcEventFastSObject::serialize( Archive & archive, const unsigned int )
{
archive & eventId;
archive & opCosThetaSCM;
archive & edDigitizerHasTriggered;
archive & edDigitizerMonitorHasTriggered;
}
#endif
#endif
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEventInfo.hh
*
* Description: event information passed to run manager
*
* Version: 1.0
* Created: 04.12.2009 14:47:50
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_EVENT_INFO_HH
#define CEXMC_EVENT_INFO_HH
#include <G4Types.hh>
#include "G4VUserEventInformation.hh"
class CexmcEventInfo : public G4VUserEventInformation
{
public:
CexmcEventInfo( G4bool edTriggerIsOk, G4bool tpTriggerIsOk,
G4bool reconstructionIsOk );
public:
void Print( void ) const;
public:
G4bool EdTriggerIsOk( void ) const;
G4bool TpTriggerIsOk( void ) const;
G4bool ReconstructionIsOk( void ) const;
private:
G4bool edTriggerIsOk;
G4bool tpTriggerIsOk;
G4bool reconstructionIsOk;
};
inline G4bool CexmcEventInfo::EdTriggerIsOk( void ) const
{
return edTriggerIsOk;
}
inline G4bool CexmcEventInfo::TpTriggerIsOk( void ) const
{
return tpTriggerIsOk;
}
inline G4bool CexmcEventInfo::ReconstructionIsOk( void ) const
{
return reconstructionIsOk;
}
#endif
@@ -0,0 +1,169 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcEventSObject.hh
*
* Description: event data serialization helper
*
* Version: 1.0
* Created: 30.12.2009 16:54:30
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_EVENT_SOBJECT_HH
#define CEXMC_EVENT_SOBJECT_HH
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include <boost/serialization/vector.hpp>
#include "CexmcSimpleTrackPointInfoStore.hh"
#include "CexmcSimpleProductionModelDataStore.hh"
#include "CexmcCommon.hh"
class CexmcTrackPointInfo;
class CexmcProductionModelData;
class CexmcEventSObject
{
friend class boost::serialization::access;
friend class CexmcRunManager;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
public:
CexmcEventSObject();
CexmcEventSObject( G4int eventId,
G4bool edDigitizerMonitorHasTriggered, G4double monitorED,
G4double vetoCounterEDLeft, G4double vetoCounterEDRight,
G4double calorimeterEDLeft, G4double calorimeterEDRight,
const CexmcEnergyDepositCalorimeterCollection &
calorimeterEDLeftCollection,
const CexmcEnergyDepositCalorimeterCollection &
calorimeterEDRightCollection,
const CexmcTrackPointInfo & monitorTP,
const CexmcTrackPointInfo & targetTPBeamParticle,
const CexmcTrackPointInfo & targetTPOutputParticle,
const CexmcTrackPointInfo & targetTPNucleusParticle,
const CexmcTrackPointInfo &
targetTPOutputParticleDecayProductParticle1,
const CexmcTrackPointInfo &
targetTPOutputParticleDecayProductParticle2,
const CexmcTrackPointInfo & vetoCounterTPLeft,
const CexmcTrackPointInfo & vetoCounterTPRight,
const CexmcTrackPointInfo & calorimeterTPLeft,
const CexmcTrackPointInfo & calorimeterTPRight,
const CexmcProductionModelData & productionModelData );
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
private:
G4int eventId;
G4bool edDigitizerMonitorHasTriggered;
G4double monitorED;
G4double vetoCounterEDLeft;
G4double vetoCounterEDRight;
G4double calorimeterEDLeft;
G4double calorimeterEDRight;
CexmcEnergyDepositCalorimeterCollection calorimeterEDLeftCollection;
CexmcEnergyDepositCalorimeterCollection calorimeterEDRightCollection;
CexmcSimpleTrackPointInfoStore monitorTP;
CexmcSimpleTrackPointInfoStore targetTPBeamParticle;
CexmcSimpleTrackPointInfoStore targetTPOutputParticle;
CexmcSimpleTrackPointInfoStore targetTPNucleusParticle;
CexmcSimpleTrackPointInfoStore
targetTPOutputParticleDecayProductParticle1;
CexmcSimpleTrackPointInfoStore
targetTPOutputParticleDecayProductParticle2;
CexmcSimpleTrackPointInfoStore vetoCounterTPLeft;
CexmcSimpleTrackPointInfoStore vetoCounterTPRight;
CexmcSimpleTrackPointInfoStore calorimeterTPLeft;
CexmcSimpleTrackPointInfoStore calorimeterTPRight;
CexmcSimpleProductionModelDataStore productionModelData;
};
template < typename Archive >
void CexmcEventSObject::serialize( Archive & archive, const unsigned int )
{
archive & eventId;
archive & edDigitizerMonitorHasTriggered;
archive & monitorED;
archive & vetoCounterEDLeft;
archive & vetoCounterEDRight;
archive & calorimeterEDLeft;
archive & calorimeterEDRight;
archive & calorimeterEDLeftCollection;
archive & calorimeterEDRightCollection;
archive & monitorTP;
archive & targetTPBeamParticle;
archive & targetTPOutputParticle;
archive & targetTPNucleusParticle;
archive & targetTPOutputParticleDecayProductParticle1;
archive & targetTPOutputParticleDecayProductParticle2;
archive & vetoCounterTPLeft;
archive & vetoCounterTPRight;
archive & calorimeterTPLeft;
archive & calorimeterTPRight;
archive & productionModelData;
}
#endif
#endif
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcException.hh
*
* Description: cexmc exceptions
*
* Version: 1.0
* Created: 04.11.2009 00:00:58
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_EXCEPTION_HH
#define CEXMC_EXCEPTION_HH
#include <stdexcept>
#include <G4Types.hh>
enum CexmcExceptionType
{
CexmcUnknownException,
CexmcSystemException,
CexmcEventActionIsNotInitialized,
CexmcCmdLineParseException,
CexmcPreinitException,
CexmcFileCompressException,
CexmcReadProjectIncomplete,
CexmcProjectExists,
CexmcCmdIsNotAllowed,
CexmcBadAngularRange,
CexmcBadThreshold,
CexmcBadCalorimeterTriggerAlgorithm,
CexmcBadOCVetoAlgorithm,
CexmcBadOCVetoFraction,
CexmcCalorimeterRegionNotInitialized,
CexmcCalorimeterGeometryDataNotInitialized,
CexmcMultipleDetectorRoles,
CexmcKinematicsException,
CexmcPoorEventData,
CexmcIncompatibleGeometry,
CexmcIncompleteProductionModel,
CexmcIncompatibleProductionModel,
CexmcBeamAndIncidentParticlesMismatch,
CexmcInvalidAngularRange,
#ifdef CEXMC_USE_CUSTOM_FILTER
CexmcCFBadSource,
CexmcCFParseError,
CexmcCFUninitialized,
CexmcCFUninitializedVector,
CexmcCFUnexpectedContext,
CexmcCFUnexpectedFunction,
CexmcCFUnexpectedVariable,
CexmcCFUnexpectedVariableUsage,
CexmcCFUnexpectedVectorIndex,
#endif
CexmcWeirdException
};
class CexmcException : public std::exception
{
public:
explicit CexmcException( CexmcExceptionType type );
~CexmcException() throw();
public:
const char * what( void ) const throw();
private:
CexmcExceptionType type;
};
void ThrowExceptionIfProjectIsRead( CexmcExceptionType type,
G4bool extraCond = true );
#endif
@@ -0,0 +1,71 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcGenbod.hh
*
* Description: original fortran routine GENBOD wrapper
*
* Version: 1.0
* Created: 08.09.2010 14:32:14
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_GENBOD_HH
#define CEXMC_GENBOD_HH
#ifdef CEXMC_USE_GENBOD
#include "CexmcPhaseSpaceGenerator.hh"
class CexmcGenbod : public CexmcPhaseSpaceGenerator
{
public:
CexmcGenbod();
public:
G4bool CheckKinematics( void );
G4double Generate( void );
private:
void ParticleChangeHook( void );
void FermiEnergyDepStatusChangeHook( void );
};
#endif
#endif
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcHadronicPhysics.hh
*
* Description: hadronic physics with adjustable production model
*
* Version: 1.0
* Created: 28.10.2009 17:16:44
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_HADRONIC_PHYSICS_HH
#define CEXMC_HADRONIC_PHYSICS_HH
#include "CexmcStudiedPhysics.hh"
#include "CexmcHadronicProcess.hh"
template < typename ProductionModel >
class CexmcHadronicPhysics : public CexmcStudiedPhysics< CexmcHadronicProcess >
{
public:
explicit CexmcHadronicPhysics( CexmcPhysicsManager * physicsManager );
~CexmcHadronicPhysics();
private:
void ApplyInteractionModel( G4VProcess * process );
};
template < typename ProductionModel >
CexmcHadronicPhysics< ProductionModel >::CexmcHadronicPhysics(
CexmcPhysicsManager * physicsManager ) :
CexmcStudiedPhysics< CexmcHadronicProcess >( physicsManager )
{
productionModel = new ProductionModel;
}
template < typename ProductionModel >
CexmcHadronicPhysics< ProductionModel >::~CexmcHadronicPhysics()
{
delete productionModel;
}
template < typename ProductionModel >
void CexmcHadronicPhysics< ProductionModel >::ApplyInteractionModel(
G4VProcess * process )
{
CexmcHadronicProcess * theProcess( static_cast< CexmcHadronicProcess * >(
process ) );
theProcess->RegisterProductionModel( productionModel );
}
#endif
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcHadronicProcess.hh
*
* Description: hadronic process with production model
*
* Version: 1.0
* Created: 31.10.2009 23:44:11
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_HADRONIC_PROCESS_HH
#define CEXMC_HADRONIC_PROCESS_HH
#include <G4HadronicProcess.hh>
#include <G4Nucleus.hh>
#include "CexmcCommon.hh"
class G4VParticleChange;
class G4ParticleDefinition;
class G4Track;
class G4Step;
class G4Material;
class G4HadronicInteraction;
class CexmcProductionModel;
class CexmcHadronicProcess : public G4HadronicProcess
{
public:
explicit CexmcHadronicProcess(
const G4String & name = CexmcStudiedProcessLastName );
~CexmcHadronicProcess();
public:
G4VParticleChange * PostStepDoIt( const G4Track & track,
const G4Step & step );
G4bool IsApplicable( const G4ParticleDefinition & particle );
public:
void RegisterProductionModel( CexmcProductionModel * model );
private:
void CalculateTargetNucleus( const G4Material * material );
void FillTotalResult( G4HadFinalState * hadFinalState,
const G4Track & track );
private:
CexmcProductionModel * productionModel;
G4HadronicInteraction * interaction;
private:
G4ParticleChange * theTotalResult;
G4Nucleus targetNucleus;
G4bool isInitialized;
};
#endif
@@ -0,0 +1,262 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcHistoManager.hh
*
* Description: histograming manager (singleton)
*
* Version: 1.0
* Created: 26.11.2009 20:55:16
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_HISTO_MANAGER_HH
#define CEXMC_HISTO_MANAGER_HH
#ifdef CEXMC_USE_ROOT
#include <vector>
#include <map>
#include <Rtypes.h>
#include <G4String.hh>
#include "CexmcAngularRange.hh"
#include "CexmcCommon.hh"
class TFile;
class TH1;
#ifdef CEXMC_USE_ROOTQT
class TQtWidget;
#endif
class CexmcHistoManagerMessenger;
enum CexmcHistoType
{
CexmcMomentumBP_TPT_Histo,
CexmcMomentumBP_RT_Histo,
CexmcTPInMonitor_TPT_Histo,
CexmcTPInTarget_TPT_Histo,
CexmcTPInTarget_RT_Histo,
CexmcRecMasses_EDT_Histo,
CexmcRecMasses_RT_Histo,
CexmcAbsorbedEnergy_EDT_Histo,
CexmcAbsorbedEnergy_RT_Histo,
CexmcHistoType_ARReal_START,
CexmcRecMassOP_ARReal_RT_Histo = CexmcHistoType_ARReal_START,
CexmcRecMassNOP_ARReal_RT_Histo,
CexmcOPDPAtLeftCalorimeter_ARReal_EDT_Histo,
CexmcOPDPAtRightCalorimeter_ARReal_EDT_Histo,
CexmcOPDPAtLeftCalorimeter_ARReal_RT_Histo,
CexmcOPDPAtRightCalorimeter_ARReal_RT_Histo,
CexmcRecOPDPAtLeftCalorimeter_ARReal_EDT_Histo,
CexmcRecOPDPAtRightCalorimeter_ARReal_EDT_Histo,
CexmcRecOPDPAtLeftCalorimeter_ARReal_RT_Histo,
CexmcRecOPDPAtRightCalorimeter_ARReal_RT_Histo,
CexmcKinEnAtLeftCalorimeter_ARReal_TPT_Histo,
CexmcKinEnAtRightCalorimeter_ARReal_TPT_Histo,
CexmcKinEnAtLeftCalorimeter_ARReal_RT_Histo,
CexmcKinEnAtRightCalorimeter_ARReal_RT_Histo,
CexmcAbsEnInLeftCalorimeter_ARReal_EDT_Histo,
CexmcAbsEnInRightCalorimeter_ARReal_EDT_Histo,
CexmcAbsEnInLeftCalorimeter_ARReal_RT_Histo,
CexmcAbsEnInRightCalorimeter_ARReal_RT_Histo,
CexmcMissEnFromLeftCalorimeter_ARReal_RT_Histo,
CexmcMissEnFromRightCalorimeter_ARReal_RT_Histo,
CexmcKinEnOP_LAB_ARReal_TPT_Histo,
CexmcKinEnOP_LAB_ARReal_RT_Histo,
CexmcAngleOP_SCM_ARReal_TPT_Histo,
CexmcAngleOP_SCM_ARReal_RT_Histo,
CexmcRecAngleOP_SCM_ARReal_RT_Histo,
CexmcDiffAngleOP_SCM_ARReal_RT_Histo,
CexmcOpenAngle_ARReal_TPT_Histo,
CexmcOpenAngle_ARReal_RT_Histo,
CexmcRecOpenAngle_ARReal_RT_Histo,
CexmcDiffOpenAngle_ARReal_RT_Histo,
CexmcTPInTarget_ARReal_TPT_Histo,
CexmcTPInTarget_ARReal_RT_Histo,
CexmcHistoType_ARReal_END = CexmcTPInTarget_ARReal_RT_Histo,
CexmcHistoType_SIZE
};
class CexmcHistoManager
{
private:
typedef std::vector< TH1 * > CexmcHistoVector;
typedef std::map< CexmcHistoType, CexmcHistoVector > CexmcHistosMap;
typedef std::pair< CexmcHistoType, CexmcHistoVector > CexmcHistoPair;
struct CexmcHistoAxisData
{
CexmcHistoAxisData() : nBins( 0 ), nBinsMin( 0 ), nBinsMax( 0 )
{}
CexmcHistoAxisData( Int_t nBins, Double_t nBinsMin,
Double_t nBinsMax ) :
nBins( nBins ), nBinsMin( nBinsMin ), nBinsMax( nBinsMax )
{}
Int_t nBins;
Double_t nBinsMin;
Double_t nBinsMax;
};
typedef std::vector< CexmcHistoAxisData > CexmcHistoAxes;
enum CexmcHistoImpl
{
Cexmc_TH1F,
Cexmc_TH2F,
Cexmc_TH3F
};
struct CexmcHistoData
{
CexmcHistoData() :
type( CexmcHistoType_SIZE ), impl( Cexmc_TH1F ),
isARHisto( false ), isARRec( false ), triggerType( CexmcTPT )
{}
CexmcHistoData( CexmcHistoType type, CexmcHistoImpl impl,
bool isARHisto, bool isARRec,
CexmcTriggerType triggerType,
const G4String & name, const G4String & title,
const CexmcHistoAxes & axes ) :
type( type ), impl( impl ), isARHisto( isARHisto ),
isARRec( isARRec ), triggerType( triggerType ), name( name ),
title( title ), axes( axes )
{}
CexmcHistoType type;
CexmcHistoImpl impl;
bool isARHisto;
bool isARRec;
CexmcTriggerType triggerType;
G4String name;
G4String title;
CexmcHistoAxes axes;
};
public:
static CexmcHistoManager * Instance( void );
static void Destroy( void );
private:
CexmcHistoManager();
~CexmcHistoManager();
public:
void Initialize( void );
void SetupARHistos( const CexmcAngularRangeList & aRanges );
void AddARHistos( const CexmcAngularRange & aRange );
void Add( CexmcHistoType histoType, unsigned int index,
G4double x );
void Add( CexmcHistoType histoType, unsigned int index, G4double x,
G4double y );
void Add( CexmcHistoType histoType, unsigned int index, G4double x,
G4double y, G4double z );
void Add( CexmcHistoType histoType, unsigned int index, G4int binX,
G4int binY, G4double value );
void List( void ) const;
void Print( const G4String & value );
#ifdef CEXMC_USE_ROOTQT
void Draw( const G4String & histoName,
const G4String & histoDrawOptions = "" );
#endif
private:
void AddHisto( const CexmcHistoData & data,
const CexmcAngularRange & aRange = CexmcAngularRange() );
void CreateHisto( CexmcHistoVector & histoVector,
CexmcHistoImpl histoImpl, const G4String & name,
const G4String & title,
const CexmcHistoAxes & axes );
private:
TFile * outFile;
private:
CexmcHistosMap histos;
bool isInitialized;
G4String opName;
G4String nopName;
G4double opMass;
G4double nopMass;
#ifdef CEXMC_USE_ROOTQT
private:
TQtWidget * rootCanvas;
#endif
private:
CexmcHistoManagerMessenger * messenger;
private:
static CexmcHistoManager * instance;
};
#endif
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcHistoManagerMessenger.hh
*
* Description: commands to list and show histograms
*
* Version: 1.0
* Created: 17.12.2009 21:38:16
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_HISTO_MANAGER_MESSENGER_HH
#define CEXMC_HISTO_MANAGER_MESSENGER_HH
#ifdef CEXMC_USE_ROOT
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAString;
class CexmcHistoManagerMessenger : public G4UImessenger
{
public:
CexmcHistoManagerMessenger();
~CexmcHistoManagerMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
G4UIcmdWithoutParameter * listHistos;
G4UIcmdWithAString * printHisto;
#ifdef CEXMC_USE_ROOTQT
G4UIcmdWithAString * drawHisto;
#endif
};
#endif
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcHistoWidget.hh
*
* Description: histogram widget without context menu
* (derived from TQtWidget)
*
* Version: 1.0
* Created: 15.03.2010 18:59:09
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_HISTO_WIDGET_HH
#define CEXMC_HISTO_WIDGET_HH
#ifdef CEXMC_USE_ROOTQT
#include <TQtWidget.h>
class QContextMenuEvent;
class CexmcHistoWidget : public TQtWidget
{
public:
void contextMenuEvent( QContextMenuEvent * event );
};
#endif
#endif
@@ -0,0 +1,153 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcIncidentParticleTrackInfo.hh
*
* Description: incident particle track info
*
* Version: 1.0
* Created: 18.05.2010 13:04:03
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_INCIDENT_PARTICLE_TRACK_INFO_HH
#define CEXMC_INCIDENT_PARTICLE_TRACK_INFO_HH
#include "CexmcTrackInfo.hh"
class CexmcIncidentParticleTrackInfo : public CexmcTrackInfo
{
public:
explicit CexmcIncidentParticleTrackInfo( CexmcTrackType trackType =
CexmcInsipidTrack );
public:
G4int GetTypeInfo( void ) const;
public:
G4double GetCurrentTrackLengthInTarget( void ) const;
void AddTrackLengthInTarget( G4double value );
void SetNeedsTrackLengthResampling( G4bool on = true );
G4double GetFinalTrackLengthInTarget( void ) const;
void SetFinalTrackLengthInTarget( G4double value );
void ResetCurrentTrackLengthInTarget( void );
G4bool NeedsTrackLengthResampling( void ) const;
G4bool IsStudiedProcessActivated( void ) const;
void ActivateStudiedProcess( G4bool on = true );
private:
G4double currentTrackLengthInTarget;
G4double finalTrackLengthInTarget;
G4bool isStudiedProcessActivated;
G4bool needsTrackLengthResampling;
};
inline G4double CexmcIncidentParticleTrackInfo::GetCurrentTrackLengthInTarget(
void ) const
{
return currentTrackLengthInTarget;
}
inline void CexmcIncidentParticleTrackInfo::AddTrackLengthInTarget(
G4double value )
{
currentTrackLengthInTarget += value;
}
inline void CexmcIncidentParticleTrackInfo::SetNeedsTrackLengthResampling(
G4bool on )
{
needsTrackLengthResampling = on;
}
inline G4double CexmcIncidentParticleTrackInfo::GetFinalTrackLengthInTarget(
void ) const
{
return finalTrackLengthInTarget;
}
inline void CexmcIncidentParticleTrackInfo::SetFinalTrackLengthInTarget(
G4double value )
{
finalTrackLengthInTarget = value;
}
inline void CexmcIncidentParticleTrackInfo::ResetCurrentTrackLengthInTarget(
void )
{
currentTrackLengthInTarget = 0.;
}
inline G4bool CexmcIncidentParticleTrackInfo::NeedsTrackLengthResampling(
void ) const
{
return needsTrackLengthResampling;
}
inline G4bool CexmcIncidentParticleTrackInfo::IsStudiedProcessActivated(
void ) const
{
return isStudiedProcessActivated;
}
inline void CexmcIncidentParticleTrackInfo::ActivateStudiedProcess(
G4bool on )
{
isStudiedProcessActivated = on;
}
#endif
@@ -0,0 +1,176 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcMessenger.hh
*
* Description: common messenger stuff (directories etc.)
*
* Version: 1.0
* Created: 15.11.2009 12:48:40
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_MESSENGER_HH
#define CEXMC_MESSENGER_HH
#include <G4String.hh>
class G4UIdirectory;
class CexmcMessenger
{
public:
static CexmcMessenger * Instance( void );
static void Destroy( void );
private:
CexmcMessenger();
~CexmcMessenger();
public:
static G4String mainDirName;
static G4String geometryDirName;
static G4String physicsDirName;
static G4String gunDirName;
static G4String detectorDirName;
static G4String eventDirName;
static G4String runDirName;
static G4String monitorDirName;
static G4String targetDirName;
static G4String vetoCounterDirName;
static G4String vetoCounterLeftDirName;
static G4String vetoCounterRightDirName;
static G4String calorimeterDirName;
static G4String calorimeterLeftDirName;
static G4String calorimeterRightDirName;
static G4String monitorEDDirName;
static G4String vetoCounterEDDirName;
static G4String vetoCounterLeftEDDirName;
static G4String vetoCounterRightEDDirName;
static G4String calorimeterEDDirName;
static G4String calorimeterLeftEDDirName;
static G4String calorimeterRightEDDirName;
static G4String reconstructorDirName;
static G4String visDirName;
#ifdef CEXMC_USE_ROOT
static G4String histoDirName;
#endif
private:
static CexmcMessenger * instance;
private:
G4UIdirectory * mainDir;
G4UIdirectory * geometryDir;
G4UIdirectory * physicsDir;
G4UIdirectory * gunDir;
G4UIdirectory * detectorDir;
G4UIdirectory * eventDir;
G4UIdirectory * runDir;
G4UIdirectory * monitorDir;
G4UIdirectory * targetDir;
G4UIdirectory * vetoCounterDir;
G4UIdirectory * vetoCounterLeftDir;
G4UIdirectory * vetoCounterRightDir;
G4UIdirectory * calorimeterDir;
G4UIdirectory * calorimeterLeftDir;
G4UIdirectory * calorimeterRightDir;
G4UIdirectory * monitorEDDir;
G4UIdirectory * vetoCounterEDDir;
G4UIdirectory * vetoCounterLeftEDDir;
G4UIdirectory * vetoCounterRightEDDir;
G4UIdirectory * calorimeterEDDir;
G4UIdirectory * calorimeterLeftEDDir;
G4UIdirectory * calorimeterRightEDDir;
G4UIdirectory * reconstructorDir;
G4UIdirectory * visDir;
#ifdef CEXMC_USE_ROOT
G4UIdirectory * histoDir;
#endif
};
#endif
@@ -0,0 +1,168 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcParticleGun.hh
*
* Description: particle gun
*
* Version: 1.0
* Created: 15.12.2009 00:41:16
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PARTICLE_GUN_HH
#define CEXMC_PARTICLE_GUN_HH
#include <G4ParticleGun.hh>
#include <G4ThreeVector.hh>
#include "CexmcPhysicsManager.hh"
#include "CexmcException.hh"
class CexmcParticleGunMessenger;
class CexmcParticleGun : public G4ParticleGun
{
public:
explicit CexmcParticleGun( CexmcPhysicsManager * physicsManager,
G4int nmbOfParticles = 1 );
~CexmcParticleGun();
public:
void PrepareForNewEvent( void );
public:
const G4ThreeVector & GetOrigPosition( void ) const;
const G4ThreeVector & GetOrigDirection( void ) const;
G4double GetOrigMomentumAmp( void ) const;
void SetOrigPosition( const G4ThreeVector & position,
G4bool fromMessenger = true );
void SetOrigDirection( const G4ThreeVector & direction,
G4bool fromMessenger = true );
void SetOrigMomentumAmp( G4double momentumAmp,
G4bool fromMessenger = true );
void SetBeamParticle( G4ParticleDefinition * particleDefinition,
G4bool fromMessenger = true );
private:
CexmcPhysicsManager * physicsManager;
G4ThreeVector origPos;
G4ThreeVector origDir;
G4double origMomentumAmp;
private:
CexmcParticleGunMessenger * messenger;
};
inline void CexmcParticleGun::PrepareForNewEvent( void )
{
/* this will prevent G4ParticleGun spam about kinetic energy redefinition */
particle_energy = 0.0;
particle_momentum = 0.0;
}
inline const G4ThreeVector & CexmcParticleGun::GetOrigPosition( void ) const
{
return origPos;
}
inline const G4ThreeVector & CexmcParticleGun::GetOrigDirection( void ) const
{
return origDir;
}
inline G4double CexmcParticleGun::GetOrigMomentumAmp( void ) const
{
return origMomentumAmp;
}
inline void CexmcParticleGun::SetOrigPosition(
const G4ThreeVector & position, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
origPos = position;
}
inline void CexmcParticleGun::SetOrigDirection(
const G4ThreeVector & direction, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
origDir = direction;
physicsManager->SetMaxIL( direction );
}
inline void CexmcParticleGun::SetOrigMomentumAmp( G4double momentumAmp,
G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
origMomentumAmp = momentumAmp;
}
inline void CexmcParticleGun::SetBeamParticle(
G4ParticleDefinition * particleDefinition, G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
SetParticleDefinition( particleDefinition );
}
#endif
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcParticleGunMessenger.hh
*
* Description: original position and momentum of the incident beam particle
*
* Version: 1.0
* Created: 15.12.2009 13:54:20
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PARTICLE_GUN_MESSENGER_HH
#define CEXMC_PARTICLE_GUN_MESSENGER_HH
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWith3Vector;
class G4UIcmdWith3VectorAndUnit;
class CexmcParticleGun;
class CexmcParticleGunMessenger : public G4UImessenger
{
public:
explicit CexmcParticleGunMessenger( CexmcParticleGun * particleGun );
~CexmcParticleGunMessenger();
public:
void SetNewValue( G4UIcommand * cnd, G4String value );
private:
CexmcParticleGun * particleGun;
G4UIcmdWithAString * setParticle;
G4UIcmdWith3VectorAndUnit * setOrigPosition;
G4UIcmdWith3Vector * setOrigDirection;
G4UIcmdWithADoubleAndUnit * setOrigMomentumAmp;
};
#endif
@@ -0,0 +1,107 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcPhaseSpaceGenerator.hh
*
* Description: phase space generator interface
*
* Version: 1.0
* Created: 08.09.2010 13:42:15
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PHASE_SPACE_GENERATOR_HH
#define CEXMC_PHASE_SPACE_GENERATOR_HH
#include <vector>
#include <G4Types.hh>
#include <G4LorentzVector.hh>
struct CexmcPhaseSpaceOutVectorElement
{
CexmcPhaseSpaceOutVectorElement( G4LorentzVector * lVec, G4double mass ) :
lVec( lVec ), mass( mass )
{}
G4LorentzVector * lVec;
G4double mass;
};
typedef std::vector< const G4LorentzVector * > CexmcPhaseSpaceInVector;
typedef std::vector< CexmcPhaseSpaceOutVectorElement >
CexmcPhaseSpaceOutVector;
class CexmcPhaseSpaceGenerator
{
public:
CexmcPhaseSpaceGenerator();
virtual ~CexmcPhaseSpaceGenerator();
public:
virtual G4bool CheckKinematics( void );
virtual G4double Generate( void ) = 0;
public:
void SetParticles( const CexmcPhaseSpaceInVector & inVec_,
const CexmcPhaseSpaceOutVector & outVec_ );
void SetFermiEnergyDependence( G4bool on = true );
protected:
virtual void ParticleChangeHook( void );
virtual void FermiEnergyDepStatusChangeHook( void );
protected:
CexmcPhaseSpaceInVector inVec;
CexmcPhaseSpaceOutVector outVec;
G4bool fermiEnergyDepIsOn;
G4double totalEnergy;
G4double totalMass;
};
#endif
@@ -0,0 +1,186 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcPhysicsList.hh
*
* Description: mandatory physics list
*
* Version: 1.0
* Created: 11.10.2009 14:51:08
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PHYSICS_LIST_HH
#define CEXMC_PHYSICS_LIST_HH
#include <Randomize.hh>
#include <G4Track.hh>
#include <G4StepPoint.hh>
#include <G4ThreeVector.hh>
#include <G4AffineTransform.hh>
#include "CexmcStudiedPhysics.hh"
#include "CexmcStudiedProcess.hh"
#include "CexmcPhysicsManager.hh"
#include "CexmcProductionModel.hh"
#include "CexmcIncidentParticleTrackInfo.hh"
#include "CexmcSetup.hh"
#include "CexmcException.hh"
#include "CexmcCommon.hh"
template < typename BasePhysics, template < typename > class StudiedPhysics,
typename ProductionModel >
class CexmcPhysicsList : public BasePhysics, public CexmcPhysicsManager
{
public:
CexmcPhysicsList();
public:
CexmcProductionModel * GetProductionModel( void );
G4bool IsStudiedProcessAllowed( void ) const;
void ResampleTrackLengthInTarget( const G4Track * track,
const G4StepPoint * stepPoint );
void SetupConstructionHook( const CexmcSetup * setup );
protected:
void CalculateBasicMaxIL( const G4ThreeVector & direction );
private:
StudiedPhysics< ProductionModel > * studiedPhysics;
G4VSolid * targetSolid;
G4AffineTransform targetTransform;
};
template < typename BasePhysics, template < typename > class StudiedPhysics,
typename ProductionModel >
CexmcPhysicsList< BasePhysics, StudiedPhysics, ProductionModel >::
CexmcPhysicsList() : studiedPhysics( NULL ), targetSolid( NULL )
{
studiedPhysics = new StudiedPhysics< ProductionModel >( this );
this->RegisterPhysics( studiedPhysics );
}
template < typename BasePhysics, template < typename > class StudiedPhysics,
typename ProductionModel >
CexmcProductionModel *
CexmcPhysicsList< BasePhysics, StudiedPhysics, ProductionModel >::
GetProductionModel( void )
{
return studiedPhysics->GetProductionModel();
}
template < typename BasePhysics, template < typename > class StudiedPhysics,
typename ProductionModel >
G4bool CexmcPhysicsList< BasePhysics, StudiedPhysics, ProductionModel >::
IsStudiedProcessAllowed( void ) const
{
return numberOfTriggeredStudiedInteractions == 0;
}
template < typename BasePhysics, template < typename > class StudiedPhysics,
typename ProductionModel >
void CexmcPhysicsList< BasePhysics, StudiedPhysics, ProductionModel >::
ResampleTrackLengthInTarget( const G4Track * track,
const G4StepPoint * stepPoint )
{
/* BEWARE: all callers must ensure that:
* 1) track (or stepPoint if not NULL) is inside target volume:
* in this case we can use already calculated targetTransform
* 2) track info object is of type CexmcIncidentParticleTrackInfo*:
* in this case we can use static_cast<> for trackInfo */
CexmcIncidentParticleTrackInfo * trackInfo(
static_cast< CexmcIncidentParticleTrackInfo * >(
track->GetUserInformation() ) );
if ( ! trackInfo )
return;
G4ThreeVector position;
G4ThreeVector direction;
if ( stepPoint )
{
position = targetTransform.TransformPoint( stepPoint->GetPosition() );
direction = targetTransform.TransformAxis(
stepPoint->GetMomentumDirection() );
}
else
{
position = targetTransform.TransformPoint( track->GetPosition() );
direction = targetTransform.TransformAxis(
track->GetMomentumDirection() );
}
G4double distanceInTarget( targetSolid->DistanceToOut( position,
direction ) );
trackInfo->ResetCurrentTrackLengthInTarget();
trackInfo->SetFinalTrackLengthInTarget( G4UniformRand() *
std::max( distanceInTarget, proposedMaxIL ) );
trackInfo->SetNeedsTrackLengthResampling( false );
}
template < typename BasePhysics, template < typename > class StudiedPhysics,
typename ProductionModel >
void CexmcPhysicsList< BasePhysics, StudiedPhysics, ProductionModel >::
CalculateBasicMaxIL( const G4ThreeVector & direction )
{
/* basicMaxIL is double distance from the point (0, 0, 0) to the edge of the
* target solid along the specified direction */
basicMaxIL = targetSolid->DistanceToOut( G4ThreeVector(),
targetTransform.TransformAxis( direction ) ) * 2;
}
template < typename BasePhysics, template < typename > class StudiedPhysics,
typename ProductionModel >
void CexmcPhysicsList< BasePhysics, StudiedPhysics, ProductionModel >::
SetupConstructionHook( const CexmcSetup * setup )
{
targetSolid = setup->GetVolume( CexmcSetup::Target )->GetSolid();
targetTransform = setup->GetTargetTransform().Inverse();
}
#endif
@@ -0,0 +1,158 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcPhysicsManager.hh
*
* Description: interface for external access to physics aspects
*
* Version: 1.0
* Created: 27.10.2009 23:10:31
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PHYSICS_MANAGER_HH
#define CEXMC_PHYSICS_MANAGER_HH
#include <G4Types.hh>
#include <G4ThreeVector.hh>
class G4ParticleDefinition;
class G4Track;
class G4StepPoint;
class CexmcProductionModel;
class CexmcSetup;
class CexmcPhysicsManagerMessenger;
class CexmcPhysicsManager
{
public:
CexmcPhysicsManager();
virtual ~CexmcPhysicsManager();
public:
virtual CexmcProductionModel * GetProductionModel( void ) = 0;
virtual G4bool IsStudiedProcessAllowed( void ) const = 0;
virtual void ResampleTrackLengthInTarget( const G4Track * track,
const G4StepPoint * stepPoint = NULL ) = 0;
virtual void SetupConstructionHook( const CexmcSetup * setup ) = 0;
public:
G4bool OnlyBeamParticleCanTriggerStudiedProcess( void ) const;
void IncrementNumberOfTriggeredStudiedInteractions( void );
void ResetNumberOfTriggeredStudiedInteractions( void );
G4double GetProposedMaxIL( void ) const;
void SetMaxIL( const G4ThreeVector & direction );
void SetMaxILCorrection( G4double value );
void SetProposedMaxIL( G4double value );
protected:
virtual void CalculateBasicMaxIL(
const G4ThreeVector & direction ) = 0;
protected:
G4double basicMaxIL;
G4double maxILCorrection;
G4double proposedMaxIL;
G4int numberOfTriggeredStudiedInteractions;
G4bool onlyBeamParticleCanTriggerStudiedProcess;
private:
CexmcPhysicsManagerMessenger * messenger;
};
inline G4bool CexmcPhysicsManager::OnlyBeamParticleCanTriggerStudiedProcess(
void ) const
{
return onlyBeamParticleCanTriggerStudiedProcess;
}
inline void CexmcPhysicsManager::IncrementNumberOfTriggeredStudiedInteractions(
void )
{
++numberOfTriggeredStudiedInteractions;
}
inline void CexmcPhysicsManager::ResetNumberOfTriggeredStudiedInteractions(
void )
{
numberOfTriggeredStudiedInteractions = 0;
}
inline G4double CexmcPhysicsManager::GetProposedMaxIL( void ) const
{
return proposedMaxIL;
}
inline void CexmcPhysicsManager::SetMaxIL( const G4ThreeVector & direction )
{
CalculateBasicMaxIL( direction );
proposedMaxIL = basicMaxIL + maxILCorrection;
}
inline void CexmcPhysicsManager::SetMaxILCorrection( G4double value )
{
maxILCorrection = value;
proposedMaxIL = basicMaxIL + maxILCorrection;
}
inline void CexmcPhysicsManager::SetProposedMaxIL( G4double value )
{
proposedMaxIL = value;
}
#endif
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcPhysicsManagerMessenger.hh
*
* Description: physics manager messenger (max IL correction etc.)
*
* Version: 1.0
* Created: 16.10.2010 14:09:59
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PHYSICS_MANAGER_MESSENGER_HH
#define CEXMC_PHYSICS_MANAGER_MESSENGER_HH
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWithADoubleAndUnit;
class CexmcPhysicsManager;
class CexmcPhysicsManagerMessenger : public G4UImessenger
{
public:
explicit CexmcPhysicsManagerMessenger(
CexmcPhysicsManager * physicsManager );
~CexmcPhysicsManagerMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcPhysicsManager * physicsManager;
G4UIcmdWithADoubleAndUnit * setMaxILCorrection;
};
#endif
@@ -0,0 +1,191 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcPrimaryGeneratorAction.hh
*
* Description: primary particle position, direction, energy etc.
*
* Version: 1.0
* Created: 11.10.2009 14:54:27
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PRIMARY_GENERATOR_ACTION_HH
#define CEXMC_PRIMARY_GENERATOR_ACTION_HH
#include <G4VUserPrimaryGeneratorAction.hh>
#include "CexmcException.hh"
class G4Event;
class CexmcParticleGun;
class CexmcPhysicsManager;
class CexmcPrimaryGeneratorActionMessenger;
class CexmcPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
explicit CexmcPrimaryGeneratorAction(
CexmcPhysicsManager * physicsManager );
~CexmcPrimaryGeneratorAction();
public:
void GeneratePrimaries( G4Event * event );
public:
void SetFwhmPosX( G4double value, G4bool fromMessenger = true );
void SetFwhmPosY( G4double value, G4bool fromMessenger = true );
void SetFwhmDirX( G4double value, G4bool fromMessenger = true );
void SetFwhmDirY( G4double value, G4bool fromMessenger = true );
void SetFwhmMomentumAmp( G4double value,
G4bool fromMessenger = true );
G4double GetFwhmPosX( void ) const;
G4double GetFwhmPosY( void ) const;
G4double GetFwhmDirX( void ) const;
G4double GetFwhmDirY( void ) const;
G4double GetFwhmMomentumAmp( void ) const;
public:
CexmcParticleGun * GetParticleGun( void );
private:
CexmcParticleGun * particleGun;
G4double fwhmPosX;
G4double fwhmPosY;
G4double fwhmDirX;
G4double fwhmDirY;
G4double fwhmMomentumAmp;
private:
CexmcPrimaryGeneratorActionMessenger * messenger;
};
inline void CexmcPrimaryGeneratorAction::SetFwhmPosX( G4double value,
G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
fwhmPosX = value;
}
inline void CexmcPrimaryGeneratorAction::SetFwhmPosY( G4double value,
G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
fwhmPosY = value;
}
inline void CexmcPrimaryGeneratorAction::SetFwhmDirX( G4double value,
G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
fwhmDirX = value;
}
inline void CexmcPrimaryGeneratorAction::SetFwhmDirY( G4double value,
G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
fwhmDirY = value;
}
inline void CexmcPrimaryGeneratorAction::SetFwhmMomentumAmp( G4double value,
G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
fwhmMomentumAmp = value;
}
inline G4double CexmcPrimaryGeneratorAction::GetFwhmPosX( void ) const
{
return fwhmPosX;
}
inline G4double CexmcPrimaryGeneratorAction::GetFwhmPosY( void ) const
{
return fwhmPosY;
}
inline G4double CexmcPrimaryGeneratorAction::GetFwhmDirX( void ) const
{
return fwhmDirX;
}
inline G4double CexmcPrimaryGeneratorAction::GetFwhmDirY( void ) const
{
return fwhmDirY;
}
inline G4double CexmcPrimaryGeneratorAction::GetFwhmMomentumAmp( void ) const
{
return fwhmMomentumAmp;
}
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcPrimaryGeneratorActionMessenger.hh
*
* Description: user assigned gun parameters
*
* Version: 1.0
* Created: 02.11.2009 13:08:52
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PRIMARY_GENERATOR_ACTION_MESSENGER_HH
#define CEXMC_PRIMARY_GENERATOR_ACTION_MESSENGER_HH
#include <G4UImessenger.hh>
class CexmcPrimaryGeneratorAction;
class G4UIcommand;
class G4UIcmdWithADouble;
class G4UIcmdWithADoubleAndUnit;
class CexmcPrimaryGeneratorActionMessenger : public G4UImessenger
{
public:
explicit CexmcPrimaryGeneratorActionMessenger(
CexmcPrimaryGeneratorAction * primaryGeneratorAction );
~CexmcPrimaryGeneratorActionMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcPrimaryGeneratorAction * primaryGeneratorAction;
G4UIcmdWithADoubleAndUnit * fwhmPosX;
G4UIcmdWithADoubleAndUnit * fwhmPosY;
G4UIcmdWithADoubleAndUnit * fwhmDirX;
G4UIcmdWithADoubleAndUnit * fwhmDirY;
G4UIcmdWithADouble * fwhmMomentumAmp;
};
#endif
@@ -0,0 +1,255 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcProductionModel.hh
*
* Description: interface to production model
*
* Version: 1.0
* Created: 03.11.2009 16:50:53
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PRODUCTION_MODEL_HH
#define CEXMC_PRODUCTION_MODEL_HH
#include <G4Types.hh>
#include <G4String.hh>
#include <G4ios.hh>
#include <G4ParticleDefinition.hh>
#include "CexmcAngularRange.hh"
#include "CexmcProductionModelData.hh"
#ifdef CEXMC_USE_ROOT
#include "CexmcHistoManager.hh"
#endif
#include "CexmcException.hh"
#include "CexmcCommon.hh"
class CexmcProductionModelMessenger;
class CexmcProductionModel
{
public:
explicit CexmcProductionModel( const G4String & name = "unspecified",
G4bool fermiMotionIsOn = false );
virtual ~CexmcProductionModel();
public:
void ApplyFermiMotion( G4bool on, G4bool fromMessenger = true );
void SetAngularRange( G4double top, G4double bottom,
G4int nmbOfDivs );
void SetAngularRanges( const CexmcAngularRangeList & angularRanges_ );
void AddAngularRange( G4double top, G4double bottom,
G4int nmbOfDivs );
void SetProductionModelData(
const CexmcProductionModelData & productionModelData_ );
void PrintInitialData( void ) const;
const CexmcAngularRangeList & GetAngularRanges( void ) const;
const CexmcAngularRangeList & GetTriggeredAngularRanges( void ) const;
const CexmcProductionModelData & GetProductionModelData( void ) const;
G4bool IsFermiMotionOn( void ) const;
void SetTriggeredAngularRanges( G4double opCosThetaSCM );
const G4String & GetName( void ) const;
public:
G4ParticleDefinition * GetIncidentParticle( void ) const;
G4ParticleDefinition * GetNucleusParticle( void ) const;
G4ParticleDefinition * GetOutputParticle( void ) const;
G4ParticleDefinition * GetNucleusOutputParticle( void ) const;
protected:
virtual void FermiMotionStatusChangeHook( void );
private:
G4bool IsValidCandidateForAngularRange( G4double top,
G4double bottom, G4int nmbOfDivs = 1 ) const;
G4bool IsGoodCandidateForAngularRange( G4double top,
G4double bottom ) const;
protected:
G4String name;
G4bool fermiMotionIsOn;
CexmcAngularRangeList angularRanges;
CexmcAngularRangeList angularRangesRef;
CexmcAngularRangeList triggeredAngularRanges;
CexmcProductionModelData productionModelData;
protected:
G4ParticleDefinition * incidentParticle;
G4ParticleDefinition * nucleusParticle;
G4ParticleDefinition * outputParticle;
G4ParticleDefinition * nucleusOutputParticle;
private:
CexmcProductionModelMessenger * messenger;
};
inline void CexmcProductionModel::ApplyFermiMotion( G4bool on,
G4bool fromMessenger )
{
if ( fromMessenger )
ThrowExceptionIfProjectIsRead( CexmcCmdIsNotAllowed );
fermiMotionIsOn = on;
FermiMotionStatusChangeHook();
}
inline void CexmcProductionModel::SetAngularRanges(
const CexmcAngularRangeList & angularRanges_ )
{
angularRangesRef = angularRanges_;
angularRanges = angularRangesRef;
#ifdef CEXMC_USE_ROOT
CexmcHistoManager::Instance()->SetupARHistos( angularRanges );
#endif
}
inline void CexmcProductionModel::SetProductionModelData(
const CexmcProductionModelData & productionModelData_ )
{
productionModelData = productionModelData_;
}
inline void CexmcProductionModel::PrintInitialData( void ) const
{
const char * fermiMotionMsg( "Fermi motion in the target is off" );
if ( fermiMotionIsOn )
fermiMotionMsg = "Fermi motion in the target is on";
G4cout << CEXMC_LINE_START << fermiMotionMsg << G4endl;
G4cout << CEXMC_LINE_START << "Angular ranges:" << angularRanges;
}
inline const CexmcAngularRangeList &
CexmcProductionModel::GetAngularRanges( void ) const
{
return angularRanges;
}
inline const CexmcAngularRangeList &
CexmcProductionModel::GetTriggeredAngularRanges( void ) const
{
return triggeredAngularRanges;
}
inline const CexmcProductionModelData &
CexmcProductionModel::GetProductionModelData( void ) const
{
return productionModelData;
}
inline G4bool CexmcProductionModel::IsFermiMotionOn( void ) const
{
return fermiMotionIsOn;
}
inline const G4String & CexmcProductionModel::GetName( void ) const
{
return name;
}
inline G4ParticleDefinition * CexmcProductionModel::GetIncidentParticle(
void ) const
{
return incidentParticle;
}
inline G4ParticleDefinition * CexmcProductionModel::GetNucleusParticle( void )
const
{
return nucleusParticle;
}
inline G4ParticleDefinition * CexmcProductionModel::GetOutputParticle( void )
const
{
return outputParticle;
}
inline G4ParticleDefinition * CexmcProductionModel::GetNucleusOutputParticle(
void ) const
{
return nucleusOutputParticle;
}
inline G4bool CexmcProductionModel::IsValidCandidateForAngularRange(
G4double top, G4double bottom, G4int nmbOfDivs ) const
{
return top > bottom && top <= 1.0 && top > -1.0 && bottom < 1.0 &&
bottom >= -1.0 && nmbOfDivs >= 1;
}
#endif
@@ -0,0 +1,110 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcProductionModelData.hh
*
* Description: SCM/LAB lorentz vector of the particles in reaction
*
* Version: 1.0
* Created: 01.12.2009 18:01:33
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PRODUCTION_MODEL_DATA_HH
#define CEXMC_PRODUCTION_MODEL_DATA_HH
#include <iosfwd>
#include <G4ParticleDefinition.hh>
#include <G4LorentzVector.hh>
#include <G4UnitsTable.hh>
/* TODO: the data model is very restrictive for generic use, there should be
* possible to generate more than one output particles. The simplest solution is
* to add here other fields and constructors; if number of fields will be
* excessive for simple models like charge exchange then they won't be stored in
* persistent storage. Other solution is to move production model data field
* from base class CexmcProductionModel to its ancestors that can decide
* themselves which concrete data capacity they require. */
struct CexmcProductionModelData
{
CexmcProductionModelData();
CexmcProductionModelData( const G4LorentzVector & incidentParticleSCM,
const G4LorentzVector & incidentParticleLAB,
const G4LorentzVector & nucleusParticleSCM,
const G4LorentzVector & nucleusParticleLAB,
const G4LorentzVector & outputParticleSCM,
const G4LorentzVector & outputParticleLAB,
const G4LorentzVector & nucleusOutputParticleSCM,
const G4LorentzVector & nucleusOutputParticleLAB,
const G4ParticleDefinition * incidentParticle,
const G4ParticleDefinition * nucleusParticle,
const G4ParticleDefinition * outputParticle,
const G4ParticleDefinition * nucleusOutputParticle );
G4LorentzVector incidentParticleSCM;
G4LorentzVector incidentParticleLAB;
G4LorentzVector nucleusParticleSCM;
G4LorentzVector nucleusParticleLAB;
G4LorentzVector outputParticleSCM;
G4LorentzVector outputParticleLAB;
G4LorentzVector nucleusOutputParticleSCM;
G4LorentzVector nucleusOutputParticleLAB;
const G4ParticleDefinition * incidentParticle;
const G4ParticleDefinition * nucleusParticle;
const G4ParticleDefinition * outputParticle;
const G4ParticleDefinition * nucleusOutputParticle;
};
std::ostream & operator<<( std::ostream & out,
const CexmcProductionModelData & data );
#endif
@@ -0,0 +1,130 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcProductionModelFactory.hh
*
* Description: production model factory
*
* Version: 1.0
* Created: 03.11.2009 23:20:35
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PRODUCTION_MODEL_FACTORY_HH
#define CEXMC_PRODUCTION_MODEL_FACTORY_HH
#include <G4VUserPhysicsList.hh>
#include <G4PionZero.hh>
#include <G4Eta.hh>
#include "CexmcPhysicsList.hh"
#include "CexmcCommon.hh"
namespace CexmcPrivate
{
template < typename BasePhysics >
class CexmcBasePhysicsInstance
{
public:
static const CexmcBasePhysicsUsed value = CexmcNoBasePhysics;
};
#ifdef CEXMC_USE_QGSP_BIC_EMY
template<>
class CexmcBasePhysicsInstance< QGSP_BIC_EMY >
{
public:
static const CexmcBasePhysicsUsed value = Cexmc_QGSP_BIC_EMY;
};
#else
template<>
class CexmcBasePhysicsInstance< QGSP_BERT >
{
public:
static const CexmcBasePhysicsUsed value = Cexmc_QGSP_BERT;
};
#endif
}
template < typename BasePhysics,
template < typename > class StudiedPhysics,
template < typename > class ProductionModel >
class CexmcProductionModelFactory
{
public:
static G4VUserPhysicsList * Create(
CexmcProductionModelType productionModelType );
static CexmcBasePhysicsUsed GetBasePhysics( void );
private:
CexmcProductionModelFactory();
};
template < typename BasePhysics,
template < typename > class StudiedPhysics,
template < typename > class ProductionModel >
G4VUserPhysicsList * CexmcProductionModelFactory<
BasePhysics, StudiedPhysics, ProductionModel >::
Create( CexmcProductionModelType productionModelType )
{
switch ( productionModelType )
{
case CexmcPionZeroProduction :
return new CexmcPhysicsList< BasePhysics, StudiedPhysics,
ProductionModel< G4PionZero > >;
case CexmcEtaProduction :
return new CexmcPhysicsList< BasePhysics, StudiedPhysics,
ProductionModel< G4Eta > >;
default :
return NULL;
}
}
template < typename BasePhysics,
template < typename > class StudiedPhysics,
template < typename > class ProductionModel >
CexmcBasePhysicsUsed CexmcProductionModelFactory<
BasePhysics, StudiedPhysics, ProductionModel >::
GetBasePhysics( void )
{
return CexmcPrivate::CexmcBasePhysicsInstance< BasePhysics >::value;
}
#endif
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcProductionModelMessenger.hh
*
* Description: set various production model aspects
*
* Version: 1.0
* Created: 03.11.2009 15:50:32
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_PRODUCTION_MODEL_MESSENGER_HH
#define CEXMC_PRODUCTION_MODEL_MESSENGER_HH
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWith3Vector;
class CexmcProductionModel;
class CexmcProductionModelMessenger : public G4UImessenger
{
public:
explicit CexmcProductionModelMessenger( CexmcProductionModel *
productionModel );
~CexmcProductionModelMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcProductionModel * productionModel;
G4UIcmdWithABool * applyFermiMotion;
G4UIcmdWith3Vector * setAngularRange;
G4UIcmdWith3Vector * addAngularRange;
};
#endif
@@ -0,0 +1,359 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcReconstructor.hh
*
* Description: reconstructor base class
*
* Version: 1.0
* Created: 02.12.2009 15:44:12
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_RECONSTRUCTOR_HH
#define CEXMC_RECONSTRUCTOR_HH
#include <G4ThreeVector.hh>
#include <G4AffineTransform.hh>
#include "CexmcSetup.hh"
#include "CexmcCommon.hh"
class CexmcReconstructorMessenger;
class CexmcEnergyDepositStore;
class CexmcReconstructor
{
public:
CexmcReconstructor();
virtual ~CexmcReconstructor();
public:
virtual void Reconstruct( const CexmcEnergyDepositStore * edStore );
public:
void SetCalorimeterEntryPointDefinitionAlgorithm(
CexmcCalorimeterEntryPointDefinitionAlgorithm algo );
void SetCalorimeterEntryPointDepthDefinitionAlgorithm(
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm algo );
void SetCrystalSelectionAlgorithm(
CexmcCrystalSelectionAlgorithm algo );
void UseInnerRefCrystal( G4bool on = true );
void SetCalorimeterEntryPointDepth( G4double depth );
CexmcCalorimeterEntryPointDefinitionAlgorithm
GetCalorimeterEntryPointDefinitionAlgorithm( void ) const;
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
GetCalorimeterEntryPointDepthDefinitionAlgorithm( void ) const;
CexmcCrystalSelectionAlgorithm
GetCrystalSelectionAlgorithm( void ) const;
G4bool IsInnerRefCrystalUsed( void ) const;
G4double GetCalorimeterEntryPointDepth( void ) const;
public:
const G4ThreeVector & GetCalorimeterEPLeftPosition( void ) const;
const G4ThreeVector & GetCalorimeterEPRightPosition( void ) const;
const G4ThreeVector & GetCalorimeterEPLeftDirection( void ) const;
const G4ThreeVector & GetCalorimeterEPRightDirection( void ) const;
const G4ThreeVector & GetTargetEPPosition( void ) const;
const G4ThreeVector & GetTargetEPDirection( void ) const;
const G4ThreeVector & GetCalorimeterEPLeftWorldPosition( void ) const;
const G4ThreeVector & GetCalorimeterEPRightWorldPosition( void ) const;
const G4ThreeVector & GetCalorimeterEPLeftWorldDirection( void ) const;
const G4ThreeVector & GetCalorimeterEPRightWorldDirection( void )
const;
const G4ThreeVector & GetTargetEPWorldPosition( void ) const;
const G4ThreeVector & GetTargetEPWorldDirection( void ) const;
G4double GetTheAngle( void ) const;
public:
G4bool HasBasicTrigger( void ) const;
virtual G4bool HasFullTrigger( void ) const;
protected:
void ReconstructEntryPoints(
const CexmcEnergyDepositStore * edStore );
void ReconstructTargetPoint( void );
void ReconstructAngle( void );
protected:
G4bool hasBasicTrigger;
protected:
CexmcCalorimeterEntryPointDefinitionAlgorithm epDefinitionAlgorithm;
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
epDepthDefinitionAlgorithm;
CexmcCrystalSelectionAlgorithm csAlgorithm;
G4bool useInnerRefCrystal;
G4double epDepth;
protected:
G4ThreeVector calorimeterEPLeftPosition;
G4ThreeVector calorimeterEPRightPosition;
G4ThreeVector calorimeterEPLeftDirection;
G4ThreeVector calorimeterEPRightDirection;
G4ThreeVector targetEPPosition;
G4ThreeVector targetEPDirection;
G4ThreeVector calorimeterEPLeftWorldPosition;
G4ThreeVector calorimeterEPRightWorldPosition;
G4ThreeVector calorimeterEPLeftWorldDirection;
G4ThreeVector calorimeterEPRightWorldDirection;
G4ThreeVector targetEPWorldPosition;
G4ThreeVector targetEPWorldDirection;
G4double theAngle;
private:
CexmcSetup::CalorimeterGeometryData calorimeterGeometry;
G4AffineTransform calorimeterLeftTransform;
G4AffineTransform calorimeterRightTransform;
G4AffineTransform targetTransform;
G4bool targetEPInitialized;
private:
CexmcReconstructorMessenger * messenger;
};
inline void CexmcReconstructor::SetCalorimeterEntryPointDefinitionAlgorithm(
CexmcCalorimeterEntryPointDefinitionAlgorithm algo )
{
epDefinitionAlgorithm = algo;
}
inline void
CexmcReconstructor::SetCalorimeterEntryPointDepthDefinitionAlgorithm(
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm algo )
{
epDepthDefinitionAlgorithm = algo;
}
inline void CexmcReconstructor::SetCrystalSelectionAlgorithm(
CexmcCrystalSelectionAlgorithm algo )
{
csAlgorithm = algo;
}
inline void CexmcReconstructor::UseInnerRefCrystal( G4bool on )
{
useInnerRefCrystal = on;
}
inline void CexmcReconstructor::SetCalorimeterEntryPointDepth(
G4double depth )
{
epDepth = depth;
}
inline CexmcCalorimeterEntryPointDefinitionAlgorithm
CexmcReconstructor::GetCalorimeterEntryPointDefinitionAlgorithm( void )
const
{
return epDefinitionAlgorithm;
}
inline CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
CexmcReconstructor::GetCalorimeterEntryPointDepthDefinitionAlgorithm(
void ) const
{
return epDepthDefinitionAlgorithm;
}
inline CexmcCrystalSelectionAlgorithm
CexmcReconstructor::GetCrystalSelectionAlgorithm( void ) const
{
return csAlgorithm;
}
inline G4bool CexmcReconstructor::IsInnerRefCrystalUsed( void ) const
{
return useInnerRefCrystal;
}
inline G4double CexmcReconstructor::GetCalorimeterEntryPointDepth( void ) const
{
return epDepth;
}
inline const G4ThreeVector &
CexmcReconstructor::GetCalorimeterEPLeftPosition( void ) const
{
return calorimeterEPLeftPosition;
}
inline const G4ThreeVector &
CexmcReconstructor::GetCalorimeterEPRightPosition( void ) const
{
return calorimeterEPRightPosition;
}
inline const G4ThreeVector &
CexmcReconstructor::GetCalorimeterEPLeftDirection( void ) const
{
return calorimeterEPLeftDirection;
}
inline const G4ThreeVector &
CexmcReconstructor::GetCalorimeterEPRightDirection( void ) const
{
return calorimeterEPRightDirection;
}
inline const G4ThreeVector &
CexmcReconstructor::GetTargetEPPosition( void ) const
{
return targetEPPosition;
}
inline const G4ThreeVector &
CexmcReconstructor::GetTargetEPDirection( void ) const
{
return targetEPDirection;
}
inline const G4ThreeVector &
CexmcReconstructor::GetCalorimeterEPLeftWorldPosition( void ) const
{
return calorimeterEPLeftWorldPosition;
}
inline const G4ThreeVector &
CexmcReconstructor::GetCalorimeterEPRightWorldPosition( void ) const
{
return calorimeterEPRightWorldPosition;
}
inline const G4ThreeVector &
CexmcReconstructor::GetCalorimeterEPLeftWorldDirection( void ) const
{
return calorimeterEPLeftWorldDirection;
}
inline const G4ThreeVector &
CexmcReconstructor::GetCalorimeterEPRightWorldDirection( void ) const
{
return calorimeterEPRightWorldDirection;
}
inline const G4ThreeVector &
CexmcReconstructor::GetTargetEPWorldPosition( void ) const
{
return targetEPWorldPosition;
}
inline const G4ThreeVector &
CexmcReconstructor::GetTargetEPWorldDirection( void ) const
{
return targetEPWorldDirection;
}
inline G4double CexmcReconstructor::GetTheAngle( void ) const
{
return theAngle;
}
inline G4bool CexmcReconstructor::HasBasicTrigger( void ) const
{
return hasBasicTrigger;
}
#endif
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcReconstructorMessenger.hh
*
* Description: reconstructor messenger
*
* Version: 1.0
* Created: 02.12.2009 15:33:00
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_RECONSTRUCTOR_MESSENGER_HH
#define CEXMC_RECONSTRUCTOR_MESSENGER_HH
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
class G4UIcmdWithADoubleAndUnit;
class G4String;
class CexmcReconstructor;
class CexmcReconstructorMessenger : public G4UImessenger
{
public:
explicit CexmcReconstructorMessenger( CexmcReconstructor *
reconstructor );
~CexmcReconstructorMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcReconstructor * reconstructor;
G4UIcmdWithAString * setCalorimeterEntryPointDefinitionAlgorithm;
G4UIcmdWithAString * setCalorimeterEntryPointDepthDefinitionAlgorithm;
G4UIcmdWithAString * setCrystalSelectionAlgorithm;
G4UIcmdWithABool * useInnerRefCrystal;
G4UIcmdWithADoubleAndUnit * setCalorimeterEntryPointDepth;
};
#endif
@@ -0,0 +1,80 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcReimplementedGenbod.hh
*
* Description: reimplemented GENBOD
* (mostly adopted from ROOT TGenPhaseSpace)
*
* Version: 1.0
* Created: 08.09.2010 18:46:18
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_REIMPLEMENTED_GENBOD_HH
#define CEXMC_REIMPLEMENTED_GENBOD_HH
#include "CexmcPhaseSpaceGenerator.hh"
class CexmcReimplementedGenbod : public CexmcPhaseSpaceGenerator
{
public:
CexmcReimplementedGenbod();
public:
G4double Generate( void );
private:
void ParticleChangeHook( void );
void FermiEnergyDepStatusChangeHook( void );
private:
void SetMaxWeight( void );
G4double PDK( G4double a, G4double b, G4double c );
private:
G4double maxWeight;
G4int nmbOfOutputParticles;
private:
static const G4int maxParticles = 18;
};
#endif
@@ -0,0 +1,180 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcRun.hh
*
* Description: run data (acceptances etc.)
*
* Version: 1.0
* Created: 19.12.2009 23:52:51
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_RUN_HH
#define CEXMC_RUN_HH
#include <map>
#include <G4Run.hh>
typedef std::map< G4int, G4int > CexmcNmbOfHitsInRanges;
class CexmcRun : public G4Run
{
public:
CexmcRun();
public:
void IncrementNmbOfHitsSampled( G4int index );
void IncrementNmbOfHitsSampledFull( G4int index );
void IncrementNmbOfHitsTriggeredRealRange( G4int index );
void IncrementNmbOfHitsTriggeredRecRange( G4int index );
void IncrementNmbOfOrphanHits( G4int index );
void IncrementNmbOfFalseHitsTriggeredEDT( void );
void IncrementNmbOfFalseHitsTriggeredRec( void );
void IncrementNmbOfSavedEvents( void );
void IncrementNmbOfSavedFastEvents( void );
public:
const CexmcNmbOfHitsInRanges & GetNmbOfHitsSampled( void ) const;
const CexmcNmbOfHitsInRanges & GetNmbOfHitsSampledFull( void ) const;
const CexmcNmbOfHitsInRanges & GetNmbOfHitsTriggeredRealRange( void )
const;
const CexmcNmbOfHitsInRanges & GetNmbOfHitsTriggeredRecRange( void )
const;
const CexmcNmbOfHitsInRanges & GetNmbOfOrphanHits( void ) const;
G4int GetNmbOfFalseHitsTriggeredEDT( void ) const;
G4int GetNmbOfFalseHitsTriggeredRec( void ) const;
G4int GetNmbOfSavedEvents( void ) const;
G4int GetNmbOfSavedFastEvents( void ) const;
private:
CexmcNmbOfHitsInRanges nmbOfHitsSampled;
CexmcNmbOfHitsInRanges nmbOfHitsSampledFull;
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRealRange;
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRecRange;
CexmcNmbOfHitsInRanges nmbOfOrphanHits;
G4int nmbOfFalseHitsTriggeredEDT;
G4int nmbOfFalseHitsTriggeredRec;
G4int nmbOfSavedEvents;
G4int nmbOfSavedFastEvents;
};
inline const CexmcNmbOfHitsInRanges &
CexmcRun::GetNmbOfHitsSampled( void ) const
{
return nmbOfHitsSampled;
}
inline const CexmcNmbOfHitsInRanges &
CexmcRun::GetNmbOfHitsSampledFull( void ) const
{
return nmbOfHitsSampledFull;
}
inline const CexmcNmbOfHitsInRanges &
CexmcRun::GetNmbOfHitsTriggeredRealRange( void ) const
{
return nmbOfHitsTriggeredRealRange;
}
inline const CexmcNmbOfHitsInRanges &
CexmcRun::GetNmbOfHitsTriggeredRecRange( void ) const
{
return nmbOfHitsTriggeredRecRange;
}
inline const CexmcNmbOfHitsInRanges &
CexmcRun::GetNmbOfOrphanHits( void ) const
{
return nmbOfOrphanHits;
}
inline G4int CexmcRun::GetNmbOfFalseHitsTriggeredEDT( void ) const
{
return nmbOfFalseHitsTriggeredEDT;
}
inline G4int CexmcRun::GetNmbOfFalseHitsTriggeredRec( void ) const
{
return nmbOfFalseHitsTriggeredRec;
}
inline G4int CexmcRun::GetNmbOfSavedEvents( void ) const
{
return nmbOfSavedEvents;
}
inline G4int CexmcRun::GetNmbOfSavedFastEvents( void ) const
{
return nmbOfSavedFastEvents;
}
#endif
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcRunAction.hh
*
* Description: run action
*
* Version: 1.0
* Created: 20.12.2009 00:15:42
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_RUN_ACTION_HH
#define CEXMC_RUN_ACTION_HH
#include <G4UserRunAction.hh>
#include <CexmcRun.hh>
#include <CexmcAngularRange.hh>
class CexmcPhysicsManager;
class CexmcRunAction : public G4UserRunAction
{
public:
explicit CexmcRunAction( CexmcPhysicsManager * physicsManager );
public:
G4Run * GenerateRun( void );
void EndOfRunAction( const G4Run * run );
public:
static void PrintResults(
const CexmcNmbOfHitsInRanges & nmbOfHitsSampled,
const CexmcNmbOfHitsInRanges & nmbOfHitsSampledFull,
const CexmcNmbOfHitsInRanges & nmbOfHitsTriggeredRealRange,
const CexmcNmbOfHitsInRanges & nmbOfHitsTriggeredRecRange,
const CexmcNmbOfHitsInRanges & nmbOfOrphanHits,
const CexmcAngularRangeList & angularRanges,
G4int nmbOfFalseHitsTriggeredEDT,
G4int nmbOfFalseHitsTriggeredRec );
private:
CexmcPhysicsManager * physicsManager;
};
#endif
@@ -0,0 +1,404 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcRunManager.hh
*
* Description: run manager
*
* Version: 1.0
* Created: 03.11.2009 20:17:20
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_RUN_MANAGER_HH
#define CEXMC_RUN_MANAGER_HH
#include <set>
#include <limits>
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/archive/binary_oarchive.hpp>
#endif
#include <G4RunManager.hh>
#include "CexmcRunSObject.hh"
#include "CexmcException.hh"
#include "CexmcCommon.hh"
class CexmcRunManagerMessenger;
class CexmcPhysicsManager;
class CexmcEventFastSObject;
#ifdef CEXMC_USE_CUSTOM_FILTER
class CexmcCustomFilterEval;
#endif
typedef std::set< CexmcOutputDataType > CexmcOutputDataTypeSet;
class CexmcRunManager : public G4RunManager
{
public:
explicit CexmcRunManager( const G4String & projectId = "",
const G4String & rProject = "",
G4bool overrideExistingProject = false );
virtual ~CexmcRunManager();
public:
void SetPhysicsManager( CexmcPhysicsManager * physicsManager_ );
void SetProductionModelType(
CexmcProductionModelType productionModelType_ );
void SetGdmlFileName( const G4String & gdmlFileName_ );
void SetGdmlFileValidation( G4bool on = true );
void SetGuiMacroName( const G4String & guiMacroName_ );
void SetEventCountPolicy( CexmcEventCountPolicy value );
void SetEventDataVerboseLevel( CexmcEventDataVerboseLevel value );
#ifdef CEXMC_USE_PERSISTENCY
void ReadProject( void );
void SaveProject( void );
void PrintReadRunData( void ) const;
void ReadAndPrintEventsData( void ) const;
void PrintReadData( const CexmcOutputDataTypeSet & outputData ) const;
void ReplayEvents( G4int nEvents = 0 );
void SeekTo( G4int eventNmb = 1 );
void SkipInteractionsWithoutEDTonWrite( G4bool on = true );
#ifdef CEXMC_USE_CUSTOM_FILTER
void SetCustomFilter( const G4String & cfFileName_ );
#endif
#endif
void EnableLiveHistograms( G4bool on = true );
public:
CexmcPhysicsManager * GetPhysicsManager( void );
CexmcProductionModelType GetProductionModelType( void ) const;
G4String GetGdmlFileName( void ) const;
G4bool ShouldGdmlFileBeValidated( void ) const;
G4String GetGuiMacroName( void ) const;
G4bool ProjectIsSaved( void ) const;
G4bool ProjectIsRead( void ) const;
G4String GetProjectsDir( void ) const;
G4String GetProjectId( void ) const;
#ifdef CEXMC_USE_PERSISTENCY
boost::archive::binary_oarchive * GetEventsArchive( void ) const;
boost::archive::binary_oarchive * GetFastEventsArchive( void ) const;
#endif
G4bool AreLiveHistogramsEnabled( void ) const;
CexmcEventDataVerboseLevel GetEventDataVerboseLevel( void ) const;
void BeamParticleChangeHook( void );
protected:
void DoEventLoop( G4int nEvent, const char * macroFile,
G4int nSelect );
private:
void DoCommonEventLoop( G4int nEvent, const G4String & cmd,
G4int nSelect );
#ifdef CEXMC_USE_PERSISTENCY
void DoReadEventLoop( G4int nEvent );
void SaveCurrentTPTEvent( const CexmcEventFastSObject & evFastSObject,
const CexmcAngularRangeList & angularRanges,
G4bool writeToDatabase );
#endif
private:
void ReadPreinitProjectData( void );
private:
CexmcBasePhysicsUsed basePhysicsUsed;
CexmcProductionModelType productionModelType;
G4String gdmlFileName;
G4bool shouldGdmlFileBeValidated;
G4bool zipGdmlFile;
G4String projectsDir;
G4String projectId;
G4String rProject;
G4String guiMacroName;
G4String cfFileName;
CexmcEventCountPolicy eventCountPolicy;
G4bool areLiveHistogramsEnabled;
G4bool skipInteractionsWithoutEDTonWrite;
CexmcEventDataVerboseLevel evDataVerboseLevel;
CexmcEventDataVerboseLevel rEvDataVerboseLevel;
private:
G4int numberOfEventsProcessed;
G4int numberOfEventsProcessedEffective;
G4int curEventRead;
#ifdef CEXMC_USE_PERSISTENCY
private:
boost::archive::binary_oarchive * eventsArchive;
boost::archive::binary_oarchive * fastEventsArchive;
CexmcRunSObject sObject;
#ifdef CEXMC_USE_CUSTOM_FILTER
CexmcCustomFilterEval * customFilter;
#endif
#endif
private:
CexmcPhysicsManager * physicsManager;
private:
CexmcRunManagerMessenger * messenger;
};
inline void CexmcRunManager::SetPhysicsManager(
CexmcPhysicsManager * physicsManager_ )
{
physicsManager = physicsManager_;
}
inline void CexmcRunManager::SetProductionModelType(
CexmcProductionModelType productionModelType_ )
{
if ( ProjectIsRead() )
throw CexmcException( CexmcCmdIsNotAllowed );
productionModelType = productionModelType_;
}
inline void CexmcRunManager::SetGdmlFileName( const G4String & gdmlFileName_ )
{
if ( ProjectIsRead() )
throw CexmcException( CexmcCmdIsNotAllowed );
gdmlFileName = gdmlFileName_;
}
inline void CexmcRunManager::SetGdmlFileValidation( G4bool on )
{
shouldGdmlFileBeValidated = on;
}
inline void CexmcRunManager::SetGuiMacroName( const G4String & guiMacroName_ )
{
guiMacroName = guiMacroName_;
}
inline void CexmcRunManager::SetEventCountPolicy(
CexmcEventCountPolicy value )
{
if ( ProjectIsRead() )
throw CexmcException( CexmcCmdIsNotAllowed );
eventCountPolicy = value;
}
inline void CexmcRunManager::SetEventDataVerboseLevel(
CexmcEventDataVerboseLevel value )
{
if ( ProjectIsRead() && value > rEvDataVerboseLevel )
throw CexmcException( CexmcPoorEventData );
evDataVerboseLevel = value;
}
inline CexmcPhysicsManager * CexmcRunManager::GetPhysicsManager( void )
{
return physicsManager;
}
inline CexmcProductionModelType
CexmcRunManager::GetProductionModelType( void ) const
{
return productionModelType;
}
inline G4String CexmcRunManager::GetGdmlFileName( void ) const
{
return gdmlFileName;
}
inline G4bool CexmcRunManager::ShouldGdmlFileBeValidated( void ) const
{
return shouldGdmlFileBeValidated;
}
inline G4String CexmcRunManager::GetGuiMacroName( void ) const
{
return guiMacroName;
}
inline G4bool CexmcRunManager::ProjectIsSaved( void ) const
{
return projectId != "";
}
inline G4bool CexmcRunManager::ProjectIsRead( void ) const
{
return rProject != "";
}
inline G4String CexmcRunManager::GetProjectsDir( void ) const
{
return projectsDir;
}
inline G4String CexmcRunManager::GetProjectId( void ) const
{
return projectId;
}
#ifdef CEXMC_USE_PERSISTENCY
inline boost::archive::binary_oarchive * CexmcRunManager::GetEventsArchive(
void ) const
{
return eventsArchive;
}
inline boost::archive::binary_oarchive * CexmcRunManager::GetFastEventsArchive(
void ) const
{
return fastEventsArchive;
}
inline void CexmcRunManager::ReplayEvents( G4int nEvents )
{
if ( ! ProjectIsRead() )
return;
if ( nEvents == 0 )
nEvents = std::numeric_limits< G4int >::max();
BeamOn( nEvents );
}
inline void CexmcRunManager::SeekTo( G4int eventNmb )
{
if ( ! ProjectIsRead() )
return;
curEventRead = eventNmb;
}
inline void CexmcRunManager::SkipInteractionsWithoutEDTonWrite( G4bool on )
{
skipInteractionsWithoutEDTonWrite = on;
}
#endif
inline void CexmcRunManager::EnableLiveHistograms( G4bool on )
{
areLiveHistogramsEnabled = on;
}
inline G4bool CexmcRunManager::AreLiveHistogramsEnabled( void ) const
{
return areLiveHistogramsEnabled;
}
inline CexmcEventDataVerboseLevel CexmcRunManager::GetEventDataVerboseLevel(
void ) const
{
return evDataVerboseLevel;
}
#endif
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcRunManagerMessenger.hh
*
* Description: init parameters (production model, gdml file etc.)
*
* Version: 1.0
* Created: 03.11.2009 20:36:25
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_RUN_MANAGER_MESSENGER_HH
#define CEXMC_RUN_MANAGER_MESSENGER_HH
#include <G4UImessenger.hh>
class CexmcRunManager;
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
class CexmcRunManagerMessenger : public G4UImessenger
{
public:
explicit CexmcRunManagerMessenger( CexmcRunManager * runManager );
~CexmcRunManagerMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcRunManager * runManager;
G4UIcmdWithAString * setProductionModel;
G4UIcmdWithAString * setGdmlFile;
G4UIcmdWithAString * setGuiMacro;
G4UIcmdWithAString * setEventCountPolicy;
G4UIcmdWithAString * setEventDataVerboseLevel;
#ifdef CEXMC_USE_PERSISTENCY
G4UIcmdWithAnInteger * replayEvents;
G4UIcmdWithAnInteger * seekTo;
G4UIcmdWithABool * skipInteractionsWithoutEDT;
#endif
G4UIcmdWithABool * validateGdmlFile;
};
#endif
@@ -0,0 +1,346 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcRunSObject.hh
*
* Description: run data serialization helper
*
* Version: 1.0
* Created: 23.12.2009 14:24:20
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_RUN_SOBJECT_HH
#define CEXMC_RUN_SOBJECT_HH
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/string.hpp>
#include "CexmcSimpleDecayTableStore.hh"
#include "CexmcSimpleThreeVectorStore.hh"
#include "CexmcAngularRange.hh"
#include "CexmcSimpleRangeWithValue.hh"
#include "CexmcRun.hh"
#include "CexmcCommon.hh"
#define CEXMC_RUN_SOBJECT_VERSION 3
class CexmcRunSObject
{
friend class boost::serialization::access;
friend class CexmcRunManager;
public:
CexmcRunSObject();
CexmcRunSObject( CexmcBasePhysicsUsed basePhysicsUsed,
CexmcProductionModelType productionModelType,
const std::string & gdmlFileName,
const CexmcSimpleDecayTableStore & etaDecayTable,
const CexmcAngularRangeList & angularRanges,
G4bool fermiMotionIsOn,
const std::vector< G4double > & calorimeterRegCuts,
CexmcEventCountPolicy eventCountPolicy,
const std::string & beamParticle,
const CexmcSimpleThreeVectorStore & beamPos,
const CexmcSimpleThreeVectorStore & beamDir,
G4double beamMomentumAmp, G4double beamFwhmPosX,
G4double beamFwhmPosY, G4double beamFwhmDirX,
G4double beamFwhmDirY,
G4double beamFwhmMomentumAmp,
G4double monitorEDThreshold,
G4double vetoCounterEDLeftThreshold,
G4double vetoCounterEDRightThreshold,
G4double calorimeterEDLeftThreshold,
G4double calorimeterEDRightThreshold,
CexmcCalorimeterTriggerAlgorithm
calorimeterTriggerAlgorithm,
CexmcOuterCrystalsVetoAlgorithm
outerCrystalsVetoAlgorithm,
G4double outerCrystalsVetoFraction,
G4bool applyFiniteCrystalResolution,
const CexmcEnergyRangeWithDoubleValueList &
crystalResolutionData,
CexmcCalorimeterEntryPointDefinitionAlgorithm
epDefinitionAlgorithm,
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
epDepthDefinitionAlgorithm,
CexmcCrystalSelectionAlgorithm csAlgorithm,
G4bool useInnerRefCrystal, G4double epDepth,
G4bool useTableMass, G4bool useMassCut,
G4double mCutOPCenter, G4double mCutNOPCenter,
G4double mCutOPWidth, G4double mCutNOPWidth,
G4double mCutAngle, G4bool useAbsorbedEnergyCut,
G4double aeCutCLCenter, G4double aeCutCRCenter,
G4double aeCutCLWidth, G4double aeCutCRWidth,
G4double aeCutAngle,
CexmcNmbOfHitsInRanges nmbOfHitsSampled,
CexmcNmbOfHitsInRanges nmbOfHitsSampledFull,
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRealRange,
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRecRange,
CexmcNmbOfHitsInRanges nmbOfOrphanHits,
G4int nmbOfFalseHitsTriggeredEDT,
G4int nmbOfFalseHitsTriggeredRec,
G4int nmbOfSavedEvents, G4int nmbOfSavedFastEvents,
G4int numberOfEventsProcessed,
G4int numberOfEventsProcessedEffective,
G4int numberOfEventsToBeProcessed,
const std::string & rProject,
G4bool interactionsWithoutEDTWereSkipped,
const std::string & cfFileName,
CexmcEventDataVerboseLevel evDataVerboseLevel,
G4double proposedMaxIL );
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
private:
CexmcBasePhysicsUsed basePhysicsUsed;
CexmcProductionModelType productionModelType;
std::string gdmlFileName;
CexmcSimpleDecayTableStore etaDecayTable;
CexmcAngularRangeList angularRanges;
G4bool fermiMotionIsOn;
std::vector< G4double > calorimeterRegCuts;
CexmcEventCountPolicy eventCountPolicy;
std::string beamParticle;
CexmcSimpleThreeVectorStore beamPos;
CexmcSimpleThreeVectorStore beamDir;
G4double beamMomentumAmp;
G4double beamFwhmPosX;
G4double beamFwhmPosY;
G4double beamFwhmDirX;
G4double beamFwhmDirY;
G4double beamFwhmMomentumAmp;
G4double monitorEDThreshold;
G4double vetoCounterEDLeftThreshold;
G4double vetoCounterEDRightThreshold;
G4double calorimeterEDLeftThreshold;
G4double calorimeterEDRightThreshold;
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm;
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm;
G4double outerCrystalsVetoFraction;
G4bool applyFiniteCrystalResolution;
CexmcEnergyRangeWithDoubleValueList crystalResolutionData;
CexmcCalorimeterEntryPointDefinitionAlgorithm epDefinitionAlgorithm;
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
epDepthDefinitionAlgorithm;
CexmcCrystalSelectionAlgorithm csAlgorithm;
G4bool useInnerRefCrystal;
G4double epDepth;
G4bool useTableMass;
G4bool useMassCut;
G4double mCutOPCenter;
G4double mCutNOPCenter;
G4double mCutOPWidth;
G4double mCutNOPWidth;
G4double mCutAngle;
G4bool useAbsorbedEnergyCut;
G4double aeCutCLCenter;
G4double aeCutCRCenter;
G4double aeCutCLWidth;
G4double aeCutCRWidth;
G4double aeCutAngle;
CexmcNmbOfHitsInRanges nmbOfHitsSampled;
CexmcNmbOfHitsInRanges nmbOfHitsSampledFull;
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRealRange;
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRecRange;
CexmcNmbOfHitsInRanges nmbOfOrphanHits;
G4int nmbOfFalseHitsTriggeredEDT;
G4int nmbOfFalseHitsTriggeredRec;
G4int nmbOfSavedEvents;
G4int nmbOfSavedFastEvents;
G4int numberOfEventsProcessed;
G4int numberOfEventsProcessedEffective;
G4int numberOfEventsToBeProcessed;
std::string rProject;
G4bool interactionsWithoutEDTWereSkipped;
std::string cfFileName;
CexmcEventDataVerboseLevel evDataVerboseLevel;
G4double proposedMaxIL;
private:
unsigned int actualVersion;
};
template < typename Archive >
void CexmcRunSObject::serialize( Archive & archive,
const unsigned int version )
{
actualVersion = version;
archive & basePhysicsUsed;
archive & productionModelType;
archive & gdmlFileName;
archive & etaDecayTable;
archive & angularRanges;
archive & fermiMotionIsOn;
archive & calorimeterRegCuts;
archive & eventCountPolicy;
archive & beamParticle;
archive & beamPos;
archive & beamDir;
archive & beamMomentumAmp;
archive & beamFwhmPosX;
archive & beamFwhmPosY;
archive & beamFwhmDirX;
archive & beamFwhmDirY;
archive & beamFwhmMomentumAmp;
archive & monitorEDThreshold;
archive & vetoCounterEDLeftThreshold;
archive & vetoCounterEDRightThreshold;
archive & calorimeterEDLeftThreshold;
archive & calorimeterEDRightThreshold;
archive & calorimeterTriggerAlgorithm;
archive & outerCrystalsVetoAlgorithm;
archive & outerCrystalsVetoFraction;
archive & applyFiniteCrystalResolution;
archive & crystalResolutionData;
archive & epDefinitionAlgorithm;
archive & epDepthDefinitionAlgorithm;
archive & csAlgorithm;
if ( version > 0 )
archive & useInnerRefCrystal;
archive & epDepth;
archive & useTableMass;
archive & useMassCut;
archive & mCutOPCenter;
archive & mCutNOPCenter;
archive & mCutOPWidth;
archive & mCutNOPWidth;
archive & mCutAngle;
archive & useAbsorbedEnergyCut;
archive & aeCutCLCenter;
archive & aeCutCRCenter;
archive & aeCutCLWidth;
archive & aeCutCRWidth;
archive & aeCutAngle;
archive & nmbOfHitsSampled;
archive & nmbOfHitsSampledFull;
archive & nmbOfHitsTriggeredRealRange;
archive & nmbOfHitsTriggeredRecRange;
archive & nmbOfOrphanHits;
archive & nmbOfFalseHitsTriggeredEDT;
archive & nmbOfFalseHitsTriggeredRec;
archive & nmbOfSavedEvents;
archive & nmbOfSavedFastEvents;
archive & numberOfEventsProcessed;
archive & numberOfEventsProcessedEffective;
archive & numberOfEventsToBeProcessed;
if ( version > 1 )
{
archive & rProject;
archive & interactionsWithoutEDTWereSkipped;
archive & cfFileName;
archive & evDataVerboseLevel;
}
if ( version > 2 )
archive & proposedMaxIL;
}
BOOST_CLASS_VERSION( CexmcRunSObject, CEXMC_RUN_SOBJECT_VERSION )
#endif
#endif
@@ -0,0 +1,77 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSensitiveDetectorMessenger.hh
*
* Description: sensitive detector messenger (verbose level etc.)
*
* Version: 1.0
* Created: 15.11.2009 14:03:56
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SENSITIVE_DETECTOR_MESSENGER_HH
#define CEXMC_SENSITIVE_DETECTOR_MESSENGER_HH
#include <G4UImessenger.hh>
class G4VPrimitiveScorer;
class G4UIcommand;
class G4UIcmdWithAnInteger;
class G4UIdirectory;
class G4String;
class CexmcSensitiveDetectorMessenger : public G4UImessenger
{
public:
CexmcSensitiveDetectorMessenger( G4VPrimitiveScorer * scorer,
const G4String & detectorName );
~CexmcSensitiveDetectorMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
G4VPrimitiveScorer * scorer;
G4UIdirectory * detectorPath;
G4UIcmdWithAnInteger * setVerboseLevel;
};
#endif
@@ -0,0 +1,84 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSensitiveDetectorsAttributes.hh
*
* Description: sensitive detectors attributes (types, roles and regions)
*
* Version: 1.0
* Created: 06.10.2010 13:07:17
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SENSITIVE_DETECTORS_ATTRIBUTES
#define CEXMC_SENSITIVE_DETECTORS_ATTRIBUTES
#include <G4String.hh>
enum CexmcDetectorType
{
CexmcEDDetector,
CexmcTPDetector,
CexmcNumberOfDetectorTypes
};
enum CexmcDetectorRole
{
CexmcMonitorDetectorRole,
CexmcVetoCounterDetectorRole,
CexmcCalorimeterDetectorRole,
CexmcTargetDetectorRole,
CexmcNumberOfDetectorRoles
};
const G4String CexmcDetectorTypeName[ CexmcNumberOfDetectorTypes ] =
{
"ED", "TP"
};
const G4String CexmcDetectorRoleName[ CexmcNumberOfDetectorRoles ] =
{
"Monitor", "VetoCounter", "Calorimeter", "Target"
};
const G4String CexmcCalorimeterRegionName( "Calorimeter" );
#endif
@@ -0,0 +1,230 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSetup.hh
*
* Description: physical setup
*
* Version: 1.0
* Created: 10.10.2009 23:15:21
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SETUP_HH
#define CEXMC_SETUP_HH
#include <G4VUserDetectorConstruction.hh>
#include <G4AffineTransform.hh>
#include <G4ThreeVector.hh>
#include <G4RotationMatrix.hh>
#include <G4String.hh>
#include "CexmcSensitiveDetectorsAttributes.hh"
class G4GDMLParser;
class G4LogicalVolume;
class G4VPhysicalVolume;
class CexmcSetup : public G4VUserDetectorConstruction
{
public:
enum SpecialVolumeType
{
Monitor,
VetoCounter,
Calorimeter,
Target
};
struct CalorimeterGeometryData
{
CalorimeterGeometryData() :
nCrystalsInColumn( 1 ), nCrystalsInRow( 1 ), crystalWidth( 0 ),
crystalHeight( 0 ), crystalLength( 0 )
{}
G4int nCrystalsInColumn;
G4int nCrystalsInRow;
G4double crystalWidth;
G4double crystalHeight;
G4double crystalLength;
};
public:
explicit CexmcSetup( const G4String & gdmlFile = "default.gdml",
G4bool validateGDMLFile = true );
G4VPhysicalVolume * Construct( void );
public:
const G4AffineTransform & GetTargetTransform( void ) const;
const G4AffineTransform & GetCalorimeterLeftTransform( void ) const;
const G4AffineTransform & GetCalorimeterRightTransform( void ) const;
void ConvertToCrystalGeometry( const G4ThreeVector & src,
G4int & row, G4int & column, G4ThreeVector & dst ) const;
const CalorimeterGeometryData & GetCalorimeterGeometry( void ) const;
const G4LogicalVolume * GetVolume( SpecialVolumeType volume ) const;
G4bool IsRightDetector( const G4VPhysicalVolume * pVolume ) const;
G4bool IsRightCalorimeter( const G4VPhysicalVolume * pVolume ) const;
private:
void SetupSpecialVolumes( G4GDMLParser & gdmlParser );
void ReadTransforms( const G4GDMLParser & gdmlParser );
void ReadCalorimeterGeometryData( const G4LogicalVolume * lVolume );
void ReadRightDetectors( void );
private:
static void AssertAndAsignDetectorRole(
CexmcDetectorRole & detectorRole, CexmcDetectorRole value );
static void RotateMatrix( const G4ThreeVector & pos,
G4RotationMatrix & rm );
private:
G4VPhysicalVolume * world;
G4String gdmlFile;
G4bool validateGDMLFile;
G4bool calorimeterRegionInitialized;
G4bool calorimeterGeometryDataInitialized;
G4LogicalVolume * monitorVolume;
G4LogicalVolume * vetoCounterVolume;
G4LogicalVolume * calorimeterVolume;
G4LogicalVolume * targetVolume;
G4VPhysicalVolume * rightVetoCounter;
G4VPhysicalVolume * rightCalorimeter;
G4AffineTransform targetTransform;
G4AffineTransform calorimeterLeftTransform;
G4AffineTransform calorimeterRightTransform;
CalorimeterGeometryData calorimeterGeometry;
};
inline const G4AffineTransform & CexmcSetup::GetTargetTransform( void ) const
{
return targetTransform;
}
inline const G4AffineTransform & CexmcSetup::GetCalorimeterLeftTransform(
void ) const
{
return calorimeterLeftTransform;
}
inline const G4AffineTransform & CexmcSetup::GetCalorimeterRightTransform(
void ) const
{
return calorimeterRightTransform;
}
inline const CexmcSetup::CalorimeterGeometryData &
CexmcSetup::GetCalorimeterGeometry( void ) const
{
return calorimeterGeometry;
}
inline const G4LogicalVolume * CexmcSetup::GetVolume(
SpecialVolumeType volume ) const
{
switch ( volume )
{
case Monitor :
return monitorVolume;
case VetoCounter :
return vetoCounterVolume;
case Calorimeter :
return calorimeterVolume;
case Target :
return targetVolume;
default :
break;
}
return NULL;
}
inline G4bool CexmcSetup::IsRightDetector(
const G4VPhysicalVolume * pVolume ) const
{
if ( pVolume == rightVetoCounter || pVolume == rightCalorimeter )
return true;
return false;
}
inline G4bool CexmcSetup::IsRightCalorimeter(
const G4VPhysicalVolume * pVolume ) const
{
if ( pVolume == rightCalorimeter )
return true;
return false;
}
#endif
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSimpleDecayTableStore.hh
*
* Description: decay table serialization helper
*
* Version: 1.0
* Created: 24.12.2009 14:17:40
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SIMPLE_DECAY_TABLE_STORE_HH
#define CEXMC_SIMPLE_DECAY_TABLE_STORE_HH
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include <boost/serialization/map.hpp>
#include <G4Types.hh>
class G4DecayTable;
typedef std::map< G4int, G4double > CexmcDecayBranchesStore;
class CexmcSimpleDecayTableStore
{
friend class boost::serialization::access;
public:
CexmcSimpleDecayTableStore();
CexmcSimpleDecayTableStore( const G4DecayTable * decayTable );
public:
const CexmcDecayBranchesStore & GetDecayBranches( void ) const;
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
private:
CexmcDecayBranchesStore decayBranches;
};
inline const CexmcDecayBranchesStore &
CexmcSimpleDecayTableStore::GetDecayBranches( void ) const
{
return decayBranches;
}
template < typename Archive >
void CexmcSimpleDecayTableStore::serialize( Archive & archive,
const unsigned int )
{
archive & decayBranches;
}
#endif
#endif
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSimpleEnergyDeposit.hh
*
* Description: simple energy deposit scorer
*
* Version: 1.0
* Created: 14.11.2009 12:45:53
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SIMPLE_ENERGY_DEPOSIT_HH
#define CEXMC_SIMPLE_ENERGY_DEPOSIT_HH
#include <G4VPrimitiveScorer.hh>
#include <G4THitsMap.hh>
class G4HCofThisEvent;
class G4Step;
class CexmcSensitiveDetectorMessenger;
typedef G4THitsMap< G4double > CexmcEnergyDepositCollection;
class CexmcSimpleEnergyDeposit : public G4VPrimitiveScorer
{
public:
explicit CexmcSimpleEnergyDeposit( const G4String & name );
virtual ~CexmcSimpleEnergyDeposit();
public:
void Initialize( G4HCofThisEvent * hcOfThisEvent );
void EndOfEvent( G4HCofThisEvent * hcOfThisEvent );
void DrawAll( void );
void PrintAll( void );
void clear( void );
protected:
G4int GetIndex( G4Step * step );
G4bool ProcessHits( G4Step * step, G4TouchableHistory * tHistory );
protected:
CexmcEnergyDepositCollection * eventMap;
private:
CexmcSensitiveDetectorMessenger * messenger;
G4int hcId;
};
#endif
@@ -0,0 +1,96 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSimpleLorentzVectorStore.hh
*
* Description: G4LorentzVector serialization helper
*
* Version: 1.0
* Created: 02.01.2010 14:08:42
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SIMPLE_LORENTZ_VECTOR_STORE_HH
#define CEXMC_SIMPLE_LORENTZ_VECTOR_STORE_HH
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include <G4LorentzVector.hh>
class CexmcSimpleLorentzVectorStore
{
friend class boost::serialization::access;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
public:
CexmcSimpleLorentzVectorStore();
CexmcSimpleLorentzVectorStore( const G4LorentzVector & lorentzVector );
public:
operator G4LorentzVector() const;
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
private:
G4double px;
G4double py;
G4double pz;
G4double e;
};
template < typename Archive >
void CexmcSimpleLorentzVectorStore::serialize( Archive & archive,
const unsigned int )
{
archive & px;
archive & py;
archive & pz;
archive & e;
}
#endif
#endif
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSimpleProductionModelDataStore.hh
*
* Description: serialization helper for production model data
*
* Version: 1.0
* Created: 02.01.2010 14:37:16
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SIMPLE_PRODUCTION_MODEL_DATA_STORE_HH
#define CEXMC_SIMPLE_PRODUCTION_MODEL_DATA_STORE_HH
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include "CexmcSimpleLorentzVectorStore.hh"
class CexmcProductionModelData;
class CexmcSimpleProductionModelDataStore
{
friend class boost::serialization::access;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
public:
CexmcSimpleProductionModelDataStore();
CexmcSimpleProductionModelDataStore(
const CexmcProductionModelData & pmData );
public:
operator CexmcProductionModelData() const;
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
private:
CexmcSimpleLorentzVectorStore incidentParticleSCM;
CexmcSimpleLorentzVectorStore incidentParticleLAB;
CexmcSimpleLorentzVectorStore nucleusParticleSCM;
CexmcSimpleLorentzVectorStore nucleusParticleLAB;
CexmcSimpleLorentzVectorStore outputParticleSCM;
CexmcSimpleLorentzVectorStore outputParticleLAB;
CexmcSimpleLorentzVectorStore nucleusOutputParticleSCM;
CexmcSimpleLorentzVectorStore nucleusOutputParticleLAB;
G4int incidentParticle;
G4int nucleusParticle;
G4int outputParticle;
G4int nucleusOutputParticle;
};
template < typename Archive >
void CexmcSimpleProductionModelDataStore::serialize( Archive & archive,
const unsigned int )
{
archive & incidentParticleSCM;
archive & incidentParticleLAB;
archive & nucleusParticleSCM;
archive & nucleusParticleLAB;
archive & outputParticleSCM;
archive & outputParticleLAB;
archive & nucleusOutputParticleSCM;
archive & nucleusOutputParticleLAB;
archive & incidentParticle;
archive & nucleusParticle;
archive & outputParticle;
archive & nucleusOutputParticle;
}
#endif
#endif
@@ -0,0 +1,124 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSimpleRangeWithValue.hh
*
* Description: simple range with value (can be serialized)
*
* Version: 1.0
* Created: 17.02.2010 14:47:55
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SIMPLE_RANGE_WITH_VALUE_HH
#define CEXMC_SIMPLE_RANGE_WITH_VALUE_HH
#include <vector>
#include <iostream>
#include <G4Types.hh>
enum CexmcValueCategory
{
CexmcPlainValueCategory,
CexmcEnergyValueCategory
};
template < CexmcValueCategory RangeCategory = CexmcPlainValueCategory,
CexmcValueCategory ValueCategory = CexmcPlainValueCategory >
struct CexmcSimpleRangeWithValue
{
CexmcSimpleRangeWithValue()
{}
CexmcSimpleRangeWithValue( G4double bottom, G4double top,
G4double value ) :
bottom( bottom ), top( top ), value( value )
{}
G4double bottom;
G4double top;
G4double value;
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
};
template < CexmcValueCategory RangeCategory,
CexmcValueCategory ValueCategory >
template < typename Archive >
inline void
CexmcSimpleRangeWithValue< RangeCategory, ValueCategory >::serialize(
Archive & archive, const unsigned int )
{
archive & bottom;
archive & top;
archive & value;
}
template < CexmcValueCategory RangeCategory,
CexmcValueCategory ValueCategory >
inline bool operator<(
const CexmcSimpleRangeWithValue< RangeCategory, ValueCategory > & left,
const CexmcSimpleRangeWithValue< RangeCategory, ValueCategory > & right )
{
if ( left.bottom != right.bottom )
return left.bottom < right.bottom;
if ( left.top != right.top )
return left.top > right.top;
return false;
}
typedef CexmcSimpleRangeWithValue< CexmcEnergyValueCategory >
CexmcEnergyRangeWithDoubleValue;
typedef std::vector< CexmcEnergyRangeWithDoubleValue >
CexmcEnergyRangeWithDoubleValueList;
std::ostream & operator<<( std::ostream & out,
const CexmcEnergyRangeWithDoubleValue & range );
std::ostream & operator<<( std::ostream & out,
const CexmcEnergyRangeWithDoubleValueList & range );
#endif
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSimpleThreeVectorStore.hh
*
* Description: G4ThreeVector serialization helper
*
* Version: 1.0
* Created: 24.12.2009 22:45:36
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SIMPLE_THREE_VECTOR_STORE_HH
#define CEXMC_SIMPLE_THREE_VECTOR_STORE_HH
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include <G4ThreeVector.hh>
class CexmcSimpleThreeVectorStore
{
friend class boost::serialization::access;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
public:
CexmcSimpleThreeVectorStore();
CexmcSimpleThreeVectorStore( const G4ThreeVector & threeVector );
public:
operator G4ThreeVector() const;
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
private:
G4double x;
G4double y;
G4double z;
};
template < typename Archive >
void CexmcSimpleThreeVectorStore::serialize( Archive & archive,
const unsigned int )
{
archive & x;
archive & y;
archive & z;
}
#endif
#endif
@@ -0,0 +1,111 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcSimpleTrackPointInfoStore.hh
*
* Description: serialization helper for track point info objects
*
* Version: 1.0
* Created: 31.12.2009 13:55:51
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SIMPLE_TRACK_POINT_INFO_STORE_HH
#define CEXMC_SIMPLE_TRACK_POINT_INFO_STORE_HH
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include "CexmcSimpleThreeVectorStore.hh"
#include "CexmcCommon.hh"
class CexmcTrackPointInfo;
class CexmcSimpleTrackPointInfoStore
{
friend class boost::serialization::access;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
public:
CexmcSimpleTrackPointInfoStore();
CexmcSimpleTrackPointInfoStore( const CexmcTrackPointInfo & tpInfo );
public:
operator CexmcTrackPointInfo() const;
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
private:
CexmcSimpleThreeVectorStore positionLocal;
CexmcSimpleThreeVectorStore positionWorld;
CexmcSimpleThreeVectorStore directionLocal;
CexmcSimpleThreeVectorStore directionWorld;
G4double momentumAmp;
G4int particlePDGEncoding;
G4int trackId;
CexmcTrackType trackType;
};
template < typename Archive >
void CexmcSimpleTrackPointInfoStore::serialize( Archive & archive,
const unsigned int )
{
archive & positionLocal;
archive & positionWorld;
archive & directionLocal;
archive & directionWorld;
archive & momentumAmp;
archive & particlePDGEncoding;
archive & trackId;
archive & trackType;
}
#endif
#endif
@@ -0,0 +1,70 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcSteppingAction.hh
*
* Description: stepping action
*
* Version: 1.0
* Created: 27.10.2009 15:59:11
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#ifndef CEXMC_STEPPING_ACTION_HH
#define CEXMC_STEPPING_ACTION_HH
#include <G4UserSteppingAction.hh>
class G4Step;
class G4LogicalVolume;
class CexmcPhysicsManager;
class CexmcSteppingAction : public G4UserSteppingAction
{
public:
explicit CexmcSteppingAction( CexmcPhysicsManager * physicsManager );
public:
void UserSteppingAction( const G4Step * step );
private:
CexmcPhysicsManager * physicsManager;
const G4LogicalVolume * targetVolume;
};
#endif
@@ -0,0 +1,154 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcStudiedPhysics.hh
*
* Description: studied physics in the target
*
* Version: 1.0
* Created: 18.10.2009 16:10:52
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_STUDIED_PHYSICS_HH
#define CEXMC_STUDIED_PHYSICS_HH
#include <G4VPhysicsConstructor.hh>
#include <G4ProcessManager.hh>
#include <G4ParticleDefinition.hh>
#include "CexmcStudiedProcess.hh"
#include "CexmcPhysicsManager.hh"
#include "CexmcProductionModel.hh"
class G4VProcess;
template < typename Process >
class CexmcStudiedPhysics : public G4VPhysicsConstructor
{
public:
explicit CexmcStudiedPhysics( CexmcPhysicsManager * physicsManager );
virtual ~CexmcStudiedPhysics();
public:
void ConstructParticle( void );
void ConstructProcess( void );
public:
CexmcProductionModel * GetProductionModel( void );
protected:
virtual void ApplyInteractionModel( G4VProcess * process );
protected:
CexmcPhysicsManager * physicsManager;
CexmcProductionModel * productionModel;
private:
G4bool wasActivated;
};
template < typename Process >
CexmcStudiedPhysics< Process >::CexmcStudiedPhysics(
CexmcPhysicsManager * physicsManager ) :
G4VPhysicsConstructor( "studiedPhysics" ), physicsManager( physicsManager ),
productionModel( NULL ), wasActivated( false )
{
}
template < typename Process >
CexmcStudiedPhysics< Process >::~CexmcStudiedPhysics()
{
}
template < typename Process >
void CexmcStudiedPhysics< Process >::ConstructParticle( void )
{
if ( productionModel )
productionModel->GetIncidentParticle();
}
template <typename Process >
void CexmcStudiedPhysics< Process >::ConstructProcess( void )
{
if ( wasActivated )
return;
wasActivated = true;
Process * process( new Process );
CexmcStudiedProcess * studiedProcess( new CexmcStudiedProcess(
physicsManager, process->GetProcessType() ) );
ApplyInteractionModel( process );
studiedProcess->RegisterProcess( process );
G4ParticleDefinition * particle( NULL );
if ( productionModel )
particle = productionModel->GetIncidentParticle();
if ( particle )
{
G4ProcessManager * processManager( particle->GetProcessManager() );
processManager->AddDiscreteProcess( studiedProcess );
}
}
template < typename Process >
CexmcProductionModel * CexmcStudiedPhysics< Process >::GetProductionModel(
void )
{
return productionModel;
}
template < typename Process >
void CexmcStudiedPhysics< Process >::ApplyInteractionModel( G4VProcess * )
{
}
#endif
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcStudiedProcess.hh
*
* Description: studied process in the target
*
* Version: 1.0
* Created: 26.10.2009 20:41:43
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_STUDIED_PROCESS_HH
#define CEXMC_STUDIED_PROCESS_HH
#include <G4WrapperProcess.hh>
#include <G4ProcessType.hh>
class G4VParticleChange;
class CexmcPhysicsManager;
class CexmcStudiedProcess : public G4WrapperProcess
{
public:
explicit CexmcStudiedProcess( CexmcPhysicsManager * physicsManager,
G4ProcessType processType = fUserDefined );
public:
G4double PostStepGetPhysicalInteractionLength( const G4Track & track,
G4double previousStepSize, G4ForceCondition * condition );
G4VParticleChange * PostStepDoIt( const G4Track & track,
const G4Step & step );
private:
CexmcPhysicsManager * physicsManager;
};
#endif
@@ -0,0 +1,96 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackInfo.hh
*
* Description: track info
*
* Version: 1.0
* Created: 22.11.2009 18:42:40
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACK_INFO_HH
#define CEXMC_TRACK_INFO_HH
#include <G4VUserTrackInformation.hh>
#include "CexmcCommon.hh"
class CexmcTrackInfo : public G4VUserTrackInformation
{
public:
explicit CexmcTrackInfo( CexmcTrackType trackType = CexmcInsipidTrack,
G4int copyNumber = 0 );
public:
void Print( void ) const;
public:
virtual G4int GetTypeInfo( void ) const;
public:
CexmcTrackType GetTrackType( void ) const;
void SetTrackType( CexmcTrackType value );
G4int GetCopyNumber( void ) const;
private:
CexmcTrackType trackType;
G4int copyNumber;
};
inline CexmcTrackType CexmcTrackInfo::GetTrackType( void ) const
{
return trackType;
}
inline void CexmcTrackInfo::SetTrackType( CexmcTrackType value )
{
trackType = value;
}
inline G4int CexmcTrackInfo::GetCopyNumber( void ) const
{
return copyNumber;
}
#endif
@@ -0,0 +1,128 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackPointInfo.hh
*
* Description: single track point information
*
* Version: 1.0
* Created: 16.11.2009 12:51:50
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACK_POINT_INFO_HH
#define CEXMC_TRACK_POINT_INFO_HH
#include <iosfwd>
#include <G4ThreeVector.hh>
#include <G4ParticleDefinition.hh>
#include <G4Allocator.hh>
#include <G4UnitsTable.hh>
#include <G4Types.hh>
#include "CexmcCommon.hh"
struct CexmcTrackPointInfo
{
CexmcTrackPointInfo() : trackId( CexmcInvalidTrackId )
{}
CexmcTrackPointInfo( const G4ThreeVector & positionLocal,
const G4ThreeVector & positionWorld,
const G4ThreeVector & directionLocal,
const G4ThreeVector & directionWorld,
G4double momentumAmp,
const G4ParticleDefinition * particle,
G4int trackId, CexmcTrackType trackType ) :
positionLocal( positionLocal ), positionWorld( positionWorld ),
directionLocal( directionLocal ), directionWorld( directionWorld ),
momentumAmp( momentumAmp ), particle( particle ), trackId( trackId ),
trackType( trackType )
{}
G4bool IsValid( void ) const
{
return trackId != CexmcInvalidTrackId;
}
void * operator new( size_t size );
void operator delete( void * obj );
G4ThreeVector positionLocal;
G4ThreeVector positionWorld;
G4ThreeVector directionLocal;
G4ThreeVector directionWorld;
G4double momentumAmp;
const G4ParticleDefinition * particle;
G4int trackId;
CexmcTrackType trackType;
// following type cast operator is only needed by G4THitsMap template
// (in PrintAll()), it has no actual use here
operator G4double()
{
return 0;
}
};
extern G4Allocator< CexmcTrackPointInfo > trackPointInfoAllocator;
inline void * CexmcTrackPointInfo::operator new( size_t )
{
return trackPointInfoAllocator.MallocSingle();
}
inline void CexmcTrackPointInfo::operator delete( void * obj )
{
trackPointInfoAllocator.FreeSingle(
reinterpret_cast< CexmcTrackPointInfo * >( obj ) );
}
std::ostream & operator<<( std::ostream & out,
const CexmcTrackPointInfo & trackPointInfo );
#endif
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackPoints.hh
*
* Description: track points collection
*
* Version: 1.0
* Created: 16.11.2009 12:41:54
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACK_POINTS_HH
#define CEXMC_TRACK_POINTS_HH
#include <G4VPrimitiveScorer.hh>
#include <G4THitsMap.hh>
#include "CexmcTrackPointInfo.hh"
class G4HCofThisEvent;
class G4Step;
class CexmcSensitiveDetectorMessenger;
typedef G4THitsMap< CexmcTrackPointInfo > CexmcTrackPointsCollection;
class CexmcTrackPoints : public G4VPrimitiveScorer
{
public:
explicit CexmcTrackPoints( const G4String & name );
virtual ~CexmcTrackPoints();
public:
void Initialize( G4HCofThisEvent * hcOfThisEvent );
void EndOfEvent( G4HCofThisEvent * hcOfThisEvent );
void DrawAll( void );
void PrintAll( void );
void clear( void );
protected:
G4int GetTrackId( G4Step * step );
G4int GetIndex( G4Step * step );
G4bool ProcessHits( G4Step * step, G4TouchableHistory * tHistory );
protected:
CexmcTrackPointsCollection * eventMap;
private:
CexmcSensitiveDetectorMessenger * messenger;
G4int hcId;
};
#endif
@@ -0,0 +1,189 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackPointsDigitizer.hh
*
* Description: track points collector
*
* Version: 1.0
* Created: 24.11.2009 16:09:59
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACK_POINTS_DIGITIZER_HH
#define CEXMC_TRACK_POINTS_DIGITIZER_HH
#include <G4VDigitizerModule.hh>
#include "CexmcTrackPointInfo.hh"
#include "CexmcSetup.hh"
class G4String;
class CexmcTrackPointsDigitizer : public G4VDigitizerModule
{
public:
explicit CexmcTrackPointsDigitizer( const G4String & name );
public:
void Digitize( void );
public:
const CexmcTrackPointInfo & GetMonitorTP( void ) const;
const CexmcTrackPointInfo & GetTargetTPBeamParticle( void ) const;
const CexmcTrackPointInfo & GetTargetTPOutputParticle( void ) const;
const CexmcTrackPointInfo & GetTargetTPNucleusParticle( void ) const;
const CexmcTrackPointInfo &
GetTargetTPOutputParticleDecayProductParticle(
G4int index ) const;
const CexmcTrackPointInfo & GetVetoCounterTPLeft( void ) const;
const CexmcTrackPointInfo & GetVetoCounterTPRight( void ) const;
const CexmcTrackPointInfo & GetCalorimeterTPLeft( void ) const;
const CexmcTrackPointInfo & GetCalorimeterTPRight( void ) const;
public:
G4bool HasTriggered( void ) const;
private:
void InitializeData( void );
private:
CexmcTrackPointInfo monitorTP;
CexmcTrackPointInfo targetTPBeamParticle;
CexmcTrackPointInfo targetTPOutputParticle;
CexmcTrackPointInfo targetTPNucleusParticle;
CexmcTrackPointInfo targetTPOutputParticleDecayProductParticle[ 2 ];
CexmcTrackPointInfo vetoCounterTPLeft;
CexmcTrackPointInfo vetoCounterTPRight;
CexmcTrackPointInfo calorimeterTPLeft;
CexmcTrackPointInfo calorimeterTPRight;
G4bool hasTriggered;
private:
CexmcSetup::CalorimeterGeometryData calorimeterGeometry;
};
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetMonitorTP( void ) const
{
return monitorTP;
}
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetTargetTPBeamParticle( void ) const
{
return targetTPBeamParticle;
}
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetTargetTPOutputParticle( void ) const
{
return targetTPOutputParticle;
}
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetTargetTPNucleusParticle( void ) const
{
return targetTPNucleusParticle;
}
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetTargetTPOutputParticleDecayProductParticle(
G4int index ) const
{
if ( index == 1 )
return targetTPOutputParticleDecayProductParticle[ 1 ];
return targetTPOutputParticleDecayProductParticle[ 0 ];
}
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetVetoCounterTPLeft( void ) const
{
return vetoCounterTPLeft;
}
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetVetoCounterTPRight( void ) const
{
return vetoCounterTPRight;
}
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetCalorimeterTPLeft( void ) const
{
return calorimeterTPLeft;
}
inline const CexmcTrackPointInfo &
CexmcTrackPointsDigitizer::GetCalorimeterTPRight( void ) const
{
return calorimeterTPRight;
}
inline G4bool CexmcTrackPointsDigitizer::HasTriggered( void ) const
{
return hasTriggered;
}
#endif
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackPointsFilter.hh
*
* Description: track points of interest
*
* Version: 1.0
* Created: 16.11.2009 22:23:00
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACK_POINTS_FILTER_HH
#define CEXMC_TRACK_POINTS_FILTER_HH
#include <G4VSDFilter.hh>
class G4String;
class G4Step;
class CexmcTrackPointsFilter : public G4VSDFilter
{
public:
explicit CexmcTrackPointsFilter( const G4String & name );
public:
G4bool Accept( const G4Step * step ) const;
};
#endif
@@ -0,0 +1,109 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackPointsInCalorimeter.hh
*
* Description: track points in calorimeter
*
* Version: 1.0
* Created: 22.11.2009 21:57:15
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACK_POINTS_IN_CALORIMETER_HH
#define CEXMC_TRACK_POINTS_IN_CALORIMETER_HH
#include "CexmcTrackPointsInLeftRightSet.hh"
class CexmcSetup;
class CexmcTrackPointsInCalorimeter : public CexmcTrackPointsInLeftRightSet
{
public:
CexmcTrackPointsInCalorimeter( const G4String & name,
const CexmcSetup * setup );
public:
void PrintAll( void );
protected:
G4int GetIndex( G4Step * step );
public:
static G4int GetRow( G4int index );
static G4int GetColumn( G4int index );
static G4int GetCopyDepth0BitsOffset( void );
static G4int GetCopyDepth1BitsOffset( void );
protected:
static G4int copyDepth0BitsOffset;
static G4int copyDepth1BitsOffset;
};
inline G4int CexmcTrackPointsInCalorimeter::GetRow( G4int index )
{
index &= ( ( 1 << ( leftRightBitsOffset - 1 ) ) |
( ( 1 << ( leftRightBitsOffset - 1 ) ) - 1 ) );
return index >> copyDepth1BitsOffset;
}
inline G4int CexmcTrackPointsInCalorimeter::GetColumn( G4int index )
{
index &= ( ( 1 << ( copyDepth1BitsOffset - 1 ) ) |
( ( 1 << ( copyDepth1BitsOffset - 1 ) ) - 1 ) );
return index >> copyDepth0BitsOffset;
}
inline G4int CexmcTrackPointsInCalorimeter::GetCopyDepth0BitsOffset( void )
{
return copyDepth0BitsOffset;
}
inline G4int CexmcTrackPointsInCalorimeter::GetCopyDepth1BitsOffset( void )
{
return copyDepth1BitsOffset;
}
#endif
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackPointsInLeftRightSet.hh
*
* Description: track points in left/right detector sets
* (e.g. veto counters and calorimeters)
*
* Version: 1.0
* Created: 22.11.2009 21:12:32
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACK_POINTS_IN_LEFT_RIGHT_SET_HH
#define CEXMC_TRACK_POINTS_IN_LEFT_RIGHT_SET_HH
#include "CexmcTrackPoints.hh"
#include "CexmcCommon.hh"
class CexmcSetup;
class CexmcTrackPointsInLeftRightSet : public CexmcTrackPoints
{
public:
CexmcTrackPointsInLeftRightSet( const G4String & name,
const CexmcSetup * setup );
public:
void PrintAll( void );
protected:
G4int GetIndex( G4Step * step );
protected:
const CexmcSetup * setup;
public:
static CexmcSide GetSide( G4int index );
static G4int GetLeftRightBitsOffset( void );
protected:
static G4int leftRightBitsOffset;
};
inline CexmcSide CexmcTrackPointsInLeftRightSet::GetSide( G4int index )
{
if ( index >> leftRightBitsOffset == 1 )
return CexmcRight;
return CexmcLeft;
}
inline G4int CexmcTrackPointsInLeftRightSet::GetLeftRightBitsOffset( void )
{
return leftRightBitsOffset;
}
#endif
@@ -0,0 +1,119 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackPointsStore.hh
*
* Description: store const references of track points of interest
*
* Version: 1.0
* Created: 25.11.2009 13:41:43
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACK_POINTS_STORE_HH
#define CEXMC_TRACK_POINTS_STORE_HH
#include <G4Allocator.hh>
#include "CexmcTrackPointInfo.hh"
struct CexmcTrackPointsStore
{
CexmcTrackPointsStore( const CexmcTrackPointInfo & monitorTP,
const CexmcTrackPointInfo & targetTPBeamParticle,
const CexmcTrackPointInfo & targetTPOutputParticle,
const CexmcTrackPointInfo & targetTPNucleusParticle,
const CexmcTrackPointInfo & targetTPOutputParticleDecayProductParticle1,
const CexmcTrackPointInfo & targetTPOutputParticleDecayProductParticle2,
const CexmcTrackPointInfo & vetoCounterTPLeft,
const CexmcTrackPointInfo & vetoCounterTPRight,
const CexmcTrackPointInfo & calorimeterTPLeft,
const CexmcTrackPointInfo & calorimeterTPRight ) :
monitorTP( monitorTP ), targetTPBeamParticle( targetTPBeamParticle ),
targetTPOutputParticle( targetTPOutputParticle ),
targetTPNucleusParticle( targetTPNucleusParticle ),
targetTPOutputParticleDecayProductParticle1 (
targetTPOutputParticleDecayProductParticle1 ),
targetTPOutputParticleDecayProductParticle2(
targetTPOutputParticleDecayProductParticle2 ),
vetoCounterTPLeft( vetoCounterTPLeft ),
vetoCounterTPRight( vetoCounterTPRight ),
calorimeterTPLeft( calorimeterTPLeft ),
calorimeterTPRight( calorimeterTPRight )
{}
void * operator new( size_t size );
void operator delete( void * obj );
const CexmcTrackPointInfo & monitorTP;
const CexmcTrackPointInfo & targetTPBeamParticle;
const CexmcTrackPointInfo & targetTPOutputParticle;
const CexmcTrackPointInfo & targetTPNucleusParticle;
const CexmcTrackPointInfo & targetTPOutputParticleDecayProductParticle1;
const CexmcTrackPointInfo & targetTPOutputParticleDecayProductParticle2;
const CexmcTrackPointInfo & vetoCounterTPLeft;
const CexmcTrackPointInfo & vetoCounterTPRight;
const CexmcTrackPointInfo & calorimeterTPLeft;
const CexmcTrackPointInfo & calorimeterTPRight;
};
extern G4Allocator< CexmcTrackPointsStore > trackPointsStoreAllocator;
inline void * CexmcTrackPointsStore::operator new( size_t )
{
return trackPointsStoreAllocator.MallocSingle();
}
inline void CexmcTrackPointsStore::operator delete( void * obj )
{
trackPointsStoreAllocator.FreeSingle(
reinterpret_cast< CexmcTrackPointsStore * >( obj ) );
}
#endif
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcTrackingAction.hh
*
* Description: tracking action
*
* Version: 1.0
* Created: 22.11.2009 17:08:27
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_TRACKING_ACTION_HH
#define CEXMC_TRACKING_ACTION_HH
#include <G4UserTrackingAction.hh>
#include "CexmcCommon.hh"
class G4Track;
class G4LogicalVolume;
class G4ParticleDefinition;
class CexmcPhysicsManager;
class CexmcTrackingAction : public G4UserTrackingAction
{
public:
explicit CexmcTrackingAction( CexmcPhysicsManager * physicsManager );
public:
void PreUserTrackingAction( const G4Track * track );
void BeginOfEventAction( void );
private:
void ResetOutputParticleTrackId( void );
void ResetOutputParticleDecayProductCopyNumber( void );
void SetupIncidentParticleTrackInfo( const G4Track * track );
private:
CexmcPhysicsManager * physicsManager;
const G4LogicalVolume * targetVolume;
G4int outputParticleTrackId;
G4int outputParticleDecayProductCopyNumber;
private:
G4ParticleDefinition * incidentParticle;
G4ParticleDefinition * outputParticle;
G4ParticleDefinition * nucleusOutputParticle;
};
inline void CexmcTrackingAction::ResetOutputParticleTrackId( void )
{
outputParticleTrackId = CexmcInvalidTrackId;
}
inline void CexmcTrackingAction::ResetOutputParticleDecayProductCopyNumber(
void )
{
outputParticleDecayProductCopyNumber = 0;
}
inline void CexmcTrackingAction::BeginOfEventAction( void )
{
ResetOutputParticleTrackId();
ResetOutputParticleDecayProductCopyNumber();
}
#endif
@@ -0,0 +1,91 @@
/control/verbose 1
/run/verbose 1
/event/verbose 0
/hits/verbose 0
# here we define branching ratios of decay modes of eta meson
# 0 - gamma gamma (original 0.3942)
# 1 - pi0 pi0 pi0 (original 0.3256)
# 2 - pi0 pi+ pi- (original 0.226)
# 3 - gamma pi+ pi- (original 0.0468)
/particle/select eta
/particle/property/decay/select 0
/particle/property/decay/br 1
/particle/property/decay/select 1
/particle/property/decay/br 0
/particle/property/decay/select 2
/particle/property/decay/br 0
/particle/property/decay/select 3
/particle/property/decay/br 0
/particle/property/decay/dump
#/run/setCutForRegion Calorimeter 1 mm
#/cexmc/detector/Monitor/ED/verbose 1
#/cexmc/detector/VetoCounter/ED/verbose 1
#/cexmc/detector/Calorimeter/ED/verbose 1
#/cexmc/detector/Target/TP/verbose 1
#/cexmc/detector/Monitor/TP/verbose 1
#/cexmc/detector/VetoCounter/TP/verbose 1
#/cexmc/detector/Calorimeter/TP/verbose 1
/cexmc/detector/calorimeterTriggerAlgorithm inner
/cexmc/detector/Monitor/ED/threshold 125 keV
/cexmc/detector/VetoCounter/ED/threshold 250 keV
/cexmc/detector/Calorimeter/ED/threshold 40 MeV
/cexmc/detector/outerCrystalsVetoAlgorithm none
/cexmc/detector/outerCrystalsVetoFraction 0.5
/cexmc/detector/applyFiniteCrystalResolution true
/cexmc/detector/addCrystalResolutionRange 0. 0.04 0.48
/cexmc/detector/addCrystalResolutionRange 0.04 0.06 0.27
/cexmc/detector/addCrystalResolutionRange 0.06 0.10 0.22
/cexmc/detector/addCrystalResolutionRange 0.10 0.20 0.18
/cexmc/detector/addCrystalResolutionRange 0.20 2.00 0.15
/cexmc/gun/particle pi-
/cexmc/gun/position 0 0 -36 cm
/cexmc/gun/direction 0 0 1
/cexmc/gun/momentumAmp 730 MeV
/cexmc/gun/fwhmPosX 3.0 cm
/cexmc/gun/fwhmPosY 3.5 cm
/cexmc/gun/fwhmDirX 1.12 deg
/cexmc/gun/fwhmDirY 1.35 deg
/cexmc/gun/fwhmMomentumAmp 0.015
/cexmc/physics/setMaxILCorrection 0
/cexmc/physics/applyFermiMotionInTarget false
#/cexmc/physics/setAngularRange 0.1 -0.1 2
#/cexmc/physics/addAngularRange 1.0 0.0 10
#/cexmc/physics/addAngularRange -0.5 -0.8 2
/cexmc/physics/setAngularRange 1.0 -1.0 10
/cexmc/reconstructor/entryPointDefinitionAlgo sqrt
/cexmc/reconstructor/crystalSelectionAlgo all
/cexmc/reconstructor/useInnerRefCrystal true
/cexmc/reconstructor/entryPointDepthDefinitionAlgo plain
/cexmc/reconstructor/entryPointDepth 0 cm
/cexmc/reconstructor/useTableMass false
/cexmc/reconstructor/useMassCut false
/cexmc/reconstructor/mCutOPCenter 530 MeV
/cexmc/reconstructor/mCutNOPCenter 970 MeV
/cexmc/reconstructor/mCutOPWidth 10 MeV
/cexmc/reconstructor/mCutNOPWidth 30 MeV
/cexmc/reconstructor/mCutAngle 45 deg
/cexmc/reconstructor/useAbsorbedEnergyCut false
/cexmc/reconstructor/aeCutCLCenter 310 MeV
/cexmc/reconstructor/aeCutCRCenter 310 MeV
/cexmc/reconstructor/aeCutCLWidth 100 MeV
/cexmc/reconstructor/aeCutCRWidth 180 MeV
/cexmc/reconstructor/aeCutAngle 45 deg
/cexmc/run/eventCountPolicy trigger
/cexmc/run/eventDataVerboseLevel trigger
/cexmc/event/verbose 2
/cexmc/vis/verbose 2
/cexmc/run/guiMacro mac/gui.mac
+623
View File
@@ -0,0 +1,623 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- also schema located at "/usr/local/share/GDML_3_0_0/schema/gdml.xsd -->
<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gdml="http://cern.ch/2001/Schemas/GDML"
xsi:noNamespaceSchemaLocation=
"http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd">
<!-- id: 'lht.gdml', geometry of liquid hydrogen target -->
<define>
<!-- all length values in cm and angles in deg! -->
<constant name="FullCircle" value="360.0"/>
<!-- we define EPSILON to struggle with Geant4 -->
<!-- geometry definition glitches. Use with care! -->
<!-- fixed in Geant 4.9.3 ? -->
<constant name="EPSILON" value="0.0"/>
<constant name="LENGTHMAKER" value="2.0"/>
<constant name="NCrystalsHor" value="6"/>
<constant name="NCrystalsVert" value="4"/>
<!-- sensitive detector roles; -->
<!-- a single logical volume may have only one detector role, -->
<!-- for example vMonitor may not have MonitorRole and TargetRole -->
<!-- simultaneously -->
<constant name="MonitorRole" value="0"/>
<constant name="VetoCounterRole" value="1"/>
<constant name="CalorimeterRole" value="2"/>
<constant name="TargetRole" value="3"/>
<!-- region types -->
<constant name="CalorimeterRegion" value="0"/>
<!-- special volumes -->
<constant name="MonitorVolume" value="0"/>
<constant name="VetoCounterVolume" value="1"/>
<constant name="CalorimeterVolume" value="2"/>
<constant name="TargetVolume" value="3"/>
<!-- these values are supposed to be changed -->
<constant name="MonitorPosZ" value="-34.0"/>
<constant name="MonitorBackPosZ" value="140.0"/>
<constant name="TargetRotZ" value="40.0"/>
<constant name="TargetColumn1Angle" value="25.0"/>
<constant name="TargetColumn2Angle" value="-110.0"/>
<constant name="TargetColumn3Angle" value="120.0"/>
<constant name="CalorimeterLeftDistance" value="60.0"/>
<constant name="CalorimeterLeftAngle" value="65.0"/>
<constant name="CalorimeterLeftVertShift" value="0.0"/>
<constant name="CalorimeterRightDistance" value="60.0"/>
<constant name="CalorimeterRightAngle" value="65.0"/>
<constant name="CalorimeterRightVertShift" value="0.0"/>
<!-- these values can be changed -->
<constant name="WorldLength" value="300.0"/>
<constant name="WorldHeight" value="50.0"/>
<constant name="WorldWidth" value="300.0"/>
<constant name="TargetPosX" value="0.0"/>
<constant name="TargetPosY" value="0.0"/>
<constant name="TargetPosZ" value="0.0"/>
<constant name="TargetRadius" value="5.0"/>
<constant name="TargetHeight" value="10.0"/>
<constant name="TargetInnerCoverThickness" value="0.01"/>
<constant name="TargetOuterCoverThickness" value="0.02"/>
<constant name="TargetOuterCoverRadius" value="15.0"/>
<constant name="MonitorLength" value="0.25"/>
<constant name="MonitorHeight" value="4.0"/>
<constant name="MonitorWidth" value="6.0"/>
<constant name="MonitorBackLength" value="2.0"/>
<constant name="MonitorBackHeight" value="WorldHeight"/>
<constant name="MonitorBackWidth" value="25.0"/>
<constant name="CrystalLength" value="30.0"/>
<constant name="CrystalHeight" value="6.0"/>
<constant name="CrystalWidth" value="6.0"/>
<constant name="CalorimeterLength" value="CrystalLength"/>
<constant name="CalorimeterHeight"
value="CrystalHeight * NCrystalsVert"/>
<constant name="CalorimeterWidth"
value="CrystalWidth * NCrystalsHor"/>
<constant name="VetoCounterWidth" value="CalorimeterWidth"/>
<constant name="VetoCounterHeight" value="25.0"/>
<constant name="VetoCounterThickness" value="0.5"/>
<constant name="TargetColumnRadius" value="0.85"/>
<constant name="OuterFerrumRingThickness" value="1.2"/>
<constant name="OuterFerrumRingHeight" value="3.0"/>
<constant name="OuterFerrumRingGauge" value="5.0"/>
<constant name="InnerFerrumRingThickness" value="1.0"/>
<constant name="InnerFerrumRingHeight" value="10.0"/>
<constant name="InnerFerrumRingGauge" value="5.0"/>
<constant name="InnerCuprumRingInnerRadius" value="11.6"/>
<constant name="InnerCuprumRingThickness" value="0.2"/>
<constant name="InnerCuprumRingHeight" value="5.0"/>
<constant name="InnerCuprumRingGauge" value="5.0"/>
<constant name="TargetWindowRadius" value="5.5"/>
<constant name="TargetWindowLength" value="7.4"/>
<constant name="TargetWindowHoleRadius" value="5.0"/>
<constant name="TargetWindowCapRadius" value="7.3"/>
<constant name="TargetWindowCapLength" value="2.4"/>
<constant name="TargetWindowEntranceOffset" value="1.2"/>
<constant name="TargetWindowMylarCoverLength" value="0.01"/>
<constant name="TargetWindowAluminiumCoverLength" value="1.39"/>
<constant name="TargetColumnDistance" value="18.6"/>
<constant name="TargetInnerColumnInnerRadius" value="0.5"/>
<constant name="TargetInnerColumnOuterRadius" value="1.2"/>
<constant name="TargetInnerColumnDistance" value="14.5"/>
<constant name="TargetInnerColumnAngle" value="25.7"/>
<constant name="VetoCounterDistanceToCalorimeter" value="1.0"/>
<constant name="VetoCounterLeftDistance"
value="CalorimeterLeftDistance - VetoCounterDistanceToCalorimeter"/>
<constant name="VetoCounterRightDistance"
value="CalorimeterRightDistance - VetoCounterDistanceToCalorimeter"/>
<!-- if TargetColumnsRotWithTarget is 1 then target columns -->
<!-- will rotate together with target, if its value is 0 -->
<!-- then they are rotated independently. Change with care !-->
<constant name="TargetColumnsRotWithTarget" value="0"/>
<!-- do not change values and definitions below -->
<constant name="TargetWindowDistanceDebugShift" value="0.0"/>
<constant name="TargetWindowEntranceDebugShift" value="0.0"/>
<constant name="TargetWindowCuttingShift" value="1.0"/>
<constant name="TargetWindowDistance"
value="TargetWindowLength/2 - TargetWindowCuttingShift + TargetOuterCoverRadius"/>
<constant name="TargetWindowCapDistance"
value="TargetWindowDistance + TargetWindowLength/2 - TargetWindowCapLength/2"/>
<constant name="TargetWindowDebugDistance"
value="TargetWindowDistance + TargetWindowDistanceDebugShift"/>
<constant name="TargetWindowEntranceDistance"
value="TargetWindowDebugDistance + TargetWindowLength/2 - TargetWindowEntranceOffset + TargetWindowEntranceDebugShift"/>
<constant name="TargetWindowCoverThickness"
value="TargetWindowMylarCoverLength + TargetWindowAluminiumCoverLength"/>
<!-- positions and rotations -->
<position name="MonitorPos" x="0.0" y="0.0" z="MonitorPosZ" unit="cm"/>
<position name="MonitorBackPos" x="0.0" y="0.0" z="MonitorBackPosZ" unit="cm"/>
<position name="TargetPos" x="TargetPosX" y="TargetPosY" z="TargetPosZ"
unit="cm"/>
<rotation name="TargetRot" x="90.0" y="0.0" z="-TargetRotZ" unit="deg"/>
<position name="CalorimeterLeftPos"
x="(CalorimeterLeftDistance + CalorimeterLength/2) * sin(CalorimeterLeftAngle/180*pi)"
y="CalorimeterLeftVertShift"
z="(CalorimeterLeftDistance + CalorimeterLength/2) * cos(CalorimeterLeftAngle/180*pi)"
unit="cm"/>
<rotation name="CalorimeterLeftRot" x="0.0" y="-CalorimeterLeftAngle" z="0.0" unit="deg"/>
<position name="CalorimeterRightPos"
x="- (CalorimeterRightDistance + CalorimeterLength/2) * sin(CalorimeterRightAngle/180*pi)"
y="CalorimeterRightVertShift"
z="(CalorimeterRightDistance + CalorimeterLength/2) * cos(CalorimeterRightAngle/180*pi)"
unit="cm"/>
<rotation name="CalorimeterRightRot" x="0.0" y="CalorimeterRightAngle" z="0.0" unit="deg"/>
<position name="VetoCounterLeftPos"
x="VetoCounterLeftDistance * sin(CalorimeterLeftAngle/180*pi)"
y="CalorimeterLeftVertShift"
z="VetoCounterLeftDistance * cos(CalorimeterLeftAngle/180*pi)"
unit="cm"/>
<position name="VetoCounterRightPos"
x="- VetoCounterRightDistance * sin(CalorimeterRightAngle/180*pi)"
y="CalorimeterRightVertShift"
z="VetoCounterRightDistance * cos(CalorimeterRightAngle/180*pi)"
unit="cm"/>
<position name="TargetColumn1Pos"
x="TargetPosX + TargetColumnDistance * sin((TargetColumn1Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
y="TargetPosY"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn1Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
unit="cm"/>
<position name="TargetColumn2Pos"
x="TargetPosX + TargetColumnDistance * sin((TargetColumn2Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
y="TargetPosY"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn2Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
unit="cm"/>
<position name="TargetColumn3Pos"
x="TargetPosX + TargetColumnDistance * sin((TargetColumn3Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
y="TargetPosY"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn3Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
unit="cm"/>
<position name="TargetInnerColumn1Pos"
x="TargetInnerColumnDistance * sin(TargetInnerColumnAngle/180*pi)"
y="TargetInnerColumnDistance * cos(TargetInnerColumnAngle/180*pi)"
z="0" unit="cm"/>
<position name="TargetInnerColumn2Pos"
x="TargetInnerColumnDistance * sin(-TargetInnerColumnAngle/180*pi)"
y="TargetInnerColumnDistance * cos(-TargetInnerColumnAngle/180*pi)"
z="0" unit="cm"/>
<position name="OuterFerrumRingUpperPos" x="TargetPosX"
y="TargetPosY + OuterFerrumRingGauge + OuterFerrumRingHeight/2"
z="TargetPosZ" unit="cm"/>
<position name="OuterFerrumRingLowerPos" x="TargetPosX"
y="TargetPosY - OuterFerrumRingGauge - OuterFerrumRingHeight/2"
z="TargetPosZ" unit="cm"/>
<position name="InnerFerrumRingUpperPos" x="TargetPosX"
y="TargetPosY + InnerFerrumRingGauge + InnerFerrumRingHeight/2"
z="TargetPosZ" unit="cm"/>
<position name="InnerFerrumRingLowerPos" x="TargetPosX"
y="TargetPosY - InnerFerrumRingGauge - InnerFerrumRingHeight/2"
z="TargetPosZ" unit="cm"/>
<position name="InnerCuprumRingUpperPos" x="TargetPosX"
y="TargetPosY + InnerCuprumRingGauge + InnerCuprumRingHeight/2"
z="TargetPosZ" unit="cm"/>
<position name="InnerCuprumRingLowerPos" x="TargetPosX"
y="TargetPosY - InnerCuprumRingGauge - InnerCuprumRingHeight/2"
z="TargetPosZ" unit="cm"/>
<position name="TargetWindowCutPos1" x="0.0" y="0.0" z="TargetWindowDistance"
unit="cm"/>
<position name="TargetWindowCutPos2" x="0.0"
y="OuterFerrumRingGauge + OuterFerrumRingHeight/2"
z="TargetWindowDistance" unit="cm"/>
<position name="TargetWindowCutPos3" x="0.0"
y="-OuterFerrumRingGauge - OuterFerrumRingHeight/2"
z="TargetWindowDistance" unit="cm"/>
<rotation name="TargetWindowCutRot" x="90.0" y="0.0" z="0.0" unit="deg"/>
<position name="TargetOuterCoverCutPos" x="0.0"
y="TargetWindowDistance" z="0.0" unit="cm"/>
<rotation name="TargetOuterCoverCutRot" x="90.0" y="0.0" z="0.0" unit="deg"/>
<position name="TargetWindowPos"
x="TargetPosX - TargetWindowDebugDistance * sin(TargetRotZ/180*pi)"
y="TargetPosY"
z="TargetPosZ - TargetWindowDebugDistance * cos(TargetRotZ/180*pi)"
unit="cm"/>
<rotation name="TargetWindowRot" x="0.0" y="-TargetRotZ" z="0.0" unit="deg"/>
<position name="TargetWindowMylarCoverPos"
x="TargetPosX - (TargetWindowEntranceDistance - TargetWindowCoverThickness/2) * sin(TargetRotZ/180*pi)"
y="TargetPosY"
z="TargetPosZ - (TargetWindowEntranceDistance - TargetWindowCoverThickness/2) * cos(TargetRotZ/180*pi)"
unit="cm"/>
<position name="TargetWindowAluminiumCoverPos"
x="TargetPosX - TargetWindowEntranceDistance * sin(TargetRotZ/180*pi)"
y="TargetPosY"
z="TargetPosZ - TargetWindowEntranceDistance * cos(TargetRotZ/180*pi)"
unit="cm"/>
<position name="TargetWindowCapPos"
x="TargetPosX - (TargetWindowCapDistance + TargetWindowDistanceDebugShift) * sin(TargetRotZ/180*pi)"
y="TargetPosY"
z="TargetPosZ - (TargetWindowCapDistance + TargetWindowDistanceDebugShift) * cos(TargetRotZ/180*pi)"
unit="cm"/>
<position name="TargetVacuumUnionPos" x="0.0"
y="TargetWindowDistance - TargetWindowEntranceOffset -TargetWindowCoverThickness/2"
z="0.0" unit="cm"/>
</define>
<materials>
<element name="Hydrogen" formula="H" Z="1">
<atom value="1"/>
</element>
<element name="Carbon" formula="C" Z="6">
<atom value="12"/>
</element>
<material name="Scintillator" formula="scintillator" state="solid">
<D value="1.05"/>
<fraction n="0.084" ref="Hydrogen"/>
<fraction n="0.916" ref="Carbon"/>
</material>
<element name="Iodine" formula="I" Z="53">
<atom value="126.9"/>
</element>
<element name="Caesium" formula="Cs" Z="55">
<atom value="132.9"/>
</element>
<material name="CsI_Crystal" formula="CsI" state="solid">
<D value="4.5"/>
<fraction n="0.488" ref="Iodine"/>
<fraction n="0.512" ref="Caesium"/>
</material>
</materials>
<solids>
<box name="sWorld" x="WorldWidth" y="WorldHeight" z="WorldLength"
lunit="cm"/>
<box name="sMonitor" x="MonitorWidth" y="MonitorHeight"
z="MonitorLength" lunit="cm"/>
<box name="sMonitorBack" x="MonitorBackWidth" y="MonitorBackHeight"
z="MonitorBackLength" lunit="cm"/>
<tube name="sTargetOuterCoverStub0" rmin="TargetOuterCoverRadius"
rmax="TargetOuterCoverRadius + TargetOuterCoverThickness"
z="TargetHeight" deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<tube name="sTargetVacuumSpaceStub"
rmin="TargetRadius + TargetInnerCoverThickness"
rmax="TargetOuterCoverRadius"
z="TargetHeight" deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<tube name="sTargetInnerCover" rmin="0"
rmax="TargetRadius + TargetInnerCoverThickness"
z="TargetHeight + TargetInnerCoverThickness * 2"
deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<tube name="sTarget" rmin="0" rmax="TargetRadius" z="TargetHeight"
deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<tube name="sTargetColumn" rmin="0" rmax="TargetColumnRadius"
z="TargetHeight" deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<tube name="sTargetInnerColumn" rmin="TargetInnerColumnInnerRadius"
rmax="TargetInnerColumnOuterRadius" z="TargetHeight"
deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<tube name="sOuterFerrumRing" rmin="TargetOuterCoverRadius"
rmax="TargetOuterCoverRadius + OuterFerrumRingThickness"
z="OuterFerrumRingHeight" deltaphi="FullCircle" aunit="deg"
lunit="cm"/>
<tube name="sInnerFerrumRing"
rmin="TargetOuterCoverRadius - InnerFerrumRingThickness"
rmax="TargetOuterCoverRadius" z="InnerFerrumRingHeight"
deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<tube name="sInnerCuprumRing"
rmin="InnerCuprumRingInnerRadius"
rmax="InnerCuprumRingInnerRadius + InnerCuprumRingThickness"
z="InnerCuprumRingHeight" deltaphi="FullCircle" aunit="deg"
lunit="cm"/>
<box name="sCrystalRow" x="CrystalWidth*NCrystalsHor" y="CrystalHeight"
z="CrystalLength" lunit="cm"/>
<box name="sCrystal" x="CrystalWidth" y="CrystalHeight"
z="CrystalLength" lunit="cm"/>
<box name="sCalorimeter" x="CalorimeterWidth" y="CalorimeterHeight"
z="CalorimeterLength" lunit="cm"/>
<box name="sVetoCounter" x="VetoCounterWidth" y="VetoCounterHeight"
z="VetoCounterThickness" lunit="cm"/>
<tube name="sTargetWindowStub0" rmin="0" rmax="TargetWindowRadius"
z="TargetWindowLength" deltaphi="FullCircle" aunit="deg"
lunit="cm"/>
<tube name="sTargetWindowLongHole" rmin="0" rmax="TargetWindowHoleRadius"
z="TargetWindowLength + LENGTHMAKER" deltaphi="FullCircle"
aunit="deg" lunit="cm"/>
<tube name="sTargetWindowHole" rmin="0" rmax="TargetWindowHoleRadius"
z="TargetWindowLength" deltaphi="FullCircle" aunit="deg"
lunit="cm"/>
<subtraction name="sTargetWindowStub1">
<first ref="sTargetWindowStub0"/>
<second ref="sTargetWindowLongHole"/>
</subtraction>
<tube name="sTargetOuterCoverWholeCylinder" rmin="0"
rmax="TargetOuterCoverRadius + TargetOuterCoverThickness"
z="TargetHeight" deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<subtraction name="sTargetWindowStub2">
<first ref="sTargetWindowStub1"/>
<second ref="sTargetOuterCoverWholeCylinder"/>
<positionref ref="TargetWindowCutPos1"/>
<rotationref ref="TargetWindowCutRot"/>
</subtraction>
<tube name="sOuterFerrumRingWholeCylinder" rmin="0"
rmax="TargetOuterCoverRadius + OuterFerrumRingThickness + EPSILON"
z="OuterFerrumRingHeight + EPSILON" deltaphi="FullCircle" aunit="deg"
lunit="cm"/>
<subtraction name="sTargetWindowStub3">
<first ref="sTargetWindowStub2"/>
<second ref="sOuterFerrumRingWholeCylinder"/>
<positionref ref="TargetWindowCutPos2"/>
<rotationref ref="TargetWindowCutRot"/>
</subtraction>
<subtraction name="sTargetWindow">
<first ref="sTargetWindowStub3"/>
<second ref="sOuterFerrumRingWholeCylinder"/>
<positionref ref="TargetWindowCutPos3"/>
<rotationref ref="TargetWindowCutRot"/>
</subtraction>
<tube name="sTargetWindowCap" rmin="TargetWindowRadius"
rmax="TargetWindowCapRadius" z="TargetWindowCapLength"
deltaphi="FullCircle" aunit="deg" lunit="cm"/>
<subtraction name="sTargetOuterCover">
<first ref="sTargetOuterCoverStub0"/>
<second ref="sTargetWindowLongHole"/>
<positionref ref="TargetOuterCoverCutPos"/>
<rotationref ref="TargetOuterCoverCutRot"/>
</subtraction>
<union name="sTargetVacuumSpace">
<first ref="sTargetVacuumSpaceStub"/>
<second ref="sTargetWindowHole"/>
<positionref ref="TargetVacuumUnionPos"/>
<rotationref ref="TargetOuterCoverCutRot"/>
</union>
<tube name="sTargetWindowMylarCover" rmin="0" rmax="TargetWindowHoleRadius"
z="TargetWindowMylarCoverLength" deltaphi="FullCircle" aunit="deg"
lunit="cm"/>
<tube name="sTargetWindowAluminiumCover" rmin="0" rmax="TargetWindowHoleRadius"
z="TargetWindowAluminiumCoverLength" deltaphi="FullCircle" aunit="deg"
lunit="cm"/>
</solids>
<structure>
<volume name="vMonitor">
<materialref ref="Scintillator"/>
<solidref ref="sMonitor"/>
<auxiliary auxtype="SpecialVolume" auxvalue="MonitorVolume"/>
<auxiliary auxtype="EnergyDepositDetector" auxvalue="MonitorRole"/>
<auxiliary auxtype="TrackPointsDetector" auxvalue="MonitorRole"/>
</volume>
<volume name="vMonitorBack">
<materialref ref="Scintillator"/>
<solidref ref="sMonitorBack"/>
</volume>
<volume name="vTarget">
<materialref ref="G4_lH2"/>
<solidref ref="sTarget"/>
<auxiliary auxtype="SpecialVolume" auxvalue="TargetVolume"/>
<auxiliary auxtype="TrackPointsDetector" auxvalue="TargetRole"/>
</volume>
<volume name="vTargetInnerCover">
<materialref ref="G4_Al"/>
<solidref ref="sTargetInnerCover"/>
<physvol name="Target">
<volumeref ref="vTarget"/>
</physvol>
</volume>
<volume name="vTargetColumn">
<materialref ref="G4_Fe"/>
<solidref ref="sTargetColumn"/>
</volume>
<volume name="vTargetInnerColumn">
<materialref ref="G4_Fe"/>
<solidref ref="sTargetInnerColumn"/>
</volume>
<volume name="vTargetVacuumSpace">
<materialref ref="G4_Galactic"/>
<solidref ref="sTargetVacuumSpace"/>
<!-- do not place them - still have wrong positions! -->
<!--<physvol name="TargetInnnerColumn1">-->
<!--<volumeref ref="vTargetInnerColumn"/>-->
<!--<positionref ref="TargetInnerColumn1Pos"/>-->
<!--</physvol>-->
<!--<physvol name="TargetInnnerColumn2">-->
<!--<volumeref ref="vTargetInnerColumn"/>-->
<!--<positionref ref="TargetInnerColumn2Pos"/>-->
<!--</physvol>-->
</volume>
<volume name="vTargetOuterCover">
<materialref ref="G4_MYLAR"/>
<solidref ref="sTargetOuterCover"/>
</volume>
<volume name="vCrystal">
<materialref ref="CsI_Crystal"/>
<solidref ref="sCrystal"/>
<auxiliary auxtype="EnergyDepositDetector"
auxvalue="CalorimeterRole"/>
<auxiliary auxtype="TrackPointsDetector"
auxvalue="CalorimeterRole"/>
</volume>
<volume name="vCrystalRow">
<materialref ref="G4_AIR"/>
<solidref ref="sCrystalRow"/>
<replicavol number="NCrystalsHor">
<volumeref ref="vCrystal"/>
<replicate_along_axis>
<direction x="1"/>
<width value="CrystalWidth" unit="cm"/>
<offset value="0" unit="cm"/>
</replicate_along_axis>
</replicavol>
</volume>
<volume name="vCalorimeter">
<materialref ref="G4_AIR"/>
<solidref ref="sCalorimeter"/>
<replicavol number="NCrystalsVert">
<volumeref ref="vCrystalRow"/>
<replicate_along_axis>
<direction y="1"/>
<width value="CrystalHeight" unit="cm"/>
<offset value="0" unit="cm"/>
</replicate_along_axis>
</replicavol>
<auxiliary auxtype="SpecialVolume" auxvalue="CalorimeterVolume"/>
<auxiliary auxtype="SensitiveRegion" auxvalue="CalorimeterRegion"/>
</volume>
<volume name="vVetoCounter">
<materialref ref="Scintillator"/>
<solidref ref="sVetoCounter"/>
<auxiliary auxtype="SpecialVolume" auxvalue="VetoCounterVolume"/>
<auxiliary auxtype="EnergyDepositDetector"
auxvalue="VetoCounterRole"/>
<auxiliary auxtype="TrackPointsDetector"
auxvalue="VetoCounterRole"/>
</volume>
<volume name="vOuterFerrumRing">
<materialref ref="G4_Fe"/>
<solidref ref="sOuterFerrumRing"/>
</volume>
<volume name="vInnerFerrumRing">
<materialref ref="G4_Fe"/>
<solidref ref="sInnerFerrumRing"/>
</volume>
<volume name="vInnerCuprumRing">
<materialref ref="G4_Cu"/>
<solidref ref="sInnerCuprumRing"/>
</volume>
<volume name="vTargetWindow">
<materialref ref="G4_Fe"/>
<solidref ref="sTargetWindow"/>
</volume>
<volume name="vTargetWindowCap">
<materialref ref="G4_Fe"/>
<solidref ref="sTargetWindowCap"/>
</volume>
<volume name="vTargetWindowMylarCover">
<materialref ref="G4_MYLAR"/>
<solidref ref="sTargetWindowMylarCover"/>
</volume>
<volume name="vTargetWindowAluminiumCover">
<materialref ref="G4_Al"/>
<solidref ref="sTargetWindowAluminiumCover"/>
</volume>
<volume name="vWorldVisible">
<materialref ref="G4_AIR"/>
<solidref ref="sWorld"/>
<physvol name="TargetOuterCover">
<volumeref ref="vTargetOuterCover"/>
<positionref ref="TargetPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="TargetVacuumSpace">
<volumeref ref="vTargetVacuumSpace"/>
<positionref ref="TargetPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="TargetInnerCover">
<volumeref ref="vTargetInnerCover"/>
<positionref ref="TargetPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="TargetColumn1">
<volumeref ref="vTargetColumn"/>
<positionref ref="TargetColumn1Pos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="TargetColumn2">
<volumeref ref="vTargetColumn"/>
<positionref ref="TargetColumn2Pos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="TargetColumn3">
<volumeref ref="vTargetColumn"/>
<positionref ref="TargetColumn3Pos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="OuterFerrumRingUpper">
<volumeref ref="vOuterFerrumRing"/>
<positionref ref="OuterFerrumRingUpperPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="OuterFerrumRingLower">
<volumeref ref="vOuterFerrumRing"/>
<positionref ref="OuterFerrumRingLowerPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="InnerFerrumRingUpper">
<volumeref ref="vInnerFerrumRing"/>
<positionref ref="InnerFerrumRingUpperPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="InnerFerrumRingLower">
<volumeref ref="vInnerFerrumRing"/>
<positionref ref="InnerFerrumRingLowerPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="InnerCuprumRingUpper">
<volumeref ref="vInnerCuprumRing"/>
<positionref ref="InnerCuprumRingUpperPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="InnerCuprumRingLower">
<volumeref ref="vInnerCuprumRing"/>
<positionref ref="InnerCuprumRingLowerPos"/>
<rotationref ref="TargetRot"/>
</physvol>
<physvol name="TargetWindow">
<volumeref ref="vTargetWindow"/>
<positionref ref="TargetWindowPos"/>
<rotationref ref="TargetWindowRot"/>
</physvol>
<physvol name="TargetWindowCap">
<volumeref ref="vTargetWindowCap"/>
<positionref ref="TargetWindowCapPos"/>
<rotationref ref="TargetWindowRot"/>
</physvol>
<physvol name="TargetWindowMylarCover">
<volumeref ref="vTargetWindowMylarCover"/>
<positionref ref="TargetWindowMylarCoverPos"/>
<rotationref ref="TargetWindowRot"/>
</physvol>
<physvol name="TargetWindowAluminiumCover">
<volumeref ref="vTargetWindowAluminiumCover"/>
<positionref ref="TargetWindowAluminiumCoverPos"/>
<rotationref ref="TargetWindowRot"/>
</physvol>
<physvol name="Monitor">
<volumeref ref="vMonitor"/>
<positionref ref="MonitorPos"/>
</physvol>
<!--<physvol name="MonitorBack">-->
<!--<volumeref ref="vMonitorBack"/>-->
<!--<positionref ref="MonitorBackPos"/>-->
<!--</physvol>-->
<physvol name="CalorimeterLeft">
<volumeref ref="vCalorimeter"/>
<positionref ref="CalorimeterLeftPos"/>
<rotationref ref="CalorimeterLeftRot"/>
</physvol>
<physvol name="CalorimeterRight">
<volumeref ref="vCalorimeter"/>
<positionref ref="CalorimeterRightPos"/>
<rotationref ref="CalorimeterRightRot"/>
</physvol>
<physvol name="VetoCounterLeft">
<volumeref ref="vVetoCounter"/>
<positionref ref="VetoCounterLeftPos"/>
<rotationref ref="CalorimeterLeftRot"/>
</physvol>
<physvol name="VetoCounterRight">
<volumeref ref="vVetoCounter"/>
<positionref ref="VetoCounterRightPos"/>
<rotationref ref="CalorimeterRightRot"/>
</physvol>
</volume>
<volume name="World">
<materialref ref="G4_AIR"/>
<solidref ref="sWorld"/>
<physvol name="WorldVisible">
<volumeref ref="vWorldVisible"/>
</physvol>
</volume>
</structure>
<setup version="1.0" name="Default">
<world ref="World"/>
</setup>
</gdml>
@@ -0,0 +1,15 @@
/gui/addMenu run Run
/gui/addButton run "Collect all events" "/control/execute mac/setup_all_events.mac"
/gui/addButton run "Collect interaction events" "/control/execute mac/setup_interaction_events.mac"
/gui/addButton run "Collect trigger events" "/control/execute mac/setup_trigger_events.mac"
/gui/addButton run "Run 1 event" "/run/beamOn 1"
/gui/addButton run "Run 5 events" "/run/beamOn 5"
/gui/addButton run "Run 10 events" "/run/beamOn 10"
/gui/addButton run "Run 100 events" "/run/beamOn 100"
/gui/addMenu viewer Viewer
/gui/addButton viewer "Draw world" "/control/execute mac/visQt.mac"
#/gui/addButton viewer "Draw world (OI)" "/control/execute mac/visOI.mac"
/gui/addButton viewer "Set style solid" "/vis/viewer/set/style solid"
/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wire"
/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
@@ -0,0 +1,3 @@
/cexmc/run/eventCountPolicy all
/cexmc/event/verbose 4
/cexmc/vis/verbose 4
@@ -0,0 +1,3 @@
/cexmc/run/eventCountPolicy interaction
/cexmc/event/verbose 1
/cexmc/vis/verbose 1
@@ -0,0 +1,3 @@
/cexmc/run/eventCountPolicy trigger
/cexmc/event/verbose 2
/cexmc/vis/verbose 2
@@ -0,0 +1,41 @@
###################################################
# Visualization of detector geometry and events
###################################################
/tracking/storeTrajectory 1
/tracking/verbose 0
/vis/scene/create
/vis/scene/add/volume WorldVisible
# Create a scene handler for a specific graphics system
/vis/open OIX 600x600-0+0
# draw scene
/vis/viewer/zoom 1.4
/vis/viewer/set/viewpointThetaPhi 90 90 deg
/vis/viewer/set/style wireframe
/vis/viewer/set/hiddenMarker false
/vis/geometry/set/visibility all -1 true
/vis/geometry/set/colour vMonitor -1 0.4 1.0 0.6
/vis/geometry/set/colour vMonitorBack -1 0.4 1.0 0.6
/vis/geometry/set/colour vTargetInnerCover -1 0.4 1.0 0.6
/vis/modeling/trajectories/create/drawByParticleID
/vis/modeling/trajectories/select drawByParticleID-0
/vis/modeling/trajectories/drawByParticleID-0/setRGBA gamma 0.8 0.8 1.0 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA neutron 0.5 0.5 0.2 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA pi- 1.0 0.0 0.0 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA e- 0.3 0.3 0.8 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA e+ 0.8 0.3 0.3 1
#/vis/scene/add/trajectories
#/vis/scene/add/hits
#/vis/scene/add/axes
/cexmc/vis/drawTrajMarkers false
/vis/viewer/flush
/vis/scene/endOfEventAction accumulate 10
@@ -0,0 +1,59 @@
###################################################
# Visualization of detector geometry and events
###################################################
/tracking/storeTrajectory 1
/tracking/verbose 0
/vis/scene/create
/vis/scene/add/volume WorldVisible
# Create a scene handler for Qt OpenGL graphics
/vis/open OGLSQt 600x600-0+0
/vis/ogl/set/transparency true
# draw scene
/vis/viewer/zoom 2.0
/vis/viewer/set/viewpointThetaPhi 60 45 deg
/vis/viewer/set/style surface
/vis/viewer/set/culling density
/vis/viewer/set/edge true
/vis/viewer/set/auxiliaryEdge false
/vis/viewer/set/lightsMove cam
/vis/viewer/set/hiddenMarker false
/vis/geometry/set/forceWireframe vWorldVisible 0 true
/vis/geometry/set/forceWireframe vCalorimeter 0 true
/vis/geometry/set/forceWireframe vCrystalRow 0 true
/vis/geometry/set/colour all 0 ! ! ! 0.5
/vis/geometry/set/colour vCrystal 0 0.9 0.7 0.7 0.2
/vis/geometry/set/colour vMonitor -1 0.4 1.0 0.6 0.2
/vis/geometry/set/colour vVetoCounter 0 0.4 1.0 0.6 0.2
/vis/geometry/set/colour vMonitorBack -1 0.4 1.0 0.6 0.0
/vis/geometry/set/colour vTargetOuterCover -1 0.2 0.8 0.6 0.2
/vis/geometry/set/colour vTarget 0 0.4 1.0 0.6 0.2
/vis/geometry/set/colour vInnerCuprumRing 0 0.8 0.5 0.0 0.3
/vis/geometry/set/colour vTargetColumn 0 0.8 0.7 0.7 0.5
/vis/geometry/set/colour vTargetInnerColumn 0 0.8 0.7 0.7 0.5
/vis/geometry/set/colour vOuterFerrumRing 0 0.8 0.7 0.7 0.5
/vis/geometry/set/colour vInnerFerrumRing 0 0.8 0.7 0.7 0.5
/vis/geometry/set/colour vTargetWindow 0 0.8 0.7 0.7 0.5
/vis/geometry/set/colour vTargetWindowCap 0 0.8 0.7 0.7 0.5
/vis/modeling/trajectories/create/drawByParticleID
/vis/modeling/trajectories/select drawByParticleID-0
/vis/modeling/trajectories/drawByParticleID-0/setRGBA gamma 0.8 0.8 1.0 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA neutron 0.5 0.5 0.2 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA pi- 1.0 0.0 0.0 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA e- 0.3 0.3 0.8 1
/vis/modeling/trajectories/drawByParticleID-0/setRGBA e+ 0.8 0.3 0.3 1
#/vis/scene/add/trajectories
#/vis/scene/add/hits
#/vis/scene/add/axes
/cexmc/vis/drawTrajMarkers false
/vis/viewer/flush
/vis/scene/endOfEventAction accumulate 10
@@ -0,0 +1,7 @@
# specify gdml file and production model here.
# do not set gun parameters or anything else.
/cexmc/geometry/gdmlFile lht.gdml
/cexmc/geometry/validateGdmlFile
/cexmc/physics/productionModel eta
@@ -0,0 +1,5 @@
/control/verbose 1
/cexmc/run/skipInteractionsWithoutEDT true
/cexmc/run/replay
@@ -0,0 +1,430 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcAST.cc
*
* Description: abstract syntax tree for custom filter scripting language
*
* Version: 1.0
* Created: 17.07.2010 14:45:14
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifdef CEXMC_USE_CUSTOM_FILTER
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <boost/variant/get.hpp>
#include <boost/format.hpp>
#include "CexmcAST.hh"
#include "CexmcException.hh"
namespace CexmcAST
{
void Subtree::Print( int level ) const
{
static const std::string opId[] =
{ "UNINITIALIZED", "TOP", "u -", "!", "*", "/", "+", "-", "<", "<=",
">", ">=", "=", "!=", "&", "|" };
std::stringstream value;
const Operator * op( boost::get< Operator >( &type ) );
if ( op )
{
value << "-op- " << opId[ op->type ];
}
else
{
const Function * fun( boost::get< Function >( &type ) );
value << "-fun- " << *fun;
}
std::stringstream format;
format << "%|" << level * printIndent << "t|";
std::cout << boost::format( format.str() ) << value.str() << std::endl;
for ( std::vector< Node >::const_iterator k( children.begin() );
k != children.end(); ++k )
{
const Subtree * subtree( boost::get< Subtree >( &*k ) );
if ( subtree )
{
subtree->Print( level + 1 );
}
else
{
const Leaf * leaf( boost::get< Leaf >( &*k ) );
if ( leaf )
PrintLeaf( leaf, level + 1 );
}
}
}
void Subtree::PrintLeaf( const Leaf * leaf, int level ) const
{
const Variable * variable( NULL );
std::stringstream value;
if ( ( variable = boost::get< Variable >( leaf ) ) )
{
value << variable->name;
if ( variable->index1 > 0 )
{
value << "[" << variable->index1;
if ( variable->index2 > 0 )
value << "," << variable->index2;
value << "]";
}
}
else
{
const Constant * constant( boost::get< Constant >( leaf ) );
const int * intConstant( boost::get< int >( constant ) );
const double * doubleConstant( boost::get< double >(
constant ) );
value << ( intConstant ? *intConstant : *doubleConstant );
}
std::stringstream format;
format << "%|" << level * printIndent << "t|";
std::cout << boost::format( format.str() ) << value.str() << std::endl;
}
BasicEval::~BasicEval()
{
}
bool BasicEval::operator()( const Subtree & ast ) const
{
ScalarValueType retval( GetScalarValue( ast ) );
int * intRetval( NULL );
double * doubleRetval( NULL );
intRetval = boost::get< int >( &retval );
if ( ! intRetval )
doubleRetval = boost::get< double >( &retval );
return doubleRetval ? bool( *doubleRetval ) : bool( *intRetval );
}
BasicEval::ScalarValueType BasicEval::GetScalarValue(
const Node & node ) const
{
const Subtree * ast( boost::get< Subtree >( &node ) );
if ( ast )
{
const Operator * op( boost::get< Operator >( &ast->type ) );
if ( op )
{
ScalarValueType left( 0 );
ScalarValueType right( 0 );
int * intLeft( NULL );
double * doubleLeft( NULL );
int * intRight( NULL );
double * doubleRight( NULL );
bool isDoubleRetval( false );
if ( ast->children.size() > 0 )
{
left = GetScalarValue( ast->children[ 0 ] );
intLeft = boost::get< int >( &left );
if ( ! intLeft )
{
doubleLeft = boost::get< double >( &left );
if ( ! doubleLeft )
throw CexmcException( CexmcCFUnexpectedContext );
}
}
switch ( op->type )
{
case And :
case Or :
break;
default :
if ( ast->children.size() > 1 )
{
right = GetScalarValue( ast->children[ 1 ] );
intRight = boost::get< int >( &right );
if ( ! intRight )
{
doubleRight = boost::get< double >( &right );
if ( ! doubleRight )
throw CexmcException(
CexmcCFUnexpectedContext );
}
}
isDoubleRetval = doubleLeft || doubleRight;
break;
}
switch ( op->type )
{
case Uninitialized :
return 1;
case Top :
return left;
case UMinus :
if ( doubleLeft )
return - *doubleLeft;
else
return - *intLeft;
case Not :
if ( doubleLeft )
return ! *doubleLeft;
else
return ! *intLeft;
case Mult :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) *
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft * *intRight;
case Div :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) /
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft / *intRight;
case Plus :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) +
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft + *intRight;
case Minus :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) -
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft - *intRight;
case Less :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) <
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft < *intRight;
case LessEq :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) <=
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft <= *intRight;
case More :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) >
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft > *intRight;
case MoreEq :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) >=
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft >= *intRight;
case Eq :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) ==
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft == *intRight;
case NotEq :
if ( isDoubleRetval )
return ( doubleLeft ? *doubleLeft : *intLeft ) !=
( doubleRight ? *doubleRight : *intRight );
else
return *intLeft != *intRight;
case And :
if ( doubleLeft )
{
if ( ! *doubleLeft )
return 0;
}
else
{
if ( ! *intLeft )
return 0;
}
right = GetScalarValue( ast->children[ 1 ] );
intRight = boost::get< int >( &right );
if ( ! intRight )
{
doubleRight = boost::get< double >( &right );
if ( ! doubleRight )
throw CexmcException( CexmcCFUnexpectedContext );
}
if ( doubleRight )
{
if ( *doubleRight )
return 1;
}
else
{
if ( *intRight )
return 1;
}
return 0;
case Or :
if ( doubleLeft )
{
if ( *doubleLeft )
return 1;
}
else
{
if ( *intLeft )
return 1;
}
right = GetScalarValue( ast->children[ 1 ] );
intRight = boost::get< int >( &right );
if ( ! intRight )
{
doubleRight = boost::get< double >( &right );
if ( ! doubleRight )
throw CexmcException( CexmcCFUnexpectedContext );
}
if ( doubleRight )
{
if ( *doubleRight )
return 1;
}
else
{
if ( *intRight )
return 1;
}
return 0;
default :
return 0;
}
}
else
{
return GetFunScalarValue( *ast );
}
}
else
{
const Leaf & leaf( boost::get< Leaf >( node ) );
const Constant * constant( boost::get< Constant >( &leaf ) );
if ( constant )
{
return *constant;
}
else
{
const Variable & variable( boost::get< Variable >( leaf ) );
return GetVarScalarValue( variable );
}
}
return 0;
}
BasicEval::ScalarValueType BasicEval::GetFunScalarValue(
const Subtree & ast ) const
{
bool evalResult( false );
ScalarValueType result( GetBasicFunScalarValue( ast, evalResult ) );
if ( evalResult )
return result;
throw CexmcException( CexmcCFUnexpectedFunction );
return 0;
}
BasicEval::ScalarValueType BasicEval::GetVarScalarValue(
const Variable & ) const
{
throw CexmcException( CexmcCFUnexpectedVariable );
return 0;
}
BasicEval::ScalarValueType BasicEval::GetBasicFunScalarValue(
const Subtree & ast, bool & result ) const
{
const Function & fun( boost::get< Function >( ast.type ) );
result = true;
ScalarValueType arg( GetScalarValue( ast.children[ 0 ] ) );
int * intArg( NULL );
double * doubleArg( NULL );
intArg = boost::get< int >( &arg );
if ( ! intArg )
doubleArg = boost::get< double >( &arg );
if ( fun == "Sqr" )
{
if ( doubleArg )
return *doubleArg * *doubleArg;
else
return *intArg * *intArg;
}
if ( fun == "Sqrt" )
{
if ( doubleArg )
return std::sqrt( *doubleArg );
else
return std::sqrt( *intArg );
}
result = false;
return 0;
}
}
#endif
@@ -0,0 +1,965 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcASTEval.cc
*
* Description: abstract syntax tree for custom filter eval
*
* Version: 1.0
* Created: 17.07.2010 15:46:01
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifdef CEXMC_USE_CUSTOM_FILTER
#include <numeric>
#include <boost/variant/get.hpp>
#include "CexmcASTEval.hh"
namespace
{
const std::string CexmcCFVarEvent( "event" );
const std::string CexmcCFVarOpCosThetaSCM( "op_cosTh_SCM" );
const std::string CexmcCFVarEDT( "edt" );
const std::string CexmcCFVarTPT( "tpt" );
const std::string CexmcCFVarMon( "mon" );
const std::string CexmcCFVarMonED( "monED" );
const std::string CexmcCFVarVclED( "vclED" );
const std::string CexmcCFVarVcrED( "vcrED" );
const std::string CexmcCFVarClED( "clED" );
const std::string CexmcCFVarCrED( "crED" );
const std::string CexmcCFVarClEDCol( "clEDcol" );
const std::string CexmcCFVarCrEDCol( "crEDcol" );
const std::string CexmcCFVarBpMonPosL( "bp_mon_posl" );
const std::string CexmcCFVarBpMonPosW( "bp_mon_posw" );
const std::string CexmcCFVarBpMonDirL( "bp_mon_dirl" );
const std::string CexmcCFVarBpMonDirW( "bp_mon_dirw" );
const std::string CexmcCFVarBpMonMom( "bp_mon_mom" );
const std::string CexmcCFVarBpMonTid( "bp_mon_tid" );
const std::string CexmcCFVarBpTgtPosL( "bp_tgt_posl" );
const std::string CexmcCFVarBpTgtPosW( "bp_tgt_posw" );
const std::string CexmcCFVarBpTgtDirL( "bp_tgt_dirl" );
const std::string CexmcCFVarBpTgtDirW( "bp_tgt_dirw" );
const std::string CexmcCFVarBpTgtMom( "bp_tgt_mom" );
const std::string CexmcCFVarBpTgtTid( "bp_tgt_tid" );
const std::string CexmcCFVarOpTgtPosL( "op_tgt_posl" );
const std::string CexmcCFVarOpTgtPosW( "op_tgt_posw" );
const std::string CexmcCFVarOpTgtDirL( "op_tgt_dirl" );
const std::string CexmcCFVarOpTgtDirW( "op_tgt_dirw" );
const std::string CexmcCFVarOpTgtMom( "op_tgt_mom" );
const std::string CexmcCFVarOpTgtTid( "op_tgt_tid" );
const std::string CexmcCFVarNpTgtPosL( "np_tgt_posl" );
const std::string CexmcCFVarNpTgtPosW( "np_tgt_posw" );
const std::string CexmcCFVarNpTgtDirL( "np_tgt_dirl" );
const std::string CexmcCFVarNpTgtDirW( "np_tgt_dirw" );
const std::string CexmcCFVarNpTgtMom( "np_tgt_mom" );
const std::string CexmcCFVarNpTgtTid( "np_tgt_tid" );
const std::string CexmcCFVarOpdp1TgtPosL( "opdp1_tgt_posl" );
const std::string CexmcCFVarOpdp1TgtPosW( "opdp1_tgt_posw" );
const std::string CexmcCFVarOpdp1TgtDirL( "opdp1_tgt_dirl" );
const std::string CexmcCFVarOpdp1TgtDirW( "opdp1_tgt_dirw" );
const std::string CexmcCFVarOpdp1TgtMom( "opdp1_tgt_mom" );
const std::string CexmcCFVarOpdp1TgtTid( "opdp1_tgt_tid" );
const std::string CexmcCFVarOpdp2TgtPosL( "opdp2_tgt_posl" );
const std::string CexmcCFVarOpdp2TgtPosW( "opdp2_tgt_posw" );
const std::string CexmcCFVarOpdp2TgtDirL( "opdp2_tgt_dirl" );
const std::string CexmcCFVarOpdp2TgtDirW( "opdp2_tgt_dirw" );
const std::string CexmcCFVarOpdp2TgtMom( "opdp2_tgt_mom" );
const std::string CexmcCFVarOpdp2TgtTid( "opdp2_tgt_tid" );
const std::string CexmcCFVarOpdpVclPosL( "opdp_vcl_posl" );
const std::string CexmcCFVarOpdpVclPosW( "opdp_vcl_posw" );
const std::string CexmcCFVarOpdpVclDirL( "opdp_vcl_dirl" );
const std::string CexmcCFVarOpdpVclDirW( "opdp_vcl_dirw" );
const std::string CexmcCFVarOpdpVclMom( "opdp_vcl_mom" );
const std::string CexmcCFVarOpdpVclTid( "opdp_vcl_tid" );
const std::string CexmcCFVarOpdpVcrPosL( "opdp_vcr_posl" );
const std::string CexmcCFVarOpdpVcrPosW( "opdp_vcr_posw" );
const std::string CexmcCFVarOpdpVcrDirL( "opdp_vcr_dirl" );
const std::string CexmcCFVarOpdpVcrDirW( "opdp_vcr_dirw" );
const std::string CexmcCFVarOpdpVcrMom( "opdp_vcr_mom" );
const std::string CexmcCFVarOpdpVcrTid( "opdp_vcr_tid" );
const std::string CexmcCFVarOpdpClPosL( "opdp_cl_posl" );
const std::string CexmcCFVarOpdpClPosW( "opdp_cl_posw" );
const std::string CexmcCFVarOpdpClDirL( "opdp_cl_dirl" );
const std::string CexmcCFVarOpdpClDirW( "opdp_cl_dirw" );
const std::string CexmcCFVarOpdpClMom( "opdp_cl_mom" );
const std::string CexmcCFVarOpdpClTid( "opdp_cl_tid" );
const std::string CexmcCFVarOpdpCrPosL( "opdp_cr_posl" );
const std::string CexmcCFVarOpdpCrPosW( "opdp_cr_posw" );
const std::string CexmcCFVarOpdpCrDirL( "opdp_cr_dirl" );
const std::string CexmcCFVarOpdpCrDirW( "opdp_cr_dirw" );
const std::string CexmcCFVarOpdpCrMom( "opdp_cr_mom" );
const std::string CexmcCFVarOpdpCrTid( "opdp_cr_tid" );
const std::string CexmcCFVarIpSCM( "ipSCM" );
const std::string CexmcCFVarIpLAB( "ipLAB" );
const std::string CexmcCFVarNpSCM( "npSCM" );
const std::string CexmcCFVarNpLAB( "npLAB" );
const std::string CexmcCFVarOpSCM( "opSCM" );
const std::string CexmcCFVarOpLAB( "opLAB" );
const std::string CexmcCFVarNopSCM( "nopSCM" );
const std::string CexmcCFVarNopLAB( "nopLAB" );
const std::string CexmcCFVarIpId( "ipId" );
const std::string CexmcCFVarNpId( "npId" );
const std::string CexmcCFVarOpId( "opId" );
const std::string CexmcCFVarNopId( "nopId" );
const std::string CexmcCFVarConst_eV( "eV" );
const std::string CexmcCFVarConst_keV( "keV" );
const std::string CexmcCFVarConst_MeV( "MeV" );
const std::string CexmcCFVarConst_GeV( "GeV" );
const std::string CexmcCFVarConst_mm( "mm" );
const std::string CexmcCFVarConst_cm( "cm" );
const std::string CexmcCFVarConst_m( "m" );
}
const G4double CexmcASTEval::constants[] = { eV, keV, MeV, GeV, mm, cm, m };
CexmcASTEval::CexmcASTEval( const CexmcEventFastSObject * evFastSObject,
const CexmcEventSObject * evSObject ) :
evFastSObject( evFastSObject ), evSObject( evSObject )
{
}
CexmcAST::BasicEval::ScalarValueType CexmcASTEval::GetFunScalarValue(
const CexmcAST::Subtree & ast ) const
{
const CexmcAST::Function & fun( boost::get< CexmcAST::Function >(
ast.type ) );
if ( fun == "Sum" )
{
CexmcEnergyDepositCalorimeterCollection edCol;
GetEDCollectionValue( ast.children[ 0 ], edCol );
G4double result( 0. );
for ( CexmcEnergyDepositCalorimeterCollection::iterator
k( edCol.begin() ); k != edCol.end(); ++k )
{
result += std::accumulate( k->begin(), k->end(), G4double( 0. ) );
}
return result;
}
bool evalResult( false );
ScalarValueType result( GetBasicFunScalarValue( ast, evalResult ) );
if ( evalResult )
return result;
throw CexmcException( CexmcCFUnexpectedFunction );
return 0;
}
CexmcAST::BasicEval::ScalarValueType CexmcASTEval::GetVarScalarValue(
const CexmcAST::Variable & var ) const
{
if ( evFastSObject == NULL || evSObject == NULL )
throw CexmcException( CexmcCFUninitialized );
/* Variables with initialized address */
/* bound to CexmcAST::Variable:addr */
const double * const * addr( boost::get< const double * >( &var.addr ) );
if ( addr )
{
if ( *addr )
return **addr;
}
else
{
const int * const & addr( boost::get< const int * >( var.addr ) );
if ( addr )
return *addr;
}
/* found in varAddrMap */
VarAddrMap::const_iterator found( varAddrMap.find( var.name ) );
if ( found != varAddrMap.end() )
{
const CexmcEnergyDepositCalorimeterCollection * const * addr(
boost::get< const CexmcEnergyDepositCalorimeterCollection * >(
&found->second ) );
if ( addr )
{
if ( *addr )
{
if ( ( *addr )->size() == 0 )
throw CexmcException( CexmcCFUninitializedVector );
if ( var.index1 == 0 || var.index2 == 0 )
throw CexmcException( CexmcCFUnexpectedVectorIndex );
return ( *addr )->at( var.index1 - 1 ).at( var.index2 - 1 );
}
}
else
{
const bool * const & addr( boost::get< const bool * >(
found->second ) );
if ( addr )
return int( *addr );
}
}
/* Variables without address */
if ( var.name == CexmcCFVarTPT )
{
return int( evSObject->targetTPOutputParticle.trackId !=
CexmcInvalidTrackId );
}
throw CexmcException( CexmcCFUnexpectedVariable );
return 0;
}
void CexmcASTEval::GetEDCollectionValue( const CexmcAST::Node & node,
CexmcEnergyDepositCalorimeterCollection & edCol ) const
{
if ( evSObject == NULL )
throw CexmcException( CexmcCFUninitialized );
const CexmcAST::Subtree * ast( boost::get< CexmcAST::Subtree >( &node ) );
if ( ast )
{
const CexmcAST::Function & fun( boost::get< CexmcAST::Function >(
ast->type ) );
if ( fun == "Inner" )
{
GetEDCollectionValue( ast->children[ 0 ], edCol );
edCol.pop_back();
edCol.erase( edCol.begin() );
for ( CexmcEnergyDepositCalorimeterCollection::iterator
k( edCol.begin() ); k != edCol.end(); ++k )
{
k->pop_back();
k->erase( k->begin() );
}
return;
}
if ( fun == "Outer" )
{
GetEDCollectionValue( ast->children[ 0 ], edCol );
if ( edCol.size() < 3 )
return;
for ( CexmcEnergyDepositCalorimeterCollection::iterator
k( edCol.begin() + 1 ); k != edCol.end() - 1; ++k )
{
if ( k->size() < 3 )
continue;
k->erase( k->begin() + 1, k->end() - 1 );
}
return;
}
}
else
{
const CexmcAST::Leaf & leaf( boost::get< CexmcAST::Leaf >(
node ) );
const CexmcAST::Variable & var( boost::get< CexmcAST::Variable >(
leaf ) );
if ( var.index1 != 0 || var.index2 != 0 )
throw CexmcException( CexmcCFUnexpectedVariableUsage );
VarAddrMap::const_iterator found( varAddrMap.find( var.name ) );
if ( found == varAddrMap.end() )
throw CexmcException( CexmcCFUnexpectedVariable );
const CexmcEnergyDepositCalorimeterCollection * const * addr(
boost::get< const CexmcEnergyDepositCalorimeterCollection * >(
&found->second ) );
if ( ! addr )
{
throw CexmcException( CexmcCFUnexpectedVariableUsage );
}
else
{
if ( *addr )
edCol = **addr;
return;
}
}
}
void CexmcASTEval::BindAddresses( CexmcAST::Subtree & ast )
{
if ( evFastSObject == NULL || evSObject == NULL )
return;
for ( std::vector< CexmcAST::Node >::iterator k( ast.children.begin() );
k != ast.children.end(); ++k )
{
CexmcAST::Subtree * subtree( boost::get< CexmcAST::Subtree >( &*k ) );
if ( subtree )
{
BindAddresses( *subtree );
}
else
{
CexmcAST::Leaf & leaf( boost::get< CexmcAST::Leaf >( *k ) );
CexmcAST::Variable * var( boost::get< CexmcAST::Variable >(
&leaf ) );
if ( ! var )
continue;
const int * const * intVarAddr(
boost::get< const int * >( &var->addr ) );
if ( intVarAddr )
{
if ( *intVarAddr )
continue;
}
else
{
const double * const & doubleVarAddr(
boost::get< const double * >( var->addr ) );
if ( doubleVarAddr )
continue;
}
VarAddrMap::const_iterator found( varAddrMap.find( var->name ) );
if ( found != varAddrMap.end() )
continue;
do
{
if ( var->name == CexmcCFVarEvent )
{
var->addr = &evFastSObject->eventId;
break;
}
if ( var->name == CexmcCFVarOpCosThetaSCM )
{
var->addr = &evFastSObject->opCosThetaSCM;
break;
}
if ( var->name == CexmcCFVarEDT )
{
varAddrMap.insert( VarAddrMapData( var->name,
&evFastSObject->edDigitizerHasTriggered ) );
break;
}
if ( var->name == CexmcCFVarMon )
{
varAddrMap.insert( VarAddrMapData( var->name,
&evFastSObject->edDigitizerMonitorHasTriggered ) );
break;
}
if ( var->name == CexmcCFVarMonED )
{
var->addr = &evSObject->monitorED;
break;
}
if ( var->name == CexmcCFVarVclED )
{
var->addr = &evSObject->vetoCounterEDLeft;
break;
}
if ( var->name == CexmcCFVarVcrED )
{
var->addr = &evSObject->vetoCounterEDRight;
break;
}
if ( var->name == CexmcCFVarClED )
{
var->addr = &evSObject->calorimeterEDLeft;
break;
}
if ( var->name == CexmcCFVarCrED )
{
var->addr = &evSObject->calorimeterEDRight;
break;
}
if ( var->name == CexmcCFVarClEDCol )
{
varAddrMap.insert( VarAddrMapData( var->name,
&evSObject->calorimeterEDLeftCollection ) );
break;
}
if ( var->name == CexmcCFVarCrEDCol )
{
varAddrMap.insert( VarAddrMapData( var->name,
&evSObject->calorimeterEDRightCollection ) );
break;
}
if ( var->name == CexmcCFVarBpMonPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->monitorTP.positionLocal, var->index1 );
break;
}
if ( var->name == CexmcCFVarBpMonPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->monitorTP.positionWorld, var->index1 );
break;
}
if ( var->name == CexmcCFVarBpMonDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->monitorTP.directionLocal, var->index1 );
break;
}
if ( var->name == CexmcCFVarBpMonDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->monitorTP.directionWorld, var->index1 );
break;
}
if ( var->name == CexmcCFVarBpMonMom )
{
var->addr = &evSObject->monitorTP.momentumAmp;
break;
}
if ( var->name == CexmcCFVarBpMonTid )
{
var->addr = &evSObject->monitorTP.trackId;
break;
}
if ( var->name == CexmcCFVarBpTgtPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPBeamParticle.positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarBpTgtPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPBeamParticle.positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarBpTgtDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPBeamParticle.directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarBpTgtDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPBeamParticle.directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarBpTgtMom )
{
var->addr = &evSObject->targetTPBeamParticle.momentumAmp;
break;
}
if ( var->name == CexmcCFVarBpTgtTid )
{
var->addr = &evSObject->targetTPBeamParticle.trackId;
break;
}
if ( var->name == CexmcCFVarOpTgtPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticle.positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpTgtPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticle.positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpTgtDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticle.directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpTgtDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticle.directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpTgtMom )
{
var->addr = &evSObject->targetTPOutputParticle.momentumAmp;
break;
}
if ( var->name == CexmcCFVarOpTgtTid )
{
var->addr = &evSObject->targetTPOutputParticle.trackId;
break;
}
if ( var->name == CexmcCFVarNpTgtPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPNucleusParticle.positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarNpTgtPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPNucleusParticle.positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarNpTgtDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPNucleusParticle.directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarNpTgtDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPNucleusParticle.directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarNpTgtMom )
{
var->addr = &evSObject->targetTPNucleusParticle.momentumAmp;
break;
}
if ( var->name == CexmcCFVarNpTgtTid )
{
var->addr = &evSObject->targetTPNucleusParticle.trackId;
break;
}
if ( var->name == CexmcCFVarOpdp1TgtPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticleDecayProductParticle1.
positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdp1TgtPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticleDecayProductParticle1.
positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdp1TgtDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticleDecayProductParticle1.
directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdp1TgtDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticleDecayProductParticle1.
directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdp1TgtMom )
{
var->addr = &evSObject->
targetTPOutputParticleDecayProductParticle1.momentumAmp;
break;
}
if ( var->name == CexmcCFVarOpdp1TgtTid )
{
var->addr = &evSObject->
targetTPOutputParticleDecayProductParticle1.trackId;
break;
}
if ( var->name == CexmcCFVarOpdp2TgtPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticleDecayProductParticle2.
positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdp2TgtPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticleDecayProductParticle2.
positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdp2TgtDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticleDecayProductParticle2.
directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdp2TgtDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->targetTPOutputParticleDecayProductParticle2.
directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdp2TgtMom )
{
var->addr = &evSObject->
targetTPOutputParticleDecayProductParticle2.momentumAmp;
break;
}
if ( var->name == CexmcCFVarOpdp2TgtTid )
{
var->addr = &evSObject->
targetTPOutputParticleDecayProductParticle2.trackId;
break;
}
if ( var->name == CexmcCFVarOpdpVclPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->vetoCounterTPLeft.positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpVclPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->vetoCounterTPLeft.positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpVclDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->vetoCounterTPLeft.directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpVclDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->vetoCounterTPLeft.directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpVclMom )
{
var->addr = &evSObject->vetoCounterTPLeft.momentumAmp;
break;
}
if ( var->name == CexmcCFVarOpdpVclTid )
{
var->addr = &evSObject->vetoCounterTPLeft.trackId;
break;
}
if ( var->name == CexmcCFVarOpdpVcrPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->vetoCounterTPRight.positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpVcrPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->vetoCounterTPRight.positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpVcrDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->vetoCounterTPRight.directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpVcrDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->vetoCounterTPRight.directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpVcrMom )
{
var->addr = &evSObject->vetoCounterTPRight.momentumAmp;
break;
}
if ( var->name == CexmcCFVarOpdpVcrTid )
{
var->addr = &evSObject->vetoCounterTPRight.trackId;
break;
}
if ( var->name == CexmcCFVarOpdpClPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->calorimeterTPLeft.positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpClPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->calorimeterTPLeft.positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpClDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->calorimeterTPLeft.directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpClDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->calorimeterTPLeft.directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpClMom )
{
var->addr = &evSObject->calorimeterTPLeft.momentumAmp;
break;
}
if ( var->name == CexmcCFVarOpdpClTid )
{
var->addr = &evSObject->calorimeterTPLeft.trackId;
break;
}
if ( var->name == CexmcCFVarOpdpCrPosL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->calorimeterTPRight.positionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpCrPosW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->calorimeterTPRight.positionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpCrDirL )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->calorimeterTPRight.directionLocal,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpCrDirW )
{
var->addr = GetThreeVectorElementAddrByIndex(
evSObject->calorimeterTPRight.directionWorld,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpdpCrMom )
{
var->addr = &evSObject->calorimeterTPRight.momentumAmp;
break;
}
if ( var->name == CexmcCFVarOpdpCrTid )
{
var->addr = &evSObject->calorimeterTPRight.trackId;
break;
}
if ( var->name == CexmcCFVarIpSCM )
{
var->addr = GetLorentzVectorElementAddrByIndex(
evSObject->productionModelData.incidentParticleSCM,
var->index1 );
break;
}
if ( var->name == CexmcCFVarIpLAB )
{
var->addr = GetLorentzVectorElementAddrByIndex(
evSObject->productionModelData.incidentParticleLAB,
var->index1 );
break;
}
if ( var->name == CexmcCFVarNpSCM )
{
var->addr = GetLorentzVectorElementAddrByIndex(
evSObject->productionModelData.nucleusParticleSCM,
var->index1 );
break;
}
if ( var->name == CexmcCFVarNpLAB )
{
var->addr = GetLorentzVectorElementAddrByIndex(
evSObject->productionModelData.nucleusParticleLAB,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpSCM )
{
var->addr = GetLorentzVectorElementAddrByIndex(
evSObject->productionModelData.outputParticleSCM,
var->index1 );
break;
}
if ( var->name == CexmcCFVarOpLAB )
{
var->addr = GetLorentzVectorElementAddrByIndex(
evSObject->productionModelData.outputParticleLAB,
var->index1 );
break;
}
if ( var->name == CexmcCFVarNopSCM )
{
var->addr = GetLorentzVectorElementAddrByIndex(
evSObject->productionModelData.nucleusOutputParticleSCM,
var->index1 );
break;
}
if ( var->name == CexmcCFVarNopLAB )
{
var->addr = GetLorentzVectorElementAddrByIndex(
evSObject->productionModelData.nucleusOutputParticleLAB,
var->index1 );
break;
}
if ( var->name == CexmcCFVarIpId )
{
var->addr =
&evSObject->productionModelData.incidentParticle;
break;
}
if ( var->name == CexmcCFVarNpId )
{
var->addr = &evSObject->productionModelData.nucleusParticle;
break;
}
if ( var->name == CexmcCFVarOpId )
{
var->addr = &evSObject->productionModelData.outputParticle;
break;
}
if ( var->name == CexmcCFVarNopId )
{
var->addr =
&evSObject->productionModelData.nucleusOutputParticle;
break;
}
if ( var->name == CexmcCFVarConst_eV )
{
var->addr = &constants[ 0 ];
break;
}
if ( var->name == CexmcCFVarConst_keV )
{
var->addr = &constants[ 1 ];
break;
}
if ( var->name == CexmcCFVarConst_MeV )
{
var->addr = &constants[ 2 ];
break;
}
if ( var->name == CexmcCFVarConst_GeV )
{
var->addr = &constants[ 3 ];
break;
}
if ( var->name == CexmcCFVarConst_mm )
{
var->addr = &constants[ 4 ];
break;
}
if ( var->name == CexmcCFVarConst_cm )
{
var->addr = &constants[ 5 ];
break;
}
if ( var->name == CexmcCFVarConst_m )
{
var->addr = &constants[ 6 ];
break;
}
} while ( false );
}
}
}
void CexmcASTEval::ResetAddressBinding( CexmcAST::Subtree & ast )
{
for ( std::vector< CexmcAST::Node >::iterator k( ast.children.begin() );
k != ast.children.end(); ++k )
{
CexmcAST::Subtree * subtree( boost::get< CexmcAST::Subtree >( &*k ) );
if ( subtree )
{
ResetAddressBinding( *subtree );
}
else
{
CexmcAST::Leaf & leaf( boost::get< CexmcAST::Leaf >( *k ) );
CexmcAST::Variable * var( boost::get< CexmcAST::Variable >(
&leaf ) );
if ( var )
var->addr = ( const int * ) NULL;
}
}
}
#endif
@@ -0,0 +1,147 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcAngularRange.cc
*
* Description: angular range object
*
* Version: 1.0
* Created: 28.12.2009 22:35:07
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include "CexmcAngularRange.hh"
void GetNormalizedAngularRange( const CexmcAngularRangeList & src,
CexmcAngularRangeList & dst )
{
dst = src;
if ( dst.size() < 2 )
return;
std::sort( dst.begin(), dst.end() );
const G4double epsilon( 1E-7 );
for ( CexmcAngularRangeList::iterator k( dst.begin() + 1 );
k != dst.end(); )
{
if ( std::fabs( k->top - ( k - 1 )->top ) < epsilon ||
k->bottom + epsilon >= ( k - 1 )->bottom )
{
dst.erase( k );
continue;
}
if ( k->top + epsilon >= ( k - 1 )->bottom )
{
( k - 1 )->bottom = k->bottom;
dst.erase( k );
continue;
}
++k;
}
}
void GetAngularGaps( const CexmcAngularRangeList & src,
CexmcAngularRangeList & dst )
{
if ( src.empty() )
{
dst.push_back( CexmcAngularRange( 1.0, -1.0 , 0 ) );
return;
}
CexmcAngularRangeList normalizedAngularRanges;
GetNormalizedAngularRange( src, normalizedAngularRanges );
G4int index( 0 );
if ( normalizedAngularRanges[ 0 ].top < 1.0 )
dst.push_back( CexmcAngularRange(
1.0, normalizedAngularRanges[ 0 ].top, index++ ) );
for ( CexmcAngularRangeList::iterator
k( normalizedAngularRanges.begin() );
k != normalizedAngularRanges.end(); ++k )
{
if ( k + 1 == normalizedAngularRanges.end() )
break;
dst.push_back( CexmcAngularRange(
k->bottom, ( k + 1 )->top, index++ ) );
}
if ( normalizedAngularRanges.back().bottom > -1.0 )
dst.push_back( CexmcAngularRange(
normalizedAngularRanges.back().bottom, -1.0, index ) );
}
std::ostream & operator<<( std::ostream & out,
const CexmcAngularRange & angularRange )
{
std::ostream::fmtflags savedFlags( out.flags() );
std::streamsize prec( out.precision() );
out.precision( 4 );
out.flags( std::ios::fixed );
out << std::setw( 2 ) << angularRange.index + 1 << " [" << std::setw( 7 ) <<
angularRange.top << ", " << std::setw( 7 ) << angularRange.bottom <<
")";
out.precision( prec );
out.flags( savedFlags );
return out;
}
std::ostream & operator<<( std::ostream & out,
const CexmcAngularRangeList & angularRanges )
{
out << std::endl;
for ( CexmcAngularRangeList::const_iterator k( angularRanges.begin() );
k != angularRanges.end(); ++k )
{
out << " " << *k << std::endl;
}
return out;
}
@@ -0,0 +1,294 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcChargeExchangeReconstructor.cc
*
* Description: charge exchange reconstructor
*
* Version: 1.0
* Created: 02.12.2009 15:17:13
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#include <G4ThreeVector.hh>
#include <G4LorentzVector.hh>
#include "CexmcChargeExchangeReconstructor.hh"
#include "CexmcChargeExchangeReconstructorMessenger.hh"
#include "CexmcEnergyDepositStore.hh"
#include "CexmcPrimaryGeneratorAction.hh"
#include "CexmcParticleGun.hh"
#include "CexmcProductionModel.hh"
#include "CexmcRunManager.hh"
#include "CexmcException.hh"
#include "CexmcCommon.hh"
CexmcChargeExchangeReconstructor::CexmcChargeExchangeReconstructor(
const CexmcProductionModel * productionModel ) :
outputParticleMass( 0 ), nucleusOutputParticleMass( 0 ),
useTableMass( false ), useMassCut( false ), massCutOPCenter( 0 ),
massCutNOPCenter( 0 ), massCutOPWidth( 0 ), massCutNOPWidth( 0 ),
massCutEllipseAngle( 0 ), useAbsorbedEnergyCut( false ),
absorbedEnergyCutCLCenter( 0 ), absorbedEnergyCutCRCenter( 0 ),
absorbedEnergyCutCLWidth( 0 ), absorbedEnergyCutCRWidth( 0 ),
absorbedEnergyCutEllipseAngle( 0 ), hasMassCutTriggered( false ),
hasAbsorbedEnergyCutTriggered( false ), beamParticleIsInitialized( false ),
particleGun( NULL ), messenger( NULL )
{
if ( ! productionModel )
throw CexmcException( CexmcWeirdException );
productionModelData.incidentParticle =
productionModel->GetIncidentParticle();
CexmcRunManager * runManager( static_cast< CexmcRunManager * >(
G4RunManager::GetRunManager() ) );
const CexmcPrimaryGeneratorAction * primaryGeneratorAction(
static_cast< const CexmcPrimaryGeneratorAction * >(
runManager->GetUserPrimaryGeneratorAction() ) );
CexmcPrimaryGeneratorAction * thePrimaryGeneratorAction(
const_cast< CexmcPrimaryGeneratorAction * >(
primaryGeneratorAction ) );
particleGun = thePrimaryGeneratorAction->GetParticleGun();
productionModelData.nucleusParticle =
productionModel->GetNucleusParticle();
productionModelData.outputParticle =
productionModel->GetOutputParticle();
productionModelData.nucleusOutputParticle =
productionModel->GetNucleusOutputParticle();
messenger = new CexmcChargeExchangeReconstructorMessenger( this );
}
CexmcChargeExchangeReconstructor::~CexmcChargeExchangeReconstructor()
{
delete messenger;
}
void CexmcChargeExchangeReconstructor::SetupBeamParticle( void )
{
if ( *productionModelData.incidentParticle !=
*particleGun->GetParticleDefinition() )
throw CexmcException( CexmcBeamAndIncidentParticlesMismatch );
beamParticleIsInitialized = true;
}
void CexmcChargeExchangeReconstructor::Reconstruct(
const CexmcEnergyDepositStore * edStore )
{
if ( ! beamParticleIsInitialized )
{
if ( *productionModelData.incidentParticle !=
*particleGun->GetParticleDefinition() )
throw CexmcException( CexmcBeamAndIncidentParticlesMismatch );
beamParticleIsInitialized = true;
}
ReconstructEntryPoints( edStore );
if ( hasBasicTrigger )
ReconstructTargetPoint();
if ( hasBasicTrigger )
ReconstructAngle();
G4ThreeVector epLeft( calorimeterEPLeftWorldPosition -
targetEPWorldPosition );
G4ThreeVector epRight( calorimeterEPRightWorldPosition -
targetEPWorldPosition );
G4double cosTheAngle( std::cos( theAngle ) );
G4double calorimeterEDLeft( edStore->calorimeterEDLeft );
G4double calorimeterEDRight( edStore->calorimeterEDRight );
//G4double cosOutputParticleLAB(
//( calorimeterEDLeft * cosAngleLeft +
//calorimeterEDRight * cosAngleRight ) /
//std::sqrt( calorimeterEDLeft * calorimeterEDLeft +
//calorimeterEDRight * calorimeterEDRight +
//calorimeterEDLeft * calorimeterEDRight * cosTheAngle ) );
outputParticleMass = std::sqrt( 2 * calorimeterEDLeft *
calorimeterEDRight * ( 1 - cosTheAngle ) );
G4ThreeVector opdpLeftMomentum( epLeft );
opdpLeftMomentum.setMag( calorimeterEDLeft );
G4ThreeVector opdpRightMomentum( epRight );
opdpRightMomentum.setMag( calorimeterEDRight );
G4ThreeVector opMomentum( opdpLeftMomentum + opdpRightMomentum );
G4double opMass( useTableMass ?
productionModelData.outputParticle->GetPDGMass() :
outputParticleMass );
G4double opEnergy( std::sqrt(
opMomentum.mag2() + opMass * opMass ) );
productionModelData.outputParticleLAB = G4LorentzVector( opMomentum,
opEnergy );
G4ThreeVector incidentParticleMomentum( particleGun->GetOrigDirection() );
G4double incidentParticleMomentumAmp(
particleGun->GetOrigMomentumAmp() );
incidentParticleMomentum *= incidentParticleMomentumAmp;
G4double incidentParticlePDGMass(
productionModelData.incidentParticle->GetPDGMass() );
G4double incidentParticlePDGMass2( incidentParticlePDGMass *
incidentParticlePDGMass );
G4double incidentParticleEnergy(
std::sqrt( incidentParticleMomentumAmp * incidentParticleMomentumAmp +
incidentParticlePDGMass2 ) );
productionModelData.incidentParticleLAB = G4LorentzVector(
incidentParticleMomentum, incidentParticleEnergy );
G4double nucleusParticlePDGMass(
productionModelData.nucleusParticle->GetPDGMass() );
productionModelData.nucleusParticleLAB = G4LorentzVector(
G4ThreeVector( 0, 0, 0 ), nucleusParticlePDGMass );
G4LorentzVector lVecSum( productionModelData.incidentParticleLAB +
productionModelData.nucleusParticleLAB );
G4ThreeVector boostVec( lVecSum.boostVector() );
productionModelData.nucleusOutputParticleLAB =
lVecSum - productionModelData.outputParticleLAB;
productionModelData.incidentParticleSCM =
productionModelData.incidentParticleLAB;
productionModelData.nucleusParticleSCM =
productionModelData.nucleusParticleLAB;
productionModelData.outputParticleSCM =
productionModelData.outputParticleLAB;
productionModelData.nucleusOutputParticleSCM =
productionModelData.nucleusOutputParticleLAB;
productionModelData.incidentParticleSCM.boost( -boostVec );
productionModelData.nucleusParticleSCM.boost( -boostVec );
productionModelData.outputParticleSCM.boost( -boostVec );
productionModelData.nucleusOutputParticleSCM.boost( -boostVec );
G4double edDelta2(
std::pow( ( calorimeterEDLeft - calorimeterEDRight ) /
( calorimeterEDLeft + calorimeterEDRight ),
2 ) );
G4double outputParticleKinEnergy(
std::sqrt( 2 * opMass * opMass / ( 1 - cosTheAngle ) /
( 1 - edDelta2 ) ) - opMass );
G4ThreeVector nopMomentum( incidentParticleMomentum - opMomentum );
G4double nopEnergy(
std::sqrt( incidentParticleMomentum.mag2() +
incidentParticlePDGMass2 ) +
nucleusParticlePDGMass -
( outputParticleKinEnergy + opMass ) );
nucleusOutputParticleMass = std::sqrt( nopEnergy * nopEnergy -
nopMomentum.mag2() );
if ( useMassCut )
{
G4double cosMassCutEllipseAngle( std::cos( massCutEllipseAngle ) );
G4double sinMassCutEllipseAngle( std::sin( massCutEllipseAngle ) );
if ( massCutOPWidth <= 0. || massCutNOPWidth <= 0. )
{
hasMassCutTriggered = false;
}
else
{
G4double massCutOPWidth2( massCutOPWidth * massCutOPWidth );
G4double massCutNOPWidth2( massCutNOPWidth * massCutNOPWidth );
hasMassCutTriggered =
std::pow( ( outputParticleMass - massCutOPCenter ) *
cosMassCutEllipseAngle +
( nucleusOutputParticleMass - massCutNOPCenter ) *
sinMassCutEllipseAngle, 2 ) / massCutOPWidth2 +
std::pow( - ( outputParticleMass - massCutOPCenter ) *
sinMassCutEllipseAngle +
( nucleusOutputParticleMass - massCutNOPCenter ) *
cosMassCutEllipseAngle, 2 ) / massCutNOPWidth2 <
1;
}
}
if ( useAbsorbedEnergyCut )
{
G4double cosAbsorbedEnergyCutEllipseAngle(
std::cos( absorbedEnergyCutEllipseAngle ) );
G4double sinAbsorbedEnergyCutEllipseAngle(
std::sin( absorbedEnergyCutEllipseAngle ) );
if ( absorbedEnergyCutCLWidth <= 0. || absorbedEnergyCutCRWidth <= 0. )
{
hasAbsorbedEnergyCutTriggered = false;
}
else
{
G4double absorbedEnergyCutCLWidth2(
absorbedEnergyCutCLWidth * absorbedEnergyCutCLWidth );
G4double absorbedEnergyCutCRWidth2(
absorbedEnergyCutCRWidth * absorbedEnergyCutCRWidth );
hasAbsorbedEnergyCutTriggered =
std::pow( ( calorimeterEDLeft - absorbedEnergyCutCLCenter ) *
cosAbsorbedEnergyCutEllipseAngle +
( calorimeterEDRight - absorbedEnergyCutCRCenter ) *
sinAbsorbedEnergyCutEllipseAngle, 2 ) /
absorbedEnergyCutCLWidth2 +
std::pow( - ( calorimeterEDLeft - absorbedEnergyCutCLCenter ) *
sinAbsorbedEnergyCutEllipseAngle +
( calorimeterEDRight - absorbedEnergyCutCRCenter ) *
cosAbsorbedEnergyCutEllipseAngle, 2 ) /
absorbedEnergyCutCRWidth2 <
1;
}
}
hasBasicTrigger = true;
}
G4bool CexmcChargeExchangeReconstructor::HasFullTrigger( void ) const
{
if ( ! hasBasicTrigger )
return false;
if ( useMassCut && ! hasMassCutTriggered )
return false;
if ( useAbsorbedEnergyCut && ! hasAbsorbedEnergyCutTriggered )
return false;
return true;
}
@@ -0,0 +1,306 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcChargeExchangeReconstructorMessenger.cc
*
* Description: charge exchange reconstructor messenger
*
* Version: 1.0
* Created: 14.12.2009 17:53:33
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#include <G4UIcmdWithABool.hh>
#include <G4UIcmdWithADoubleAndUnit.hh>
#include "CexmcChargeExchangeReconstructorMessenger.hh"
#include "CexmcChargeExchangeReconstructor.hh"
#include "CexmcMessenger.hh"
CexmcChargeExchangeReconstructorMessenger::
CexmcChargeExchangeReconstructorMessenger(
CexmcChargeExchangeReconstructor * reconstructor ) :
reconstructor( reconstructor ), useTableMass( NULL ),
useMassCut( NULL ), mCutOPCenter( NULL ), mCutNOPCenter( NULL ),
mCutOPWidth( NULL ), mCutNOPWidth( NULL ), mCutAngle( NULL ),
useAbsorbedEnergyCut( NULL ), aeCutCLCenter( NULL ),
aeCutCRCenter( NULL ), aeCutCLWidth( NULL ), aeCutCRWidth( NULL ),
aeCutAngle( NULL )
{
useTableMass = new G4UIcmdWithABool(
( CexmcMessenger::reconstructorDirName + "useTableMass" ).c_str(),
this );
useTableMass->SetGuidance( "\n If true then reconstructor will use "
"table mass of output\n particle when building output particle "
"energy,\n otherwise reconstructed mass will be used" );
useTableMass->SetParameterName( "UseTableMass", false );
useTableMass->SetDefaultValue( false );
useTableMass->AvailableForStates( G4State_PreInit, G4State_Idle );
useMassCut = new G4UIcmdWithABool(
( CexmcMessenger::reconstructorDirName + "useMassCut" ).c_str(), this );
useMassCut->SetGuidance( "\n Use elliptical cut for masses of output "
"particle\n and nucleus output particle" );
useMassCut->SetParameterName( "UseMassCut", false );
useMassCut->SetDefaultValue( false );
useMassCut->AvailableForStates( G4State_PreInit, G4State_Idle );
mCutOPCenter = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "mCutOPCenter" ).c_str(),
this );
mCutOPCenter->SetGuidance( "Center of the ellipse in output particle mass "
"coordinate" );
mCutOPCenter->SetParameterName( "MCutOPCenter", false );
mCutOPCenter->SetDefaultValue( reconstructor->GetProductionModelData().
outputParticle->GetPDGMass() );
mCutOPCenter->SetDefaultUnit( "MeV" );
mCutOPCenter->SetUnitCandidates( "eV keV MeV GeV" );
mCutOPCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
mCutNOPCenter = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "mCutNOPCenter" ).c_str(),
this );
mCutNOPCenter->SetGuidance( "Center of the ellipse in nucleus output "
"particle mass\n coordinate" );
mCutNOPCenter->SetParameterName( "MCutNOPCenter", false );
mCutNOPCenter->SetDefaultValue( reconstructor->GetProductionModelData().
nucleusOutputParticle->GetPDGMass() );
mCutNOPCenter->SetDefaultUnit( "MeV" );
mCutNOPCenter->SetUnitCandidates( "eV keV MeV GeV" );
mCutNOPCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
mCutOPWidth = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "mCutOPWidth" ).c_str(),
this );
mCutOPWidth->SetGuidance( "Width of the ellipse in output particle mass "
"coordinate" );
mCutOPWidth->SetParameterName( "MCutOPWidth", false );
mCutOPWidth->SetDefaultValue( reconstructor->GetProductionModelData().
outputParticle->GetPDGMass() * 0.1 );
mCutOPWidth->SetDefaultUnit( "MeV" );
mCutOPWidth->SetUnitCandidates( "eV keV MeV GeV" );
mCutOPWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
mCutNOPWidth = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "mCutNOPWidth" ).c_str(),
this );
mCutNOPWidth->SetGuidance( "Width of the ellipse in nucleus output "
"particle mass\n coordinate" );
mCutNOPWidth->SetParameterName( "MCutNOPWidth", false );
mCutNOPWidth->SetDefaultValue( reconstructor->GetProductionModelData().
nucleusOutputParticle->GetPDGMass() * 0.1 );
mCutNOPWidth->SetDefaultUnit( "MeV" );
mCutNOPWidth->SetUnitCandidates( "eV keV MeV GeV" );
mCutNOPWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
mCutAngle = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "mCutAngle" ).c_str(),
this );
mCutAngle->SetGuidance( "Angle of the ellipse" );
mCutAngle->SetParameterName( "MCutAngle", false );
mCutAngle->SetDefaultValue( 0 );
mCutAngle->SetDefaultUnit( "deg" );
mCutAngle->SetUnitCandidates( "deg rad" );
mCutAngle->AvailableForStates( G4State_PreInit, G4State_Idle );
useAbsorbedEnergyCut = new G4UIcmdWithABool(
( CexmcMessenger::reconstructorDirName + "useAbsorbedEnergyCut" ).
c_str(), this );
useAbsorbedEnergyCut->SetGuidance( "Use elliptical cut for absorbed "
"energies in\n calorimeters" );
useAbsorbedEnergyCut->SetParameterName( "UseAbsorbedEnergyCut", false );
useAbsorbedEnergyCut->SetDefaultValue( false );
useAbsorbedEnergyCut->AvailableForStates( G4State_PreInit, G4State_Idle );
aeCutCLCenter = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "aeCutCLCenter" ).c_str(),
this );
aeCutCLCenter->SetGuidance( "Center of the ellipse in left calorimeter"
"\n absorbed energy coordinate" );
aeCutCLCenter->SetParameterName( "AECutCLCenter", false );
aeCutCLCenter->SetDefaultValue( 0 );
aeCutCLCenter->SetDefaultUnit( "MeV" );
aeCutCLCenter->SetUnitCandidates( "eV keV MeV GeV" );
aeCutCLCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
aeCutCRCenter = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "aeCutCRCenter" ).c_str(),
this );
aeCutCRCenter->SetGuidance( "Center of the ellipse in right calorimeter"
"\n absorbed energy coordinate" );
aeCutCRCenter->SetParameterName( "AECutCRCenter", false );
aeCutCRCenter->SetDefaultValue( 0 );
aeCutCRCenter->SetDefaultUnit( "MeV" );
aeCutCRCenter->SetUnitCandidates( "eV keV MeV GeV" );
aeCutCRCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
aeCutCLWidth = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "aeCutCLWidth" ).c_str(),
this );
aeCutCLWidth->SetGuidance( "Width of the ellipse in left calorimeter"
"\n absorbed energy coordinate" );
aeCutCLWidth->SetParameterName( "AECutCLWidth", false );
aeCutCLWidth->SetDefaultValue( 0 );
aeCutCLWidth->SetDefaultUnit( "MeV" );
aeCutCLWidth->SetUnitCandidates( "eV keV MeV GeV" );
aeCutCLWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
aeCutCRWidth = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "aeCutCRWidth" ).c_str(),
this );
aeCutCRWidth->SetGuidance( "Width of the ellipse in right calorimeter"
"\n absorbed energy coordinate" );
aeCutCRWidth->SetParameterName( "AECutCRWidth", false );
aeCutCRWidth->SetDefaultValue( 0 );
aeCutCRWidth->SetDefaultUnit( "MeV" );
aeCutCRWidth->SetUnitCandidates( "eV keV MeV GeV" );
aeCutCRWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
aeCutAngle = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "aeCutAngle" ).c_str(),
this );
aeCutAngle->SetGuidance( "Angle of the ellipse" );
aeCutAngle->SetParameterName( "AECutAngle", false );
aeCutAngle->SetDefaultValue( 0 );
aeCutAngle->SetDefaultUnit( "deg" );
aeCutAngle->SetUnitCandidates( "deg rad" );
aeCutAngle->AvailableForStates( G4State_PreInit, G4State_Idle );
}
CexmcChargeExchangeReconstructorMessenger::
~CexmcChargeExchangeReconstructorMessenger()
{
delete useTableMass;
delete useMassCut;
delete mCutOPCenter;
delete mCutNOPCenter;
delete mCutOPWidth;
delete mCutNOPWidth;
delete mCutAngle;
delete useAbsorbedEnergyCut;
delete aeCutCLCenter;
delete aeCutCRCenter;
delete aeCutCLWidth;
delete aeCutCRWidth;
delete aeCutAngle;
}
void CexmcChargeExchangeReconstructorMessenger::SetNewValue(
G4UIcommand * cmd, G4String value )
{
do
{
if ( cmd == useTableMass )
{
reconstructor->UseTableMass(
G4UIcmdWithABool::GetNewBoolValue( value ) );
break;
}
if ( cmd == useMassCut )
{
reconstructor->UseMassCut(
G4UIcmdWithABool::GetNewBoolValue( value ) );
break;
}
if ( cmd == mCutOPCenter )
{
reconstructor->SetMassCutOPCenter(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == mCutNOPCenter )
{
reconstructor->SetMassCutNOPCenter(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == mCutOPWidth )
{
reconstructor->SetMassCutOPWidth(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == mCutNOPWidth )
{
reconstructor->SetMassCutNOPWidth(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == mCutAngle )
{
reconstructor->SetMassCutEllipseAngle(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == useAbsorbedEnergyCut )
{
reconstructor->UseAbsorbedEnergyCut(
G4UIcmdWithABool::GetNewBoolValue( value ) );
break;
}
if ( cmd == aeCutCLCenter )
{
reconstructor->SetAbsorbedEnergyCutCLCenter(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == aeCutCRCenter )
{
reconstructor->SetAbsorbedEnergyCutCRCenter(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == aeCutCLWidth )
{
reconstructor->SetAbsorbedEnergyCutCLWidth(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == aeCutCRWidth )
{
reconstructor->SetAbsorbedEnergyCutCRWidth(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == aeCutAngle )
{
reconstructor->SetAbsorbedEnergyCutEllipseAngle(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
} while ( false );
}
@@ -0,0 +1,52 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcCommon.cc
*
* Description: global objects etc.
*
* Version: 1.0
* Created: 03.12.2009 22:19:20
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#include <G4Allocator.hh>
#include "CexmcTrackPointInfo.hh"
#include "CexmcEnergyDepositStore.hh"
#include "CexmcTrackPointsStore.hh"
G4Allocator< CexmcTrackPointInfo > trackPointInfoAllocator;
G4Allocator< CexmcEnergyDepositStore > energyDepositStoreAllocator;
G4Allocator< CexmcTrackPointsStore > trackPointsStoreAllocator;
@@ -0,0 +1,207 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcCustomFilter.cc
*
* Description: custom filter grammar and compiler
*
* Version: 1.0
* Created: 17.07.2010 15:37:38
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifdef CEXMC_USE_CUSTOM_FILTER
#include "CexmcCustomFilter.hh"
namespace CexmcCustomFilter
{
void Compiler::operator()( ParseResult & parseResult, Action value )
const
{
parseResult.action = value;
}
void Compiler::operator()( ParseResult & parseResult, Subtree & value )
const
{
parseResult.expression = value;
}
void Compiler::operator()( Subtree & ast, Node & node ) const
{
try
{
ast = boost::get< Subtree >( node );
}
catch( const boost::bad_get & )
{
ast.type = Operator( Top );
ast.children.push_back( node );
}
}
void Compiler::operator()( Node & self, Node & left, Node & right,
Operator value ) const
{
Subtree & ast( boost::get< Subtree >( self ) );
ast.children.push_back( left );
ast.type = value;
Subtree * astRight( boost::get< Subtree >( &right ) );
if ( ! astRight )
{
ast.children.push_back( right );
return;
}
bool haveSamePriorities( false );
Operator * rightOp( boost::get< Operator >( &astRight->type ) );
if ( rightOp )
haveSamePriorities = value.priority == rightOp->priority;
if ( value.hasRLAssoc || ! haveSamePriorities )
{
ast.children.push_back( right );
return;
}
Subtree * astDeepestRight( astRight );
/* propagate left binary operators with LR associativity (i.e. all in
* our grammar) deep into the AST until any operator with a different
* priority (which includes operators in parentheses that have priority
* 0) or a unary operator or a function occured */
while ( true )
{
Subtree * candidate = boost::get< Subtree >(
&astDeepestRight->children[ 0 ] );
if ( ! candidate )
break;
if ( candidate->children.size() < 2 )
break;
bool haveSamePriorities( false );
Operator * candidateOp( boost::get< Operator >(
&candidate->type ) );
if ( candidateOp )
haveSamePriorities = value.priority == candidateOp->priority;
/* FIXME: what to do if candidate has RL association? Our grammar is
* not a subject of this issue; probably no grammar is a subject */
if ( ! haveSamePriorities )
break;
astDeepestRight = candidate;
}
Subtree astResult;
astResult.children.push_back( ast.children[ 0 ] );
astResult.children.push_back( astDeepestRight->children[ 0 ] );
astResult.type = value;
astDeepestRight->children[ 0 ] = astResult;
self = right;
}
void Compiler::operator()( Node & self, Node & child, Operator value )
const
{
Subtree & ast( boost::get< Subtree >( self ) );
ast.children.push_back( child );
ast.type = value;
}
void Compiler::operator()( Node & self, Node & primary ) const
{
self = primary;
Subtree * ast( boost::get< Subtree >( &self ) );
if ( ! ast )
return;
Operator * op( boost::get< Operator >( &ast->type ) );
if ( op )
op->priority = 0;
}
void Compiler::operator()( Node & self, Node & child,
std::string & value ) const
{
Subtree & ast( boost::get< Subtree >( self ) );
ast.children.push_back( child );
ast.type = value;
}
void Compiler::operator()( Leaf & self, std::string & name ) const
{
Variable & variable( boost::get< Variable >( self ) );
variable.name = name;
}
void Compiler::operator()( Leaf & self, int value, size_t index ) const
{
Variable & variable( boost::get< Variable >( self ) );
switch ( index )
{
case 0 :
variable.index1 = value;
break;
case 1 :
variable.index2 = value;
break;
default :
break;
}
}
}
#endif
@@ -0,0 +1,183 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcCustomFilterEval.cc
*
* Description: custom filter eval
*
* Version: 1.0
* Created: 17.07.2010 15:46:01
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifdef CEXMC_USE_CUSTOM_FILTER
#include <fstream>
#include <string>
#include "CexmcCustomFilterEval.hh"
#include "CexmcException.hh"
CexmcCustomFilterEval::CexmcCustomFilterEval( const G4String & sourceFileName,
const CexmcEventFastSObject * evFastSObject,
const CexmcEventSObject * evSObject ) :
astEval( evFastSObject, evSObject )
{
std::string command;
std::ifstream sourceFile( sourceFileName );
if ( ! sourceFile )
throw CexmcException( CexmcCFBadSource );
while ( ! sourceFile.eof() )
{
std::string line;
std::getline( sourceFile, line );
size_t commentStartPos( line.find_first_of( '#' ) );
if ( commentStartPos != std::string::npos )
line.erase( commentStartPos );
command += line;
if ( ! command.empty() )
{
size_t length( command.length() );
if ( command[ length - 1 ] == '\\' )
{
command.erase( length - 1 );
continue;
}
CexmcCustomFilter::ParseResult curParseResult;
std::string::const_iterator begin( command.begin() );
std::string::const_iterator end( command.end() );
try
{
if ( ! CexmcCustomFilter::phrase_parse( begin, end, grammar,
CexmcCustomFilter::space, curParseResult ) ||
begin != end )
{
throw CexmcException( CexmcCFParseError );
}
}
catch ( ... )
{
sourceFile.close();
throw;
}
#ifdef CEXMC_DEBUG_CF
G4cout << "Parsed expression AST:" << G4endl;
curParseResult.expression.Print();
#endif
switch ( curParseResult.action )
{
case CexmcCustomFilter::KeepTPT :
case CexmcCustomFilter::DeleteTPT :
parseResultTPT.push_back( curParseResult );
break;
case CexmcCustomFilter::KeepEDT :
case CexmcCustomFilter::DeleteEDT :
parseResultEDT.push_back( curParseResult );
break;
default :
break;
}
}
command = "";
}
sourceFile.close();
}
void CexmcCustomFilterEval::SetAddressedData(
const CexmcEventFastSObject * evFastSObject,
const CexmcEventSObject * evSObject )
{
astEval.SetAddressedData( evFastSObject, evSObject );
for ( ParseResultVector::iterator k( parseResultTPT.begin() );
k != parseResultTPT.end(); ++k )
{
if ( evFastSObject == NULL || evSObject == NULL )
astEval.ResetAddressBinding( k->expression );
else
astEval.BindAddresses( k->expression );
}
for ( ParseResultVector::iterator k( parseResultEDT.begin() );
k != parseResultEDT.end(); ++k )
{
if ( evFastSObject == NULL || evSObject == NULL )
astEval.ResetAddressBinding( k->expression );
else
astEval.BindAddresses( k->expression );
}
}
bool CexmcCustomFilterEval::EvalTPT( void ) const
{
for ( ParseResultVector::const_iterator k( parseResultTPT.begin() );
k != parseResultTPT.end(); ++k )
{
if ( astEval( k->expression ) )
return k->action == CexmcCustomFilter::KeepTPT;
}
return true;
}
bool CexmcCustomFilterEval::EvalEDT( void ) const
{
for ( ParseResultVector::const_iterator k( parseResultEDT.begin() );
k != parseResultEDT.end(); ++k )
{
if ( astEval( k->expression ) )
return k->action == CexmcCustomFilter::KeepEDT;
}
return true;
}
#endif
@@ -0,0 +1,362 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcEnergyDepositDigitizer.cc
*
* Description: digitizes of energy deposit in a single event
*
* Version: 1.0
* Created: 23.11.2009 14:39:41
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#include <iostream>
#include <iomanip>
#include <G4DigiManager.hh>
#include <G4String.hh>
#include <Randomize.hh>
#include "CexmcEnergyDepositDigitizer.hh"
#include "CexmcEnergyDepositDigitizerMessenger.hh"
#include "CexmcSimpleEnergyDeposit.hh"
#include "CexmcEnergyDepositInLeftRightSet.hh"
#include "CexmcEnergyDepositInCalorimeter.hh"
#include "CexmcSetup.hh"
#include "CexmcRunManager.hh"
#include "CexmcSensitiveDetectorsAttributes.hh"
#include "CexmcCommon.hh"
CexmcEnergyDepositDigitizer::CexmcEnergyDepositDigitizer(
const G4String & name ) :
G4VDigitizerModule( name ), monitorED( 0 ),
vetoCounterEDLeft( 0 ), vetoCounterEDRight( 0 ),
calorimeterEDLeft( 0 ), calorimeterEDRight( 0 ),
calorimeterEDLeftMaxX( 0 ), calorimeterEDLeftMaxY( 0 ),
calorimeterEDRightMaxX( 0 ), calorimeterEDRightMaxY( 0 ),
monitorHasTriggered( false ), hasTriggered( false ),
monitorEDThreshold( 0 ),
vetoCounterEDLeftThreshold( 0 ), vetoCounterEDRightThreshold( 0 ),
calorimeterEDLeftThreshold( 0 ), calorimeterEDRightThreshold( 0 ),
calorimeterTriggerAlgorithm( CexmcAllCrystalsMakeEDTriggerThreshold ),
outerCrystalsVetoAlgorithm( CexmcNoOuterCrystalsVeto ),
outerCrystalsVetoFraction( 0 ), monitorEDThresholdRef( 0 ),
vetoCounterEDLeftThresholdRef( 0 ), vetoCounterEDRightThresholdRef( 0 ),
calorimeterEDLeftThresholdRef( 0 ), calorimeterEDRightThresholdRef( 0 ),
calorimeterTriggerAlgorithmRef( CexmcAllCrystalsMakeEDTriggerThreshold ),
outerCrystalsVetoAlgorithmRef( CexmcNoOuterCrystalsVeto ),
outerCrystalsVetoFractionRef( 0 ), nCrystalsInColumn( 1 ),
nCrystalsInRow( 1 ), applyFiniteCrystalResolution( false ),
messenger( NULL )
{
G4RunManager * runManager( G4RunManager::GetRunManager() );
const CexmcSetup * setup( static_cast< const CexmcSetup * >(
runManager->GetUserDetectorConstruction() ) );
const CexmcSetup::CalorimeterGeometryData & calorimeterGeometry(
setup->GetCalorimeterGeometry() );
nCrystalsInColumn = calorimeterGeometry.nCrystalsInColumn;
nCrystalsInRow = calorimeterGeometry.nCrystalsInRow;
if ( nCrystalsInColumn > 0 )
{
calorimeterEDLeftCollection.resize( nCrystalsInColumn );
calorimeterEDRightCollection.resize( nCrystalsInColumn );
}
if ( nCrystalsInRow > 0 )
{
for ( CexmcEnergyDepositCalorimeterCollection::iterator
k( calorimeterEDLeftCollection.begin() );
k != calorimeterEDLeftCollection.end(); ++k )
{
k->resize( nCrystalsInRow );
}
for ( CexmcEnergyDepositCalorimeterCollection::iterator
k( calorimeterEDRightCollection.begin() );
k != calorimeterEDRightCollection.end(); ++k )
{
k->resize( nCrystalsInRow );
}
}
messenger = new CexmcEnergyDepositDigitizerMessenger( this );
}
CexmcEnergyDepositDigitizer::~CexmcEnergyDepositDigitizer()
{
delete messenger;
}
void CexmcEnergyDepositDigitizer::InitializeData( void )
{
monitorED = 0;
vetoCounterEDLeft = 0;
vetoCounterEDRight = 0;
calorimeterEDLeft = 0;
calorimeterEDRight = 0;
calorimeterEDLeftMaxX = 0;
calorimeterEDLeftMaxY = 0;
calorimeterEDRightMaxX = 0;
calorimeterEDRightMaxY = 0;
monitorHasTriggered = false;
hasTriggered = false;
for ( CexmcEnergyDepositCalorimeterCollection::iterator
k( calorimeterEDLeftCollection.begin() );
k != calorimeterEDLeftCollection.end(); ++k )
{
for ( CexmcEnergyDepositCrystalRowCollection::iterator
l( k->begin() ); l != k->end(); ++l )
{
*l = 0;
}
}
for ( CexmcEnergyDepositCalorimeterCollection::iterator
k( calorimeterEDRightCollection.begin() );
k != calorimeterEDRightCollection.end(); ++k )
{
for ( CexmcEnergyDepositCrystalRowCollection::iterator
l( k->begin() ); l != k->end(); ++l )
{
*l = 0;
}
}
}
void CexmcEnergyDepositDigitizer::Digitize( void )
{
InitializeData();
G4DigiManager * digiManager( G4DigiManager::GetDMpointer() );
G4int hcId( digiManager->GetHitsCollectionID(
CexmcDetectorRoleName[ CexmcMonitorDetectorRole ] +
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] ) );
const CexmcEnergyDepositCollection *
hitsCollection( static_cast< const CexmcEnergyDepositCollection* >(
digiManager->GetHitsCollection( hcId ) ) );
if ( hitsCollection )
{
/* it always must have index 0 */
if ( ( *hitsCollection )[ 0 ] )
monitorED = *( *hitsCollection )[ 0 ];
}
hcId = digiManager->GetHitsCollectionID(
CexmcDetectorRoleName[ CexmcVetoCounterDetectorRole ] +
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] );
hitsCollection = static_cast< const CexmcEnergyDepositCollection* >(
digiManager->GetHitsCollection( hcId ) );
if ( hitsCollection )
{
for ( std::map< G4int, G4double* >::iterator
k( hitsCollection->GetMap()->begin() );
k != hitsCollection->GetMap()->end(); ++k )
{
G4int index( k->first );
CexmcSide side( CexmcEnergyDepositInLeftRightSet::GetSide(
index ) );
switch ( side )
{
case CexmcLeft :
vetoCounterEDLeft = *k->second;
break;
case CexmcRight :
vetoCounterEDRight = *k->second;
break;
default :
break;
}
}
}
G4double maxEDCrystalLeft( 0 );
G4double maxEDCrystalRight( 0 );
G4double outerCrystalsEDLeft( 0 );
G4double outerCrystalsEDRight( 0 );
G4double innerCrystalsEDLeft( 0 );
G4double innerCrystalsEDRight( 0 );
CexmcRunManager * runManager( static_cast< CexmcRunManager * >(
G4RunManager::GetRunManager() ) );
hcId = digiManager->GetHitsCollectionID(
CexmcDetectorRoleName[ CexmcCalorimeterDetectorRole ] +
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] );
hitsCollection = static_cast< const CexmcEnergyDepositCollection* >(
digiManager->GetHitsCollection( hcId ) );
if ( hitsCollection )
{
for ( std::map< G4int, G4double* >::iterator
k( hitsCollection->GetMap()->begin() );
k != hitsCollection->GetMap()->end(); ++k )
{
G4int index( k->first );
CexmcSide side( CexmcEnergyDepositInLeftRightSet::GetSide(
index ) );
G4int row( CexmcEnergyDepositInCalorimeter::GetRow( index ) );
G4int column( CexmcEnergyDepositInCalorimeter::GetColumn(
index ) );
G4double value( *k->second );
if ( applyFiniteCrystalResolution && value > 0. &&
! runManager->ProjectIsRead() )
{
for ( CexmcEnergyRangeWithDoubleValueList::const_iterator
l( crystalResolutionData.begin() );
l != crystalResolutionData.end(); ++l )
{
if ( value < l->bottom || value >= l->top )
continue;
value = G4RandGauss::shoot( value,
value * l->value * CexmcFwhmToStddev );
if ( value < 0. )
value = 0.;
break;
}
}
switch ( side )
{
case CexmcLeft :
if ( value > maxEDCrystalLeft )
{
calorimeterEDLeftMaxX = column;
calorimeterEDLeftMaxY = row;
maxEDCrystalLeft = value;
}
if ( IsOuterCrystal( column, row ) )
{
outerCrystalsEDLeft += value;
}
else
{
innerCrystalsEDLeft += value;
}
calorimeterEDLeft += value;
calorimeterEDLeftCollection[ row ][ column ] = value;
break;
case CexmcRight :
if ( value > maxEDCrystalRight )
{
calorimeterEDRightMaxX = column;
calorimeterEDRightMaxY = row;
maxEDCrystalRight = value;
}
if ( IsOuterCrystal( column, row ) )
{
outerCrystalsEDRight += value;
}
else
{
innerCrystalsEDRight += value;
}
calorimeterEDRight += value;
calorimeterEDRightCollection[ row ][ column ] = value;
break;
default :
break;
}
}
}
G4double calorimeterEDLeftEffective( calorimeterEDLeft );
G4double calorimeterEDRightEffective( calorimeterEDRight );
if ( calorimeterTriggerAlgorithm ==
CexmcInnerCrystalsMakeEDTriggerThreshold )
{
calorimeterEDLeftEffective = innerCrystalsEDLeft;
calorimeterEDRightEffective = innerCrystalsEDRight;
}
monitorHasTriggered = monitorED >= monitorEDThreshold;
hasTriggered = monitorHasTriggered &&
vetoCounterEDLeft < vetoCounterEDLeftThreshold &&
vetoCounterEDRight < vetoCounterEDRightThreshold &&
calorimeterEDLeftEffective >= calorimeterEDLeftThreshold &&
calorimeterEDRightEffective >= calorimeterEDRightThreshold;
/* event won't trigger if outer crystals veto triggered */
if ( hasTriggered )
{
switch ( outerCrystalsVetoAlgorithm )
{
case CexmcNoOuterCrystalsVeto :
break;
case CexmcMaximumEDInASingleOuterCrystalVeto :
hasTriggered =
! IsOuterCrystal( calorimeterEDLeftMaxX,
calorimeterEDLeftMaxY ) &&
! IsOuterCrystal( calorimeterEDRightMaxX,
calorimeterEDRightMaxY );
break;
case CexmcFractionOfEDInOuterCrystalsVeto :
hasTriggered =
( ( outerCrystalsEDLeft / calorimeterEDLeft ) <
outerCrystalsVetoFraction ) &&
( ( outerCrystalsEDRight / calorimeterEDRight ) <
outerCrystalsVetoFraction );
break;
default :
break;
}
}
}
std::ostream & operator<<( std::ostream & out,
const CexmcEnergyDepositCalorimeterCollection & edCollection )
{
std::streamsize prec( out.precision() );
out.precision( 4 );
out << std::endl;
for ( CexmcEnergyDepositCalorimeterCollection::const_reverse_iterator
k( edCollection.rbegin() ); k != edCollection.rend(); ++k )
{
for ( CexmcEnergyDepositCrystalRowCollection::const_reverse_iterator
l( k->rbegin() ); l != k->rend(); ++l )
out << std::setw( 10 ) << *l;
out << std::endl;
}
out.precision( prec );
return out;
}
@@ -0,0 +1,372 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcEnergyDepositDigitizerMessenger.cc
*
* Description: energy deposit digitizer messenger
*
* Version: 1.0
* Created: 29.11.2009 19:07:05
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#include <G4UIcmdWithADouble.hh>
#include <G4UIcmdWithADoubleAndUnit.hh>
#include <G4UIcmdWithAString.hh>
#include <G4UIcmdWithABool.hh>
#include <G4UIcmdWith3Vector.hh>
#include <G4UIcmdWithoutParameter.hh>
#include "CexmcEnergyDepositDigitizer.hh"
#include "CexmcEnergyDepositDigitizerMessenger.hh"
#include "CexmcMessenger.hh"
#include "CexmcCommon.hh"
CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
CexmcEnergyDepositDigitizer * energyDepositDigitizer ) :
energyDepositDigitizer( energyDepositDigitizer ),
setMonitorThreshold( NULL ), setVetoCountersThreshold( NULL ),
setLeftVetoCounterThreshold( NULL ), setRightVetoCounterThreshold( NULL ),
setCalorimetersThreshold( NULL ), setLeftCalorimeterThreshold( NULL ),
setRightCalorimeterThreshold( NULL ),
setCalorimeterTriggerAlgorithm( NULL ),
setOuterCrystalsVetoAlgorithm( NULL ), setOuterCrystalsVetoFraction( NULL ),
applyFiniteCrystalResolution( NULL ), addCrystalResolutionRange( NULL ),
clearCrystalResolutionData( NULL )
{
setMonitorThreshold = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::monitorEDDirName + "threshold" ).c_str(), this );
setMonitorThreshold->SetGuidance( "Monitor trigger threshold" );
setMonitorThreshold->SetParameterName( "MonitorThreshold", false );
setMonitorThreshold->SetDefaultValue( 0 );
setMonitorThreshold->SetDefaultUnit( "MeV" );
setMonitorThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setMonitorThreshold->AvailableForStates( G4State_PreInit, G4State_Idle );
setVetoCountersThreshold = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::vetoCounterEDDirName + "threshold" ).c_str(),
this );
setVetoCountersThreshold->SetGuidance( "Veto counters trigger threshold" );
setVetoCountersThreshold->SetParameterName( "VetoCountersThreshold",
false );
setVetoCountersThreshold->SetDefaultValue( 0 );
setVetoCountersThreshold->SetDefaultUnit( "MeV" );
setVetoCountersThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setVetoCountersThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
setLeftVetoCounterThreshold = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::vetoCounterLeftEDDirName + "threshold" ).c_str(),
this );
setLeftVetoCounterThreshold->SetGuidance(
"Left veto counter trigger threshold" );
setLeftVetoCounterThreshold->SetParameterName( "LeftVetoCounterThreshold",
false );
setLeftVetoCounterThreshold->SetDefaultValue( 0 );
setLeftVetoCounterThreshold->SetDefaultUnit( "MeV" );
setLeftVetoCounterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setLeftVetoCounterThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
setRightVetoCounterThreshold = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::vetoCounterRightEDDirName + "threshold" ).c_str(),
this );
setRightVetoCounterThreshold->SetGuidance(
"Right veto counter trigger threshold" );
setRightVetoCounterThreshold->SetParameterName( "RightVetoCounterThreshold",
false );
setRightVetoCounterThreshold->SetDefaultValue( 0 );
setRightVetoCounterThreshold->SetDefaultUnit( "MeV" );
setRightVetoCounterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setRightVetoCounterThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
setCalorimetersThreshold = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::calorimeterEDDirName + "threshold" ).c_str(),
this );
setCalorimetersThreshold->SetGuidance( "Calorimeters trigger threshold" );
setCalorimetersThreshold->SetParameterName( "CalorimetersThreshold",
false );
setCalorimetersThreshold->SetDefaultValue( 0 );
setCalorimetersThreshold->SetDefaultUnit( "MeV" );
setCalorimetersThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setCalorimetersThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
setLeftCalorimeterThreshold = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::calorimeterLeftEDDirName + "threshold" ).c_str(),
this );
setLeftCalorimeterThreshold->SetGuidance(
"Left calorimeter trigger threshold" );
setLeftCalorimeterThreshold->SetParameterName( "LeftCalorimeterThreshold",
false );
setLeftCalorimeterThreshold->SetDefaultValue( 0 );
setLeftCalorimeterThreshold->SetDefaultUnit( "MeV" );
setLeftCalorimeterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setLeftCalorimeterThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
setRightCalorimeterThreshold = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::calorimeterRightEDDirName + "threshold" ).c_str(),
this );
setRightCalorimeterThreshold->SetGuidance(
"Right calorimeter trigger threshold" );
setRightCalorimeterThreshold->SetParameterName( "RightCalorimeterThreshold",
false );
setRightCalorimeterThreshold->SetDefaultValue( 0 );
setRightCalorimeterThreshold->SetDefaultUnit( "MeV" );
setRightCalorimeterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setRightCalorimeterThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
setCalorimeterTriggerAlgorithm = new G4UIcmdWithAString(
( CexmcMessenger::detectorDirName +
"calorimeterTriggerAlgorithm" ).c_str(), this );
setCalorimeterTriggerAlgorithm->SetGuidance( "\n"
" all - energy deposit in all crystals in a calorimeter\n"
" will be checked against calorimeter threshold "
"value,\n"
" inner - energy deposit in only inner crystals\n"
" will be checked against calorimeter threshold "
"value" );
setCalorimeterTriggerAlgorithm->SetParameterName(
"CalorimeterTriggerAlgorithm", false );
setCalorimeterTriggerAlgorithm->SetDefaultValue( "inner" );
setCalorimeterTriggerAlgorithm->SetCandidates( "all inner" );
setCalorimeterTriggerAlgorithm->AvailableForStates( G4State_PreInit,
G4State_Idle );
setOuterCrystalsVetoAlgorithm = new G4UIcmdWithAString(
( CexmcMessenger::detectorDirName +
"outerCrystalsVetoAlgorithm" ).c_str(), this );
setOuterCrystalsVetoAlgorithm->SetGuidance( "\n"
" none - events will not be rejected by any algorithm,\n"
" max - reject event trigger if crystal with maximum energy "
"\n deposit is one of outer crystals,\n"
" fraction - reject event trigger if energy deposit "
"fraction in\n outer crystals is more than "
"value of\n 'outerCrystalsVetoFraction'" );
setOuterCrystalsVetoAlgorithm->SetParameterName(
"OuterCrystalsVetoAlgorithm", false );
setOuterCrystalsVetoAlgorithm->SetDefaultValue( "none" );
setOuterCrystalsVetoAlgorithm->SetCandidates( "none max fraction" );
setOuterCrystalsVetoAlgorithm->AvailableForStates( G4State_PreInit,
G4State_Idle );
setOuterCrystalsVetoFraction = new G4UIcmdWithADouble(
( CexmcMessenger::detectorDirName +
"outerCrystalsVetoFraction" ).c_str(), this );
setOuterCrystalsVetoFraction->SetGuidance( "\n Fraction of whole energy "
"deposit in one calorimeter\n that belongs to outer crystals.\n"
" If 'outerCrystalsVetoAlgorithm' is 'fraction' and\n"
" the outer crystals energy deposit fraction exceeds "
"this\n value then event won't trigger" );
setOuterCrystalsVetoFraction->SetParameterName(
"OuterCrystalsVetoFraction", false );
setOuterCrystalsVetoFraction->SetDefaultValue( 0 );
setOuterCrystalsVetoFraction->AvailableForStates( G4State_PreInit,
G4State_Idle );
applyFiniteCrystalResolution = new G4UIcmdWithABool(
( CexmcMessenger::detectorDirName +
"applyFiniteCrystalResolution" ).c_str(), this );
applyFiniteCrystalResolution->SetGuidance( "\n Specify if finite "
"energy resolution of the crystals\n will be accounted" );
applyFiniteCrystalResolution->SetParameterName(
"ApplyFiniteCrystalResolution", false );
applyFiniteCrystalResolution->SetDefaultValue( false );
applyFiniteCrystalResolution->AvailableForStates( G4State_PreInit,
G4State_Idle );
addCrystalResolutionRange = new G4UIcmdWith3Vector(
( CexmcMessenger::detectorDirName +
"addCrystalResolutionRange" ).c_str(), this );
addCrystalResolutionRange->SetGuidance( "\n Add new energy range "
"(in GeV!) with fwhm percentage\n value of crystal resolution "
"in this range" );
addCrystalResolutionRange->SetParameterName(
"CrystalResolutionRangeBottom", "CrystalResolutionRangeTop",
"CrystalResolutionRangeValue", false );
addCrystalResolutionRange->SetRange( "CrystalResolutionRangeBottom >= 0. "
"&& CrystalResolutionRangeTop >= 0. && "
"CrystalResolutionRangeValue >= 0." );
addCrystalResolutionRange->AvailableForStates( G4State_PreInit,
G4State_Idle );
clearCrystalResolutionData = new G4UIcmdWithoutParameter(
( CexmcMessenger::detectorDirName +
"clearCrystalResolutionData" ).c_str(), this );
clearCrystalResolutionData->SetGuidance( "\n Clear all crystal "
"resolution ranges.\n Can be used to redefine crystal "
"resolution data" );
clearCrystalResolutionData->AvailableForStates( G4State_PreInit,
G4State_Idle );
}
CexmcEnergyDepositDigitizerMessenger::~CexmcEnergyDepositDigitizerMessenger()
{
delete setMonitorThreshold;
delete setVetoCountersThreshold;
delete setLeftVetoCounterThreshold;
delete setRightVetoCounterThreshold;
delete setCalorimetersThreshold;
delete setLeftCalorimeterThreshold;
delete setRightCalorimeterThreshold;
delete setCalorimeterTriggerAlgorithm;
delete setOuterCrystalsVetoAlgorithm;
delete setOuterCrystalsVetoFraction;
delete applyFiniteCrystalResolution;
delete addCrystalResolutionRange;
delete clearCrystalResolutionData;
}
void CexmcEnergyDepositDigitizerMessenger::SetNewValue( G4UIcommand * cmd,
G4String value )
{
do
{
if ( cmd == setMonitorThreshold )
{
energyDepositDigitizer->SetMonitorThreshold(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setVetoCountersThreshold )
{
energyDepositDigitizer->SetVetoCountersThreshold(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setLeftVetoCounterThreshold )
{
energyDepositDigitizer->SetVetoCounterLeftThreshold(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setRightVetoCounterThreshold )
{
energyDepositDigitizer->SetVetoCounterRightThreshold(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setCalorimetersThreshold )
{
energyDepositDigitizer->SetCalorimetersThreshold(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setLeftCalorimeterThreshold )
{
energyDepositDigitizer->SetCalorimeterLeftThreshold(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setRightCalorimeterThreshold )
{
energyDepositDigitizer->SetCalorimeterRightThreshold(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setCalorimeterTriggerAlgorithm )
{
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm(
CexmcAllCrystalsMakeEDTriggerThreshold );
do
{
if ( value == "inner" )
{
calorimeterTriggerAlgorithm =
CexmcInnerCrystalsMakeEDTriggerThreshold;
break;
}
} while ( false );
energyDepositDigitizer->SetCalorimeterTriggerAlgorithm(
calorimeterTriggerAlgorithm );
break;
}
if ( cmd == setOuterCrystalsVetoAlgorithm )
{
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm(
CexmcNoOuterCrystalsVeto );
do
{
if ( value == "max" )
{
outerCrystalsVetoAlgorithm =
CexmcMaximumEDInASingleOuterCrystalVeto;
break;
}
if ( value == "fraction" )
{
outerCrystalsVetoAlgorithm =
CexmcFractionOfEDInOuterCrystalsVeto;
break;
}
} while ( false );
energyDepositDigitizer->SetOuterCrystalsVetoAlgorithm(
outerCrystalsVetoAlgorithm );
break;
}
if ( cmd == setOuterCrystalsVetoFraction )
{
energyDepositDigitizer->SetOuterCrystalsVetoFraction(
G4UIcmdWithADouble::GetNewDoubleValue( value ) );
break;
}
if ( cmd == applyFiniteCrystalResolution )
{
energyDepositDigitizer->ApplyFiniteCrystalResolution(
G4UIcmdWithABool::GetNewBoolValue( value ) );
break;
}
if ( cmd == addCrystalResolutionRange )
{
G4ThreeVector vec( G4UIcmdWith3Vector::GetNew3VectorValue(
value ) );
G4double bottom( std::min( vec.x(), vec.y() ) );
G4double top( std::max( vec.x(), vec.y() ) );
energyDepositDigitizer->AddCrystalResolutionRange( bottom, top,
vec.z() );
break;
}
if ( cmd == clearCrystalResolutionData )
{
energyDepositDigitizer->ClearCrystalResolutionData();
break;
}
} while ( false );
}
@@ -0,0 +1,114 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcEnergyDepositInCalorimeter.cc
*
* Description: energy deposit scorer in calorimeters
*
* Version: 1.0
* Created: 14.11.2009 12:48:22
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#include <G4Step.hh>
#include <G4StepPoint.hh>
#include <G4VTouchable.hh>
#include <G4VPhysicalVolume.hh>
#include <G4NavigationHistory.hh>
#include <G4UnitsTable.hh>
#include "CexmcEnergyDepositInCalorimeter.hh"
#include "CexmcSetup.hh"
G4int CexmcEnergyDepositInCalorimeter::copyDepth1BitsOffset( 8 );
CexmcEnergyDepositInCalorimeter::CexmcEnergyDepositInCalorimeter(
const G4String & name, const CexmcSetup * setup ) :
CexmcEnergyDepositInLeftRightSet( name, setup )
{
}
G4int CexmcEnergyDepositInCalorimeter::GetIndex( G4Step * step )
{
G4int ret( 0 );
G4StepPoint * preStep( step->GetPreStepPoint() );
const G4VTouchable * touchable( preStep->GetTouchable() );
const G4NavigationHistory * navHistory( touchable->GetHistory() );
G4int navDepth( navHistory->GetDepth() );
G4VPhysicalVolume * pVolume( navHistory->GetVolume(
navDepth - 2 ) );
if ( setup->IsRightCalorimeter( pVolume ) )
ret |= 1 << leftRightBitsOffset;
ret |= touchable->GetReplicaNumber( 0 );
ret |= touchable->GetReplicaNumber( 1 ) << copyDepth1BitsOffset;
return ret;
}
void CexmcEnergyDepositInCalorimeter::PrintAll( void )
{
G4int nmbOfEntries( eventMap->entries() );
if ( nmbOfEntries == 0 )
return;
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << nmbOfEntries << G4endl;
for( std::map< G4int, G4double* >::iterator
itr( eventMap->GetMap()->begin() );
itr != eventMap->GetMap()->end(); ++itr )
{
G4bool isRightDetector( itr->first >> leftRightBitsOffset );
G4int index( itr->first &
( ( 1 << ( leftRightBitsOffset - 1 ) ) |
( ( 1 << ( leftRightBitsOffset - 1 ) ) - 1 ) ) );
G4int copyDepth1( index >> copyDepth1BitsOffset );
G4int copyDepth0( index &
( ( 1 << ( copyDepth1BitsOffset - 1 ) ) |
( ( 1 << ( copyDepth1BitsOffset - 1 ) ) - 1 ) ) );
const G4String detectorSide( isRightDetector ? "right" : "left" );
G4cout << " " << detectorSide << " detector, row " <<
copyDepth1 << ", column " << copyDepth0 << G4endl;
G4cout << " , energy deposit " <<
G4BestUnit( *( itr->second ), "Energy" ) << G4endl;
}
}
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcEnergyDepositInLeftRightSet.cc
*
* Description: energy deposit scorer in left/right detector sets
* (e.g. veto counters and calorimeters)
*
* Version: 1.0
* Created: 14.11.2009 12:48:22
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#include <G4Step.hh>
#include <G4StepPoint.hh>
#include <G4VTouchable.hh>
#include <G4VPhysicalVolume.hh>
#include <G4UnitsTable.hh>
#include "CexmcEnergyDepositInLeftRightSet.hh"
#include "CexmcSetup.hh"
G4int CexmcEnergyDepositInLeftRightSet::leftRightBitsOffset( 16 );
CexmcEnergyDepositInLeftRightSet::CexmcEnergyDepositInLeftRightSet(
const G4String & name, const CexmcSetup * setup ) :
CexmcSimpleEnergyDeposit( name ), setup( setup )
{
}
G4int CexmcEnergyDepositInLeftRightSet::GetIndex( G4Step * step )
{
G4int ret( 0 );
G4StepPoint * preStep( step->GetPreStepPoint() );
G4VPhysicalVolume * pVolume( preStep->GetPhysicalVolume() );
if ( setup->IsRightDetector( pVolume ) )
ret |= 1 << leftRightBitsOffset;
return ret;
}
void CexmcEnergyDepositInLeftRightSet::PrintAll( void )
{
G4int nmbOfEntries( eventMap->entries() );
if ( nmbOfEntries == 0 )
return;
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << nmbOfEntries << G4endl;
for( std::map< G4int, G4double* >::iterator
itr( eventMap->GetMap()->begin() );
itr != eventMap->GetMap()->end(); ++itr )
{
G4bool isRightDetector( itr->first >> leftRightBitsOffset );
const G4String detectorSide( isRightDetector ? "right" : "left" );
G4cout << " " << detectorSide << " detector" << G4endl;
G4cout << " , energy deposit " <<
G4BestUnit( *( itr->second ), "Energy" ) << G4endl;
}
}

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