Import Geant4 9.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:46:55 +02:00
parent 89a9605df1
commit b1eb5424d2
10957 changed files with 888481 additions and 160139 deletions
File diff suppressed because it is too large Load Diff
+41
View File
@@ -0,0 +1,41 @@
// $Id: Doxymain.h 55087 2011-11-16 10:11:00Z gcosmo $
/// \file Doxymain.h
/// \brief The main page for Geant4 Examples code documenation
/*! \mainpage Geant4 Examples
This module collects four sets of user examples aimed to demonstrate to
the user how to make correct use of the GEANT4 toolkit by implementing
in a correct way those user-classes which the user is supposed to
customize in order to define his/her own simulation setup.
The <b>"novice"</b> set of examples is oriented to novice users and covering all
possible general use-cases typical of an "application"-oriented kind of
development. As several examples in this "novice" set became too complicated,
a new <b>"basic"</b> set, covering the most typical use-cases of a Geant4 application
with keeping simplicity and ease of use, is provided and is going to replace
the "novice" set in future.
An <b>"extended"</b> set of examples require some additional
libraries besides of Geant4. This set covers some specific use cases
for actual detector simulation. An <b>"advanced"</b> set of examples covers
the use-cases typical of a "toolkit"-oriented kind of development,
where real complete applications for different simulation studies are
provided; may require additional third party products to be built.
Most of the examples can be run both in interactive and batch mode, and
input macro files (*.in) and reference output files (*.out) are provided.
Basic, novice and most of the extended examples are considered part of the
system testing suite for validation of the official releases of the
GEANT4 toolkit. Basic, novice and some of the extended and advanced
examples are also used as "acceptance"-tests for the release process.
See more on each examples category pages:
- \ref README_basic
- \ref README_extended
- <a href="http://geant4advancedexampleswg.wikispaces.com/ExamplesDocumentation">
Geant4 Advanced Examples </a>
*/
+160
View File
@@ -0,0 +1,160 @@
// $Id: Doxymodules_basic.h 55087 2011-11-16 10:11:00Z gcosmo $
// The example class categories definitions for Doxygen
/// \file Doxymodules_basic.h
/// \brief The page that defines the class groups for examples documentation
/** @defgroup basic basic
* Basic examples classes
* @{
*/
/** @} */
/** @defgroup B1 B1
* Example B1
* @ingroup basic
* @{
*/
class B1DetectorConstruction{};
class B1EventAction{};
class B1PrimaryGeneratorAction{};
class B1RunAction{};
class B1SteppingAction{};
/** @} */
/** @defgroup B2 B2
* Example B2
* @ingroup basic
* @{
*/
/** @defgroup B2a B2a
* Example B2a
* @ingroup B2
* @{
*/
class B2aDetectorConstruction{};
class B2aDetectorMessenger{};
class B2EventAction{};
class B2MagneticField{};
class B2PrimaryGeneratorAction{};
class B2RunAction{};
class B2TrackerHit{};
class B2TrackerSD{};
/** @} */
/** @defgroup B2b B2b
* Example B2b
* @ingroup B2
* @{
*/
class B2bChamberParameterisation{};
class B2bDetectorConstruction{};
class B2bDetectorMessenger{};
class B2EventAction{};
class B2MagneticField{};
class B2PrimaryGeneratorAction{};
class B2RunAction{};
class B2TrackerHit{};
class B2TrackerSD{};
/** @} */
/** @} */
/** @defgroup B3 B3
* Example B3
* @ingroup basic
* @{
*/
class B3DetectorConstruction{};
class B3EventAction{};
class B3PhysicsList{};
class B3PrimaryGeneratorAction{};
class B3StackingAction{};
class B3RunAction{};
/** @} */
/** @defgroup B4 B4
* Example B4
* @ingroup basic
* @{
*/
/** @} */
/** @defgroup B4a B4a
* Example B4a
* @ingroup B4
* @{
*/
class B4aEventAction{};
class B4aEventActionMessenger{};
class B4aSteppingAction{};
class B4DetectorConstruction{};
class B4DetectorMessenger{};
class B4PrimaryGeneratorAction{};
class B4RunAction{};
/** @} */
/** @} */
/** @defgroup B4b B4b
* Example B4b
* @ingroup B4
* @{
*/
class B4bEventAction{};
class B4bEventActionMessenger{};
class B4bRunData{};
class B4bSteppingAction{};
class B4DetectorConstruction{};
class B4DetectorMessenger{};
class B4PrimaryGeneratorAction{};
class B4RunAction{};
/** @} */
/** @defgroup B4c B4c
* Example B4c
* @ingroup B4
* @{
*/
class B4cDetectorConstruction{};
class B4cDetectorMessenger{};
class B4cCalorHit{};
class B4cCalorimeterSD{};
class B4cEventAction{};
class B4cEventActionMessenger{};
class B4PrimaryGeneratorAction{};
class B4RunAction{};
/** @} */
/** @} */
/** @defgroup B4d B4d
* Example B4d
* @ingroup B4
* @{
*/
class B4dDetectorConstruction{};
class B4dDetectorMessenger{};
class B4dEventAction{};
class B4dEventActionMessenger{};
class B4PrimaryGeneratorAction{};
class B4RunAction{};
/** @} */
/** @} */
+70
View File
@@ -0,0 +1,70 @@
// $Id: Doxymodules_common.h 55417 2011-11-23 11:19:12Z gcosmo $
// The example class categories definitions for Doxygen
/// \file Doxymodules_common.h
/// \brief The page that defines the class groups for examples documentation
/** @defgroup extended_common common
* Extended examples common classes
* @{
*/
/** @defgroup extended_common_analysis analysis
* The analysis classes of generic use in examples
* @ingroup extended_common
* @{
*/
class ExG4HbookAnalysisManager{};
/** @} */
/** @defgroup extended_common_detectorConstruction detectorConstruction
* The detector construction classes of generic use in examples
* @ingroup extended_common
* @{
*/
class ExG4DetectorConstruction01{};
class ExG4DetectorConstruction01Messenger{};
class ExG4DetectorConstruction02{};
class ExG4DetectorConstruction02Messenger{};
/** @} */
/** @defgroup extended_common_physicsList physicsList
* The primary generator classes of generic use in examples
* @ingroup extended_common
* @{
*/
class ExG4PhysicsList00{};
/** @} */
/** @defgroup extended_common_primaryGenerator primaryGenerator
* The primary generator classes of generic use in examples
* @ingroup extended_common
* @{
*/
class ExG4PrimaryGeneratorAction01{};
class ExG4PrimaryGeneratorAction02{};
/** @} */
/** @defgroup extended_common_userActions userActions
* The user action classes of generic use in examples
* @ingroup extended_common
* @{
*/
class ExG4EventAction01{};
class ExG4EventAction01Messenger{};
class ExG4RunAction01{};
class ExG4RunAction01Messenger{};
/** @} */
/** @} */
+70
View File
@@ -0,0 +1,70 @@
// $Id: Doxymodules_new.h 55087 2011-11-16 10:11:00Z gcosmo $
// The example class categories definitions for Doxygen
/// \file Doxymodules_new.h
/// \brief The page that defines the class groups for examples documentation
/** @defgroup extended_new new
* New extended examples classes
* @{
*/
/** @defgroup extended_new_decay decay
* The extended/decay classes
* @ingroup extended_new
* @{
*/
/** @defgroup extended_new_decay_pythia6Decayer pythia6Decayer
* The Example pythia6Decayer classes
* @ingroup extended_new_decay
* @{
*/
class G4Pythia6Decayer{};
class G4Pythia6DecayerMessenger{};
class P6DExtDecayerPhysics{};
class P6DPhysicsList{};
class Pythia6{};
/** @} */
/** @} */
/** @defgroup extended_new_geometry geometry
* The extended/geometry classes
* @ingroup extended_new
* @{
*/
/** @defgroup extended_new_geometry_transform transform
* The Example transform classes
* @ingroup extended_new_geometry
* @{
*/
class TrDetectorConstruction{};
class TrDetectorConstructionMessenger{};
/** @} */
/** @} */
/** @defgroup extended_new_materials materials
* The extended/materials classes
* @ingroup extended_new
* @{
*/
/** @defgroup extended_new_materials_mat01 mat01
* The Example mat01 classes
* @ingroup extended_new_materials
* @{
*/
class Mat01DetectorConstruction{};
/** @} */
/** @} */
/** @} */
+8
View File
@@ -0,0 +1,8 @@
#---Adding examples subdirectories explicitly-------
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
add_subdirectory(advanced)
add_subdirectory(basic)
add_subdirectory(extended)
add_subdirectory(novice)
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 1999/01/07 16:05:16 gunter Exp $
# $Id: GNUmakefile,v 1.1 1999-01-07 16:05:16 gunter Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
+147 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.163 2010/10/29 13:21:45 gcosmo Exp $
$Id: History,v 1.163 2010-10-29 13:21:45 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,152 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
2nd December 2011 Gabriele Cosmo (examples-V09-05-00)
- Updated reference outputs according to reference tag geant4-09-05-ref-00.
- Includes tags: air_shower-V09-04-01, dnaphysics-V09-04-08, eRosita-V09-04-01,
hadrontherapy-V09-04-08, iort_therapy-V09-04-08,
human_phantom-V09-04-04, medical_linac-V09-04-03,
nanobeam-V09-04-06, purtag-V09-04-01, XrayFluo-V09-04-05,
radioprotection-V09-04-02, exbasic-V09-04-05,
exbiasing-V09-04-04, excommon-V09-04-01, testem1-V09-04-05,
testem2-V09-04-07, testem3-V09-04-08, testem4-V09-04-01,
testem5-V09-04-10, testem6-V09-04-00, testem7-V09-04-12,
testem11-V09-04-07, testem12-V09-04-10, testem13-V09-04-02,
testem14-V09-04-03, testem15-V09-04-01, testem17-V09-04-02,
testem18-V09-04-04, exerrprop-V09-04-01, fieldex-V09-04-01,
g3tog4Tests-V09-04-01, olapex-V09-04-02, DICOM-V09-04-03,
exTransforms-V09-04-00, electronScattering-V09-04-07,
fano-V09-04-03, fano2-V09-04-03, gtherapy-V09-04-00,
LXe-V09-04-00, WLS-V09-04-03, G02-V09-04-01, G03-V09-04-00,
exgflash-V09-04-01, exradioactive-V09-04-00,
rdecay01-V09-04-06, rdecay02-V09-04-04, exnovice-V09-04-01,
example_RandE-V09-04-01, exampleRE04-V09-04-02,
exam-ext-vis-UVA-V09-04-00.
7th November 2011 Gabriele Cosmo (examples-V09-04-10)
- Updated reference outputs according to reference tag geant4-09-04-ref-10.
- Includes tags: ChargeExchangeMC-V09-04-05, hadrontherapy-V09-04-02,
exampleA01-V09-04-00, testem1-V09-04-04, testem2-V09-04-06,
testem3-V09-04-07, testem5-V09-04-10, testem7-V09-04-12,
testem9-V09-04-03, testem11-V09-04-06, testem12-V09-04-07,
electronScattering-V09-04-05, exampleES2-V09-04-04,
WLS-V09-04-02, exampleRE02-V09-04-00, exampleN06-V09-04-00.
7th October 2011 Gabriele Cosmo (examples-V09-04-09)
- Updated reference outputs according to reference tag geant4-09-04-ref-09.
- Includes tags: brachy-V09-04-01, gammaraytel-V09-04-03,
hadrontherapy-V09-04-01, microbeam-V09-04-04,
nanobeam-V09-04-05, ReverseMC01-V09-04-01, testem09-V09-04-02,
testem10-V09-04-00, testem17-V09-04-00, exerrprop-V09-04-00,
olapex-V09-04-00, DICOM-V09-04-02, G02-V09-04-00,
exampleRE01-V09-04-00, exampleN04-V09-04-01,
exampleN05-V09-04-02.
16th September 2011 Gabriele Cosmo (examples-V09-04-08)
- Updated reference outputs according to reference tag geant4-09-04-ref-08.
- Includes tags: dnaphysics-V09-04-07, microbeam-V09-04-01,
microdosimetry-V09-04-06, nanobeam-V09-04-04.
12th September 2011 Pere Mato
- Added CMakeLists.txt files for each example (novice, advade and externded)
- Fixed minor issues concetning the use of G4UI_USE macro in:
extended/hadronic/Hadr00/hadr00.cc, Hadr01/hadr01.cc, Hadr02/hadr02.cc,
extended/runAndEvent/RE01/exampleRE02.cc, extended/geometry/olap/olapex.cc,
extended/visualization/userVisAction/userVisAction.cc,
extended/polarisation/Pol01/pol01.cc, advanced/gammaray_telescope/GammaRayTel.cc
2nd August 2011 Gabriele Cosmo (examples-V09-04-07)
- Updated reference outputs according to reference tag geant4-09-04-ref-07.
- Includes tags: nanobeam-V09-04-01, exampleN04-V09-04-00.
30th June 2011 Gabriele Cosmo (examples-V09-04-06)
- Updated reference outputs according to reference tag geant4-09-04-ref-06.
- Includes tags: microbeam-V09-04-00, AnaEx01-V09-04-01, AnaEx02-V09-04-02,
testem1-V09-04-03, testem2-V09-04-05, testem3-V09-04-05,
testem4-V09-04-00, testem5-V09-04-09, testem7-V09-04-09,
testem9-V09-04-01, testem11-V09-04-05, testem12-V09-04-06,
testem13-V09-04-01, testem14-V09-04-02, testem18-V09-04-03,
exhadr02-V09-04-07, DICOM-V09-04-01, exampleES2-V09-04-01,
electronScattering-V09-04-03, fano-V09-04-02, fano2-V09-04-02,
exampleN02-V09-04-02, exampleN03-V09-04-04.
31st May 2011 Gabriele Cosmo (examples-V09-04-05)
- Updated reference outputs according to reference tag geant4-09-04-ref-05.
- Includes tags: microdosimetry-V09-04-03, nanobeam-V09-04-00, fano-V09-04-01,
testem0-V09-04-00, testem1-V09-04-02, testem2-V09-04-03,
testem3-V09-04-04, testem5-V09-04-08, testem7-V09-04-07,
testem11-V09-04-04, testem12-V09-04-05, testem13-V09-04-00,
testem15-V09-04-00, testem18-V09-04-02, mctruthex-V09-04-00,
exhadr02-V09-04-04, electronScattering-V09-04-02,
fano2-V09-04-01, rdecay01-V09-04-05, exampleN03-V09-04-03.
29th April 2011 Gabriele Cosmo (examples-V09-04-04)
- Updated reference outputs according to reference tag geant4-09-04-ref-04.
- Includes tags: dnaphysics-V09-04-03, microdosimetry-V09-04-01,
testem1-V09-04-01, testem2-V09-04-02, testem3-V09-04-03
testem5-V09-04-06, testem7-V09-04-06, testem11-V09-04-03,
testem12-V09-04-03, testem14-V09-04-01, exhadr01-V09-04-01,
exhadr02-V09-04-03, ParN02-V09-04-00, ParN04-V09-04-00,
rdecay01-V09-04-04, rdecay02-V09-04-02.
1st April 2011 Gabriele Cosmo (examples-V09-04-03)
- Updated reference outputs according to reference tag geant4-09-04-ref-03.
- Includes tags: microdosimetry-V09-04-00, testem2-V09-04-00, testem3-V09-04-01,
XrayFluo-V09-04-01, testem5-V09-04-05, testem7-V09-04-03,
testem11-V09-04-02, testem12-V09-04-02, exhadr01-V09-04-00,
exhadr02-V09-04-02, WLS-V09-04-00, rdecay02-V09-04-01.
3rd March 2011 Gabriele Cosmo (examples-V09-04-02)
- Updated reference outputs according to reference tag geant4-09-04-ref-02.
- Includes tags: dnaphysics-V09-04-02, AnaEx01-V09-04-00, AnaEx02-V09-04-01,
testem5-V09-04-02, testem7-V09-04-03, exgflash-V09-04-00,
particleGunExample-V09-04-00, rdecay01-V09-04-03,
exampleN02-V09-04-01, exampleN03-V09-04-01,
exampleN05-V09-04-01.
31st January 2011 Gabriele Cosmo (examples-V09-04-01)
- Updated reference outputs according to reference tag geant4-09-04-ref-01.
- Includes tags: air_shower-V09-04-00, ccal-V09-04-00, XrayFluo-V09-04-00,
lAr_calorimeter-V09-04-00, human_phantom-V09-04-00,
DMX-V09-04-00, ReverseMC01-V09-04-00, testem3-V09-04-00,
testem5-V09-04-00, testem7-V09-04-00, testem9-V09-04-00,
testem11-V09-04-00, testem12-V09-04-00, testem14-V09-04-00,
testem18-V09-04-00, electronScattering-V09-04-00,
exampleES2-V09-04-00, fano-V09-04-00, fano2-V09-04-00,
exampleP03-V09-04-00.
17th December 2010 Gabriele Cosmo (examples-V09-04-00)
- Updated reference outputs according to reference tag geant4-09-04-ref-00.
- Includes tags: air_shower-V09-03-01, amsEcal-V09-03-02, brachy-V09-03-05,
ChargeExchangeMC-V09-03-04, ccal-V09-03-02, eRosita-V09-03-09,
gammaraytel-V09-03-03, lAr_calorimeter-V09-03-01,
hadrontherapy-V09-03-16, human_phantom-V09-03-04,
medical_linac-V09-03-11, microbeam-V09-03-09,
microdosimetry-V09-03-10, nanobeam-V09-03-04, purtag-V09-03-02,
radioprotection-V09-03-03, Rich-V09-03-03, DMX-V09-03-02,
XrayFluo-V09-03-03, xraytel-V09-03-01, AnaEx01-V09-03-00,
exampleN03Con-V09-03-03, B02-V09-03-00, ReverseMC01-V09-03-04,
testem0-V09-03-05, testem1-V09-03-03, testem2-V09-03-05,
testem3-V09-03-06, testem4-V09-03-03, testem5-V09-03-04,
testem6-V09-03-05, testem7-V09-03-08, testem8-V09-03-07,
testem9-V09-03-05, testem11-V09-03-05, testem12-V09-03-05,
testem14-V09-03-05, testem15-V09-03-03, testem16-V09-03-04,
testem17-V09-03-03, testem18-V09-03-05, exgps-V09-03-05,
exHepMC-V09-03-03, monopole-V09-03-08, g3tog4Tests-V09-03-04,
olapex-V09-03-04, exhadr01-V09-03-10,
electronScattering-V09-03-07, exampleES2-V09-03-02,
fano-V09-03-05, fano2-V09-03-06, DICOM-V09-03-09,
gtherapy-V09-03-05, WLS-V09-03-04, MPI-V09-03-02,
ParN02-V09-03-01, ParN04-V09-03-02, exgflash-V09-03-03,
G01-V09-03-07, G02-V09-03-04, G03-V09-03-06, G04-V09-03-03,
exampleP01-V09-03-02, exampleP02-V09-03-02,
exampleP03-V09-03-03, expol01-V09-03-03, rdecay02-V09-03-04,
exampleRE01-V09-03-05, exampleRE02-V09-03-05,
exampleRE03-V09-03-01, exam-ext-vis-perps-V09-03-00,
exam-ext-vis-V09-03-00, exam-ext-vis-UVA-V09-03-02,
exampleN03-V09-03-05.
29th October 2010 Gabriele Cosmo (examples-V09-03-09)
- Updated reference outputs according to reference tag geant4-09-03-ref-09.
- Includes tags: microbeam-V09-03-07, microdosimetry-V09-03-07, exgps-V09-03-03,
+36 -6
View File
@@ -1,4 +1,4 @@
$Id: README,v 1.16 2010/11/29 10:34:36 gcosmo Exp $
$Id: README,v 1.16 2010-11-29 10:34:36 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -8,25 +8,52 @@ $Id: README,v 1.16 2010/11/29 10:34:36 gcosmo Exp $
Examples module
---------------
This module collects three sets of user examples aimed to demonstrate to
This module collects four sets of user examples aimed to demonstrate to
the user how to make correct use of the GEANT4 toolkit by implementing
in a correct way those user-classes which the user is supposed to
customize in order to define his/her own simulation setup.
One set of examples is oriented to "novice" users and covering all
The "novice" set of examples is oriented to novice users and covering all
possible general use-cases typical of an "application"-oriented kind of
development. An "extended" set of examples require some additional
development. As several examples in this "novice" set became too complicated,
a new "basic" set, covering the most typical use-cases of a Geant4 application
with keeping simplicity and ease of use, is provided and is going to replace
the "novice" set in future.
An "extended" set of examples require some additional
libraries besides of Geant4. This set covers some specific use cases
for actual detector simulation. An "advanced" set of examples covers
the use-cases typical of a "toolkit"-oriented kind of development,
where real complete applications for different simulation studies are
provided; may require additional third party products to be built.
Most of the examples can be run both in interactive and batch mode, and
input macro files (*.in) and reference output files (*.out) are provided.
Novice and most of the extended examples are considered part of the
Basic, novice and most of the extended examples are considered part of the
system testing suite for validation of the official releases of the
GEANT4 toolkit. Novice examples and some of the extended and advanced
GEANT4 toolkit. Basic, novice and some of the extended and advanced
examples are also used as "acceptance"-tests for the release process.
Basic examples
ExampleB1
- Simple geometry with a few solids
- Scoring total dose in a selected volume user action classes
ExampleB2
- Simplified tracker geometry with global constant magnetic field
- Scoring within tracker via G4 sensitive detector and hits
- Started from novice/N02 example
ExampleB3
- Simplified calorimeter crystals
- Radioactive source
- Scoring within Crystals via G4 scorers
ExampleB4
- Simplified calorimeter with layers of two materials
- Scoring within layers in four ways: via user actions (a), via user own
object (b), via G4 sensitive detector and hits (c) and via scorers (d)
Novice level examples
ExampleN01
- Mandatory user classes
@@ -56,6 +83,9 @@ Extended level examples
- Histogramming through the AIDA interface
biasing
- Examples of event biasing, scoring and reverse-MC
common
- A set of common classes which can be reused in other examples demonstrating
just a particular feature
electromagnetic
- Specific EM physics simulation with histogramming
errorpropagation
+8
View File
@@ -0,0 +1,8 @@
#---Add all subdirectories that contains a CMakeLists.txt file -------------------------------------
file(GLOB_RECURSE files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CMakeLists.txt)
foreach( file ${files} )
get_filename_component(path ${file} PATH)
if(path)
add_subdirectory(${path})
endif()
endforeach()
@@ -49,7 +49,6 @@
#include <boost/variant/get.hpp>
#endif
#endif
#include <G4Version.hh>
#include <G4UImanager.hh>
#include <G4String.hh>
#ifdef G4UI_USE
@@ -66,9 +65,7 @@
#include <G4VisExecutive.hh>
#endif
#include "CexmcRunManager.hh"
#ifdef CEXMC_USE_ROOT
#include "CexmcHistoManager.hh"
#endif
#include "CexmcSetup.hh"
#include "CexmcPhysicsList.hh"
#include "CexmcPhysicsManager.hh"
@@ -155,7 +152,7 @@ void printUsage( void )
}
G4bool parseArgs( int argc, char ** argv, CexmcCmdLineData & cmdLineData )
G4bool parseArgs( int argc, char ** argv, CexmcCmdLineData & cmdLineData )
{
if ( argc < 2 )
return false;
@@ -341,11 +338,10 @@ int main( int argc, char ** argv )
}
CexmcRunManager * runManager( NULL );
CexmcMessenger::Instance();
#ifdef G4VIS_USE
G4VisManager * visManager( NULL );
#endif
CexmcMessenger::Instance();
#ifdef CEXMC_USE_ROOT
CexmcHistoManager::Instance();
#endif
@@ -430,11 +426,7 @@ int main( int argc, char ** argv )
#ifdef G4VIS_USE
if ( cmdLineData.isInteractive )
{
#if G4VERSION_NUMBER < 940
visManager = new G4VisExecutive;
#else
visManager = new G4VisExecutive( CexmcVisManagerVerboseLevel );
#endif
visManager->Initialize();
}
#endif
@@ -452,9 +444,7 @@ int main( int argc, char ** argv )
cmdLineData.initMacro );
if ( cmdLineData.isInteractive )
{
productionModel->PrintInitialData();
}
#ifdef G4UI_USE
if ( cmdLineData.isInteractive )
@@ -462,7 +452,8 @@ int main( int argc, char ** argv )
if ( cmdLineData.startQtSession )
{
#ifdef G4UI_USE_QT
session = new G4UIQt( argc, argv );
/* no need to pass all command line options to QApplication */
session = new G4UIQt( 1, argv );
const G4String & guiMacroName( runManager->GetGuiMacroName() );
if ( guiMacroName != "" )
uiManager->ApplyCommand( "/control/execute " +
@@ -487,9 +478,7 @@ int main( int argc, char ** argv )
#ifdef CEXMC_USE_PERSISTENCY
if ( runManager->ProjectIsSaved() )
{
runManager->SaveProject();
}
#endif
}
catch ( CexmcException & e )
@@ -518,11 +507,10 @@ int main( int argc, char ** argv )
#ifdef CEXMC_USE_ROOT
CexmcHistoManager::Destroy();
#endif
CexmcMessenger::Destroy();
#ifdef G4VIS_USE
delete visManager;
#endif
CexmcMessenger::Destroy();
delete runManager;
#ifdef G4UI_USE
delete session;
@@ -32,14 +32,6 @@ 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`
@@ -60,6 +52,14 @@ ifeq ($(CEXMC_USE_GENBOD),yes)
endif
endif
ifdef BOOST_INCLUDE_PATH
CPPFLAGS += -I$(BOOST_INCLUDE_PATH)
endif
ifdef BOOST_LIBRARY_PATH
EXTRALIBS += -L$(BOOST_LIBRARY_PATH)
endif
ifeq ($(CEXMC_USE_PERSISTENCY),yes)
EXTRALIBS += -lboost_serialization
CPPFLAGS += -DCEXMC_USE_PERSISTENCY
+27 -8
View File
@@ -1,4 +1,4 @@
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
History File, 2010/11/18 G.A.P. Cirrone, Created
cirrone@lns.infn.it
-------------------------------------------------------------------------------
@@ -7,16 +7,35 @@ cirrone@lns.infn.it
History file of the ChargeExchangeMC application
====================================================
01.11.2011, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-04-05
- Header files added.
31.10.2011, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-04-04
- Minor revision and removal of no more used files.
31.10.2011, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-04-03
- A new framework for easy creation of various scene primitives
implemented. 3 primitives were added: center of the target mark,
auxiliary radial lines and inner crystals area highlights.
- New algorithms for energy deposit collection strategies added
- New reconstruction parameter added: expected momentum at the
center of the taget
- Calculation of physical values was significantly optimized
- Multiple optimizations and code cleanup
31.10.2011, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-04-02
- Minor revisions and code cleanup
23.11.2010, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-03-03
- Possibility to remove the boost dependence
- Documentation updated
- README updated
- Documentation updated
- README updated
18.11.2010, G.A.P.Cirrone & A.Radkov, Tag: ChargeExchangeMC-V09-03-02
- Corrected tag name erroneously assigned
- 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 & A.Radkov, Tag: ChargeExchangeMC-V09-04-01
- General code revision and update
18.11.2010, G.A.P. Cirrone, Tag: ChargeExchangeMC-V09-03-00
- First tag of the example
18.11.2010, G.A.P. Cirrone, Tag: ChargeExchangeMC-V09-04-00
- First tag of the example
+1 -3
View File
@@ -18,9 +18,7 @@ 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
with older versions of Geant4. 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
@@ -93,7 +93,7 @@ namespace CexmcAST
struct Variable
{
Variable() : index1 ( 0 ), index2( 0 ), addr( ( const int * ) NULL )
Variable() : index1( 0 ), index2( 0 ), addr( ( const int * ) NULL )
{}
std::string name;
@@ -123,7 +123,7 @@ namespace CexmcAST
struct Subtree
{
Subtree() : type ( Operator( Uninitialized ) )
Subtree() : type( Operator( Uninitialized ) )
{}
void Print( int level = 0 ) const;
@@ -60,11 +60,11 @@ class CexmcASTEval : public CexmcAST::BasicEval
{
private:
typedef boost::variant< const CexmcEnergyDepositCalorimeterCollection *,
const bool * > VarAddr;
const bool * > VarAddr;
typedef std::map< std::string, VarAddr > VarAddrMap;
typedef std::map< std::string, VarAddr > VarAddrMap;
typedef std::pair< std::string, VarAddr > VarAddrMapData;
typedef VarAddrMap::value_type VarAddrMapData;
public:
explicit CexmcASTEval(
@@ -88,7 +88,7 @@ CexmcChargeExchangeProductionModel< OutputParticle >::
outputParticle = OutputParticle::Definition();
nucleusOutputParticle = G4Neutron::Definition();
nucleusParticleMass = nucleusParticle->GetPDGMass();
nucleusParticleMass = nucleusParticle->GetPDGMass();
productionModelData.incidentParticle = incidentParticle;
productionModelData.nucleusParticle = nucleusParticle;
@@ -46,6 +46,7 @@
#include "CexmcReconstructor.hh"
#include "CexmcProductionModelData.hh"
#include "CexmcCommon.hh"
class CexmcChargeExchangeReconstructorMessenger;
class CexmcEnergyDepositStore;
@@ -56,7 +57,7 @@ class CexmcParticleGun;
class CexmcChargeExchangeReconstructor : public CexmcReconstructor
{
public:
explicit CexmcChargeExchangeReconstructor(
CexmcChargeExchangeReconstructor(
const CexmcProductionModel * productionModel );
~CexmcChargeExchangeReconstructor();
@@ -97,6 +98,12 @@ class CexmcChargeExchangeReconstructor : public CexmcReconstructor
void SetAbsorbedEnergyCutEllipseAngle( G4double value );
void SetExpectedMomentumAmp( G4double );
void SetExpectedMomentumAmpDiff( G4double );
void SetEDCollectionAlgorithm( CexmcEDCollectionAlgoritm value );
void SetupBeamParticle( void );
G4bool IsTableMassUsed( void ) const;
@@ -127,49 +134,57 @@ class CexmcChargeExchangeReconstructor : public CexmcReconstructor
G4double GetAbsorbedEnergyCutEllipseAngle( void ) const;
G4double GetExpectedMomentumAmp( void ) const;
CexmcEDCollectionAlgoritm GetEDCollectionAlgorithm( void ) const;
G4bool HasAbsorbedEnergyCutTriggered( void ) const;
G4bool HasFullTrigger( void ) const;
private:
G4double outputParticleMass;
G4double outputParticleMass;
G4double nucleusOutputParticleMass;
G4double nucleusOutputParticleMass;
private:
CexmcProductionModelData productionModelData;
CexmcProductionModelData productionModelData;
private:
G4bool useTableMass;
G4bool useTableMass;
G4bool useMassCut;
G4bool useMassCut;
G4double massCutOPCenter;
G4double massCutOPCenter;
G4double massCutNOPCenter;
G4double massCutNOPCenter;
G4double massCutOPWidth;
G4double massCutOPWidth;
G4double massCutNOPWidth;
G4double massCutNOPWidth;
G4double massCutEllipseAngle;
G4double massCutEllipseAngle;
G4bool useAbsorbedEnergyCut;
G4bool useAbsorbedEnergyCut;
G4double absorbedEnergyCutCLCenter;
G4double absorbedEnergyCutCLCenter;
G4double absorbedEnergyCutCRCenter;
G4double absorbedEnergyCutCRCenter;
G4double absorbedEnergyCutCLWidth;
G4double absorbedEnergyCutCLWidth;
G4double absorbedEnergyCutCRWidth;
G4double absorbedEnergyCutCRWidth;
G4double absorbedEnergyCutEllipseAngle;
G4double absorbedEnergyCutEllipseAngle;
G4double expectedMomentumAmp;
CexmcEDCollectionAlgoritm edCollectionAlgorithm;
private:
G4bool hasMassCutTriggered;
G4bool hasMassCutTriggered;
G4bool hasAbsorbedEnergyCutTriggered;
G4bool hasAbsorbedEnergyCutTriggered;
private:
G4bool beamParticleIsInitialized;
@@ -290,6 +305,20 @@ inline void CexmcChargeExchangeReconstructor::SetAbsorbedEnergyCutEllipseAngle(
}
inline void CexmcChargeExchangeReconstructor::SetExpectedMomentumAmp(
G4double value )
{
expectedMomentumAmp = value;
}
inline void CexmcChargeExchangeReconstructor::SetEDCollectionAlgorithm(
CexmcEDCollectionAlgoritm value )
{
edCollectionAlgorithm = value;
}
inline G4bool CexmcChargeExchangeReconstructor::IsTableMassUsed( void ) const
{
return useTableMass;
@@ -386,6 +415,20 @@ inline G4double CexmcChargeExchangeReconstructor::
}
inline G4double CexmcChargeExchangeReconstructor::GetExpectedMomentumAmp(
void ) const
{
return expectedMomentumAmp;
}
inline CexmcEDCollectionAlgoritm CexmcChargeExchangeReconstructor::
GetEDCollectionAlgorithm( void ) const
{
return edCollectionAlgorithm;
}
inline G4bool CexmcChargeExchangeReconstructor::HasAbsorbedEnergyCutTriggered(
void ) const
{
@@ -48,8 +48,8 @@
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4String;
class CexmcChargeExchangeReconstructor;
@@ -92,6 +92,12 @@ class CexmcChargeExchangeReconstructorMessenger : public G4UImessenger
G4UIcmdWithADoubleAndUnit * aeCutCRWidth;
G4UIcmdWithADoubleAndUnit * aeCutAngle;
G4UIcmdWithADoubleAndUnit * setExpectedMomentumAmp;
G4UIcmdWithADoubleAndUnit * setExpectedMomentumAmpDiff;
G4UIcmdWithAString * setEDCollectionAlgorithm;
};
@@ -53,9 +53,11 @@
typedef std::vector< G4double > CexmcEnergyDepositCrystalRowCollection;
typedef std::vector< CexmcEnergyDepositCrystalRowCollection >
CexmcEnergyDepositCalorimeterCollection;
const G4double CexmcDblMax( std::numeric_limits< double >::max() );
const G4String CexmcStudiedProcessFirstName( "studiedProcess_" );
@@ -69,6 +71,8 @@ const G4String CexmcChargeExchangeInteractionName( "Cexmc" +
const G4String CexmcEDDigitizerName( "EDDig" );
const G4String CexmcTPDigitizerName( "TPDig" );
const G4String CexmcScenePrimitivesDescription( "CexmcScenePrimitives" );
const G4double CexmcFwhmToStddev( 0.42466 );
const G4double CexmcInvalidCosTheta( 2.0 );
@@ -169,6 +173,13 @@ enum CexmcCrystalSelectionAlgorithm
};
enum CexmcEDCollectionAlgoritm
{
CexmcCollectEDInAllCrystals,
CexmcCollectEDInAdjacentCrystals
};
enum CexmcEventDataVerboseLevel
{
CexmcWriteNoEventData,
@@ -97,9 +97,9 @@ namespace CexmcCustomFilter
struct Compiler
{
template < typename A, typename B = boost::fusion::unused_type,
typename C = boost::fusion::unused_type,
typename D = boost::fusion::unused_type >
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;
@@ -185,8 +185,8 @@ namespace CexmcCustomFilter
( lit( "tpt" )[ _val = KeepTPT ] |
lit( "edt" )[ _val = KeepEDT ] ) |
lit( "delete" ) >>
( lit ( "tpt" )[ _val = DeleteTPT ] |
lit ( "edt" )[ _val = DeleteEDT ] );
( lit( "tpt" )[ _val = DeleteTPT ] |
lit( "edt" )[ _val = DeleteEDT ] );
condition = lit( "if" ) >> expression[ op( _val, _1 ) ];
@@ -55,7 +55,7 @@ class CexmcEventFastSObject;
class CexmcEventSObject;
class CexmcCustomFilterEval : public CexmcAST::BasicEval
class CexmcCustomFilterEval
{
private:
typedef std::vector< CexmcCustomFilter::ParseResult >
@@ -51,7 +51,6 @@
#include "CexmcException.hh"
#include "CexmcCommon.hh"
class G4String;
class CexmcEnergyDepositDigitizerMessenger;
@@ -125,10 +124,10 @@ class CexmcEnergyDepositDigitizer : public G4VDigitizerModule
G4bool fromMessenger = true );
void SetOuterCrystalsVetoFraction( G4double value,
G4bool fromMessenger = true );
G4bool fromMessenger = true );
void ApplyFiniteCrystalResolution( G4bool value,
G4bool fromMessenger = true );
G4bool fromMessenger = true );
void AddCrystalResolutionRange( G4double bottom, G4double top,
G4double value,
@@ -165,9 +164,6 @@ class CexmcEnergyDepositDigitizer : public G4VDigitizerModule
public:
G4bool IsOuterCrystal( G4int column, G4int row ) const;
void TransformToAdjacentInnerCrystal( G4int & column,
G4int & row ) const;
private:
void InitializeData( void );
@@ -512,20 +508,6 @@ inline G4bool CexmcEnergyDepositDigitizer::IsOuterCrystal( G4int column,
}
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;
@@ -56,7 +56,7 @@ class CexmcEnergyDepositInCalorimeter : public CexmcEnergyDepositInLeftRightSet
const CexmcSetup * setup );
public:
void PrintAll( void );
void PrintAll( void );
protected:
G4int GetIndex( G4Step * step );
@@ -69,7 +69,7 @@ class CexmcEnergyDepositInCalorimeter : public CexmcEnergyDepositInLeftRightSet
static G4int GetCopyDepth1BitsOffset( void );
protected:
static G4int copyDepth1BitsOffset;
static const G4int copyDepth1BitsOffset = 8;
};
@@ -58,7 +58,7 @@ class CexmcEnergyDepositInLeftRightSet : public CexmcSimpleEnergyDeposit
const CexmcSetup * setup );
public:
void PrintAll( void );
void PrintAll( void );
protected:
G4int GetIndex( G4Step * step );
@@ -72,7 +72,7 @@ class CexmcEnergyDepositInLeftRightSet : public CexmcSimpleEnergyDeposit
static G4int GetLeftRightBitsOffset( void );
protected:
static G4int leftRightBitsOffset;
static const G4int leftRightBitsOffset = 16;
};
@@ -111,7 +111,7 @@ extern G4Allocator< CexmcEnergyDepositStore > energyDepositStoreAllocator;
inline void * CexmcEnergyDepositStore::operator new( size_t )
{
return energyDepositStoreAllocator.MallocSingle();
return energyDepositStoreAllocator.MallocSingle();
}
@@ -74,11 +74,9 @@ class CexmcEventAction : public G4UserEventAction
public:
void BeamParticleChangeHook( void );
void SetVerboseOnCexmcLevel( G4int verbose_ );
void SetVerboseOnCexmcLevel( G4int value );
void SetVerboseDrawLevel( G4int verboseDraw_ );
void DrawTrajectoryMarkers( G4bool on );
void SetVerboseDrawLevel( G4int value );
CexmcChargeExchangeReconstructor * GetReconstructor( void );
@@ -95,7 +93,7 @@ class CexmcEventAction : public G4UserEventAction
const CexmcProductionModelData & pmData,
const CexmcAngularRangeList & triggeredAngularRanges ) const;
void FillRTHistos( G4bool reconstructorHasFullTrigger,
void FillRTHistos( G4bool reconstructorHasFullTrigger,
const CexmcEnergyDepositStore * edStore,
const CexmcTrackPointsStore * tpStore,
const CexmcProductionModelData & pmData,
@@ -132,8 +130,7 @@ class CexmcEventAction : public G4UserEventAction
public:
static CexmcEnergyDepositStore * MakeEnergyDepositStore(
const CexmcEnergyDepositDigitizer * digitizer,
G4bool useInnerRefCrystal );
const CexmcEnergyDepositDigitizer * digitizer );
static CexmcTrackPointsStore * MakeTrackPointsStore(
const CexmcTrackPointsDigitizer * digitizer );
@@ -151,35 +148,28 @@ class CexmcEventAction : public G4UserEventAction
private:
CexmcPhysicsManager * physicsManager;
private:
CexmcChargeExchangeReconstructor * reconstructor;
G4double opKinEnergy;
private:
G4int verbose;
G4int verboseDraw;
G4bool drawTrajectoryMarkers;
CexmcEventActionMessenger * messenger;
};
inline void CexmcEventAction::SetVerboseOnCexmcLevel( G4int verbose_ )
inline void CexmcEventAction::SetVerboseOnCexmcLevel( G4int value )
{
verbose = verbose_;
verbose = value;
}
inline void CexmcEventAction::SetVerboseDrawLevel( G4int verboseDraw_ )
inline void CexmcEventAction::SetVerboseDrawLevel( G4int value )
{
verboseDraw = verboseDraw_;
}
inline void CexmcEventAction::DrawTrajectoryMarkers( G4bool on )
{
drawTrajectoryMarkers = on;
verboseDraw = value;
}
@@ -48,8 +48,6 @@
class G4UIcommand;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
class G4String;
class CexmcEventAction;
@@ -69,8 +67,6 @@ class CexmcEventActionMessenger : public G4UImessenger
G4UIcmdWithAnInteger * setVerboseLevel;
G4UIcmdWithAnInteger * setVerboseDrawLevel;
G4UIcmdWithABool * drawTrajectoryMarkers;
};
@@ -46,37 +46,21 @@
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/serialization/access.hpp>
#include <G4Types.hh>
class CexmcEventFastSObject
struct CexmcEventFastSObject
{
friend class boost::serialization::access;
friend class CexmcRunManager;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
G4int eventId;
public:
CexmcEventFastSObject();
G4double opCosThetaSCM;
CexmcEventFastSObject( G4int eventId, G4double opCosThetaSCM,
G4bool edDigitizerHasTriggered,
G4bool edDigitizerMonitorHasTriggered );
G4bool edDigitizerHasTriggered;
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
G4bool edDigitizerMonitorHasTriggered;
private:
G4int eventId;
G4double opCosThetaSCM;
G4bool edDigitizerHasTriggered;
G4bool edDigitizerMonitorHasTriggered;
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
};
@@ -55,7 +55,7 @@ class CexmcEventInfo : public G4VUserEventInformation
G4bool reconstructionIsOk );
public:
void Print( void ) const;
void Print( void ) const;
public:
G4bool EdTriggerIsOk( void ) const;
@@ -46,95 +46,56 @@
#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
struct CexmcEventSObject
{
friend class boost::serialization::access;
friend class CexmcRunManager;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
G4int eventId;
public:
CexmcEventSObject();
G4bool edDigitizerMonitorHasTriggered;
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 );
G4double monitorED;
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
G4double vetoCounterEDLeft;
private:
G4int eventId;
G4double vetoCounterEDRight;
G4bool edDigitizerMonitorHasTriggered;
G4double calorimeterEDLeft;
G4double monitorED;
G4double calorimeterEDRight;
G4double vetoCounterEDLeft;
CexmcEnergyDepositCalorimeterCollection calorimeterEDLeftCollection;
G4double vetoCounterEDRight;
CexmcEnergyDepositCalorimeterCollection calorimeterEDRightCollection;
G4double calorimeterEDLeft;
CexmcSimpleTrackPointInfoStore monitorTP;
G4double calorimeterEDRight;
CexmcSimpleTrackPointInfoStore targetTPBeamParticle;
CexmcEnergyDepositCalorimeterCollection calorimeterEDLeftCollection;
CexmcSimpleTrackPointInfoStore targetTPOutputParticle;
CexmcEnergyDepositCalorimeterCollection calorimeterEDRightCollection;
CexmcSimpleTrackPointInfoStore targetTPNucleusParticle;
CexmcSimpleTrackPointInfoStore monitorTP;
CexmcSimpleTrackPointInfoStore targetTPOutputParticleDecayProductParticle1;
CexmcSimpleTrackPointInfoStore targetTPBeamParticle;
CexmcSimpleTrackPointInfoStore targetTPOutputParticleDecayProductParticle2;
CexmcSimpleTrackPointInfoStore targetTPOutputParticle;
CexmcSimpleTrackPointInfoStore vetoCounterTPLeft;
CexmcSimpleTrackPointInfoStore targetTPNucleusParticle;
CexmcSimpleTrackPointInfoStore vetoCounterTPRight;
CexmcSimpleTrackPointInfoStore
targetTPOutputParticleDecayProductParticle1;
CexmcSimpleTrackPointInfoStore calorimeterTPLeft;
CexmcSimpleTrackPointInfoStore
targetTPOutputParticleDecayProductParticle2;
CexmcSimpleTrackPointInfoStore calorimeterTPRight;
CexmcSimpleTrackPointInfoStore vetoCounterTPLeft;
CexmcSimpleProductionModelDataStore productionModelData;
CexmcSimpleTrackPointInfoStore vetoCounterTPRight;
CexmcSimpleTrackPointInfoStore calorimeterTPLeft;
CexmcSimpleTrackPointInfoStore calorimeterTPRight;
CexmcSimpleProductionModelDataStore productionModelData;
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
};
@@ -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: CexmcFakeCrossSectionData.hh
*
* Description: fake cross section data (to be never really applied)
*
* Version: 1.0
* Created: 18.09.2011 21:47:10
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_FAKE_CROSS_SECTION_DATA_HH
#define CEXMC_FAKE_CROSS_SECTION_DATA_HH
#include <G4VCrossSectionDataSet.hh>
class G4DynamicParticle;
class G4Element;
class G4ParticleDefinition;
class CexmcFakeCrossSectionData : public G4VCrossSectionDataSet
{
public:
G4bool IsApplicable( const G4DynamicParticle *, const G4Element * )
{
return false;
}
G4double GetCrossSection( const G4DynamicParticle *,
const G4Element *, G4double )
{
return 0;
}
void BuildPhysicsTable( const G4ParticleDefinition & )
{}
void DumpPhysicsTable( const G4ParticleDefinition & )
{}
};
#endif
@@ -72,13 +72,13 @@ class CexmcHadronicProcess : public G4HadronicProcess
G4bool IsApplicable( const G4ParticleDefinition & particle );
public:
void RegisterProductionModel( CexmcProductionModel * model );
void RegisterProductionModel( CexmcProductionModel * model );
private:
void CalculateTargetNucleus( const G4Material * material );
void CalculateTargetNucleus( const G4Material * material );
void FillTotalResult( G4HadFinalState * hadFinalState,
const G4Track & track );
void FillTotalResult( G4HadFinalState * hadFinalState,
const G4Track & track );
private:
CexmcProductionModel * productionModel;
@@ -65,6 +65,7 @@ enum CexmcHistoType
{
CexmcMomentumBP_TPT_Histo,
CexmcMomentumBP_RT_Histo,
CexmcMomentumIP_TPT_Histo,
CexmcTPInMonitor_TPT_Histo,
CexmcTPInTarget_TPT_Histo,
CexmcTPInTarget_RT_Histo,
@@ -113,11 +114,11 @@ enum CexmcHistoType
class CexmcHistoManager
{
private:
typedef std::vector< TH1 * > CexmcHistoVector;
typedef std::vector< TH1 * > CexmcHistoVector;
typedef std::map< CexmcHistoType, CexmcHistoVector > CexmcHistosMap;
typedef std::map< CexmcHistoType, CexmcHistoVector > CexmcHistosMap;
typedef std::pair< CexmcHistoType, CexmcHistoVector > CexmcHistoPair;
typedef CexmcHistosMap::value_type CexmcHistoPair;
struct CexmcHistoAxisData
{
@@ -136,7 +137,7 @@ class CexmcHistoManager
Double_t nBinsMax;
};
typedef std::vector< CexmcHistoAxisData > CexmcHistoAxes;
typedef std::vector< CexmcHistoAxisData > CexmcHistoAxes;
enum CexmcHistoImpl
{
@@ -217,6 +218,11 @@ class CexmcHistoManager
const G4String & histoDrawOptions = "" );
#endif
public:
void SetVerboseLevel( G4int value );
G4int GetVerboseLevel( void ) const;
private:
void AddHisto( const CexmcHistoData & data,
const CexmcAngularRange & aRange = CexmcAngularRange() );
@@ -242,6 +248,8 @@ class CexmcHistoManager
G4double nopMass;
G4int verboseLevel;
#ifdef CEXMC_USE_ROOTQT
private:
@@ -255,8 +263,19 @@ class CexmcHistoManager
static CexmcHistoManager * instance;
};
#endif
inline void CexmcHistoManager::SetVerboseLevel( G4int value )
{
verboseLevel = value;
}
inline G4int CexmcHistoManager::GetVerboseLevel( void ) const
{
return verboseLevel;
}
#endif
#endif
@@ -50,13 +50,16 @@
class G4UIcommand;
class G4UIcmdWithoutParameter;
class G4UIcmdWithAnInteger;
class G4UIcmdWithAString;
class CexmcHistoManager;
class CexmcHistoManagerMessenger : public G4UImessenger
{
public:
CexmcHistoManagerMessenger();
explicit CexmcHistoManagerMessenger(
CexmcHistoManager * histoManager );
~CexmcHistoManagerMessenger();
@@ -64,6 +67,10 @@ class CexmcHistoManagerMessenger : public G4UImessenger
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcHistoManager * histoManager;
G4UIcmdWithAnInteger * setVerboseLevel;
G4UIcmdWithoutParameter * listHistos;
G4UIcmdWithAString * printHisto;
@@ -75,6 +82,5 @@ class CexmcHistoManagerMessenger : public G4UImessenger
#endif
#endif
@@ -62,7 +62,7 @@ class CexmcParticleGunMessenger : public G4UImessenger
~CexmcParticleGunMessenger();
public:
void SetNewValue( G4UIcommand * cnd, G4String value );
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcParticleGun * particleGun;
@@ -49,8 +49,6 @@
#include <G4StepPoint.hh>
#include <G4ThreeVector.hh>
#include <G4AffineTransform.hh>
#include "CexmcStudiedPhysics.hh"
#include "CexmcStudiedProcess.hh"
#include "CexmcPhysicsManager.hh"
#include "CexmcProductionModel.hh"
#include "CexmcIncidentParticleTrackInfo.hh"
@@ -24,41 +24,48 @@
// ********************************************************************
//
/*
* ============================================================================
* =============================================================================
*
* Filename: CexmcEventFastSObject.cc
* Filename: CexmcPrimitiveScorer.hh
*
* Description: event data serialization helper
* Description: primitive scorer with a messenger
*
* Version: 1.0
* Created: 02.01.2010 20:31:12
* Created: 24.01.2011 18:22:41
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
* =============================================================================
*/
#ifdef CEXMC_USE_PERSISTENCY
#ifndef CEXMC_PRIMITIVE_SCORER_HH
#define CEXMC_PRIMITIVE_SCORER_HH
#include "CexmcEventFastSObject.hh"
#include <G4VPrimitiveScorer.hh>
class CexmcSensitiveDetectorMessenger;
CexmcEventFastSObject::CexmcEventFastSObject()
class CexmcPrimitiveScorer : public G4VPrimitiveScorer
{
}
public:
explicit CexmcPrimitiveScorer( const G4String & name );
virtual ~CexmcPrimitiveScorer();
public:
void InitializeMessenger( void );
protected:
void PrintHeader( G4int nmbOfEntries ) const;
private:
CexmcSensitiveDetectorMessenger * messenger;
};
CexmcEventFastSObject::CexmcEventFastSObject( G4int eventId,
G4double opCosThetaSCM, G4bool edDigitizerHasTriggered,
G4bool edDigitizerMonitorHasTriggered ) :
eventId( eventId ), opCosThetaSCM( opCosThetaSCM ),
edDigitizerHasTriggered( edDigitizerHasTriggered ),
edDigitizerMonitorHasTriggered( edDigitizerMonitorHasTriggered )
{
}
#endif
@@ -50,9 +50,7 @@
#include <G4ParticleDefinition.hh>
#include "CexmcAngularRange.hh"
#include "CexmcProductionModelData.hh"
#ifdef CEXMC_USE_ROOT
#include "CexmcHistoManager.hh"
#endif
#include "CexmcException.hh"
#include "CexmcCommon.hh"
@@ -53,26 +53,23 @@
namespace CexmcPrivate
{
template < typename BasePhysics >
class CexmcBasePhysicsInstance
template < typename >
struct CexmcBasePhysicsInstance
{
public:
static const CexmcBasePhysicsUsed value = CexmcNoBasePhysics;
static const CexmcBasePhysicsUsed value = CexmcNoBasePhysics;
};
#ifdef CEXMC_USE_QGSP_BIC_EMY
template<>
class CexmcBasePhysicsInstance< QGSP_BIC_EMY >
template <>
struct CexmcBasePhysicsInstance< QGSP_BIC_EMY >
{
public:
static const CexmcBasePhysicsUsed value = Cexmc_QGSP_BIC_EMY;
static const CexmcBasePhysicsUsed value = Cexmc_QGSP_BIC_EMY;
};
#else
template<>
class CexmcBasePhysicsInstance< QGSP_BERT >
template <>
struct CexmcBasePhysicsInstance< QGSP_BERT >
{
public:
static const CexmcBasePhysicsUsed value = Cexmc_QGSP_BERT;
static const CexmcBasePhysicsUsed value = Cexmc_QGSP_BERT;
};
#endif
}
@@ -56,7 +56,7 @@ class CexmcEnergyDepositStore;
class CexmcReconstructor
{
public:
CexmcReconstructor();
explicit CexmcReconstructor();
virtual ~CexmcReconstructor();
@@ -131,6 +131,19 @@ class CexmcReconstructor
void ReconstructAngle( void );
private:
void CollectEDInAdjacentCrystals(
const CexmcEnergyDepositCalorimeterCollection & edHits,
G4int row, G4int column, G4double & ed );
void CalculateWeightedEPPosition(
const CexmcEnergyDepositCalorimeterCollection & edHits,
G4int row, G4int column, G4double & x, G4double & y,
G4double & ed );
void TransformToAdjacentInnerCrystal( G4int & column,
G4int & row ) const;
protected:
G4bool hasBasicTrigger;
@@ -173,6 +186,13 @@ class CexmcReconstructor
G4double theAngle;
protected:
G4double calorimeterEDLeftAdjacent;
G4double calorimeterEDRightAdjacent;
G4bool collectEDInAdjacentCrystals;
private:
CexmcSetup::CalorimeterGeometryData calorimeterGeometry;
@@ -355,5 +375,19 @@ inline G4bool CexmcReconstructor::HasBasicTrigger( void ) const
}
inline void CexmcReconstructor::TransformToAdjacentInnerCrystal(
G4int & column, G4int & row ) const
{
if ( column == 0 )
++column;
if ( column == calorimeterGeometry.nCrystalsInRow - 1 )
--column;
if ( row == 0 )
++row;
if ( row == calorimeterGeometry.nCrystalsInColumn - 1 )
--row;
}
#endif
@@ -47,10 +47,9 @@
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4UIcmdWithADoubleAndUnit;
class G4String;
class CexmcReconstructor;
@@ -61,11 +61,8 @@ class CexmcReimplementedGenbod : public CexmcPhaseSpaceGenerator
void FermiEnergyDepStatusChangeHook( void );
private:
void SetMaxWeight( void );
G4double PDK( G4double a, G4double b, G4double c );
private:
G4double maxWeight;
@@ -48,7 +48,9 @@
#include <G4Run.hh>
typedef std::map< G4int, G4int > CexmcNmbOfHitsInRanges;
typedef std::map< G4int, G4int > CexmcNmbOfHitsInRanges;
typedef CexmcNmbOfHitsInRanges::value_type CexmcNmbOfHitsInRangesData;
class CexmcRun : public G4Run
@@ -90,6 +90,8 @@ class CexmcRunManager : public G4RunManager
void SetEventDataVerboseLevel( CexmcEventDataVerboseLevel value );
void RegisterScenePrimitives( void );
#ifdef CEXMC_USE_PERSISTENCY
void ReadProject( void );
@@ -114,6 +116,10 @@ class CexmcRunManager : public G4RunManager
void EnableLiveHistograms( G4bool on = true );
void BeamParticleChangeHook( void );
void SetupConstructionHook( void );
public:
CexmcPhysicsManager * GetPhysicsManager( void );
@@ -143,8 +149,6 @@ class CexmcRunManager : public G4RunManager
CexmcEventDataVerboseLevel GetEventDataVerboseLevel( void ) const;
void BeamParticleChangeHook( void );
protected:
void DoEventLoop( G4int nEvent, const char * macroFile,
G4int nSelect );
@@ -51,6 +51,7 @@ class G4UIcommand;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
class G4UIcmdWithoutParameter;
class CexmcRunManagerMessenger : public G4UImessenger
@@ -64,27 +65,29 @@ class CexmcRunManagerMessenger : public G4UImessenger
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcRunManager * runManager;
CexmcRunManager * runManager;
G4UIcmdWithAString * setProductionModel;
G4UIcmdWithAString * setProductionModel;
G4UIcmdWithAString * setGdmlFile;
G4UIcmdWithAString * setGdmlFile;
G4UIcmdWithAString * setGuiMacro;
G4UIcmdWithAString * setGuiMacro;
G4UIcmdWithAString * setEventCountPolicy;
G4UIcmdWithAString * setEventCountPolicy;
G4UIcmdWithAString * setEventDataVerboseLevel;
G4UIcmdWithAString * setEventDataVerboseLevel;
#ifdef CEXMC_USE_PERSISTENCY
G4UIcmdWithAnInteger * replayEvents;
G4UIcmdWithAnInteger * replayEvents;
G4UIcmdWithAnInteger * seekTo;
G4UIcmdWithAnInteger * seekTo;
G4UIcmdWithABool * skipInteractionsWithoutEDT;
G4UIcmdWithABool * skipInteractionsWithoutEDT;
#endif
G4UIcmdWithABool * validateGdmlFile;
G4UIcmdWithoutParameter * registerScenePrimitives;
G4UIcmdWithABool * validateGdmlFile;
};
@@ -46,10 +46,10 @@
#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 <boost/serialization/version.hpp>
#include "CexmcSimpleDecayTableStore.hh"
#include "CexmcSimpleThreeVectorStore.hh"
#include "CexmcAngularRange.hh"
@@ -58,207 +58,145 @@
#include "CexmcCommon.hh"
#define CEXMC_RUN_SOBJECT_VERSION 3
#define CEXMC_RUN_SOBJECT_VERSION 4
class CexmcRunSObject
struct 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 );
CexmcBasePhysicsUsed basePhysicsUsed;
private:
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
CexmcProductionModelType productionModelType;
private:
CexmcBasePhysicsUsed basePhysicsUsed;
std::string gdmlFileName;
CexmcProductionModelType productionModelType;
CexmcSimpleDecayTableStore etaDecayTable;
std::string gdmlFileName;
CexmcAngularRangeList angularRanges;
CexmcSimpleDecayTableStore etaDecayTable;
G4bool fermiMotionIsOn;
CexmcAngularRangeList angularRanges;
std::vector< G4double > calorimeterRegCuts;
G4bool fermiMotionIsOn;
CexmcEventCountPolicy eventCountPolicy;
std::vector< G4double > calorimeterRegCuts;
std::string beamParticle;
CexmcEventCountPolicy eventCountPolicy;
CexmcSimpleThreeVectorStore beamPos;
std::string beamParticle;
CexmcSimpleThreeVectorStore beamDir;
CexmcSimpleThreeVectorStore beamPos;
G4double beamMomentumAmp;
CexmcSimpleThreeVectorStore beamDir;
G4double beamFwhmPosX;
G4double beamMomentumAmp;
G4double beamFwhmPosY;
G4double beamFwhmPosX;
G4double beamFwhmDirX;
G4double beamFwhmPosY;
G4double beamFwhmDirY;
G4double beamFwhmDirX;
G4double beamFwhmMomentumAmp;
G4double beamFwhmDirY;
G4double monitorEDThreshold;
G4double beamFwhmMomentumAmp;
G4double vetoCounterEDLeftThreshold;
G4double monitorEDThreshold;
G4double vetoCounterEDRightThreshold;
G4double vetoCounterEDLeftThreshold;
G4double calorimeterEDLeftThreshold;
G4double vetoCounterEDRightThreshold;
G4double calorimeterEDRightThreshold;
G4double calorimeterEDLeftThreshold;
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm;
G4double calorimeterEDRightThreshold;
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm;
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm;
G4double outerCrystalsVetoFraction;
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm;
G4bool applyFiniteCrystalResolution;
G4double outerCrystalsVetoFraction;
CexmcEnergyRangeWithDoubleValueList crystalResolutionData;
G4bool applyFiniteCrystalResolution;
CexmcCalorimeterEntryPointDefinitionAlgorithm
epDefinitionAlgorithm;
CexmcEnergyRangeWithDoubleValueList crystalResolutionData;
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
epDepthDefinitionAlgorithm;
CexmcCalorimeterEntryPointDefinitionAlgorithm epDefinitionAlgorithm;
CexmcCrystalSelectionAlgorithm csAlgorithm;
CexmcCalorimeterEntryPointDepthDefinitionAlgorithm
epDepthDefinitionAlgorithm;
G4bool useInnerRefCrystal;
CexmcCrystalSelectionAlgorithm csAlgorithm;
G4double epDepth;
G4bool useInnerRefCrystal;
G4bool useTableMass;
G4double epDepth;
G4bool useMassCut;
G4bool useTableMass;
G4double mCutOPCenter;
G4bool useMassCut;
G4double mCutNOPCenter;
G4double mCutOPCenter;
G4double mCutOPWidth;
G4double mCutNOPCenter;
G4double mCutNOPWidth;
G4double mCutOPWidth;
G4double mCutAngle;
G4double mCutNOPWidth;
G4bool useAbsorbedEnergyCut;
G4double mCutAngle;
G4double aeCutCLCenter;
G4bool useAbsorbedEnergyCut;
G4double aeCutCRCenter;
G4double aeCutCLCenter;
G4double aeCutCLWidth;
G4double aeCutCRCenter;
G4double aeCutCRWidth;
G4double aeCutCLWidth;
G4double aeCutAngle;
G4double aeCutCRWidth;
CexmcNmbOfHitsInRanges nmbOfHitsSampled;
G4double aeCutAngle;
CexmcNmbOfHitsInRanges nmbOfHitsSampledFull;
CexmcNmbOfHitsInRanges nmbOfHitsSampled;
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRealRange;
CexmcNmbOfHitsInRanges nmbOfHitsSampledFull;
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRecRange;
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRealRange;
CexmcNmbOfHitsInRanges nmbOfOrphanHits;
CexmcNmbOfHitsInRanges nmbOfHitsTriggeredRecRange;
G4int nmbOfFalseHitsTriggeredEDT;
CexmcNmbOfHitsInRanges nmbOfOrphanHits;
G4int nmbOfFalseHitsTriggeredRec;
G4int nmbOfFalseHitsTriggeredEDT;
G4int nmbOfSavedEvents;
G4int nmbOfFalseHitsTriggeredRec;
G4int nmbOfSavedFastEvents;
G4int nmbOfSavedEvents;
G4int numberOfEventsProcessed;
G4int nmbOfSavedFastEvents;
G4int numberOfEventsProcessedEffective;
G4int numberOfEventsProcessed;
G4int numberOfEventsToBeProcessed;
G4int numberOfEventsProcessedEffective;
std::string rProject;
G4int numberOfEventsToBeProcessed;
G4bool interactionsWithoutEDTWereSkipped;
std::string rProject;
std::string cfFileName;
G4bool interactionsWithoutEDTWereSkipped;
CexmcEventDataVerboseLevel evDataVerboseLevel;
std::string cfFileName;
G4double proposedMaxIL;
CexmcEventDataVerboseLevel evDataVerboseLevel;
G4double expectedMomentumAmp;
G4double proposedMaxIL;
CexmcEDCollectionAlgoritm edCollectionAlgorithm;
private:
unsigned int actualVersion;
unsigned int actualVersion;
template < typename Archive >
void serialize( Archive & archive, const unsigned int version );
};
@@ -266,8 +204,6 @@ template < typename Archive >
void CexmcRunSObject::serialize( Archive & archive,
const unsigned int version )
{
actualVersion = version;
archive & basePhysicsUsed;
archive & productionModelType;
archive & gdmlFileName;
@@ -335,6 +271,13 @@ void CexmcRunSObject::serialize( Archive & archive,
}
if ( version > 2 )
archive & proposedMaxIL;
if ( version > 3 )
{
archive & expectedMomentumAmp;
archive & edCollectionAlgorithm;
}
actualVersion = version;
}
@@ -0,0 +1,177 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* =============================================================================
*
* Filename: CexmcScenePrimitives.hh
*
* Description: auxiliary scene primitives (radial lines etc.)
*
* Version: 1.0
* Created: 03.01.2011 11:27:34
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SCENE_PRIMITIVES_HH
#define CEXMC_SCENE_PRIMITIVES_HH
#include <vector>
#include <map>
#include <G4Colour.hh>
#include <G4ThreeVector.hh>
#include <G4VModel.hh>
#include <G4VVisManager.hh>
class G4VGraphicsScene;
class CexmcSetup;
class CexmcScenePrimitivesMessenger;
enum CexmcSPType
{
CexmcTargetCenterMark_SP,
CexmcRadialLine_SP,
CexmcInnerCrystalsHl_SP
};
class CexmcScenePrimitives : public G4VModel
{
private:
struct CexmcRadialLine
{
CexmcRadialLine( const G4ThreeVector & line ) :
theta( line.x() ), phi( line.y() ), length( line.z() )
{}
G4double theta;
G4double phi;
G4double length;
};
typedef std::vector< CexmcRadialLine > CexmcRadialLines;
typedef std::map< CexmcSPType, G4Colour > CexmcSPColourMap;
public:
explicit CexmcScenePrimitives( CexmcSetup * setup );
~CexmcScenePrimitives();
public:
void DescribeYourselfTo( G4VGraphicsScene & scene );
public:
void MarkTargetCenter( G4bool on = true );
void DrawRadialLine( const G4ThreeVector & line );
void HighlightInnerCrystals( G4bool = true );
void ClearRadialLines( void );
void SetColour( CexmcSPType primitive, const G4Colour & colour );
private:
void DrawRadialLine( G4VGraphicsScene & scene,
const CexmcRadialLine * rLine );
void MarkTargetCenter( G4VGraphicsScene & scene );
void HighlightInnerCrystals( G4VGraphicsScene & scene );
private:
void UpdateScene( void );
private:
CexmcSetup * setup;
G4bool markTargetCenter;
G4bool highlightInnerCrystals;
CexmcRadialLines radialLines;
CexmcSPColourMap spColours;
private:
CexmcScenePrimitivesMessenger * messenger;
};
inline void CexmcScenePrimitives::SetColour( CexmcSPType primitive,
const G4Colour & colour )
{
spColours[ primitive ] = colour;
}
inline void CexmcScenePrimitives::DrawRadialLine( const G4ThreeVector & line )
{
radialLines.push_back( line );
UpdateScene();
}
inline void CexmcScenePrimitives::MarkTargetCenter( G4bool on )
{
markTargetCenter = on;
UpdateScene();
}
inline void CexmcScenePrimitives::HighlightInnerCrystals( G4bool on )
{
highlightInnerCrystals = on;
UpdateScene();
}
inline void CexmcScenePrimitives::ClearRadialLines( void )
{
radialLines.clear();
UpdateScene();
}
inline void CexmcScenePrimitives::UpdateScene( void )
{
G4VVisManager * visManager( G4VVisManager::GetConcreteInstance() );
if ( visManager )
visManager->NotifyHandlers();
}
#endif
@@ -0,0 +1,83 @@
//
// ********************************************************************
// * 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: CexmcScenePrimitivesMessenger.hh
*
* Description: draw auxiliary scene primitives
*
* Version: 1.0
* Created: 03.01.2011 12:34:09
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#ifndef CEXMC_SCENE_PRIMITIVES_MESSENGER_HH
#define CEXMC_SCENE_PRIMITIVES_MESSENGER_HH
#include <G4UImessenger.hh>
class G4UIcommand;
class G4UIcmdWith3Vector;
class G4UIcmdWithABool;
class G4UIcmdWithoutParameter;
class CexmcScenePrimitives;
class CexmcScenePrimitivesMessenger : public G4UImessenger
{
public:
explicit CexmcScenePrimitivesMessenger(
CexmcScenePrimitives * scenePrimitives );
~CexmcScenePrimitivesMessenger();
public:
void SetNewValue( G4UIcommand * cmd, G4String value );
private:
CexmcScenePrimitives * scenePrimitives;
G4UIcmdWith3Vector * drawRadialLine;
G4UIcmdWithoutParameter * clearRadialLines;
G4UIcmdWithABool * markTargetCenter;
G4UIcmdWithABool * highlightInnerCrystals;
G4UIcommand * setColour;
};
#endif
@@ -50,14 +50,13 @@ class G4VPrimitiveScorer;
class G4UIcommand;
class G4UIcmdWithAnInteger;
class G4UIdirectory;
class G4String;
class CexmcSensitiveDetectorMessenger : public G4UImessenger
{
public:
CexmcSensitiveDetectorMessenger( G4VPrimitiveScorer * scorer,
const G4String & detectorName );
explicit CexmcSensitiveDetectorMessenger(
G4VPrimitiveScorer * scorer );
~CexmcSensitiveDetectorMessenger();
@@ -110,11 +110,11 @@ class CexmcSetup : public G4VUserDetectorConstruction
G4bool IsRightCalorimeter( const G4VPhysicalVolume * pVolume ) const;
private:
void SetupSpecialVolumes( G4GDMLParser & gdmlParser );
void SetupSpecialVolumes( const G4GDMLParser & gdmlParser );
void ReadTransforms( const G4GDMLParser & gdmlParser );
void ReadTransforms( const G4GDMLParser & gdmlParser );
void ReadCalorimeterGeometryData( const G4LogicalVolume * lVolume );
void ReadCalorimeterGeometryData( const G4LogicalVolume * lVolume );
void ReadRightDetectors( void );
@@ -199,10 +199,8 @@ inline const G4LogicalVolume * CexmcSetup::GetVolume(
case Target :
return targetVolume;
default :
break;
return NULL;
}
return NULL;
}
@@ -44,24 +44,23 @@
#ifndef CEXMC_SIMPLE_ENERGY_DEPOSIT_HH
#define CEXMC_SIMPLE_ENERGY_DEPOSIT_HH
#include <G4VPrimitiveScorer.hh>
#include <G4THitsMap.hh>
#include "CexmcPrimitiveScorer.hh"
class G4HCofThisEvent;
class G4Step;
class CexmcSensitiveDetectorMessenger;
typedef G4THitsMap< G4double > CexmcEnergyDepositCollection;
typedef G4THitsMap< G4double > CexmcEnergyDepositCollection;
typedef std::map< G4int, G4double * > CexmcEnergyDepositCollectionData;
class CexmcSimpleEnergyDeposit : public G4VPrimitiveScorer
class CexmcSimpleEnergyDeposit : public CexmcPrimitiveScorer
{
public:
explicit CexmcSimpleEnergyDeposit( const G4String & name );
virtual ~CexmcSimpleEnergyDeposit();
public:
void Initialize( G4HCofThisEvent * hcOfThisEvent );
@@ -79,12 +78,10 @@ class CexmcSimpleEnergyDeposit : public G4VPrimitiveScorer
G4bool ProcessHits( G4Step * step, G4TouchableHistory * tHistory );
protected:
CexmcEnergyDepositCollection * eventMap;
CexmcEnergyDepositCollection * eventMap;
private:
CexmcSensitiveDetectorMessenger * messenger;
G4int hcId;
G4int hcId;
};
@@ -52,7 +52,7 @@
class CexmcSimpleLorentzVectorStore
{
friend class boost::serialization::access;
friend class boost::serialization::access;
#ifdef CEXMC_USE_CUSTOM_FILTER
friend class CexmcASTEval;
#endif
@@ -45,7 +45,7 @@
#define CEXMC_SIMPLE_RANGE_WITH_VALUE_HH
#include <vector>
#include <iostream>
#include <iosfwd>
#include <G4Types.hh>
@@ -108,7 +108,8 @@ inline bool operator<(
typedef CexmcSimpleRangeWithValue< CexmcEnergyValueCategory >
CexmcEnergyRangeWithDoubleValue;
CexmcEnergyRangeWithDoubleValue;
typedef std::vector< CexmcEnergyRangeWithDoubleValue >
CexmcEnergyRangeWithDoubleValueList;
@@ -116,6 +117,7 @@ typedef std::vector< CexmcEnergyRangeWithDoubleValue >
std::ostream & operator<<( std::ostream & out,
const CexmcEnergyRangeWithDoubleValue & range );
std::ostream & operator<<( std::ostream & out,
const CexmcEnergyRangeWithDoubleValueList & range );
@@ -47,6 +47,7 @@
#include <G4VPhysicsConstructor.hh>
#include <G4ProcessManager.hh>
#include <G4ParticleDefinition.hh>
#include "CexmcFakeCrossSectionData.hh"
#include "CexmcStudiedProcess.hh"
#include "CexmcPhysicsManager.hh"
#include "CexmcProductionModel.hh"
@@ -106,7 +107,7 @@ void CexmcStudiedPhysics< Process >::ConstructParticle( void )
}
template <typename Process >
template < typename Process >
void CexmcStudiedPhysics< Process >::ConstructProcess( void )
{
if ( wasActivated )
@@ -116,6 +117,8 @@ void CexmcStudiedPhysics< Process >::ConstructProcess( void )
Process * process( new Process );
process->AddDataSet( new CexmcFakeCrossSectionData );
CexmcStudiedProcess * studiedProcess( new CexmcStudiedProcess(
physicsManager, process->GetProcessType() ) );
@@ -52,10 +52,10 @@ class CexmcTrackInfo : public G4VUserTrackInformation
{
public:
explicit CexmcTrackInfo( CexmcTrackType trackType = CexmcInsipidTrack,
G4int copyNumber = 0 );
G4int copyNumber = 0 );
public:
void Print( void ) const;
void Print( void ) const;
public:
virtual G4int GetTypeInfo( void ) const;
@@ -110,7 +110,7 @@ extern G4Allocator< CexmcTrackPointInfo > trackPointInfoAllocator;
inline void * CexmcTrackPointInfo::operator new( size_t )
{
return trackPointInfoAllocator.MallocSingle();
return trackPointInfoAllocator.MallocSingle();
}
@@ -124,5 +124,6 @@ inline void CexmcTrackPointInfo::operator delete( void * obj )
std::ostream & operator<<( std::ostream & out,
const CexmcTrackPointInfo & trackPointInfo );
#endif
@@ -44,25 +44,25 @@
#ifndef CEXMC_TRACK_POINTS_HH
#define CEXMC_TRACK_POINTS_HH
#include <G4VPrimitiveScorer.hh>
#include <G4THitsMap.hh>
#include "CexmcPrimitiveScorer.hh"
#include "CexmcTrackPointInfo.hh"
class G4HCofThisEvent;
class G4Step;
class CexmcSensitiveDetectorMessenger;
typedef G4THitsMap< CexmcTrackPointInfo > CexmcTrackPointsCollection;
typedef std::map< G4int, CexmcTrackPointInfo * >
CexmcTrackPointsCollectionData;
class CexmcTrackPoints : public G4VPrimitiveScorer
class CexmcTrackPoints : public CexmcPrimitiveScorer
{
public:
explicit CexmcTrackPoints( const G4String & name );
virtual ~CexmcTrackPoints();
public:
void Initialize( G4HCofThisEvent * hcOfThisEvent );
@@ -82,12 +82,10 @@ class CexmcTrackPoints : public G4VPrimitiveScorer
G4bool ProcessHits( G4Step * step, G4TouchableHistory * tHistory );
protected:
CexmcTrackPointsCollection * eventMap;
CexmcTrackPointsCollection * eventMap;
private:
CexmcSensitiveDetectorMessenger * messenger;
G4int hcId;
G4int hcId;
};
@@ -56,7 +56,7 @@ class CexmcTrackPointsInCalorimeter : public CexmcTrackPointsInLeftRightSet
const CexmcSetup * setup );
public:
void PrintAll( void );
void PrintAll( void );
protected:
G4int GetIndex( G4Step * step );
@@ -71,9 +71,9 @@ class CexmcTrackPointsInCalorimeter : public CexmcTrackPointsInLeftRightSet
static G4int GetCopyDepth1BitsOffset( void );
protected:
static G4int copyDepth0BitsOffset;
static const G4int copyDepth0BitsOffset = 8;
static G4int copyDepth1BitsOffset;
static const G4int copyDepth1BitsOffset = 16;
};
@@ -58,7 +58,7 @@ class CexmcTrackPointsInLeftRightSet : public CexmcTrackPoints
const CexmcSetup * setup );
public:
void PrintAll( void );
void PrintAll( void );
protected:
G4int GetIndex( G4Step * step );
@@ -69,10 +69,10 @@ class CexmcTrackPointsInLeftRightSet : public CexmcTrackPoints
public:
static CexmcSide GetSide( G4int index );
static G4int GetLeftRightBitsOffset( void );
static G4int GetLeftRightBitsOffset( void );
protected:
static G4int leftRightBitsOffset;
static const G4int leftRightBitsOffset = 24;
};
@@ -63,7 +63,7 @@ struct CexmcTrackPointsStore
monitorTP( monitorTP ), targetTPBeamParticle( targetTPBeamParticle ),
targetTPOutputParticle( targetTPOutputParticle ),
targetTPNucleusParticle( targetTPNucleusParticle ),
targetTPOutputParticleDecayProductParticle1 (
targetTPOutputParticleDecayProductParticle1(
targetTPOutputParticleDecayProductParticle1 ),
targetTPOutputParticleDecayProductParticle2(
targetTPOutputParticleDecayProductParticle2 ),
@@ -104,7 +104,7 @@ extern G4Allocator< CexmcTrackPointsStore > trackPointsStoreAllocator;
inline void * CexmcTrackPointsStore::operator new( size_t )
{
return trackPointsStoreAllocator.MallocSingle();
return trackPointsStoreAllocator.MallocSingle();
}
+5 -2
View File
@@ -48,7 +48,7 @@
/cexmc/gun/particle pi-
/cexmc/gun/position 0 0 -36 cm
/cexmc/gun/direction 0 0 1
/cexmc/gun/momentumAmp 730 MeV
/cexmc/gun/momentumAmp 732.1 MeV
/cexmc/gun/fwhmPosX 3.0 cm
/cexmc/gun/fwhmPosY 3.5 cm
/cexmc/gun/fwhmDirX 1.12 deg
@@ -62,9 +62,12 @@
#/cexmc/physics/addAngularRange -0.5 -0.8 2
/cexmc/physics/setAngularRange 1.0 -1.0 10
/cexmc/reconstructor/momentumAmpDiff -2.1 MeV
/cexmc/reconstructor/edCollectionAlgo all
/cexmc/reconstructor/useInnerRefCrystal true
/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
+84 -69
View File
@@ -1,5 +1,4 @@
<?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=
@@ -19,24 +18,6 @@
<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"/>
@@ -77,8 +58,7 @@
<constant name="CalorimeterLength" value="CrystalLength"/>
<constant name="CalorimeterHeight"
value="CrystalHeight * NCrystalsVert"/>
<constant name="CalorimeterWidth"
value="CrystalWidth * NCrystalsHor"/>
<constant name="CalorimeterWidth" value="CrystalWidth * NCrystalsHor"/>
<constant name="VetoCounterWidth" value="CalorimeterWidth"/>
<constant name="VetoCounterHeight" value="25.0"/>
<constant name="VetoCounterThickness" value="0.5"/>
@@ -111,7 +91,8 @@
<constant name="VetoCounterLeftDistance"
value="CalorimeterLeftDistance - VetoCounterDistanceToCalorimeter"/>
<constant name="VetoCounterRightDistance"
value="CalorimeterRightDistance - VetoCounterDistanceToCalorimeter"/>
value="CalorimeterRightDistance -
VetoCounterDistanceToCalorimeter"/>
<!-- if TargetColumnsRotWithTarget is 1 then target columns -->
<!-- will rotate together with target, if its value is 0 -->
@@ -124,58 +105,76 @@
<constant name="TargetWindowEntranceDebugShift" value="0.0"/>
<constant name="TargetWindowCuttingShift" value="1.0"/>
<constant name="TargetWindowDistance"
value="TargetWindowLength/2 - TargetWindowCuttingShift + TargetOuterCoverRadius"/>
value="TargetWindowLength/2 - TargetWindowCuttingShift +
TargetOuterCoverRadius"/>
<constant name="TargetWindowCapDistance"
value="TargetWindowDistance + TargetWindowLength/2 - TargetWindowCapLength/2"/>
value="TargetWindowDistance + TargetWindowLength/2 -
TargetWindowCapLength/2"/>
<constant name="TargetWindowDebugDistance"
value="TargetWindowDistance + TargetWindowDistanceDebugShift"/>
<constant name="TargetWindowEntranceDistance"
value="TargetWindowDebugDistance + TargetWindowLength/2 - TargetWindowEntranceOffset + TargetWindowEntranceDebugShift"/>
value="TargetWindowDebugDistance + TargetWindowLength/2 -
TargetWindowEntranceOffset +
TargetWindowEntranceDebugShift"/>
<constant name="TargetWindowCoverThickness"
value="TargetWindowMylarCoverLength + TargetWindowAluminiumCoverLength"/>
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="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)"
x="(CalorimeterLeftDistance + CalorimeterLength/2) *
sin(CalorimeterLeftAngle/180*pi)"
y="CalorimeterLeftVertShift"
z="(CalorimeterLeftDistance + CalorimeterLength/2) * cos(CalorimeterLeftAngle/180*pi)"
z="(CalorimeterLeftDistance + CalorimeterLength/2) *
cos(CalorimeterLeftAngle/180*pi)"
unit="cm"/>
<rotation name="CalorimeterLeftRot" x="0.0" y="-CalorimeterLeftAngle" z="0.0" unit="deg"/>
<rotation name="CalorimeterLeftRot" x="0.0" y="-CalorimeterLeftAngle"
z="0.0" unit="deg"/>
<position name="CalorimeterRightPos"
x="- (CalorimeterRightDistance + CalorimeterLength/2) * sin(CalorimeterRightAngle/180*pi)"
x="-(CalorimeterRightDistance + CalorimeterLength/2) *
sin(CalorimeterRightAngle/180*pi)"
y="CalorimeterRightVertShift"
z="(CalorimeterRightDistance + CalorimeterLength/2) * cos(CalorimeterRightAngle/180*pi)"
z="(CalorimeterRightDistance + CalorimeterLength/2) *
cos(CalorimeterRightAngle/180*pi)"
unit="cm"/>
<rotation name="CalorimeterRightRot" x="0.0" y="CalorimeterRightAngle" z="0.0" unit="deg"/>
<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)"
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)"
x="TargetPosX + TargetColumnDistance * sin((TargetColumn1Angle +
TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
y="TargetPosY"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn1Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn1Angle +
TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
unit="cm"/>
<position name="TargetColumn2Pos"
x="TargetPosX + TargetColumnDistance * sin((TargetColumn2Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
x="TargetPosX + TargetColumnDistance * sin((TargetColumn2Angle +
TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
y="TargetPosY"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn2Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn2Angle +
TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
unit="cm"/>
<position name="TargetColumn3Pos"
x="TargetPosX + TargetColumnDistance * sin((TargetColumn3Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
x="TargetPosX + TargetColumnDistance * sin((TargetColumn3Angle +
TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
y="TargetPosY"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn3Angle + TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
z="TargetPosZ + TargetColumnDistance * cos((TargetColumn3Angle +
TargetRotZ * TargetColumnsRotWithTarget)/180*pi)"
unit="cm"/>
<position name="TargetInnerColumn1Pos"
x="TargetInnerColumnDistance * sin(TargetInnerColumnAngle/180*pi)"
@@ -203,42 +202,58 @@
<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="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"/>
<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"/>
<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"/>
<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)"
x="TargetPosX -
(TargetWindowEntranceDistance - TargetWindowCoverThickness/2) *
sin(TargetRotZ/180*pi)"
y="TargetPosY"
z="TargetPosZ - (TargetWindowEntranceDistance - TargetWindowCoverThickness/2) * cos(TargetRotZ/180*pi)"
z="TargetPosZ -
(TargetWindowEntranceDistance - TargetWindowCoverThickness/2) *
cos(TargetRotZ/180*pi)"
unit="cm"/>
<position name="TargetWindowAluminiumCoverPos"
x="TargetPosX - TargetWindowEntranceDistance * sin(TargetRotZ/180*pi)"
x="TargetPosX -
TargetWindowEntranceDistance * sin(TargetRotZ/180*pi)"
y="TargetPosY"
z="TargetPosZ - TargetWindowEntranceDistance * cos(TargetRotZ/180*pi)"
z="TargetPosZ -
TargetWindowEntranceDistance * cos(TargetRotZ/180*pi)"
unit="cm"/>
<position name="TargetWindowCapPos"
x="TargetPosX - (TargetWindowCapDistance + TargetWindowDistanceDebugShift) * sin(TargetRotZ/180*pi)"
x="TargetPosX -
(TargetWindowCapDistance + TargetWindowDistanceDebugShift) *
sin(TargetRotZ/180*pi)"
y="TargetPosY"
z="TargetPosZ - (TargetWindowCapDistance + TargetWindowDistanceDebugShift) * cos(TargetRotZ/180*pi)"
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"/>
<position name="TargetVacuumUnionPos" x="0.0"
y="TargetWindowDistance - TargetWindowEntranceOffset -TargetWindowCoverThickness/2"
z="0.0" unit="cm"/>
</define>
<materials>
@@ -315,9 +330,9 @@
<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="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"/>
@@ -336,8 +351,8 @@
</subtraction>
<tube name="sOuterFerrumRingWholeCylinder" rmin="0"
rmax="TargetOuterCoverRadius + OuterFerrumRingThickness + EPSILON"
z="OuterFerrumRingHeight + EPSILON" deltaphi="FullCircle" aunit="deg"
lunit="cm"/>
z="OuterFerrumRingHeight + EPSILON" deltaphi="FullCircle"
aunit="deg" lunit="cm"/>
<subtraction name="sTargetWindowStub3">
<first ref="sTargetWindowStub2"/>
<second ref="sOuterFerrumRingWholeCylinder"/>
@@ -365,19 +380,19 @@
<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"/>
<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="SpecialVolume" auxvalue="Monitor"/>
<auxiliary auxtype="EnergyDepositDetector" auxvalue="MonitorRole"/>
<auxiliary auxtype="TrackPointsDetector" auxvalue="MonitorRole"/>
</volume>
@@ -388,7 +403,7 @@
<volume name="vTarget">
<materialref ref="G4_lH2"/>
<solidref ref="sTarget"/>
<auxiliary auxtype="SpecialVolume" auxvalue="TargetVolume"/>
<auxiliary auxtype="SpecialVolume" auxvalue="Target"/>
<auxiliary auxtype="TrackPointsDetector" auxvalue="TargetRole"/>
</volume>
<volume name="vTargetInnerCover">
@@ -454,13 +469,13 @@
<offset value="0" unit="cm"/>
</replicate_along_axis>
</replicavol>
<auxiliary auxtype="SpecialVolume" auxvalue="CalorimeterVolume"/>
<auxiliary auxtype="SpecialVolume" auxvalue="Calorimeter"/>
<auxiliary auxtype="SensitiveRegion" auxvalue="CalorimeterRegion"/>
</volume>
<volume name="vVetoCounter">
<materialref ref="Scintillator"/>
<solidref ref="sVetoCounter"/>
<auxiliary auxtype="SpecialVolume" auxvalue="VetoCounterVolume"/>
<auxiliary auxtype="SpecialVolume" auxvalue="VetoCounter"/>
<auxiliary auxtype="EnergyDepositDetector"
auxvalue="VetoCounterRole"/>
<auxiliary auxtype="TrackPointsDetector"
@@ -12,4 +12,6 @@
#/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 "Highlight inner crystals" "/cexmc/vis/hlIC"
/gui/addButton viewer "Unhighlight inner crystals" "/cexmc/vis/hlIC false"
/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
@@ -34,8 +34,6 @@
#/vis/scene/add/hits
#/vis/scene/add/axes
/cexmc/vis/drawTrajMarkers false
/vis/viewer/flush
/vis/scene/endOfEventAction accumulate 10
@@ -6,8 +6,16 @@
/tracking/verbose 0
/vis/scene/create
/vis/scene/add/volume WorldVisible
# adding custom scene primitives after world volume will make them shine
# brighter which is most important for rendering inner crystal highligts
/cexmc/vis/registerScenePrimitives
# this will make whole scene smooth
/cexmc/vis/markTargetCenter
# Create a scene handler for Qt OpenGL graphics
/vis/open OGLSQt 600x600-0+0
/vis/ogl/set/transparency true
@@ -40,6 +48,9 @@
/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
/cexmc/vis/setColour ic 1.0 1.0 0.0 0.16
/cexmc/vis/setColour rl 0.8 0.2 0.4
/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
@@ -52,8 +63,6 @@
#/vis/scene/add/hits
#/vis/scene/add/axes
/cexmc/vis/drawTrajMarkers false
/vis/viewer/flush
/vis/scene/endOfEventAction accumulate 10
@@ -1,7 +1,10 @@
# specify gdml file and production model here.
# histogram manager verbosity level and option to validate gdml file
# may also be put here.
# do not set gun parameters or anything else.
/cexmc/geometry/gdmlFile lht.gdml
/cexmc/geometry/validateGdmlFile
/cexmc/histo/verbose 0
/cexmc/physics/productionModel eta
@@ -55,7 +55,7 @@
namespace CexmcAST
{
void Subtree::Print( int level ) const
void Subtree::Print( int level ) const
{
static const std::string opId[] =
{ "UNINITIALIZED", "TOP", "u -", "!", "*", "/", "+", "-", "<", "<=",
@@ -97,7 +97,7 @@ namespace CexmcAST
}
void Subtree::PrintLeaf( const Leaf * leaf, int level ) const
void Subtree::PrintLeaf( const Leaf * leaf, int level ) const
{
const Variable * variable( NULL );
std::stringstream value;
@@ -144,7 +144,7 @@ namespace
}
const G4double CexmcASTEval::constants[] = { eV, keV, MeV, GeV, mm, cm, m };
const G4double CexmcASTEval::constants[] = { eV, keV, MeV, GeV, mm, cm, m };
CexmcASTEval::CexmcASTEval( const CexmcEventFastSObject * evFastSObject,
@@ -65,13 +65,13 @@ void GetNormalizedAngularRange( const CexmcAngularRangeList & src,
if ( std::fabs( k->top - ( k - 1 )->top ) < epsilon ||
k->bottom + epsilon >= ( k - 1 )->bottom )
{
dst.erase( k );
k = dst.erase( k );
continue;
}
if ( k->top + epsilon >= ( k - 1 )->bottom )
{
( k - 1 )->bottom = k->bottom;
dst.erase( k );
k = dst.erase( k );
continue;
}
++k;
@@ -41,6 +41,7 @@
* ============================================================================
*/
#include <cmath>
#include <G4ThreeVector.hh>
#include <G4LorentzVector.hh>
#include "CexmcChargeExchangeReconstructor.hh"
@@ -51,20 +52,20 @@
#include "CexmcProductionModel.hh"
#include "CexmcRunManager.hh"
#include "CexmcException.hh"
#include "CexmcCommon.hh"
CexmcChargeExchangeReconstructor::CexmcChargeExchangeReconstructor(
const CexmcProductionModel * productionModel ) :
outputParticleMass( 0 ), nucleusOutputParticleMass( 0 ),
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 )
absorbedEnergyCutEllipseAngle( 0 ), expectedMomentumAmp( -1 ),
edCollectionAlgorithm( CexmcCollectEDInAllCrystals ),
hasMassCutTriggered( false ), hasAbsorbedEnergyCutTriggered( false ),
beamParticleIsInitialized( false ), particleGun( NULL ), messenger( NULL )
{
if ( ! productionModel )
throw CexmcException( CexmcWeirdException );
@@ -121,6 +122,9 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
beamParticleIsInitialized = true;
}
if ( edCollectionAlgorithm == CexmcCollectEDInAdjacentCrystals )
collectEDInAdjacentCrystals = true;
ReconstructEntryPoints( edStore );
if ( hasBasicTrigger )
ReconstructTargetPoint();
@@ -136,6 +140,12 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
G4double calorimeterEDLeft( edStore->calorimeterEDLeft );
G4double calorimeterEDRight( edStore->calorimeterEDRight );
if ( edCollectionAlgorithm == CexmcCollectEDInAdjacentCrystals )
{
calorimeterEDLeft = calorimeterEDLeftAdjacent;
calorimeterEDRight = calorimeterEDRightAdjacent;
}
//G4double cosOutputParticleLAB(
//( calorimeterEDLeft * cosAngleLeft +
//calorimeterEDRight * cosAngleRight ) /
@@ -152,17 +162,21 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
opdpRightMomentum.setMag( calorimeterEDRight );
G4ThreeVector opMomentum( opdpLeftMomentum + opdpRightMomentum );
/* opMass will be used only in calculation of output particle's total
* energy, in other places outputParticleMass should be used instead */
G4double opMass( useTableMass ?
productionModelData.outputParticle->GetPDGMass() :
outputParticleMass );
G4double opEnergy( std::sqrt(
opMomentum.mag2() + opMass * opMass ) );
/* the formula below is equivalent to
* calorimeterEDLeft + calorimeterEDRight if opMass = outputParticleMass */
G4double opEnergy( std::sqrt( opMomentum.mag2() +
opMass * opMass ) );
productionModelData.outputParticleLAB = G4LorentzVector( opMomentum,
opEnergy );
G4ThreeVector incidentParticleMomentum( particleGun->GetOrigDirection() );
G4double incidentParticleMomentumAmp(
particleGun->GetOrigMomentumAmp() );
G4double incidentParticleMomentumAmp( expectedMomentumAmp > 0 ?
expectedMomentumAmp : particleGun->GetOrigMomentumAmp() );
incidentParticleMomentum *= incidentParticleMomentumAmp;
G4double incidentParticlePDGMass(
@@ -179,6 +193,7 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
productionModelData.nucleusParticle->GetPDGMass() );
productionModelData.nucleusParticleLAB = G4LorentzVector(
G4ThreeVector( 0, 0, 0 ), nucleusParticlePDGMass );
G4LorentzVector lVecSum( productionModelData.incidentParticleLAB +
productionModelData.nucleusParticleLAB );
G4ThreeVector boostVec( lVecSum.boostVector() );
@@ -200,19 +215,9 @@ void CexmcChargeExchangeReconstructor::Reconstruct(
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 ) );
G4double nopEnergy( incidentParticleEnergy + nucleusParticlePDGMass -
opEnergy );
nucleusOutputParticleMass = std::sqrt( nopEnergy * nopEnergy -
nopMomentum.mag2() );
@@ -292,3 +297,10 @@ G4bool CexmcChargeExchangeReconstructor::HasFullTrigger( void ) const
return true;
}
void CexmcChargeExchangeReconstructor::SetExpectedMomentumAmpDiff(
G4double value )
{
expectedMomentumAmp = particleGun->GetOrigMomentumAmp() + value;
}
@@ -42,6 +42,7 @@
*/
#include <G4UIcmdWithABool.hh>
#include <G4UIcmdWithAString.hh>
#include <G4UIcmdWithADoubleAndUnit.hh>
#include "CexmcChargeExchangeReconstructorMessenger.hh"
#include "CexmcChargeExchangeReconstructor.hh"
@@ -56,7 +57,8 @@ CexmcChargeExchangeReconstructorMessenger::
mCutOPWidth( NULL ), mCutNOPWidth( NULL ), mCutAngle( NULL ),
useAbsorbedEnergyCut( NULL ), aeCutCLCenter( NULL ),
aeCutCRCenter( NULL ), aeCutCLWidth( NULL ), aeCutCRWidth( NULL ),
aeCutAngle( NULL )
aeCutAngle( NULL ), setExpectedMomentumAmp( NULL ),
setExpectedMomentumAmpDiff( NULL ), setEDCollectionAlgorithm( NULL )
{
useTableMass = new G4UIcmdWithABool(
( CexmcMessenger::reconstructorDirName + "useTableMass" ).c_str(),
@@ -64,138 +66,180 @@ CexmcChargeExchangeReconstructorMessenger::
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->SetParameterName( "UseTableMass", true );
useTableMass->SetDefaultValue( true );
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->SetParameterName( "UseMassCut", true );
useMassCut->SetDefaultValue( true );
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->SetGuidance( "\n 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->SetDefaultUnit( "MeV" );
mCutOPCenter->AvailableForStates( G4State_PreInit, G4State_Idle );
mCutNOPCenter = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "mCutNOPCenter" ).c_str(),
this );
mCutNOPCenter->SetGuidance( "Center of the ellipse in nucleus output "
mCutNOPCenter->SetGuidance( "\n 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->SetDefaultUnit( "MeV" );
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->SetGuidance( "\n 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->SetDefaultUnit( "MeV" );
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->SetGuidance( "\n 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->SetDefaultUnit( "MeV" );
mCutNOPWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
mCutAngle = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "mCutAngle" ).c_str(),
this );
mCutAngle->SetGuidance( "Angle of the ellipse" );
mCutAngle->SetGuidance( "\n Angle of the ellipse" );
mCutAngle->SetParameterName( "MCutAngle", false );
mCutAngle->SetDefaultValue( 0 );
mCutAngle->SetDefaultUnit( "deg" );
mCutAngle->SetUnitCandidates( "deg rad" );
mCutAngle->SetDefaultUnit( "deg" );
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->SetGuidance( "\n Use elliptical cut for absorbed "
"energies in\n calorimeters" );
useAbsorbedEnergyCut->SetParameterName( "UseAbsorbedEnergyCut", true );
useAbsorbedEnergyCut->SetDefaultValue( true );
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->SetGuidance( "\n 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->SetDefaultUnit( "MeV" );
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->SetGuidance( "\n 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->SetDefaultUnit( "MeV" );
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->SetGuidance( "\n 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->SetDefaultUnit( "MeV" );
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->SetGuidance( "\n 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->SetDefaultUnit( "MeV" );
aeCutCRWidth->AvailableForStates( G4State_PreInit, G4State_Idle );
aeCutAngle = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "aeCutAngle" ).c_str(),
this );
aeCutAngle->SetGuidance( "Angle of the ellipse" );
aeCutAngle->SetGuidance( "\n Angle of the ellipse" );
aeCutAngle->SetParameterName( "AECutAngle", false );
aeCutAngle->SetDefaultValue( 0 );
aeCutAngle->SetDefaultUnit( "deg" );
aeCutAngle->SetUnitCandidates( "deg rad" );
aeCutAngle->SetDefaultUnit( "deg" );
aeCutAngle->AvailableForStates( G4State_PreInit, G4State_Idle );
setExpectedMomentumAmp = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "momentumAmp" ).c_str(),
this );
setExpectedMomentumAmp->SetGuidance( "\n Momentum of a beam particle "
"expected in the target;\n this value may differ from original "
"momentum\n of the beam as far as profile data of the beam refer\n"
" to the place where it starts. This parameter is used only\n"
" in reconstruction procedure");
setExpectedMomentumAmp->SetParameterName( "RecMomentumAmp", false );
setExpectedMomentumAmp->SetRange( "RecMomentumAmp > 0" );
setExpectedMomentumAmp->SetUnitCandidates( "eV keV MeV GeV" );
setExpectedMomentumAmp->SetDefaultUnit( "MeV" );
setExpectedMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
setExpectedMomentumAmpDiff = new G4UIcmdWithADoubleAndUnit(
( CexmcMessenger::reconstructorDirName + "momentumAmpDiff" ).c_str(),
this );
setExpectedMomentumAmpDiff->SetGuidance( "\n Expected difference "
"between momenta of the beam\n on its start and in the target. This "
"parameter can\n be used to automatically calculate value of the\n"
" previous parameter 'momentumAmp'" );
setExpectedMomentumAmpDiff->SetParameterName( "RecMomentumAmpDiff", false );
setExpectedMomentumAmpDiff->SetDefaultValue( 0 );
setExpectedMomentumAmpDiff->SetUnitCandidates( "eV keV MeV GeV" );
setExpectedMomentumAmpDiff->SetDefaultUnit( "MeV" );
setExpectedMomentumAmpDiff->AvailableForStates( G4State_PreInit,
G4State_Idle );
setEDCollectionAlgorithm = new G4UIcmdWithAString(
( CexmcMessenger::reconstructorDirName + "edCollectionAlgo" ).c_str(),
this );
setEDCollectionAlgorithm->SetGuidance(
"\n Choose crystals to be selected when energy deposit collected\n"
" all - all,\n"
" adjacent - crystal with maximum energy deposit and\n"
" adjacent crystals" );
setEDCollectionAlgorithm->SetParameterName( "EDCollectionAlgo", false );
setEDCollectionAlgorithm->SetCandidates( "all adjacent" );
setEDCollectionAlgorithm->SetDefaultValue( "all" );
setEDCollectionAlgorithm->AvailableForStates( G4State_PreInit,
G4State_Idle );
}
@@ -215,6 +259,9 @@ CexmcChargeExchangeReconstructorMessenger::
delete aeCutCLWidth;
delete aeCutCRWidth;
delete aeCutAngle;
delete setExpectedMomentumAmp;
delete setExpectedMomentumAmpDiff;
delete setEDCollectionAlgorithm;
}
@@ -301,6 +348,33 @@ void CexmcChargeExchangeReconstructorMessenger::SetNewValue(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setExpectedMomentumAmp )
{
reconstructor->SetExpectedMomentumAmp(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setExpectedMomentumAmpDiff )
{
reconstructor->SetExpectedMomentumAmpDiff(
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
break;
}
if ( cmd == setEDCollectionAlgorithm )
{
CexmcEDCollectionAlgoritm
edCollectionAlgorithm( CexmcCollectEDInAllCrystals );
do
{
if ( value == "adjacent" )
{
edCollectionAlgorithm = CexmcCollectEDInAdjacentCrystals;
break;
}
} while ( false );
reconstructor->SetEDCollectionAlgorithm( edCollectionAlgorithm );
break;
}
} while ( false );
}
@@ -46,6 +46,7 @@
#include "CexmcEnergyDepositStore.hh"
#include "CexmcTrackPointsStore.hh"
G4Allocator< CexmcTrackPointInfo > trackPointInfoAllocator;
G4Allocator< CexmcEnergyDepositStore > energyDepositStoreAllocator;
G4Allocator< CexmcTrackPointsStore > trackPointsStoreAllocator;
@@ -68,7 +68,7 @@ namespace CexmcCustomFilter
{
ast = boost::get< Subtree >( node );
}
catch( const boost::bad_get & )
catch ( const boost::bad_get & )
{
ast.type = Operator( Top );
ast.children.push_back( node );
@@ -112,7 +112,7 @@ namespace CexmcCustomFilter
* 0) or a unary operator or a function occured */
while ( true )
{
Subtree * candidate = boost::get< Subtree >(
Subtree * candidate = boost::get< Subtree >(
&astDeepestRight->children[ 0 ] );
if ( ! candidate )
break;
@@ -54,7 +54,6 @@
#include "CexmcSetup.hh"
#include "CexmcRunManager.hh"
#include "CexmcSensitiveDetectorsAttributes.hh"
#include "CexmcCommon.hh"
CexmcEnergyDepositDigitizer::CexmcEnergyDepositDigitizer(
@@ -166,7 +165,7 @@ void CexmcEnergyDepositDigitizer::Digitize( void )
CexmcDetectorRoleName[ CexmcMonitorDetectorRole ] +
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] ) );
const CexmcEnergyDepositCollection *
hitsCollection( static_cast< const CexmcEnergyDepositCollection* >(
hitsCollection( static_cast< const CexmcEnergyDepositCollection * >(
digiManager->GetHitsCollection( hcId ) ) );
if ( hitsCollection )
@@ -179,11 +178,11 @@ void CexmcEnergyDepositDigitizer::Digitize( void )
hcId = digiManager->GetHitsCollectionID(
CexmcDetectorRoleName[ CexmcVetoCounterDetectorRole ] +
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] );
hitsCollection = static_cast< const CexmcEnergyDepositCollection* >(
hitsCollection = static_cast< const CexmcEnergyDepositCollection * >(
digiManager->GetHitsCollection( hcId ) );
if ( hitsCollection )
{
for ( std::map< G4int, G4double* >::iterator
for ( CexmcEnergyDepositCollectionData::iterator
k( hitsCollection->GetMap()->begin() );
k != hitsCollection->GetMap()->end(); ++k )
{
@@ -217,11 +216,11 @@ void CexmcEnergyDepositDigitizer::Digitize( void )
hcId = digiManager->GetHitsCollectionID(
CexmcDetectorRoleName[ CexmcCalorimeterDetectorRole ] +
"/" + CexmcDetectorTypeName[ CexmcEDDetector ] );
hitsCollection = static_cast< const CexmcEnergyDepositCollection* >(
hitsCollection = static_cast< const CexmcEnergyDepositCollection * >(
digiManager->GetHitsCollection( hcId ) );
if ( hitsCollection )
{
for ( std::map< G4int, G4double* >::iterator
for ( CexmcEnergyDepositCollectionData::iterator
k( hitsCollection->GetMap()->begin() );
k != hitsCollection->GetMap()->end(); ++k )
{
@@ -70,8 +70,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
setMonitorThreshold->SetGuidance( "Monitor trigger threshold" );
setMonitorThreshold->SetParameterName( "MonitorThreshold", false );
setMonitorThreshold->SetDefaultValue( 0 );
setMonitorThreshold->SetDefaultUnit( "MeV" );
setMonitorThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setMonitorThreshold->SetDefaultUnit( "MeV" );
setMonitorThreshold->AvailableForStates( G4State_PreInit, G4State_Idle );
setVetoCountersThreshold = new G4UIcmdWithADoubleAndUnit(
@@ -81,8 +81,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
setVetoCountersThreshold->SetParameterName( "VetoCountersThreshold",
false );
setVetoCountersThreshold->SetDefaultValue( 0 );
setVetoCountersThreshold->SetDefaultUnit( "MeV" );
setVetoCountersThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setVetoCountersThreshold->SetDefaultUnit( "MeV" );
setVetoCountersThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -94,8 +94,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
setLeftVetoCounterThreshold->SetParameterName( "LeftVetoCounterThreshold",
false );
setLeftVetoCounterThreshold->SetDefaultValue( 0 );
setLeftVetoCounterThreshold->SetDefaultUnit( "MeV" );
setLeftVetoCounterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setLeftVetoCounterThreshold->SetDefaultUnit( "MeV" );
setLeftVetoCounterThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -107,8 +107,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
setRightVetoCounterThreshold->SetParameterName( "RightVetoCounterThreshold",
false );
setRightVetoCounterThreshold->SetDefaultValue( 0 );
setRightVetoCounterThreshold->SetDefaultUnit( "MeV" );
setRightVetoCounterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setRightVetoCounterThreshold->SetDefaultUnit( "MeV" );
setRightVetoCounterThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -119,8 +119,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
setCalorimetersThreshold->SetParameterName( "CalorimetersThreshold",
false );
setCalorimetersThreshold->SetDefaultValue( 0 );
setCalorimetersThreshold->SetDefaultUnit( "MeV" );
setCalorimetersThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setCalorimetersThreshold->SetDefaultUnit( "MeV" );
setCalorimetersThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -132,8 +132,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
setLeftCalorimeterThreshold->SetParameterName( "LeftCalorimeterThreshold",
false );
setLeftCalorimeterThreshold->SetDefaultValue( 0 );
setLeftCalorimeterThreshold->SetDefaultUnit( "MeV" );
setLeftCalorimeterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setLeftCalorimeterThreshold->SetDefaultUnit( "MeV" );
setLeftCalorimeterThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -145,8 +145,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
setRightCalorimeterThreshold->SetParameterName( "RightCalorimeterThreshold",
false );
setRightCalorimeterThreshold->SetDefaultValue( 0 );
setRightCalorimeterThreshold->SetDefaultUnit( "MeV" );
setRightCalorimeterThreshold->SetUnitCandidates( "ev keV MeV GeV" );
setRightCalorimeterThreshold->SetDefaultUnit( "MeV" );
setRightCalorimeterThreshold->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -162,8 +162,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
"value" );
setCalorimeterTriggerAlgorithm->SetParameterName(
"CalorimeterTriggerAlgorithm", false );
setCalorimeterTriggerAlgorithm->SetDefaultValue( "inner" );
setCalorimeterTriggerAlgorithm->SetCandidates( "all inner" );
setCalorimeterTriggerAlgorithm->SetDefaultValue( "inner" );
setCalorimeterTriggerAlgorithm->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -179,8 +179,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
"value of\n 'outerCrystalsVetoFraction'" );
setOuterCrystalsVetoAlgorithm->SetParameterName(
"OuterCrystalsVetoAlgorithm", false );
setOuterCrystalsVetoAlgorithm->SetDefaultValue( "none" );
setOuterCrystalsVetoAlgorithm->SetCandidates( "none max fraction" );
setOuterCrystalsVetoAlgorithm->SetDefaultValue( "none" );
setOuterCrystalsVetoAlgorithm->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -204,8 +204,8 @@ CexmcEnergyDepositDigitizerMessenger::CexmcEnergyDepositDigitizerMessenger(
applyFiniteCrystalResolution->SetGuidance( "\n Specify if finite "
"energy resolution of the crystals\n will be accounted" );
applyFiniteCrystalResolution->SetParameterName(
"ApplyFiniteCrystalResolution", false );
applyFiniteCrystalResolution->SetDefaultValue( false );
"ApplyFiniteCrystalResolution", true );
applyFiniteCrystalResolution->SetDefaultValue( true );
applyFiniteCrystalResolution->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -302,7 +302,7 @@ void CexmcEnergyDepositDigitizerMessenger::SetNewValue( G4UIcommand * cmd,
}
if ( cmd == setCalorimeterTriggerAlgorithm )
{
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm(
CexmcCalorimeterTriggerAlgorithm calorimeterTriggerAlgorithm(
CexmcAllCrystalsMakeEDTriggerThreshold );
do
{
@@ -319,7 +319,7 @@ void CexmcEnergyDepositDigitizerMessenger::SetNewValue( G4UIcommand * cmd,
}
if ( cmd == setOuterCrystalsVetoAlgorithm )
{
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm(
CexmcOuterCrystalsVetoAlgorithm outerCrystalsVetoAlgorithm(
CexmcNoOuterCrystalsVeto );
do
{
@@ -51,9 +51,6 @@
#include "CexmcSetup.hh"
G4int CexmcEnergyDepositInCalorimeter::copyDepth1BitsOffset( 8 );
CexmcEnergyDepositInCalorimeter::CexmcEnergyDepositInCalorimeter(
const G4String & name, const CexmcSetup * setup ) :
CexmcEnergyDepositInLeftRightSet( name, setup )
@@ -88,13 +85,11 @@ void CexmcEnergyDepositInCalorimeter::PrintAll( void )
if ( nmbOfEntries == 0 )
return;
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << nmbOfEntries << G4endl;
PrintHeader( nmbOfEntries );
for( std::map< G4int, G4double* >::iterator
itr( eventMap->GetMap()->begin() );
itr != eventMap->GetMap()->end(); ++itr )
for ( CexmcEnergyDepositCollectionData::iterator
itr( eventMap->GetMap()->begin() );
itr != eventMap->GetMap()->end(); ++itr )
{
G4bool isRightDetector( itr->first >> leftRightBitsOffset );
G4int index( itr->first &
@@ -51,9 +51,6 @@
#include "CexmcSetup.hh"
G4int CexmcEnergyDepositInLeftRightSet::leftRightBitsOffset( 16 );
CexmcEnergyDepositInLeftRightSet::CexmcEnergyDepositInLeftRightSet(
const G4String & name, const CexmcSetup * setup ) :
CexmcSimpleEnergyDeposit( name ), setup( setup )
@@ -81,13 +78,11 @@ void CexmcEnergyDepositInLeftRightSet::PrintAll( void )
if ( nmbOfEntries == 0 )
return;
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << GetName() << G4endl;
G4cout << " Number of entries " << nmbOfEntries << G4endl;
PrintHeader( nmbOfEntries );
for( std::map< G4int, G4double* >::iterator
itr( eventMap->GetMap()->begin() );
itr != eventMap->GetMap()->end(); ++itr )
for ( CexmcEnergyDepositCollectionData::iterator
itr( eventMap->GetMap()->begin() );
itr != eventMap->GetMap()->end(); ++itr )
{
G4bool isRightDetector( itr->first >> leftRightBitsOffset );
const G4String detectorSide( isRightDetector ? "right" : "left" );
@@ -41,6 +41,7 @@
* ============================================================================
*/
#include <cmath>
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/archive/binary_oarchive.hpp>
#endif
@@ -59,10 +60,8 @@
#include "CexmcEventFastSObject.hh"
#include "CexmcTrackingAction.hh"
#include "CexmcChargeExchangeReconstructor.hh"
#ifdef CEXMC_USE_ROOT
#include "CexmcHistoManager.hh"
#endif
#include "CexmcRunManager.hh"
#include "CexmcHistoManager.hh"
#include "CexmcRun.hh"
#include "CexmcPhysicsManager.hh"
#include "CexmcProductionModel.hh"
@@ -82,13 +81,19 @@ namespace
G4double CexmcBigCircleScreenSize( 10.0 );
G4Colour CexmcTrackPointsMarkerColour( 0.0, 1.0, 0.4 );
G4Colour CexmcRecTrackPointsMarkerColour( 1.0, 0.4, 0.0 );
inline G4double CexmcGetKinEnergy( G4double momentumAmp, G4double mass )
{
return std::sqrt( momentumAmp * momentumAmp + mass * mass ) - mass;
}
}
CexmcEventAction::CexmcEventAction( CexmcPhysicsManager * physicsManager,
G4int verbose ) :
physicsManager( physicsManager ), reconstructor( NULL ), verbose( verbose ),
verboseDraw( 4 ), messenger( NULL )
physicsManager( physicsManager ), reconstructor( NULL ), opKinEnergy( 0. ),
verbose( verbose ), verboseDraw( 4 ), messenger( NULL )
{
G4DigiManager * digiManager( G4DigiManager::GetDMpointer() );
digiManager->AddNewModule( new CexmcEnergyDepositDigitizer(
@@ -128,7 +133,7 @@ void CexmcEventAction::BeginOfEventAction( const G4Event * )
CexmcEnergyDepositStore * CexmcEventAction::MakeEnergyDepositStore(
const CexmcEnergyDepositDigitizer * digitizer, G4bool useInnerRefCrystal )
const CexmcEnergyDepositDigitizer * digitizer )
{
G4double monitorED( digitizer->GetMonitorED() );
G4double vetoCounterEDLeft( digitizer->GetVetoCounterEDLeft() );
@@ -139,18 +144,12 @@ CexmcEnergyDepositStore * CexmcEventAction::MakeEnergyDepositStore(
G4int calorimeterEDLeftMaxY( digitizer->GetCalorimeterEDLeftMaxY() );
G4int calorimeterEDRightMaxX( digitizer->GetCalorimeterEDRightMaxX() );
G4int calorimeterEDRightMaxY( digitizer->GetCalorimeterEDRightMaxY() );
if ( useInnerRefCrystal )
{
digitizer->TransformToAdjacentInnerCrystal( calorimeterEDLeftMaxX,
calorimeterEDLeftMaxY );
digitizer->TransformToAdjacentInnerCrystal( calorimeterEDRightMaxX,
calorimeterEDRightMaxY );
}
const CexmcEnergyDepositCalorimeterCollection &
calorimeterEDLeftCollection(
calorimeterEDLeftCollection(
digitizer->GetCalorimeterEDLeftCollection() );
const CexmcEnergyDepositCalorimeterCollection &
calorimeterEDRightCollection(
calorimeterEDRightCollection(
digitizer->GetCalorimeterEDRightCollection() );
/* ATTENTION: return object in heap - must be freed by caller! */
@@ -266,8 +265,8 @@ void CexmcEventAction::PrintProductionModelData(
void CexmcEventAction::PrintReconstructedData(
const CexmcAngularRangeList & triggeredRecAngularRanges,
const CexmcAngularRange & angularGap ) const
const CexmcAngularRangeList & triggeredRecAngularRanges,
const CexmcAngularRange & angularGap ) const
{
G4cout << " --- Reconstructed data: " << G4endl;
G4cout << " -- entry points:" << G4endl;
@@ -352,6 +351,11 @@ void CexmcEventAction::FillTPTHistos( const CexmcTrackPointsStore * tpStore,
tpStore->targetTPOutputParticle.positionLocal.x(),
tpStore->targetTPOutputParticle.positionLocal.y(),
tpStore->targetTPOutputParticle.positionLocal.z() );
if ( histoManager->GetVerboseLevel() > 0 )
{
histoManager->Add( CexmcMomentumIP_TPT_Histo, 0,
pmData.incidentParticleLAB.rho() );
}
}
for ( CexmcAngularRangeList::const_iterator
@@ -377,16 +381,10 @@ void CexmcEventAction::FillTPTHistos( const CexmcTrackPointsStore * tpStore,
tpStore->targetTPOutputParticle.positionLocal.x(),
tpStore->targetTPOutputParticle.positionLocal.y(),
tpStore->targetTPOutputParticle.positionLocal.z() );
G4double momentumAmp(
tpStore->targetTPOutputParticle.momentumAmp );
G4double mass( tpStore->targetTPOutputParticle.particle->
GetPDGMass() );
G4double kinEnergy( std::sqrt( momentumAmp * momentumAmp +
mass * mass ) -mass );
histoManager->Add( CexmcKinEnOP_LAB_ARReal_TPT_Histo,
k->index, kinEnergy );
histoManager->Add( CexmcAngleOP_SCM_ARReal_TPT_Histo,
k->index, pmData.outputParticleSCM.cosTheta() );
histoManager->Add( CexmcKinEnOP_LAB_ARReal_TPT_Histo, k->index,
opKinEnergy );
histoManager->Add( CexmcAngleOP_SCM_ARReal_TPT_Histo, k->index,
pmData.outputParticleSCM.cosTheta() );
}
if ( tpStore->targetTPOutputParticleDecayProductParticle1.IsValid() &&
tpStore->targetTPOutputParticleDecayProductParticle2.IsValid() )
@@ -396,8 +394,8 @@ void CexmcEventAction::FillTPTHistos( const CexmcTrackPointsStore * tpStore,
directionWorld.angle( tpStore->
targetTPOutputParticleDecayProductParticle2.
directionWorld ) / deg );
histoManager->Add( CexmcOpenAngle_ARReal_TPT_Histo,
k->index, openAngle );
histoManager->Add( CexmcOpenAngle_ARReal_TPT_Histo, k->index,
openAngle );
}
}
}
@@ -502,20 +500,14 @@ void CexmcEventAction::FillRTHistos( G4bool reconstructorHasFullTrigger,
tpStore->targetTPOutputParticle.positionLocal.x(),
tpStore->targetTPOutputParticle.positionLocal.y(),
tpStore->targetTPOutputParticle.positionLocal.z() );
G4double momentumAmp(
tpStore->targetTPOutputParticle.momentumAmp );
G4double mass( tpStore->targetTPOutputParticle.particle->
GetPDGMass() );
G4double kinEnergy( std::sqrt( momentumAmp * momentumAmp +
mass * mass ) -mass );
histoManager->Add( CexmcKinEnOP_LAB_ARReal_RT_Histo,
k->index, kinEnergy );
histoManager->Add( CexmcAngleOP_SCM_ARReal_RT_Histo,
k->index, pmData.outputParticleSCM.cosTheta() );
histoManager->Add( CexmcKinEnOP_LAB_ARReal_RT_Histo, k->index,
opKinEnergy );
histoManager->Add( CexmcAngleOP_SCM_ARReal_RT_Histo, k->index,
pmData.outputParticleSCM.cosTheta() );
G4double diffCosTheta( pmData.outputParticleSCM.cosTheta() -
recCosTheta );
histoManager->Add( CexmcDiffAngleOP_SCM_ARReal_RT_Histo,
k->index, diffCosTheta );
histoManager->Add( CexmcDiffAngleOP_SCM_ARReal_RT_Histo, k->index,
diffCosTheta );
}
if ( tpStore->targetTPOutputParticleDecayProductParticle1.IsValid() &&
tpStore->targetTPOutputParticleDecayProductParticle2.IsValid() )
@@ -525,12 +517,12 @@ void CexmcEventAction::FillRTHistos( G4bool reconstructorHasFullTrigger,
directionWorld.angle( tpStore->
targetTPOutputParticleDecayProductParticle2.
directionWorld ) / deg );
histoManager->Add( CexmcOpenAngle_ARReal_RT_Histo,
k->index, openAngle );
histoManager->Add( CexmcOpenAngle_ARReal_RT_Histo, k->index,
openAngle );
G4double diffOpenAngle( openAngle - reconstructor->GetTheAngle() /
deg );
histoManager->Add( CexmcDiffOpenAngle_ARReal_RT_Histo,
k->index, diffOpenAngle );
histoManager->Add( CexmcDiffOpenAngle_ARReal_RT_Histo, k->index,
diffOpenAngle );
}
if ( tpStore->calorimeterTPLeft.IsValid() )
{
@@ -583,12 +575,10 @@ void CexmcEventAction::DrawTrajectories( const G4Event * event )
nTraj = trajContainer->entries();
G4int drawMode( drawTrajectoryMarkers ? 1000 : 0 );
for ( int i( 0 ); i < nTraj; ++i )
{
G4VTrajectory * traj( ( *trajContainer )[ i ] );
traj->DrawTrajectory( drawMode );
traj->DrawTrajectory();
}
}
@@ -749,7 +739,7 @@ void CexmcEventAction::SaveEvent( const G4Event * event,
runManager->GetEventsArchive() );
if ( archive )
{
CexmcEventSObject sObject( event->GetEventID(),
CexmcEventSObject sObject = { event->GetEventID(),
edDigitizerHasTriggered, edStore->monitorED,
edStore->vetoCounterEDLeft, edStore->vetoCounterEDRight,
edStore->calorimeterEDLeft, edStore->calorimeterEDRight,
@@ -760,7 +750,7 @@ void CexmcEventAction::SaveEvent( const G4Event * event,
tpStore->targetTPOutputParticleDecayProductParticle1,
tpStore->targetTPOutputParticleDecayProductParticle2,
tpStore->vetoCounterTPLeft, tpStore->vetoCounterTPRight,
tpStore->calorimeterTPLeft, tpStore->calorimeterTPRight, pmData );
tpStore->calorimeterTPLeft, tpStore->calorimeterTPRight, pmData };
archive->operator<<( sObject );
const CexmcRun * run( static_cast< const CexmcRun * >(
runManager->GetCurrentRun() ) );
@@ -791,9 +781,9 @@ void CexmcEventAction::SaveEventFast( const G4Event * event,
if ( ! tpDigitizerHasTriggered )
opCosThetaSCM = CexmcInvalidCosTheta;
CexmcEventFastSObject sObject( event->GetEventID(), opCosThetaSCM,
edDigitizerHasTriggered,
edDigitizerMonitorHasTriggered );
CexmcEventFastSObject sObject = { event->GetEventID(), opCosThetaSCM,
edDigitizerHasTriggered,
edDigitizerMonitorHasTriggered };
archive->operator<<( sObject );
const CexmcRun * run( static_cast< const CexmcRun * >(
runManager->GetCurrentRun() ) );
@@ -809,10 +799,10 @@ void CexmcEventAction::EndOfEventAction( const G4Event * event )
{
G4DigiManager * digiManager( G4DigiManager::GetDMpointer() );
CexmcEnergyDepositDigitizer * energyDepositDigitizer(
static_cast< CexmcEnergyDepositDigitizer* >( digiManager->
static_cast< CexmcEnergyDepositDigitizer * >( digiManager->
FindDigitizerModule( CexmcEDDigitizerName ) ) );
CexmcTrackPointsDigitizer * trackPointsDigitizer(
static_cast< CexmcTrackPointsDigitizer* >( digiManager->
CexmcTrackPointsDigitizer * trackPointsDigitizer(
static_cast< CexmcTrackPointsDigitizer * >( digiManager->
FindDigitizerModule( CexmcTPDigitizerName ) ) );
energyDepositDigitizer->Digitize();
@@ -832,10 +822,9 @@ void CexmcEventAction::EndOfEventAction( const G4Event * event )
G4bool reconstructorHasFullTrigger( false );
CexmcEnergyDepositStore * edStore( MakeEnergyDepositStore(
energyDepositDigitizer,
reconstructor->IsInnerRefCrystalUsed() ) );
energyDepositDigitizer ) );
CexmcTrackPointsStore * tpStore( MakeTrackPointsStore(
trackPointsDigitizer ) );
trackPointsDigitizer ) );
try
{
@@ -845,9 +834,9 @@ void CexmcEventAction::EndOfEventAction( const G4Event * event )
if ( ! productionModel )
throw CexmcException( CexmcWeirdException );
const CexmcAngularRangeList & angularRanges(
const CexmcAngularRangeList & angularRanges(
productionModel->GetAngularRanges() );
const CexmcAngularRangeList & triggeredAngularRanges(
const CexmcAngularRangeList & triggeredAngularRanges(
productionModel->GetTriggeredAngularRanges() );
const CexmcProductionModelData & pmData(
productionModel->GetProductionModelData() );
@@ -950,21 +939,25 @@ void CexmcEventAction::EndOfEventAction( const G4Event * event )
#endif
#ifdef CEXMC_USE_ROOT
if ( edDigitizerHasTriggered )
/* opKinEnergy will be used in several histos */
if ( tpStore->targetTPOutputParticle.IsValid() )
{
FillEDTHistos( edStore, triggeredAngularRanges );
opKinEnergy = CexmcGetKinEnergy(
tpStore->targetTPOutputParticle.momentumAmp,
tpStore->targetTPOutputParticle.particle->GetPDGMass() );
}
if ( tpDigitizerHasTriggered )
{
if ( edDigitizerHasTriggered )
FillEDTHistos( edStore, triggeredAngularRanges );
/* fill TPT histos only when the monitor has triggered because events
* when it was missed have less value for us */
if ( tpDigitizerHasTriggered && edDigitizerMonitorHasTriggered )
FillTPTHistos( tpStore, pmData, triggeredAngularRanges );
}
if ( reconstructorHasBasicTrigger )
{
FillRTHistos( reconstructorHasFullTrigger, edStore, tpStore,
pmData, triggeredAngularRanges );
}
#endif
G4Event * theEvent( const_cast< G4Event * >( event ) );
@@ -42,7 +42,6 @@
*/
#include <G4UIcmdWithAnInteger.hh>
#include <G4UIcmdWithABool.hh>
#include "CexmcEventActionMessenger.hh"
#include "CexmcEventAction.hh"
#include "CexmcMessenger.hh"
@@ -51,7 +50,7 @@
CexmcEventActionMessenger::CexmcEventActionMessenger(
CexmcEventAction * eventAction ) :
eventAction( eventAction ), setVerboseLevel( NULL ),
setVerboseDrawLevel( NULL ), drawTrajectoryMarkers( NULL )
setVerboseDrawLevel( NULL )
{
setVerboseLevel = new G4UIcmdWithAnInteger(
( CexmcMessenger::eventDirName + "verbose" ).c_str() , this );
@@ -65,8 +64,8 @@ CexmcEventActionMessenger::CexmcEventActionMessenger(
"event\n triggered,\n"
" 4 - print messages on every event" );
setVerboseLevel->SetParameterName( "Verbose", false );
setVerboseLevel->SetDefaultValue( 0 );
setVerboseLevel->SetRange( "Verbose >= 0 && Verbose <= 4" );
setVerboseLevel->SetDefaultValue( 0 );
setVerboseLevel->AvailableForStates( G4State_PreInit, G4State_Idle );
setVerboseDrawLevel = new G4UIcmdWithAnInteger(
@@ -84,17 +83,9 @@ CexmcEventActionMessenger::CexmcEventActionMessenger(
" 4 - draw trajectories and/or track points on "
"every event" );
setVerboseDrawLevel->SetParameterName( "VerboseDraw", false );
setVerboseDrawLevel->SetDefaultValue( 4 );
setVerboseDrawLevel->SetRange( "VerboseDraw >= 0 && VerboseDraw <= 4" );
setVerboseDrawLevel->SetDefaultValue( 4 );
setVerboseDrawLevel->AvailableForStates( G4State_PreInit, G4State_Idle );
drawTrajectoryMarkers = new G4UIcmdWithABool(
( CexmcMessenger::visDirName + "drawTrajMarkers" ).c_str() , this );
drawTrajectoryMarkers->SetGuidance( "draw markers in places where "
"trajectories change" );
drawTrajectoryMarkers->SetParameterName( "DrawTrajMarkers", false );
drawTrajectoryMarkers->SetDefaultValue( false );
drawTrajectoryMarkers->AvailableForStates( G4State_PreInit, G4State_Idle );
}
@@ -102,7 +93,6 @@ CexmcEventActionMessenger::~CexmcEventActionMessenger()
{
delete setVerboseLevel;
delete setVerboseDrawLevel;
delete drawTrajectoryMarkers;
}
@@ -123,12 +113,6 @@ void CexmcEventActionMessenger::SetNewValue( G4UIcommand * cmd,
G4UIcmdWithAnInteger::GetNewIntValue( value ) );
break;
}
if ( cmd == drawTrajectoryMarkers )
{
eventAction->DrawTrajectoryMarkers(
G4UIcmdWithABool::GetNewBoolValue( value ) );
break;
}
} while ( false );
}
@@ -1,100 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcEventSObject.cc
*
* Description: event data serialization helper
*
* Version: 1.0
* Created: 30.12.2009 17:10:25
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#ifdef CEXMC_USE_PERSISTENCY
#include "CexmcEventSObject.hh"
#include "CexmcTrackPointInfo.hh"
CexmcEventSObject::CexmcEventSObject() : edDigitizerMonitorHasTriggered( true )
{
}
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 ) :
eventId( eventId ),
edDigitizerMonitorHasTriggered( edDigitizerMonitorHasTriggered ),
monitorED( monitorED ), vetoCounterEDLeft( vetoCounterEDLeft ),
vetoCounterEDRight( vetoCounterEDRight ),
calorimeterEDLeft( calorimeterEDLeft ),
calorimeterEDRight( calorimeterEDRight ),
calorimeterEDLeftCollection( calorimeterEDLeftCollection ),
calorimeterEDRightCollection( calorimeterEDRightCollection ),
monitorTP( monitorTP ), targetTPBeamParticle( targetTPBeamParticle ),
targetTPOutputParticle( targetTPOutputParticle ),
targetTPNucleusParticle( targetTPNucleusParticle ),
targetTPOutputParticleDecayProductParticle1(
targetTPOutputParticleDecayProductParticle1 ),
targetTPOutputParticleDecayProductParticle2(
targetTPOutputParticleDecayProductParticle2 ),
vetoCounterTPLeft( vetoCounterTPLeft ),
vetoCounterTPRight( vetoCounterTPRight ),
calorimeterTPLeft( calorimeterTPLeft ),
calorimeterTPRight( calorimeterTPRight ),
productionModelData( productionModelData )
{
}
#endif
@@ -70,9 +70,9 @@ CexmcHadronicProcess::~CexmcHadronicProcess()
void CexmcHadronicProcess::RegisterProductionModel(
CexmcProductionModel * productionModel_ )
CexmcProductionModel * model )
{
productionModel = productionModel_;
productionModel = model;
interaction = dynamic_cast< G4HadronicInteraction * >( productionModel );
@@ -122,7 +122,7 @@ void CexmcHadronicProcess::FillTotalResult( G4HadFinalState * hadFinalState,
if ( hadFinalState->GetStatusChange() == stopAndKill )
theTotalResult->ProposeTrackStatus( fStopAndKill );
for( G4int i( 0 ); i < numberOfSecondaries; ++i )
for ( G4int i( 0 ); i < numberOfSecondaries; ++i )
{
G4double time( hadFinalState->GetSecondary( i )->GetTime() );
if ( time < 0 )
@@ -116,7 +116,7 @@ void CexmcHistoManager::Destroy( void )
CexmcHistoManager::CexmcHistoManager() : outFile( NULL ),
isInitialized( false ), opName( "" ), nopName( "" ), opMass( 0. ),
nopMass( 0. ),
nopMass( 0. ), verboseLevel( 0 ),
#ifdef CEXMC_USE_ROOTQT
rootCanvas( NULL ),
#endif
@@ -128,7 +128,7 @@ CexmcHistoManager::CexmcHistoManager() : outFile( NULL ),
CexmcHistoVector() ) );
}
messenger = new CexmcHistoManagerMessenger;
messenger = new CexmcHistoManagerMessenger( this );
}
@@ -199,7 +199,7 @@ void CexmcHistoManager::AddHisto( const CexmcHistoData & data,
CexmcHistosMap::iterator found( histos.find( data.type ) );
if ( found == histos.end() )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
CexmcHistoVector & histoVector( found->second );
@@ -286,13 +286,13 @@ void CexmcHistoManager::Initialize( void )
CexmcPhysicsManager * physicsManager( runManager->GetPhysicsManager() );
if ( ! physicsManager )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
CexmcProductionModel * productionModel( physicsManager->
GetProductionModel() );
if ( ! productionModel )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
G4ParticleDefinition * outputParticle(
productionModel->GetOutputParticle() );
@@ -300,7 +300,7 @@ void CexmcHistoManager::Initialize( void )
productionModel->GetNucleusOutputParticle() );
if ( ! outputParticle || ! nucleusOutputParticle )
throw CexmcException ( CexmcIncompleteProductionModel );
throw CexmcException( CexmcIncompleteProductionModel );
opName = outputParticle->GetParticleName();
nopName = nucleusOutputParticle->GetParticleName();
@@ -327,12 +327,12 @@ void CexmcHistoManager::Initialize( void )
const CexmcSetup * setup( static_cast< const CexmcSetup * >(
runManager->GetUserDetectorConstruction() ) );
if ( ! setup )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
const G4LogicalVolume * lVolume( setup->GetVolume( CexmcSetup::Monitor ) );
if ( ! lVolume )
throw CexmcException ( CexmcIncompatibleGeometry );
throw CexmcException( CexmcIncompatibleGeometry );
nBinsMinX = CexmcHistoBeamMomentumMin;
nBinsMaxX = CexmcHistoBeamMomentumMax;
@@ -343,11 +343,17 @@ void CexmcHistoManager::Initialize( void )
false, CexmcTPT, "mombp", "Beam momentum at the monitor", axes ) );
AddHisto( CexmcHistoData( CexmcMomentumBP_RT_Histo, Cexmc_TH1F, false,
false, CexmcRT, "mombp", "Beam momentum at the monitor", axes ) );
if ( verboseLevel > 0 )
{
AddHisto( CexmcHistoData( CexmcMomentumIP_TPT_Histo, Cexmc_TH1F, false,
false, CexmcTPT, "momip", "Momentum of the incident particle",
axes ) );
}
G4Box * box( dynamic_cast< G4Box * >( lVolume->GetSolid() ) );
if ( ! box )
throw CexmcException ( CexmcIncompatibleGeometry );
throw CexmcException( CexmcIncompatibleGeometry );
G4double width( box->GetXHalfLength() * 2 );
G4double height( box->GetYHalfLength() * 2 );
@@ -366,7 +372,7 @@ void CexmcHistoManager::Initialize( void )
G4Tubs * tube( dynamic_cast< G4Tubs * >( lVolume->GetSolid() ) );
if ( ! tube )
throw CexmcException ( CexmcIncompatibleGeometry );
throw CexmcException( CexmcIncompatibleGeometry );
G4double radius( tube->GetOuterRadius() );
height = tube->GetZHalfLength() * 2;
@@ -410,9 +416,9 @@ void CexmcHistoManager::Initialize( void )
axes.push_back( CexmcHistoAxisData( nBinsX, nBinsMinX, nBinsMaxX ) );
axes.push_back( CexmcHistoAxisData( nBinsY, nBinsMinY, nBinsMaxY ) );
AddHisto( CexmcHistoData( CexmcAbsorbedEnergy_EDT_Histo, Cexmc_TH2F, false,
false, CexmcEDT, "ae", "Absorbed energy (rc vs. ls)", axes ) );
false, CexmcEDT, "ae", "Absorbed energy (rc vs. lc)", axes ) );
AddHisto( CexmcHistoData( CexmcAbsorbedEnergy_RT_Histo, Cexmc_TH2F, false,
false, CexmcRT, "ae", "Absorbed energy (rc vs. ls)", axes ) );
false, CexmcRT, "ae", "Absorbed energy (rc vs. lc)", axes ) );
SetupARHistos( runManager->GetPhysicsManager()->GetProductionModel()->
GetAngularRanges() );
@@ -499,7 +505,7 @@ void CexmcHistoManager::AddARHistos( const CexmcAngularRange & aRange )
const CexmcSetup * setup( static_cast< const CexmcSetup * >(
runManager->GetUserDetectorConstruction() ) );
if ( ! setup )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
const G4LogicalVolume * lVolume( setup->GetVolume(
CexmcSetup::Calorimeter ) );
@@ -507,7 +513,7 @@ void CexmcHistoManager::AddARHistos( const CexmcAngularRange & aRange )
G4Box * box( dynamic_cast< G4Box * >( lVolume->GetSolid() ) );
if ( ! box )
throw CexmcException ( CexmcIncompatibleGeometry );
throw CexmcException( CexmcIncompatibleGeometry );
G4double width( box->GetXHalfLength() * 2 );
G4double height( box->GetYHalfLength() * 2 );
@@ -650,7 +656,7 @@ void CexmcHistoManager::AddARHistos( const CexmcAngularRange & aRange )
G4Tubs * tube( dynamic_cast< G4Tubs * >( lVolume->GetSolid() ) );
if ( ! tube )
throw CexmcException ( CexmcIncompatibleGeometry );
throw CexmcException( CexmcIncompatibleGeometry );
G4double radius( tube->GetOuterRadius() );
height = tube->GetZHalfLength() * 2;
@@ -676,7 +682,7 @@ void CexmcHistoManager::Add( CexmcHistoType histoType, unsigned int index,
{
CexmcHistosMap::iterator found( histos.find( histoType ) );
if ( found == histos.end() || histos[ histoType ].size() <= index )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
histos[ histoType ][ index ]->Fill( x );
}
@@ -687,7 +693,7 @@ void CexmcHistoManager::Add( CexmcHistoType histoType, unsigned int index,
{
CexmcHistosMap::iterator found( histos.find( histoType ) );
if ( found == histos.end() || histos[ histoType ].size() <= index )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
/* no cast needed because TH1 has virtual method
* Fill( Double_t, Double_t ) */
@@ -700,7 +706,7 @@ void CexmcHistoManager::Add( CexmcHistoType histoType, unsigned int index,
{
CexmcHistosMap::iterator found( histos.find( histoType ) );
if ( found == histos.end() || histos[ histoType ].size() <= index )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
/* cast needed because TH1 does not have virtual method
* Fill( Double_t, Double_t, Double_t ) */
@@ -715,7 +721,7 @@ void CexmcHistoManager::Add( CexmcHistoType histoType, unsigned int index,
{
CexmcHistosMap::iterator found( histos.find( histoType ) );
if ( found == histos.end() || histos[ histoType ].size() <= index )
throw CexmcException ( CexmcWeirdException );
throw CexmcException( CexmcWeirdException );
++binX;
++binY;
@@ -44,6 +44,7 @@
#ifdef CEXMC_USE_ROOT
#include <G4UIcmdWithoutParameter.hh>
#include <G4UIcmdWithAnInteger.hh>
#include <G4UIcmdWithAString.hh>
#include <G4String.hh>
#include "CexmcHistoManagerMessenger.hh"
@@ -51,12 +52,22 @@
#include "CexmcMessenger.hh"
CexmcHistoManagerMessenger::CexmcHistoManagerMessenger() :
listHistos( NULL ), printHisto( NULL )
CexmcHistoManagerMessenger::CexmcHistoManagerMessenger(
CexmcHistoManager * histoManager ) :
histoManager( histoManager ), setVerboseLevel( NULL ), listHistos( NULL ),
printHisto( NULL )
#ifdef CEXMC_USE_ROOTQT
, drawHisto( NULL )
#endif
{
setVerboseLevel = new G4UIcmdWithAnInteger(
( CexmcMessenger::histoDirName + "verbose" ).c_str(), this );
setVerboseLevel->SetGuidance( "0 - basic set of histograms created, "
"1 - extra histograms created" );
setVerboseLevel->SetParameterName( "Verbose", true );
setVerboseLevel->SetDefaultValue( 0 );
setVerboseLevel->AvailableForStates( G4State_PreInit );
listHistos = new G4UIcmdWithoutParameter(
( CexmcMessenger::histoDirName + "list" ).c_str(), this );
listHistos->SetGuidance( "List available histograms" );
@@ -83,6 +94,7 @@ CexmcHistoManagerMessenger::CexmcHistoManagerMessenger() :
CexmcHistoManagerMessenger::~CexmcHistoManagerMessenger()
{
delete setVerboseLevel;
delete listHistos;
delete printHisto;
#ifdef CEXMC_USE_ROOTQT
@@ -91,20 +103,26 @@ CexmcHistoManagerMessenger::~CexmcHistoManagerMessenger()
}
void CexmcHistoManagerMessenger::SetNewValue(
G4UIcommand * cmd, G4String value )
void CexmcHistoManagerMessenger::SetNewValue( G4UIcommand * cmd,
G4String value )
{
CexmcHistoManager * histoManager( CexmcHistoManager::Instance() );
do
{
if ( cmd == setVerboseLevel )
{
histoManager->SetVerboseLevel(
G4UIcmdWithAnInteger::GetNewIntValue( value ) );
break;
}
if ( cmd == listHistos )
{
histoManager->List();
break;
}
if ( cmd == printHisto )
{
histoManager->Print( value );
break;
}
#ifdef CEXMC_USE_ROOTQT
if ( cmd == drawHisto )
@@ -116,6 +134,7 @@ void CexmcHistoManagerMessenger::SetNewValue(
histoManager->Draw( std::string( value, 0, delimPos ),
delimPosEnd == G4String::npos ? "" :
value.c_str() + delimPosEnd );
break;
}
#endif
} while ( false );
@@ -62,9 +62,9 @@ CexmcParticleGunMessenger::CexmcParticleGunMessenger(
setParticle = new G4UIcmdWithAString(
( CexmcMessenger::gunDirName + "particle" ).c_str(), this );
setParticle->SetGuidance( "Incident beam particle" );
setParticle->SetDefaultValue( "pi-" );
setParticle->SetParameterName( "BeamParticle", false );
setParticle->SetCandidates( "pi-" );
setParticle->SetDefaultValue( "pi-" );
setParticle->AvailableForStates( G4State_PreInit, G4State_Idle );
setOrigPosition = new G4UIcmdWith3VectorAndUnit(
@@ -72,8 +72,8 @@ CexmcParticleGunMessenger::CexmcParticleGunMessenger(
setOrigPosition->SetGuidance( "Original position of the beam" );
setOrigPosition->SetParameterName( "PositionX", "PositionY", "PositionZ",
false );
setOrigPosition->SetDefaultUnit( "cm" );
setOrigPosition->SetUnitCandidates( "mm cm m" );
setOrigPosition->SetDefaultUnit( "cm" );
setOrigPosition->AvailableForStates( G4State_PreInit, G4State_Idle );
setOrigDirection = new G4UIcmdWith3Vector(
@@ -92,8 +92,8 @@ CexmcParticleGunMessenger::CexmcParticleGunMessenger(
setOrigMomentumAmp->SetGuidance( "Original momentum of the beam" );
setOrigMomentumAmp->SetParameterName( "MomentumAmp", false );
setOrigMomentumAmp->SetRange( "MomentumAmp > 0" );
setOrigMomentumAmp->SetDefaultUnit( "MeV" );
setOrigMomentumAmp->SetUnitCandidates( "eV keV MeV GeV" );
setOrigMomentumAmp->SetDefaultUnit( "MeV" );
setOrigMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
}
@@ -107,8 +107,8 @@ CexmcParticleGunMessenger::~CexmcParticleGunMessenger()
}
void CexmcParticleGunMessenger::SetNewValue( G4UIcommand * cmd,
G4String value )
void CexmcParticleGunMessenger::SetNewValue( G4UIcommand * cmd,
G4String value )
{
do
{
@@ -58,8 +58,8 @@ CexmcPhysicsManagerMessenger::CexmcPhysicsManagerMessenger(
"length in the\n target; can be used for precise tuning of the "
"center of\n distribution of interaction vertices in the target" );
setMaxILCorrection->SetParameterName( "MaxILCorrection", false );
setMaxILCorrection->SetDefaultUnit( "mm" );
setMaxILCorrection->SetUnitCandidates( "mm cm m" );
setMaxILCorrection->SetDefaultUnit( "mm" );
setMaxILCorrection->AvailableForStates( G4State_PreInit, G4State_Idle );
}
@@ -70,8 +70,8 @@ CexmcPhysicsManagerMessenger::~CexmcPhysicsManagerMessenger()
}
void CexmcPhysicsManagerMessenger::SetNewValue( G4UIcommand * cmd,
G4String value )
void CexmcPhysicsManagerMessenger::SetNewValue( G4UIcommand * cmd,
G4String value )
{
do
{
@@ -59,8 +59,8 @@ CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
fwhmPosX->SetGuidance( "Set positional fwhm of the beam along X axis" );
fwhmPosX->SetParameterName( "FwhmPosX", false );
fwhmPosX->SetDefaultValue( 0 );
fwhmPosX->SetDefaultUnit( "cm" );
fwhmPosX->SetUnitCandidates( "mm cm m" );
fwhmPosX->SetDefaultUnit( "cm" );
fwhmPosX->AvailableForStates( G4State_PreInit, G4State_Idle );
fwhmPosY = new G4UIcmdWithADoubleAndUnit(
@@ -68,8 +68,8 @@ CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
fwhmPosY->SetGuidance( "Set positional fwhm of the beam along Y axis" );
fwhmPosY->SetParameterName( "FwhmPosY", false );
fwhmPosY->SetDefaultValue( 0 );
fwhmPosY->SetDefaultUnit( "cm" );
fwhmPosY->SetUnitCandidates( "mm cm m" );
fwhmPosY->SetDefaultUnit( "cm" );
fwhmPosY->AvailableForStates( G4State_PreInit, G4State_Idle );
fwhmDirX = new G4UIcmdWithADoubleAndUnit(
@@ -77,8 +77,8 @@ CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
fwhmDirX->SetGuidance( "Set directional fwhm of the beam along X axis" );
fwhmDirX->SetParameterName( "FwhmDirX", false );
fwhmDirX->SetDefaultValue( 0 );
fwhmDirX->SetDefaultUnit( "deg" );
fwhmDirX->SetUnitCandidates( "deg rad" );
fwhmDirX->SetDefaultUnit( "deg" );
fwhmDirX->AvailableForStates( G4State_PreInit, G4State_Idle );
fwhmDirY = new G4UIcmdWithADoubleAndUnit(
@@ -86,16 +86,16 @@ CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
fwhmDirY->SetGuidance( "Set directional fwhm of the beam along Y axis" );
fwhmDirY->SetParameterName( "FwhmDirY", false );
fwhmDirY->SetDefaultValue( 0 );
fwhmDirY->SetDefaultUnit( "deg" );
fwhmDirY->SetUnitCandidates( "deg rad" );
fwhmDirY->SetDefaultUnit( "deg" );
fwhmDirY->AvailableForStates( G4State_PreInit, G4State_Idle );
fwhmMomentumAmp = new G4UIcmdWithADouble(
( CexmcMessenger::gunDirName + "fwhmMomentumAmp" ).c_str(), this );
fwhmMomentumAmp->SetGuidance( "Set fwhm of the beam momentum as fraction "
"of its value" );
fwhmMomentumAmp->SetDefaultValue( 0 );
fwhmMomentumAmp->SetParameterName( "FwhmMomentumAmp", false );
fwhmMomentumAmp->SetDefaultValue( 0 );
fwhmMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
}
@@ -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: CexmcPrimitiveScorer.cc
*
* Description: primitive scorer with a messenger
*
* Version: 1.0
* Created: 24.01.2011 18:34:30
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#include <G4ios.hh>
#include "CexmcPrimitiveScorer.hh"
#include "CexmcSensitiveDetectorMessenger.hh"
CexmcPrimitiveScorer::CexmcPrimitiveScorer( const G4String & name ) :
G4VPrimitiveScorer( name ), messenger( NULL )
{
}
CexmcPrimitiveScorer::~CexmcPrimitiveScorer()
{
delete messenger;
}
void CexmcPrimitiveScorer::InitializeMessenger( void )
{
messenger = new CexmcSensitiveDetectorMessenger( this );
}
void CexmcPrimitiveScorer::PrintHeader( G4int nmbOfEntries ) const
{
G4cout << " --- MultiFunctionalDet " << detector->GetName() << G4endl;
G4cout << " PrimitiveScorer " << primitiveName << G4endl;
G4cout << " Number of entries " << nmbOfEntries << G4endl;
}
@@ -78,7 +78,7 @@ void CexmcProductionModel::SetAngularRange( G4double top, G4double bottom,
{
G4double binWidth( ( top - bottom ) / nmbOfDivs );
G4double curTop( curBottom );
curBottom -= binWidth;
curBottom -= binWidth;
angularRanges.push_back( CexmcAngularRange( curTop, curBottom, i ) );
}
#ifdef CEXMC_USE_ROOT
@@ -58,8 +58,8 @@ CexmcProductionModelMessenger::CexmcProductionModelMessenger(
this );
applyFermiMotion->SetGuidance( "Switch on/off fermi motion in target "
"nuclei" );
applyFermiMotion->SetParameterName( "ApplyFermiMotionInTarget", false );
applyFermiMotion->SetDefaultValue( false );
applyFermiMotion->SetParameterName( "ApplyFermiMotionInTarget", true );
applyFermiMotion->SetDefaultValue( true );
applyFermiMotion->AvailableForStates( G4State_PreInit, G4State_Idle );
setAngularRange = new G4UIcmdWith3Vector(
@@ -102,8 +102,8 @@ CexmcProductionModelMessenger::~CexmcProductionModelMessenger()
}
void CexmcProductionModelMessenger::SetNewValue( G4UIcommand * cmd,
G4String value )
void CexmcProductionModelMessenger::SetNewValue( G4UIcommand * cmd,
G4String value )
{
do
{
@@ -47,12 +47,13 @@
#include "CexmcRunManager.hh"
CexmcReconstructor::CexmcReconstructor() :
hasBasicTrigger( false ),
CexmcReconstructor::CexmcReconstructor() : hasBasicTrigger( false ),
epDefinitionAlgorithm( CexmcEntryPointBySqrtEDWeights ),
epDepthDefinitionAlgorithm( CexmcEntryPointDepthPlain ),
csAlgorithm( CexmcSelectAllCrystals ), useInnerRefCrystal( false ),
epDepth( 0 ), theAngle( 0 ), targetEPInitialized( false ), messenger( NULL )
epDepth( 0 ), theAngle( 0 ), calorimeterEDLeftAdjacent( 0 ),
calorimeterEDRightAdjacent( 0 ), collectEDInAdjacentCrystals( false ),
targetEPInitialized( false ), messenger( NULL )
{
G4RunManager * runManager( G4RunManager::GetRunManager() );
const CexmcSetup * setup( static_cast< const CexmcSetup * >(
@@ -72,7 +73,8 @@ CexmcReconstructor::~CexmcReconstructor()
}
void CexmcReconstructor::Reconstruct( const CexmcEnergyDepositStore * edStore )
void CexmcReconstructor::Reconstruct(
const CexmcEnergyDepositStore * edStore )
{
ReconstructEntryPoints( edStore );
if ( hasBasicTrigger )
@@ -89,14 +91,20 @@ G4bool CexmcReconstructor::HasFullTrigger( void ) const
void CexmcReconstructor::ReconstructEntryPoints(
const CexmcEnergyDepositStore * edStore )
const CexmcEnergyDepositStore * edStore )
{
G4int nCrystalsInColumn( calorimeterGeometry.nCrystalsInColumn );
G4int nCrystalsInRow( calorimeterGeometry.nCrystalsInRow );
G4double crystalWidth( calorimeterGeometry.crystalWidth );
G4double crystalHeight( calorimeterGeometry.crystalHeight );
G4int columnLeft( edStore->calorimeterEDLeftMaxX );
G4int rowLeft( edStore->calorimeterEDLeftMaxY );
G4int columnRight( edStore->calorimeterEDRightMaxX );
G4int rowRight( edStore->calorimeterEDRightMaxY );
G4double crystalLength( calorimeterGeometry.crystalLength );
if ( useInnerRefCrystal )
{
TransformToAdjacentInnerCrystal( columnLeft, rowLeft );
TransformToAdjacentInnerCrystal( columnRight, rowRight );
}
calorimeterEPLeftPosition.setX( 0 );
calorimeterEPLeftPosition.setY( 0 );
calorimeterEPLeftPosition.setZ( -crystalLength / 2 + epDepth );
@@ -110,196 +118,54 @@ void CexmcReconstructor::ReconstructEntryPoints(
calorimeterEPRightDirection.setY( 0 );
calorimeterEPRightDirection.setZ( 0 );
G4int columnLeft( edStore->calorimeterEDLeftMaxX );
G4int rowLeft( edStore->calorimeterEDLeftMaxY );
G4int columnRight( edStore->calorimeterEDRightMaxX );
G4int rowRight( edStore->calorimeterEDRightMaxY );
G4double xInCalorimeterLeftOffset(
( G4double( columnLeft ) - G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2 );
G4double yInCalorimeterLeftOffset(
( G4double( rowLeft ) - G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2 );
G4double xInCalorimeterRightOffset(
( G4double( columnRight ) - G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2 );
G4double yInCalorimeterRightOffset(
( G4double( rowRight ) - G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2 );
G4int i( 0 );
G4double xWeightsSum( 0 );
G4double yWeightsSum( 0 );
G4double energySum( 0 );
G4bool edInAdjacentCrystalsCollected( false );
switch ( epDefinitionAlgorithm )
{
case CexmcEntryPointInTheCenter :
break;
case CexmcEntryPointInTheCenterOfCrystalWithMaxED :
calorimeterEPLeftPosition.setX( xInCalorimeterLeftOffset );
calorimeterEPLeftPosition.setY( yInCalorimeterLeftOffset );
calorimeterEPRightPosition.setX( xInCalorimeterRightOffset );
calorimeterEPRightPosition.setY( yInCalorimeterRightOffset );
{
G4int nCrystalsInColumn(
calorimeterGeometry.nCrystalsInColumn );
G4int nCrystalsInRow( calorimeterGeometry.nCrystalsInRow );
G4double crystalWidth( calorimeterGeometry.crystalWidth );
G4double crystalHeight( calorimeterGeometry.crystalHeight );
calorimeterEPLeftPosition.setX(
( G4double( columnLeft ) - G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2 );
calorimeterEPLeftPosition.setY(
( G4double( rowLeft ) - G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2 );
calorimeterEPRightPosition.setX(
( G4double( columnRight ) - G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2 );
calorimeterEPRightPosition.setY(
( G4double( rowRight ) - G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2 );
}
break;
case CexmcEntryPointByLinearEDWeights :
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
k( edStore->calorimeterEDLeftCollection.begin() );
k != edStore->calorimeterEDLeftCollection.end(); ++k )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( i - rowLeft > 1 || i - rowLeft < -1 ) )
{
++i;
continue;
}
G4int j( 0 );
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
l( k->begin() ); l != k->end(); ++l )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( j - columnLeft > 1 || j - columnLeft < -1 ) )
{
++j;
continue;
}
xInCalorimeterLeftOffset = ( G4double( j ) -
G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2;
xWeightsSum += *l * xInCalorimeterLeftOffset;
yInCalorimeterLeftOffset = ( G4double( i ) -
G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2;
yWeightsSum += *l * yInCalorimeterLeftOffset;
energySum += *l;
++j;
}
++i;
}
calorimeterEPLeftPosition.setX( xWeightsSum / energySum );
calorimeterEPLeftPosition.setY( yWeightsSum / energySum );
i = 0;
xWeightsSum = 0;
yWeightsSum = 0;
energySum = 0;
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
k( edStore->calorimeterEDRightCollection.begin() );
k != edStore->calorimeterEDRightCollection.end(); ++k )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( i - rowRight > 1 || i - rowRight < -1 ) )
{
++i;
continue;
}
G4int j( 0 );
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
l( k->begin() ); l != k->end(); ++l )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( j - columnRight > 1 || j - columnRight < -1 ) )
{
++j;
continue;
}
xInCalorimeterRightOffset = ( G4double( j ) -
G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2;
xWeightsSum += *l * xInCalorimeterRightOffset;
yInCalorimeterRightOffset = ( G4double( i ) -
G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2;
yWeightsSum += *l * yInCalorimeterRightOffset;
energySum += *l;
++j;
}
++i;
}
calorimeterEPRightPosition.setX( xWeightsSum / energySum );
calorimeterEPRightPosition.setY( yWeightsSum / energySum );
break;
case CexmcEntryPointBySqrtEDWeights :
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
k( edStore->calorimeterEDLeftCollection.begin() );
k != edStore->calorimeterEDLeftCollection.end(); ++k )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( i - rowLeft > 1 || i - rowLeft < -1 ) )
{
++i;
continue;
}
G4double x( 0 );
G4double y( 0 );
G4int j( 0 );
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
l( k->begin() ); l != k->end(); ++l )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( j - columnLeft > 1 || j - columnLeft < -1 ) )
{
++j;
continue;
}
CalculateWeightedEPPosition( edStore->calorimeterEDLeftCollection,
rowLeft, columnLeft, x, y,
calorimeterEDLeftAdjacent );
calorimeterEPLeftPosition.setX( x );
calorimeterEPLeftPosition.setY( y );
CalculateWeightedEPPosition( edStore->calorimeterEDRightCollection,
rowRight, columnRight, x, y,
calorimeterEDRightAdjacent );
calorimeterEPRightPosition.setX( x );
calorimeterEPRightPosition.setY( y );
xInCalorimeterLeftOffset = ( G4double( j ) -
G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2;
xWeightsSum += std::sqrt( *l ) * xInCalorimeterLeftOffset;
yInCalorimeterLeftOffset = ( G4double( i ) -
G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2;
yWeightsSum += std::sqrt( *l ) * yInCalorimeterLeftOffset;
energySum += std::sqrt( *l );
++j;
}
++i;
if ( csAlgorithm == CexmcSelectAdjacentCrystals )
edInAdjacentCrystalsCollected = true;
}
calorimeterEPLeftPosition.setX( xWeightsSum / energySum );
calorimeterEPLeftPosition.setY( yWeightsSum / energySum );
i = 0;
xWeightsSum = 0;
yWeightsSum = 0;
energySum = 0;
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
k( edStore->calorimeterEDRightCollection.begin() );
k != edStore->calorimeterEDRightCollection.end(); ++k )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( i - rowRight > 1 || i - rowRight < -1 ) )
{
++i;
continue;
}
G4int j( 0 );
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
l( k->begin() ); l != k->end(); ++l )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( j - columnRight > 1 || j - columnRight < -1 ) )
{
++j;
continue;
}
xInCalorimeterRightOffset = ( G4double( j ) -
G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2;
xWeightsSum += std::sqrt( *l ) * xInCalorimeterRightOffset;
yInCalorimeterRightOffset = ( G4double( i ) -
G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2;
yWeightsSum += std::sqrt( *l ) * yInCalorimeterRightOffset;
energySum += std::sqrt( *l );
++j;
}
++i;
}
calorimeterEPRightPosition.setX( xWeightsSum / energySum );
calorimeterEPRightPosition.setY( yWeightsSum / energySum );
break;
default :
break;
@@ -351,6 +217,8 @@ void CexmcReconstructor::ReconstructEntryPoints(
calorimeterEPRightPositionZOffset );
}
break;
default :
break;
}
calorimeterEPLeftWorldPosition = calorimeterLeftTransform.TransformPoint(
@@ -362,6 +230,16 @@ void CexmcReconstructor::ReconstructEntryPoints(
calorimeterEPRightWorldDirection = calorimeterRightTransform.TransformAxis(
calorimeterEPRightDirection );
if ( collectEDInAdjacentCrystals && ! edInAdjacentCrystalsCollected )
{
CollectEDInAdjacentCrystals( edStore->calorimeterEDLeftCollection,
rowLeft, columnLeft,
calorimeterEDLeftAdjacent );
CollectEDInAdjacentCrystals( edStore->calorimeterEDRightCollection,
rowRight, columnRight,
calorimeterEDRightAdjacent );
}
hasBasicTrigger = true;
}
@@ -398,3 +276,100 @@ void CexmcReconstructor::ReconstructAngle( void )
hasBasicTrigger = true;
}
void CexmcReconstructor::CollectEDInAdjacentCrystals(
const CexmcEnergyDepositCalorimeterCollection & edHits,
G4int row, G4int column, G4double & ed )
{
G4int i( 0 );
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
k( edHits.begin() ); k != edHits.end(); ++k )
{
if ( i - row > 1 || i - row < -1 )
{
++i;
continue;
}
G4int j( 0 );
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
l( k->begin() ); l != k->end(); ++l )
{
if ( j - column > 1 || j - column < -1 )
{
++j;
continue;
}
ed += *l;
++j;
}
++i;
}
}
void CexmcReconstructor::CalculateWeightedEPPosition(
const CexmcEnergyDepositCalorimeterCollection & edHits,
G4int row, G4int column, G4double & x, G4double & y,
G4double & ed )
{
G4int nCrystalsInColumn( calorimeterGeometry.nCrystalsInColumn );
G4int nCrystalsInRow( calorimeterGeometry.nCrystalsInRow );
G4double crystalWidth( calorimeterGeometry.crystalWidth );
G4double crystalHeight( calorimeterGeometry.crystalHeight );
G4int i( 0 );
G4double xWeightsSum( 0 );
G4double yWeightsSum( 0 );
G4double energyWeightsSum( 0 );
if ( csAlgorithm == CexmcSelectAdjacentCrystals )
ed = 0.;
for ( CexmcEnergyDepositCalorimeterCollection::const_iterator
k( edHits.begin() ); k != edHits.end(); ++k )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( i - row > 1 || i - row < -1 ) )
{
++i;
continue;
}
G4int j( 0 );
for ( CexmcEnergyDepositCrystalRowCollection::const_iterator
l( k->begin() ); l != k->end(); ++l )
{
if ( csAlgorithm == CexmcSelectAdjacentCrystals &&
( j - column > 1 || j - column < -1 ) )
{
++j;
continue;
}
if ( csAlgorithm == CexmcSelectAdjacentCrystals )
ed += *l;
G4double xInCalorimeterOffset(
( G4double( j ) - G4double( nCrystalsInRow ) / 2 ) *
crystalWidth + crystalWidth / 2 );
G4double energyWeight(
epDefinitionAlgorithm ==
CexmcEntryPointBySqrtEDWeights ?
std::sqrt( *l ) : *l );
xWeightsSum += energyWeight * xInCalorimeterOffset;
G4double yInCalorimeterOffset(
( G4double( i ) - G4double( nCrystalsInColumn ) / 2 ) *
crystalHeight + crystalHeight / 2 );
yWeightsSum += energyWeight * yInCalorimeterOffset;
energyWeightsSum += energyWeight;
++j;
}
++i;
}
x = xWeightsSum / energyWeightsSum;
y = yWeightsSum / energyWeightsSum;
}
@@ -72,11 +72,11 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
" deposit in crystals,\n"
" sqrt - entry points defined by square root weights of\n"
" energy deposit in crystals" );
setCalorimeterEntryPointDefinitionAlgorithm->SetDefaultValue( "sqrt" );
setCalorimeterEntryPointDefinitionAlgorithm->SetParameterName(
"EntryPointDefinitionAlgo", false );
setCalorimeterEntryPointDefinitionAlgorithm->SetCandidates(
"center simple linear sqrt" );
setCalorimeterEntryPointDefinitionAlgorithm->SetDefaultValue( "sqrt" );
setCalorimeterEntryPointDefinitionAlgorithm->AvailableForStates(
G4State_PreInit, G4State_Idle );
@@ -93,12 +93,12 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
" with origin in the center of the target;\n"
" radius of the sphere is sum of distance to\n"
" the calorimeter and 'entryPointDepth' value" );
setCalorimeterEntryPointDepthDefinitionAlgorithm->SetDefaultValue(
"plain" );
setCalorimeterEntryPointDepthDefinitionAlgorithm->SetParameterName(
"EntryPointDepthDefinitionAlgo", false );
setCalorimeterEntryPointDepthDefinitionAlgorithm->SetCandidates(
"plain sphere" );
setCalorimeterEntryPointDepthDefinitionAlgorithm->SetDefaultValue(
"plain" );
setCalorimeterEntryPointDepthDefinitionAlgorithm->AvailableForStates(
G4State_PreInit, G4State_Idle );
@@ -106,14 +106,14 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
( CexmcMessenger::reconstructorDirName + "crystalSelectionAlgo" ).
c_str(), this );
setCrystalSelectionAlgorithm->SetGuidance(
"\n Choose which crystals will be selected in weighted entry point\n"
"\n Choose crystals to be selected in weighted entry point\n"
" reconstruction algorithms\n"
" all - all,\n"
" adjacent - crystal with maximum energy deposit and\n"
" adjacent crystals" );
setCrystalSelectionAlgorithm->SetDefaultValue( "all" );
setCrystalSelectionAlgorithm->SetParameterName( "CrystalSelAlgo", false );
setCrystalSelectionAlgorithm->SetCandidates( "all adjacent" );
setCrystalSelectionAlgorithm->SetDefaultValue( "all" );
setCrystalSelectionAlgorithm->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -124,11 +124,12 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
"\n Defines that if the crystal with maximum energy deposit in\n"
" calorimeter is an outer crystal then the closest inner crystal\n"
" will be chosen as the reference for adjacent crystal selection\n"
" algorithm and simple entry point definition algorithm.\n"
" If not set then the reference crystal will be found from all\n"
" crystals in calorimeter" );
useInnerRefCrystal->SetDefaultValue( false );
useInnerRefCrystal->SetParameterName( "UseInnerRefCrystal", false );
" algorithm and simple entry point definition algorithm. It also\n"
" affects energy deposit collection if adjacent crystals\n"
" algorithm was chosen for that. If not set then the reference\n"
" crystal will be found from all crystals in calorimeter" );
useInnerRefCrystal->SetParameterName( "UseInnerRefCrystal", true );
useInnerRefCrystal->SetDefaultValue( true );
useInnerRefCrystal->AvailableForStates( G4State_PreInit, G4State_Idle );
setCalorimeterEntryPointDepth = new G4UIcmdWithADoubleAndUnit(
@@ -139,8 +140,8 @@ CexmcReconstructorMessenger::CexmcReconstructorMessenger(
" between output particle decay products" );
setCalorimeterEntryPointDepth->SetParameterName( "EntryPointDepth", false );
setCalorimeterEntryPointDepth->SetDefaultValue( 0 );
setCalorimeterEntryPointDepth->SetDefaultUnit( "cm" );
setCalorimeterEntryPointDepth->SetUnitCandidates( "mm cm m" );
setCalorimeterEntryPointDepth->SetDefaultUnit( "cm" );
setCalorimeterEntryPointDepth->AvailableForStates( G4State_PreInit,
G4State_Idle );
}
@@ -167,18 +168,18 @@ void CexmcReconstructorMessenger::SetNewValue( G4UIcommand * cmd,
epDefinitionAlgorithm( CexmcEntryPointInTheCenter );
do
{
if ( value == "simple" )
if ( value == "simple" )
{
epDefinitionAlgorithm =
CexmcEntryPointInTheCenterOfCrystalWithMaxED;
break;
}
if ( value == "linear" )
if ( value == "linear" )
{
epDefinitionAlgorithm = CexmcEntryPointByLinearEDWeights;
break;
}
if ( value == "sqrt" )
if ( value == "sqrt" )
{
epDefinitionAlgorithm = CexmcEntryPointBySqrtEDWeights;
break;
@@ -194,7 +195,7 @@ void CexmcReconstructorMessenger::SetNewValue( G4UIcommand * cmd,
epDepthDefinitionAlgorithm( CexmcEntryPointDepthPlain );
do
{
if ( value == "sphere" )
if ( value == "sphere" )
{
epDepthDefinitionAlgorithm = CexmcEntryPointDepthSphere;
break;
@@ -210,7 +211,7 @@ void CexmcReconstructorMessenger::SetNewValue( G4UIcommand * cmd,
csAlgorithm( CexmcSelectAllCrystals );
do
{
if ( value == "adjacent" )
if ( value == "adjacent" )
{
csAlgorithm = CexmcSelectAdjacentCrystals;
break;
@@ -64,6 +64,16 @@ namespace
return 0;
}
G4double PDK( G4double a, G4double b, G4double c )
{
G4double x( ( a - b - c ) * ( a + b + c ) * ( a - b + c ) *
( a + b - c ) );
x = std::sqrt( x ) / ( 2 * a );
return x;
}
}
@@ -109,7 +119,7 @@ G4double CexmcReimplementedGenbod::Generate( void )
G4double wt( maxWeight );
G4double pd[ maxParticles ];
for ( int i( 0 ); i < nmbOfOutputParticles - 1; ++i )
for ( int i( 0 ); i < nmbOfOutputParticles - 1; ++i )
{
pd[ i ] = PDK( invMas[ i + 1 ], invMas[ i ],
outVec[ i + 1 ].mass / GeV );
@@ -226,13 +236,3 @@ void CexmcReimplementedGenbod::SetMaxWeight( void )
}
}
G4double CexmcReimplementedGenbod::PDK( G4double a, G4double b, G4double c )
{
G4double x( ( a - b - c ) * ( a + b + c ) * ( a - b + c ) *
( a + b - c ) );
x = std::sqrt( x ) / ( 2 * a );
return x;
}
@@ -56,7 +56,7 @@ void CexmcRun::IncrementNmbOfHitsSampled( G4int index )
CexmcNmbOfHitsInRanges::iterator found(
nmbOfHitsSampled.find( index ) );
if ( found == nmbOfHitsSampled.end() )
nmbOfHitsSampled.insert( std::pair< int, int >( index, 1 ) );
nmbOfHitsSampled.insert( CexmcNmbOfHitsInRangesData( index, 1 ) );
else
++found->second;
}
@@ -67,7 +67,7 @@ void CexmcRun::IncrementNmbOfHitsSampledFull( G4int index )
CexmcNmbOfHitsInRanges::iterator found(
nmbOfHitsSampledFull.find( index ) );
if ( found == nmbOfHitsSampledFull.end() )
nmbOfHitsSampledFull.insert( std::pair< int, int >( index, 1 ) );
nmbOfHitsSampledFull.insert( CexmcNmbOfHitsInRangesData( index, 1 ) );
else
++found->second;
}
@@ -78,7 +78,8 @@ void CexmcRun::IncrementNmbOfHitsTriggeredRealRange( G4int index )
CexmcNmbOfHitsInRanges::iterator found(
nmbOfHitsTriggeredRealRange.find( index ) );
if ( found == nmbOfHitsTriggeredRealRange.end() )
nmbOfHitsTriggeredRealRange.insert( std::pair< int, int >( index, 1 ) );
nmbOfHitsTriggeredRealRange.insert(
CexmcNmbOfHitsInRangesData( index, 1 ) );
else
++found->second;
}
@@ -89,7 +90,8 @@ void CexmcRun::IncrementNmbOfHitsTriggeredRecRange( G4int index )
CexmcNmbOfHitsInRanges::iterator found(
nmbOfHitsTriggeredRecRange.find( index ) );
if ( found == nmbOfHitsTriggeredRecRange.end() )
nmbOfHitsTriggeredRecRange.insert( std::pair< int, int >( index, 1 ) );
nmbOfHitsTriggeredRecRange.insert(
CexmcNmbOfHitsInRangesData( index, 1 ) );
else
++found->second;
}
@@ -100,7 +102,7 @@ void CexmcRun::IncrementNmbOfOrphanHits( G4int index )
CexmcNmbOfHitsInRanges::iterator found(
nmbOfOrphanHits.find( index ) );
if ( found == nmbOfOrphanHits.end() )
nmbOfOrphanHits.insert( std::pair< int, int >( index, 1 ) );
nmbOfOrphanHits.insert( CexmcNmbOfHitsInRangesData( index, 1 ) );
else
++found->second;
}
@@ -173,6 +173,9 @@ void CexmcRunAction::PrintResults(
auxStrings.push_back( auxString );
}
G4cout << " --- Setup acceptances (range | real (trg / mon) | "
"rec (trg / mon / all)):" << G4endl;
G4int i( 0 );
for ( CexmcAngularRangeList::const_iterator k( angularRanges.begin() );
k != angularRanges.end(); ++k )
@@ -218,8 +221,9 @@ void CexmcRunAction::PrintResults(
}
G4cout << " ---" << G4endl;
G4cout << " False hits (edt, rec): " << nmbOfFalseHitsTriggeredEDT <<
" | " << nmbOfFalseHitsTriggeredRec << G4endl;
G4cout << " False hits (edt | rec): " <<
nmbOfFalseHitsTriggeredEDT << " | " << nmbOfFalseHitsTriggeredRec <<
G4endl;
}
@@ -246,11 +250,12 @@ void CexmcRunAction::EndOfRunAction( const G4Run * run )
const CexmcAngularRangeList & angularRanges(
productionModel->GetAngularRanges() );
G4cout << " --- Setup acceptances (real, rec):" << G4endl;
G4cout << G4endl;
PrintResults( nmbOfHitsSampled, nmbOfHitsSampledFull,
nmbOfHitsTriggeredRealRange, nmbOfHitsTriggeredRecRange,
nmbOfOrphanHits, angularRanges,
theRun->GetNmbOfFalseHitsTriggeredEDT(),
theRun->GetNmbOfFalseHitsTriggeredRec() );
G4cout << G4endl;
}
@@ -43,6 +43,7 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <vector>
#include <fstream>
#ifdef CEXMC_USE_PERSISTENCY
#include <boost/archive/binary_iarchive.hpp>
@@ -59,6 +60,9 @@
#include <G4Region.hh>
#include <G4RegionStore.hh>
#include <G4ProductionCuts.hh>
#include <G4VisManager.hh>
#include <G4Scene.hh>
#include <G4VModel.hh>
#include "CexmcRunManager.hh"
#include "CexmcRunManagerMessenger.hh"
#include "CexmcRunAction.hh"
@@ -87,6 +91,7 @@
#include "CexmcBasicPhysicsSettings.hh"
#include "CexmcSensitiveDetectorsAttributes.hh"
#include "CexmcCustomFilterEval.hh"
#include "CexmcScenePrimitives.hh"
namespace
@@ -141,35 +146,11 @@ CexmcRunManager::CexmcRunManager( const G4String & projectId,
}
void CexmcRunManager::BeamParticleChangeHook( void )
{
const CexmcEventAction * eventAction(
static_cast< const CexmcEventAction * >( userEventAction ) );
if ( ! eventAction )
throw CexmcException( CexmcWeirdException );
CexmcEventAction * theEventAction( const_cast< CexmcEventAction * >(
eventAction ) );
theEventAction->BeamParticleChangeHook();
}
CexmcRunManager::~CexmcRunManager()
{
#ifdef CEXMC_USE_PERSISTENCY
if ( ProjectIsRead() && zipGdmlFile )
{
G4String cmd( G4String( "bzip2 " ) + projectsDir + "/" + rProject +
gdmlFileExtension );
if ( system( cmd ) != 0 )
G4cerr << "Failed to zip geometry data" << G4endl;
}
#ifdef CEXMC_USE_CUSTOM_FILTER
delete customFilter;
#endif
#endif
delete messenger;
}
@@ -182,8 +163,8 @@ void CexmcRunManager::ReadPreinitProjectData( void )
return;
/* read run data */
std::ifstream runDataFile( ( projectsDir + "/" + rProject + ".rdb" ).
c_str() );
std::ifstream runDataFile( ( projectsDir + "/" + rProject + ".rdb" ).
c_str() );
if ( ! runDataFile )
throw CexmcException( CexmcReadProjectIncomplete );
@@ -197,13 +178,16 @@ void CexmcRunManager::ReadPreinitProjectData( void )
productionModelType = sObject.productionModelType;
/* read gdml file */
G4String fileExtension( zipGdmlFile ? gdmlbz2FileExtension :
gdmlFileExtension );
G4String cmd( G4String( "cp " ) + projectsDir + "/" + rProject +
fileExtension + " " + projectsDir + "/" + projectId +
fileExtension );
if ( ProjectIsSaved() && system( cmd ) != 0 )
throw CexmcException( CexmcReadProjectIncomplete );
G4String cmd;
if ( ProjectIsSaved() )
{
G4String fileExtension( zipGdmlFile ? gdmlbz2FileExtension :
gdmlFileExtension );
cmd = G4String( "cp " ) + projectsDir + "/" + rProject + fileExtension +
" " + projectsDir + "/" + projectId + fileExtension;
if ( system( cmd ) != 0 )
throw CexmcException( CexmcReadProjectIncomplete );
}
if ( zipGdmlFile )
{
@@ -331,6 +315,8 @@ void CexmcRunManager::ReadProject( void )
reconstructor->SetAbsorbedEnergyCutCLWidth( sObject.aeCutCLWidth );
reconstructor->SetAbsorbedEnergyCutCRWidth( sObject.aeCutCRWidth );
reconstructor->SetAbsorbedEnergyCutEllipseAngle( sObject.aeCutAngle );
reconstructor->SetExpectedMomentumAmp( sObject.expectedMomentumAmp );
reconstructor->SetEDCollectionAlgorithm( sObject.edCollectionAlgorithm );
physicsManager->SetProposedMaxIL( sObject.proposedMaxIL );
@@ -412,7 +398,7 @@ void CexmcRunManager::SaveProject( void )
nmbOfSavedFastEvents = run->GetNmbOfSavedFastEvents();
}
CexmcRunSObject sObjectToWrite(
CexmcRunSObject sObjectToWrite = {
basePhysicsUsed, productionModelType, gdmlFileName, etaDecayTable,
physicsManager->GetProductionModel()->GetAngularRanges(),
physicsManager->GetProductionModel()->IsFermiMotionOn(),
@@ -456,7 +442,9 @@ void CexmcRunManager::SaveProject( void )
nmbOfFalseHitsTriggeredRec, nmbOfSavedEvents, nmbOfSavedFastEvents,
numberOfEventsProcessed, numberOfEventsProcessedEffective,
numberOfEventToBeProcessed, rProject, skipInteractionsWithoutEDTonWrite,
cfFileName, evDataVerboseLevel, physicsManager->GetProposedMaxIL() );
cfFileName, evDataVerboseLevel, physicsManager->GetProposedMaxIL(),
reconstructor->GetExpectedMomentumAmp(),
reconstructor->GetEDCollectionAlgorithm(), 0 };
std::ofstream runDataFile( ( projectsDir + "/" + projectId + ".rdb" ).
c_str() );
@@ -465,20 +453,6 @@ void CexmcRunManager::SaveProject( void )
boost::archive::binary_oarchive archive( runDataFile );
archive << sObjectToWrite;
}
/* save gdml file */
G4String cmd( G4String( "cp " ) + gdmlFileName + " " +
projectsDir + "/" + projectId +
gdmlFileExtension );
CexmcExceptionType exceptionType( CexmcSystemException );
if ( zipGdmlFile )
{
cmd = G4String( "bzip2 -c " ) + gdmlFileName + " > " + projectsDir +
"/" + projectId + gdmlbz2FileExtension;
exceptionType = CexmcFileCompressException;
}
if ( system( cmd ) != 0 )
throw CexmcException( exceptionType );
}
#endif
@@ -490,7 +464,7 @@ void CexmcRunManager::DoCommonEventLoop( G4int nEvent, const G4String & cmd,
G4int iEvent( 0 );
G4int iEventEffective( 0 );
for( iEvent = 0; iEventEffective < nEvent; ++iEvent )
for ( iEvent = 0; iEventEffective < nEvent; ++iEvent )
{
currentEvent = GenerateEvent( iEvent );
eventManager->ProcessOneEvent( currentEvent );
@@ -515,11 +489,11 @@ void CexmcRunManager::DoCommonEventLoop( G4int nEvent, const G4String & cmd,
}
AnalyzeEvent( currentEvent );
UpdateScoring();
if( iEvent < nSelect )
if ( iEvent < nSelect )
G4UImanager::GetUIpointer()->ApplyCommand( cmd );
StackPreviousEvent( currentEvent );
currentEvent = 0;
if( runAborted )
if ( runAborted )
break;
}
@@ -939,7 +913,6 @@ void CexmcRunManager::DoEventLoop( G4int nEvent, const char * macroFile,
std::ofstream eventsDataFile(
( projectsDir + "/" + projectId + ".edb" ).c_str() );
boost::archive::binary_oarchive eventsArchive_( eventsDataFile );
eventsArchive = &eventsArchive_;
std::ofstream fastEventsDataFile(
( projectsDir + "/" + projectId + ".fdb" ).c_str() );
boost::archive::binary_oarchive fastEventsArchive_(
@@ -979,12 +952,12 @@ void CexmcRunManager::DoEventLoop( G4int nEvent, const char * macroFile,
DoCommonEventLoop( nEvent, cmd, nSelect );
#endif
if( verboseLevel > 0 )
if ( verboseLevel > 0 )
{
timer->Stop();
G4cout << "Run terminated." << G4endl;
G4cout << "Run Summary" << G4endl;
if( runAborted )
if ( runAborted )
{
G4cout << " Run Aborted after " << numberOfEventsProcessed <<
" events processed." << G4endl;
@@ -1007,6 +980,8 @@ void CexmcRunManager::PrintReadRunData( void ) const
if ( ! ProjectIsRead() )
return;
G4bool refCrystalInfoPrinted( false );
G4cout << CEXMC_LINE_START << "Run data read from project '" << rProject <<
"'" << G4endl;
G4cout << " (archive class version " <<
@@ -1105,6 +1080,20 @@ void CexmcRunManager::PrintReadRunData( void ) const
sObject.crystalResolutionData;
}
G4cout << " -- Reconstructor settings: " << G4endl;
if ( sObject.expectedMomentumAmp > 0 )
{
G4cout << " -- expected momentum in the target: " <<
G4BestUnit( sObject.expectedMomentumAmp, "Energy" ) << G4endl;
}
G4cout << " -- ed collection algorithm (0 - all, 1 - adjacent): " <<
sObject.edCollectionAlgorithm << G4endl;
if ( sObject.edCollectionAlgorithm == CexmcCollectEDInAdjacentCrystals )
{
G4cout <<
" -- inner crystal used as reference (0 - no, 1 - yes): " <<
sObject.useInnerRefCrystal << G4endl;
refCrystalInfoPrinted = true;
}
G4cout << " -- entry point definition algorithm " << G4endl;
G4cout << " (0 - center of calorimeter, 1 - center of crystal with "
"max ED," << G4endl;
@@ -1122,12 +1111,13 @@ void CexmcRunManager::PrintReadRunData( void ) const
" -- crystal selection algorithm (0 - all, 1 - adjacent): " <<
sObject.csAlgorithm << G4endl;
}
if ( sObject.epDefinitionAlgorithm ==
if ( ! refCrystalInfoPrinted &&
( sObject.epDefinitionAlgorithm ==
CexmcEntryPointInTheCenterOfCrystalWithMaxED ||
( ( sObject.epDefinitionAlgorithm == CexmcEntryPointBySqrtEDWeights ||
sObject.epDefinitionAlgorithm ==
CexmcEntryPointByLinearEDWeights ) &&
sObject.csAlgorithm == CexmcSelectAdjacentCrystals ) )
sObject.csAlgorithm == CexmcSelectAdjacentCrystals ) ) )
{
G4cout <<
" -- inner crystal used as reference (0 - no, 1 - yes): " <<
@@ -1168,7 +1158,7 @@ void CexmcRunManager::PrintReadRunData( void ) const
G4cout << " -- absorbed energy cut angle of the ellipse: " <<
sObject.aeCutAngle / deg << " deg" << G4endl;
}
G4cout << " -- Setup acceptances (real, rec): " << G4endl;
G4cout << G4endl;
CexmcRunAction::PrintResults( sObject.nmbOfHitsSampled,
sObject.nmbOfHitsSampledFull,
sObject.nmbOfHitsTriggeredRealRange,
@@ -1177,13 +1167,15 @@ void CexmcRunManager::PrintReadRunData( void ) const
sObject.angularRanges,
sObject.nmbOfFalseHitsTriggeredEDT,
sObject.nmbOfFalseHitsTriggeredRec );
G4cout << G4endl;
}
void CexmcRunManager::ReadAndPrintEventsData( void ) const
{
if ( ! ProjectIsRead() )
return;
CexmcEventSObject evSObject;
/* read events data */
@@ -1229,6 +1221,9 @@ void CexmcRunManager::ReadAndPrintEventsData( void ) const
void CexmcRunManager::PrintReadData(
const CexmcOutputDataTypeSet & outputData ) const
{
if ( ! ProjectIsRead() )
return;
G4bool addSpace( false );
CexmcOutputDataTypeSet::const_iterator found(
@@ -1238,7 +1233,15 @@ void CexmcRunManager::PrintReadData(
G4String cmd( G4String( "cat " ) + projectsDir + "/" + rProject +
gdmlFileExtension );
if ( system( cmd ) != 0 )
G4cerr << "Failed to cat geometry data" << G4endl;
throw CexmcException( CexmcReadProjectIncomplete );
if ( zipGdmlFile )
{
cmd = G4String( "bzip2 " ) + projectsDir + "/" + rProject +
gdmlFileExtension;
if ( system( cmd ) != 0 )
throw CexmcException( CexmcFileCompressException );
}
addSpace = true;
}
@@ -1267,6 +1270,7 @@ void CexmcRunManager::PrintReadData(
{
etaDecayTable->GetDecayChannel( k->first )->SetBR( k->second );
}
PrintReadRunData();
}
}
@@ -1298,3 +1302,83 @@ void CexmcRunManager::SetCustomFilter( const G4String & cfFileName_ )
#endif
void CexmcRunManager::RegisterScenePrimitives( void )
{
G4VisManager * visManager( static_cast< G4VisManager * >(
G4VVisManager::GetConcreteInstance() ) );
if ( ! visManager )
return;
G4Scene * curScene( visManager->GetCurrentScene() );
if ( ! curScene )
return;
/* G4Scene declarations lack this kind of typedef */
typedef std::vector< G4VModel * > MList;
const MList & mList( curScene->GetRunDurationModelList() );
for ( MList::const_iterator k( mList.begin() ); k != mList.end(); ++k )
{
if ( ( *k )->GetGlobalDescription() == CexmcScenePrimitivesDescription )
return;
}
CexmcSetup * setup( static_cast< CexmcSetup * >( userDetector ) );
if ( ! setup )
throw CexmcException( CexmcWeirdException );
/* BEWARE: looks like G4Scene won't delete models from its lists upon
* termination! Hence destructor of the new model won't be called */
curScene->AddRunDurationModel( new CexmcScenePrimitives( setup ) );
}
void CexmcRunManager::BeamParticleChangeHook( void )
{
const CexmcEventAction * eventAction(
static_cast< const CexmcEventAction * >( userEventAction ) );
if ( ! eventAction )
throw CexmcException( CexmcWeirdException );
CexmcEventAction * theEventAction( const_cast< CexmcEventAction * >(
eventAction ) );
theEventAction->BeamParticleChangeHook();
}
void CexmcRunManager::SetupConstructionHook( void )
{
#ifdef CEXMC_USE_PERSISTENCY
/* save gdml file */
G4String cmd( "" );
CexmcExceptionType exceptionType( CexmcSystemException );
if ( zipGdmlFile )
{
if ( ProjectIsRead() )
{
cmd = G4String( "bzip2 " ) + projectsDir + "/" + rProject +
gdmlFileExtension;
}
else
{
if ( ProjectIsSaved() )
cmd = G4String( "bzip2 -c " ) + gdmlFileName + " > " +
projectsDir + "/" + projectId + gdmlbz2FileExtension;
}
exceptionType = CexmcFileCompressException;
}
else
{
if ( ! ProjectIsRead() && ProjectIsSaved() )
cmd = G4String( "cp " ) + gdmlFileName + " " + projectsDir + "/" +
projectId + gdmlFileExtension;
/* else already saved in ReadPreinitProjectData() */
}
if ( ! cmd.empty() && system( cmd ) != 0 )
throw CexmcException( exceptionType );
#endif
}
@@ -44,6 +44,7 @@
#include <G4UIcmdWithAString.hh>
#include <G4UIcmdWithAnInteger.hh>
#include <G4UIcmdWithABool.hh>
#include <G4UIcmdWithoutParameter.hh>
#include "CexmcRunManager.hh"
#include "CexmcRunManagerMessenger.hh"
#include "CexmcMessenger.hh"
@@ -57,7 +58,7 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
#ifdef CEXMC_USE_PERSISTENCY
replayEvents( NULL ), seekTo( NULL ), skipInteractionsWithoutEDT( NULL ),
#endif
validateGdmlFile( NULL )
registerScenePrimitives( NULL ), validateGdmlFile( NULL )
{
setProductionModel = new G4UIcmdWithAString(
( CexmcMessenger::physicsDirName + "productionModel" ).c_str(), this );
@@ -85,8 +86,8 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
" interaction - events with studied interaction triggered,\n"
" trigger - only events with trigger" );
setEventCountPolicy->SetParameterName( "EventCountPolicy", false );
setEventCountPolicy->SetDefaultValue( "all" );
setEventCountPolicy->SetCandidates( "all interaction trigger" );
setEventCountPolicy->SetDefaultValue( "all" );
setEventCountPolicy->AvailableForStates( G4State_PreInit, G4State_Idle );
setEventDataVerboseLevel = new G4UIcmdWithAString(
@@ -98,8 +99,8 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
" interaction - when studied interaction triggered (TPT)" );
setEventDataVerboseLevel->SetParameterName( "EventDataVerboseLevel",
false );
setEventDataVerboseLevel->SetDefaultValue( "trigger" );
setEventDataVerboseLevel->SetCandidates( "nosave trigger interaction" );
setEventDataVerboseLevel->SetDefaultValue( "trigger" );
setEventDataVerboseLevel->AvailableForStates( G4State_PreInit,
G4State_Idle );
@@ -111,8 +112,8 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
"\n If number of events is 0 (or not specified) then all"
"\n run will be replayed" );
replayEvents->SetParameterName( "ReplayEvents", true );
replayEvents->SetDefaultValue( 0 );
replayEvents->SetRange( "ReplayEvents >= 0" );
replayEvents->SetDefaultValue( 0 );
replayEvents->AvailableForStates( G4State_PreInit, G4State_Idle );
seekTo = new G4UIcmdWithAnInteger(
@@ -123,8 +124,8 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
"\n first recorded event with interaction after fourth recorded"
"\n event with trigger" );
seekTo->SetParameterName( "SeekTo", false );
seekTo->SetDefaultValue( 0 );
seekTo->SetRange( "SeekTo >= 0" );
seekTo->SetDefaultValue( 0 );
seekTo->AvailableForStates( G4State_PreInit, G4State_Idle );
skipInteractionsWithoutEDT = new G4UIcmdWithABool(
@@ -141,6 +142,14 @@ CexmcRunManagerMessenger::CexmcRunManagerMessenger(
G4State_Idle );
#endif
registerScenePrimitives = new G4UIcmdWithoutParameter(
( CexmcMessenger::visDirName + "registerScenePrimitives" ).c_str(),
this );
registerScenePrimitives->SetGuidance( "Register custom scene primitives "
"(radial lines,\n inner crystals highlights etc.)" );
registerScenePrimitives->AvailableForStates( G4State_PreInit,
G4State_Idle );
validateGdmlFile = new G4UIcmdWithABool(
( CexmcMessenger::geometryDirName + "validateGdmlFile" ).c_str(),
this );
@@ -163,6 +172,7 @@ CexmcRunManagerMessenger::~CexmcRunManagerMessenger()
delete seekTo;
delete skipInteractionsWithoutEDT;
#endif
delete registerScenePrimitives;
delete validateGdmlFile;
}
@@ -265,6 +275,11 @@ void CexmcRunManagerMessenger::SetNewValue( G4UIcommand * cmd,
break;
}
#endif
if ( cmd == registerScenePrimitives )
{
runManager->RegisterScenePrimitives();
break;
}
if ( cmd == validateGdmlFile )
{
runManager->SetGdmlFileValidation(
@@ -1,146 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* ============================================================================
*
* Filename: CexmcRunSObject.cc
*
* Description: run data serialization helper
*
* Version: 1.0
* Created: 23.12.2009 14:41:49
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* ============================================================================
*/
#ifdef CEXMC_USE_PERSISTENCY
#include "CexmcRunSObject.hh"
CexmcRunSObject::CexmcRunSObject()
{
}
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 ) :
basePhysicsUsed( basePhysicsUsed ),
productionModelType( productionModelType ), gdmlFileName( gdmlFileName ),
etaDecayTable( etaDecayTable ), angularRanges( angularRanges ),
fermiMotionIsOn( fermiMotionIsOn ),
calorimeterRegCuts( calorimeterRegCuts ),
eventCountPolicy( eventCountPolicy ), beamParticle( beamParticle ),
beamPos( beamPos ), beamDir( beamDir ), beamMomentumAmp( beamMomentumAmp ),
beamFwhmPosX( beamFwhmPosX ), beamFwhmPosY( beamFwhmPosY ),
beamFwhmDirX( beamFwhmDirX ), beamFwhmDirY( beamFwhmDirY ),
beamFwhmMomentumAmp( beamFwhmMomentumAmp ),
monitorEDThreshold( monitorEDThreshold ),
vetoCounterEDLeftThreshold( vetoCounterEDLeftThreshold ),
vetoCounterEDRightThreshold( vetoCounterEDRightThreshold ),
calorimeterEDLeftThreshold( calorimeterEDLeftThreshold ),
calorimeterEDRightThreshold( calorimeterEDRightThreshold ),
calorimeterTriggerAlgorithm( calorimeterTriggerAlgorithm ),
outerCrystalsVetoAlgorithm( outerCrystalsVetoAlgorithm ),
outerCrystalsVetoFraction( outerCrystalsVetoFraction ),
applyFiniteCrystalResolution( applyFiniteCrystalResolution ),
crystalResolutionData( crystalResolutionData ),
epDefinitionAlgorithm( epDefinitionAlgorithm ),
epDepthDefinitionAlgorithm( epDepthDefinitionAlgorithm ),
csAlgorithm( csAlgorithm ), useInnerRefCrystal( useInnerRefCrystal ),
epDepth( epDepth ), useTableMass( useTableMass ), useMassCut( useMassCut ),
mCutOPCenter( mCutOPCenter ), mCutNOPCenter( mCutNOPCenter ),
mCutOPWidth( mCutOPWidth ), mCutNOPWidth( mCutNOPWidth ),
mCutAngle( mCutAngle ), useAbsorbedEnergyCut( useAbsorbedEnergyCut ),
aeCutCLCenter( aeCutCLCenter ), aeCutCRCenter( aeCutCRCenter ),
aeCutCLWidth( aeCutCLWidth ), aeCutCRWidth( aeCutCRWidth ),
aeCutAngle( aeCutAngle ), nmbOfHitsSampled( nmbOfHitsSampled ),
nmbOfHitsSampledFull( nmbOfHitsSampledFull ),
nmbOfHitsTriggeredRealRange( nmbOfHitsTriggeredRealRange ),
nmbOfHitsTriggeredRecRange( nmbOfHitsTriggeredRecRange ),
nmbOfOrphanHits( nmbOfOrphanHits ),
nmbOfFalseHitsTriggeredEDT( nmbOfFalseHitsTriggeredEDT ),
nmbOfFalseHitsTriggeredRec( nmbOfFalseHitsTriggeredRec ),
nmbOfSavedEvents( nmbOfSavedEvents ),
nmbOfSavedFastEvents( nmbOfSavedFastEvents ),
numberOfEventsProcessed( numberOfEventsProcessed ),
numberOfEventsProcessedEffective( numberOfEventsProcessedEffective ),
numberOfEventsToBeProcessed( numberOfEventsToBeProcessed ),
rProject( rProject ),
interactionsWithoutEDTWereSkipped( interactionsWithoutEDTWereSkipped ),
cfFileName( cfFileName ), evDataVerboseLevel( evDataVerboseLevel ),
proposedMaxIL( proposedMaxIL ), actualVersion( CEXMC_RUN_SOBJECT_VERSION )
{
}
#endif
@@ -0,0 +1,188 @@
//
// ********************************************************************
// * 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: CexmcScenePrimitives.cc
*
* Description: auxiliary scene primitives (radial lines etc.)
*
* Version: 1.0
* Created: 03.01.2011 11:45:33
* Revision: none
* Compiler: gcc
*
* Author: Alexey Radkov (),
* Company: PNPI
*
* =============================================================================
*/
#include <cmath>
#include <G4Polyline.hh>
#include <G4Circle.hh>
#include <G4Polyhedron.hh>
#include <G4ThreeVector.hh>
#include <G4VisAttributes.hh>
#include <G4VGraphicsScene.hh>
#include <G4AffineTransform.hh>
#include <G4Transform3D.hh>
#include <G4Point3D.hh>
#include "CexmcScenePrimitives.hh"
#include "CexmcScenePrimitivesMessenger.hh"
#include "CexmcSetup.hh"
#include "CexmcCommon.hh"
namespace
{
G4double CexmcRadialLineWidth( 2.0 );
G4double CexmcRadialLineCapScreenSize( 4.0 );
G4double CexmcMarkerScreenSize( 2.0 );
G4double CexmcICHlLineLineWidth( 1.0 );
G4Colour CexmcDefaultSPColour( 1.0, 1.0, 1.0 );
}
CexmcScenePrimitives::CexmcScenePrimitives( CexmcSetup * setup ) :
setup( setup ), markTargetCenter( false ), highlightInnerCrystals( false ),
messenger( NULL )
{
messenger = new CexmcScenePrimitivesMessenger( this );
SetGlobalDescription( CexmcScenePrimitivesDescription );
spColours[ CexmcTargetCenterMark_SP ] = CexmcDefaultSPColour;
spColours[ CexmcRadialLine_SP ] = CexmcDefaultSPColour;
spColours[ CexmcInnerCrystalsHl_SP ] = CexmcDefaultSPColour;
}
CexmcScenePrimitives::~CexmcScenePrimitives()
{
delete messenger;
}
void CexmcScenePrimitives::DescribeYourselfTo( G4VGraphicsScene & scene )
{
if ( markTargetCenter )
MarkTargetCenter( scene );
if ( highlightInnerCrystals )
HighlightInnerCrystals( scene );
for ( CexmcRadialLines::const_iterator k( radialLines.begin() );
k != radialLines.end(); ++k )
{
DrawRadialLine( scene, &*k );
}
}
void CexmcScenePrimitives::MarkTargetCenter( G4VGraphicsScene & scene )
{
G4Circle circle;
circle.SetScreenSize( CexmcMarkerScreenSize );
circle.SetFillStyle( G4Circle::filled );
circle.SetVisAttributes( spColours[ CexmcTargetCenterMark_SP ] );
const G4AffineTransform & transform( setup->GetTargetTransform() );
G4Transform3D transform3D( G4RotationMatrix(),
transform.NetTranslation() );
scene.BeginPrimitives( transform3D );
scene.AddPrimitive( circle );
scene.EndPrimitives();
}
void CexmcScenePrimitives::DrawRadialLine( G4VGraphicsScene & scene,
const CexmcRadialLine * rLine )
{
G4double theta( rLine->theta * deg );
G4double phi( rLine->phi * deg );
G4double length( rLine->length * cm );
G4Point3D radialLineEnd( - std::sin( theta ) * std::cos( phi ) * length,
std::sin( theta ) * std::sin( phi ) * length,
std::cos( theta ) * length );
G4Polyline line;
line.push_back( G4ThreeVector() );
line.push_back( radialLineEnd );
G4VisAttributes visAttributes( spColours[ CexmcRadialLine_SP ] );
visAttributes.SetLineWidth( CexmcRadialLineWidth );
line.SetVisAttributes( visAttributes );
G4Circle circle;
circle.SetScreenSize( CexmcRadialLineCapScreenSize );
circle.SetFillStyle( G4Circle::filled );
circle.SetVisAttributes( spColours[ CexmcRadialLine_SP ] );
const G4AffineTransform & transform( setup->GetTargetTransform() );
G4Transform3D transform3D( G4RotationMatrix(),
transform.NetTranslation() );
scene.BeginPrimitives( transform3D );
scene.AddPrimitive( circle );
scene.AddPrimitive( line );
scene.EndPrimitives();
}
void CexmcScenePrimitives::HighlightInnerCrystals( G4VGraphicsScene & scene )
{
const CexmcSetup::CalorimeterGeometryData & calorimeterGeometry(
setup->GetCalorimeterGeometry() );
G4double icWidth( calorimeterGeometry.crystalWidth *
( calorimeterGeometry.nCrystalsInRow - 2 ) / 2 );
G4double icHeight( calorimeterGeometry.crystalHeight *
( calorimeterGeometry.nCrystalsInColumn - 2 ) / 2 );
G4double icLength( calorimeterGeometry.crystalLength / 2 );
icWidth = icWidth < 0 ? 0 : icWidth;
icHeight = icHeight < 0 ? 0 : icHeight;
G4PolyhedronBox innerCrystals( icWidth, icHeight, icLength );
G4VisAttributes visAttributes( spColours[ CexmcInnerCrystalsHl_SP ] );
visAttributes.SetLineWidth( CexmcICHlLineLineWidth );
innerCrystals.SetVisAttributes( visAttributes );
const G4AffineTransform & transformLeft(
setup->GetCalorimeterLeftTransform() );
G4Transform3D transform3DLeft(
transformLeft.NetRotation().inverse(),
transformLeft.NetTranslation() );
const G4AffineTransform & transformRight(
setup->GetCalorimeterRightTransform() );
G4Transform3D transform3DRight(
transformRight.NetRotation().inverse(),
transformRight.NetTranslation() );
scene.BeginPrimitives( transform3DLeft );
scene.AddPrimitive( innerCrystals );
scene.EndPrimitives();
scene.BeginPrimitives( transform3DRight );
scene.AddPrimitive( innerCrystals );
scene.EndPrimitives();
}

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