Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -12,10 +12,13 @@ examples/extended/optical/LXe and wls
|
||||
|
||||
\section ExampleOpNovice_s1 main()
|
||||
|
||||
Define Random Number Engine and initial seed
|
||||
Define Random Number generator initial seed
|
||||
|
||||
\section ExampleOpNovice_s2 G4OpticalPhysics
|
||||
|
||||
The G4OpticalPhysics physics class is used. The messenger is the
|
||||
G4OpticalParametersMessenger class.
|
||||
|
||||
- Define particles; including - *** G4OpticalPhoton ***
|
||||
- Define processes; including
|
||||
- *** G4Cerenkov ***
|
||||
@@ -44,12 +47,11 @@ examples/extended/optical/LXe and wls
|
||||
A messenger command allows to define interactively the polarization of an
|
||||
primary optical photon (see for instance optPhoton.mac)
|
||||
|
||||
\section ExampleOpNovice_s5 G4UserRunAction
|
||||
\section ExampleOpNovice_s5 G4UserRunAction and G4Run
|
||||
|
||||
- Define G4Timer (start/stop)
|
||||
- Set verbose levels
|
||||
- Used to accumulate statistics.
|
||||
|
||||
\section ExampleOpNovice_s6 G4UserStackingAction
|
||||
\section ExampleOpNovice_s6 G4UserStackingAction and G4UserEventAction
|
||||
|
||||
Show how to count the number of secondary particles in an event
|
||||
|
||||
@@ -70,7 +72,7 @@ examples/extended/optical/LXe and wls
|
||||
This example handles the program arguments in a new way.
|
||||
It can be run with the following optional arguments:
|
||||
\verbatim
|
||||
% OpNovice [-m macro ] [-u UIsession] [-t nThreads]
|
||||
$ OpNovice [-m macro ] [-u UIsession] [-t nThreads]
|
||||
\endverbatim
|
||||
|
||||
The -t option is available only in multi-threading mode
|
||||
@@ -80,12 +82,12 @@ examples/extended/optical/LXe and wls
|
||||
|
||||
- execute OpNovice in 'batch' mode from macro files
|
||||
\verbatim
|
||||
% OpNovice -m OpNovice.in
|
||||
$ OpNovice -m OpNovice.in
|
||||
\endverbatim
|
||||
|
||||
- execute OpNovice in 'interactive mode' with visualization
|
||||
\verbatim
|
||||
% OpNovice
|
||||
$ OpNovice
|
||||
....
|
||||
Idle> type your commands. For instance:
|
||||
Idle> /control/execute optPhoton.mac
|
||||
@@ -93,4 +95,14 @@ Idle> /control/execute optPhoton.mac
|
||||
Idle> exit
|
||||
\endverbatim
|
||||
|
||||
Macros
|
||||
------
|
||||
|
||||
The following macros are provided:
|
||||
|
||||
optPhoton.mac: Shoot optical photons with energy 3 eV
|
||||
OpNovice.in: Shoot positrons with energy 500 keV.
|
||||
gui.mac: Configure the graphical user interface.
|
||||
vis.mac: Configure visualization.
|
||||
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.8...3.18)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.12)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
endif()
|
||||
project(OpNovice)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -14,6 +14,18 @@ track of all tags.
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
November 1, 2020 D. Sawkey (OpNovice-V10-06-01)
|
||||
- Print out process statistics at end of run. Added EventAction and Run
|
||||
classes for this.
|
||||
- Update macros, especially to run more particles. Update gui.mac
|
||||
- Migrate to new G4RunManagerFactory
|
||||
- Remove G4Timer
|
||||
- Use default random number generator
|
||||
- Apply clang-format style
|
||||
|
||||
August 4, 2020 D. Sawkey (OpNovice-V10-06-00)
|
||||
- Add material properties using new interface with std::vectors
|
||||
|
||||
October 29, 2019 D. Sawkey (OpNovice-V10-05-00)
|
||||
- Use G4OpticalPhysics and G4SteppingVerbose
|
||||
- remove unused surface parameters
|
||||
|
||||
@@ -39,48 +39,42 @@
|
||||
// Version: 5.0
|
||||
// Created: 1996-04-30
|
||||
// Author: Juliet Armstrong
|
||||
// mail: gum@triumf.ca
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Types.hh"
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
#include "G4MTRunManager.hh"
|
||||
#else
|
||||
#include "G4RunManager.hh"
|
||||
#endif
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "G4OpticalPhysics.hh"
|
||||
#include "G4EmStandardPhysics_option4.hh"
|
||||
|
||||
#include "OpNoviceDetectorConstruction.hh"
|
||||
#include "OpNoviceActionInitialization.hh"
|
||||
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "G4EmStandardPhysics_option4.hh"
|
||||
#include "G4OpticalPhysics.hh"
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4Types.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
namespace {
|
||||
void PrintUsage() {
|
||||
namespace
|
||||
{
|
||||
void PrintUsage()
|
||||
{
|
||||
G4cerr << " Usage: " << G4endl;
|
||||
G4cerr << " OpNovice [-m macro ] [-u UIsession] [-t nThreads] [-r seed] "
|
||||
<< G4endl;
|
||||
G4cerr << " note: -t option is available only for multi-threaded mode."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Evaluate arguments
|
||||
//
|
||||
if ( argc > 9 ) {
|
||||
if(argc > 9)
|
||||
{
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
@@ -92,16 +86,22 @@ int main(int argc,char** argv)
|
||||
#endif
|
||||
|
||||
G4long myseed = 345354;
|
||||
for ( G4int i=1; i<argc; i=i+2 ) {
|
||||
if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
|
||||
else if ( G4String(argv[i]) == "-u" ) session = argv[i+1];
|
||||
else if ( G4String(argv[i]) == "-r" ) myseed = atoi(argv[i+1]);
|
||||
for(G4int i = 1; i < argc; i = i + 2)
|
||||
{
|
||||
if(G4String(argv[i]) == "-m")
|
||||
macro = argv[i + 1];
|
||||
else if(G4String(argv[i]) == "-u")
|
||||
session = argv[i + 1];
|
||||
else if(G4String(argv[i]) == "-r")
|
||||
myseed = atoi(argv[i + 1]);
|
||||
#ifdef G4MULTITHREADED
|
||||
else if ( G4String(argv[i]) == "-t" ) {
|
||||
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
|
||||
else if(G4String(argv[i]) == "-t")
|
||||
{
|
||||
nThreads = G4UIcommand::ConvertToInt(argv[i + 1]);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
else
|
||||
{
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
@@ -109,21 +109,16 @@ int main(int argc,char** argv)
|
||||
|
||||
// Instantiate G4UIExecutive if interactive mode
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( macro.size() == 0 ) {
|
||||
if(macro.size() == 0)
|
||||
{
|
||||
ui = new G4UIExecutive(argc, argv);
|
||||
}
|
||||
|
||||
// Choose the Random engine
|
||||
//
|
||||
G4Random::setTheEngine(new CLHEP::RanecuEngine);
|
||||
|
||||
// Construct the default run manager
|
||||
//
|
||||
auto runManager = G4RunManagerFactory::CreateRunManager();
|
||||
#ifdef G4MULTITHREADED
|
||||
G4MTRunManager * runManager = new G4MTRunManager;
|
||||
if ( nThreads > 0 ) runManager->SetNumberOfThreads(nThreads);
|
||||
#else
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
if(nThreads > 0)
|
||||
runManager->SetNumberOfThreads(nThreads);
|
||||
#endif
|
||||
|
||||
// Seed the random number generator manually
|
||||
@@ -132,43 +127,34 @@ int main(int argc,char** argv)
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
// Detector construction
|
||||
runManager-> SetUserInitialization(new OpNoviceDetectorConstruction());
|
||||
runManager->SetUserInitialization(new OpNoviceDetectorConstruction());
|
||||
// Physics list
|
||||
G4VModularPhysicsList* physicsList = new FTFP_BERT;
|
||||
physicsList->ReplacePhysics(new G4EmStandardPhysics_option4());
|
||||
G4OpticalPhysics* opticalPhysics = new G4OpticalPhysics();
|
||||
physicsList->RegisterPhysics(opticalPhysics);
|
||||
runManager-> SetUserInitialization(physicsList);
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
// User action initialization
|
||||
runManager->SetUserInitialization(new OpNoviceActionInitialization());
|
||||
|
||||
// Initialize visualization
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
G4VisManager* visManager = new G4VisExecutive("Quiet");
|
||||
visManager->Initialize();
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
if ( macro.size() ) {
|
||||
// Batch mode
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command+macro);
|
||||
}
|
||||
else // Define UI session for interactive mode
|
||||
if(macro.size())
|
||||
{
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
if (ui->IsGUI())
|
||||
UImanager->ApplyCommand("/control/execute gui.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command + macro);
|
||||
}
|
||||
else // Define UI session for interactive mode
|
||||
{
|
||||
UImanager->ApplyCommand("/control/execute vis.mac");
|
||||
if(ui->IsGUI())
|
||||
UImanager->ApplyCommand("/control/execute gui.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not
|
||||
// be deleted in the main() program !
|
||||
|
||||
delete visManager;
|
||||
delete runManager;
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
/control/verbose 2
|
||||
/tracking/verbose 0
|
||||
/tracking/verbose 1
|
||||
/process/optical/verbose 1
|
||||
/run/verbose 1
|
||||
/control/cout/ignoreThreadsExcept 0
|
||||
#
|
||||
/process/optical/verbose 0
|
||||
/run/initialize
|
||||
#
|
||||
/gun/particle e+
|
||||
/gun/energy 500 keV
|
||||
#
|
||||
/run/beamOn 1
|
||||
/process/optical/cerenkov/setMaxBetaChange 1
|
||||
/run/beamOn 10
|
||||
#
|
||||
/tracking/verbose 0
|
||||
/process/optical/cerenkov/setMaxPhotons 15
|
||||
/process/optical/cerenkov/setTrackSecondariesFirst false
|
||||
/process/optical/scintillation/setYieldFactor 0.3
|
||||
#
|
||||
/run/beamOn 1
|
||||
/run/beamOn 1000
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,11 +16,14 @@ examples/extended/optical/LXe and wls.
|
||||
main()
|
||||
------
|
||||
|
||||
==> define Random Number Engine and initial seed
|
||||
==> define Random Number generator initial seed
|
||||
|
||||
G4Optical Physics
|
||||
-----------------
|
||||
|
||||
The G4OpticalPhysics physics class is used. The messenger is the
|
||||
G4OpticalParametersMessenger class.
|
||||
|
||||
==> define particles; including *** G4OpticalPhoton ***
|
||||
define processes; including *** G4Cerenkov ***
|
||||
*** G4Scintillation ***
|
||||
@@ -50,14 +53,13 @@ G4VUserPrimaryGeneratorAction
|
||||
==> A messenger command allows to define interactively the polarization of an
|
||||
primary optical photon (see for instance optPhoton.mac)
|
||||
|
||||
G4UserRunAction
|
||||
---------------
|
||||
G4UserRunAction and G4Run
|
||||
-------------------------
|
||||
|
||||
==> define G4Timer (start/stop)
|
||||
set verbose levels
|
||||
Used to accumulate statistics.
|
||||
|
||||
G4UserStackingAction
|
||||
--------------------
|
||||
G4UserStackingAction and G4UserEventAction
|
||||
------------------------------------------
|
||||
|
||||
==> show how to count the number of secondary particles in an event
|
||||
|
||||
@@ -79,7 +81,7 @@ Visualisation
|
||||
|
||||
This example handles the program arguments in a new way.
|
||||
It can be run with the following optional arguments:
|
||||
% OpNovice [-m macro ] [-u UIsession] [-t nThreads]
|
||||
$ OpNovice [-m macro ] [-u UIsession] [-t nThreads]
|
||||
|
||||
The -t option is available only in multi-threading mode
|
||||
and it allows the user to override the Geant4 default number of
|
||||
@@ -87,13 +89,22 @@ Visualisation
|
||||
environment variable which has the top priority.
|
||||
|
||||
- execute OpNovice in 'batch' mode from macro files
|
||||
% OpNovice -m OpNovice.in
|
||||
$ OpNovice -m OpNovice.in
|
||||
|
||||
- execute OpNovice in 'interactive mode' with visualization
|
||||
% OpNovice
|
||||
$ OpNovice
|
||||
....
|
||||
Idle> type your commands. For instance:
|
||||
Idle> /control/execute optPhoton.mac
|
||||
....
|
||||
Idle> exit
|
||||
|
||||
|
||||
Macros
|
||||
------
|
||||
|
||||
The following macros are provided:
|
||||
|
||||
optPhoton.mac: Shoot optical photons with energy 3 eV
|
||||
OpNovice.in: Shoot positrons with energy 500 keV.
|
||||
gui.mac: Configure the graphical user interface.
|
||||
vis.mac: Configure visualization.
|
||||
|
||||
@@ -10,26 +10,20 @@
|
||||
# Run menu :
|
||||
/gui/addMenu run Run
|
||||
/gui/addButton run "beamOn 1" "/run/beamOn 1"
|
||||
#/gui/addButton run run1 "/control/execute run1.mac"
|
||||
#/gui/addButton run run2 "/control/execute run2.mac"
|
||||
#
|
||||
# Gun menu :
|
||||
/gui/addMenu gun Gun
|
||||
/gui/addButton gun "500 keV" "/gun/energy 500 keV"
|
||||
/gui/addButton gun "1 MeV" "/gun/energy 1 MeV"
|
||||
/gui/addButton gun "50 MeV" "/gun/energy 50 MeV"
|
||||
/gui/addButton gun "1 GeV" "/gun/energy 1 GeV"
|
||||
/gui/addButton gun "10 GeV" "/gun/energy 10 GeV"
|
||||
/gui/addButton gun "opticalphoton" "/gun/particle opticalphoton"
|
||||
/gui/addButton gun "e-" "/gun/particle e-"
|
||||
/gui/addButton gun "pi0" "/gun/particle pi0"
|
||||
/gui/addButton gun "pi+" "/gun/particle pi+"
|
||||
/gui/addButton gun "neutron" "/gun/particle neutron"
|
||||
/gui/addButton gun "proton" "/gun/particle proton"
|
||||
#
|
||||
# Field menu :
|
||||
#/gui/addMenu field Field
|
||||
#/gui/addButton field "off" "/B2/det/setField 0.2 tesla"
|
||||
#/gui/addButton field "0.2 tesla" "/B2/det/setField 0.2 tesla"
|
||||
#/gui/addButton field "2.0 tesla" "/B2/det/setField 2.0 tesla"
|
||||
#
|
||||
|
||||
# Viewer menu :
|
||||
/gui/addMenu viewer Viewer
|
||||
/gui/addButton viewer "Set style surface" "/vis/viewer/set/style surface"
|
||||
|
||||
@@ -32,19 +32,14 @@
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
class B4DetectorConstruction;
|
||||
|
||||
/// Action initialization class.
|
||||
///
|
||||
|
||||
class OpNoviceActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
OpNoviceActionInitialization();
|
||||
virtual ~OpNoviceActionInitialization();
|
||||
public:
|
||||
OpNoviceActionInitialization();
|
||||
~OpNoviceActionInitialization();
|
||||
|
||||
virtual void BuildForMaster() const;
|
||||
virtual void Build() const;
|
||||
void BuildForMaster() const override;
|
||||
void Build() const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,25 +41,24 @@
|
||||
|
||||
class OpNoviceDetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
OpNoviceDetectorConstruction();
|
||||
virtual ~OpNoviceDetectorConstruction();
|
||||
public:
|
||||
OpNoviceDetectorConstruction();
|
||||
~OpNoviceDetectorConstruction();
|
||||
|
||||
public:
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
G4VPhysicalVolume* Construct() override;
|
||||
|
||||
private:
|
||||
G4double fExpHall_x;
|
||||
G4double fExpHall_y;
|
||||
G4double fExpHall_z;
|
||||
private:
|
||||
G4double fExpHall_x;
|
||||
G4double fExpHall_y;
|
||||
G4double fExpHall_z;
|
||||
|
||||
G4double fTank_x;
|
||||
G4double fTank_y;
|
||||
G4double fTank_z;
|
||||
G4double fTank_x;
|
||||
G4double fTank_y;
|
||||
G4double fTank_z;
|
||||
|
||||
G4double fBubble_x;
|
||||
G4double fBubble_y;
|
||||
G4double fBubble_z;
|
||||
G4double fBubble_x;
|
||||
G4double fBubble_y;
|
||||
G4double fBubble_z;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice/include/OpNoviceEventAction.hh
|
||||
/// \brief Definition of the OpNoviceEventAction class
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef OpNoviceEventAction_h
|
||||
#define OpNoviceEventAction_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UserEventAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class OpNoviceEventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
OpNoviceEventAction();
|
||||
~OpNoviceEventAction();
|
||||
|
||||
void BeginOfEventAction(const G4Event*) override;
|
||||
void EndOfEventAction(const G4Event*) override;
|
||||
|
||||
void AddRayleigh() { ++fRayleigh; }
|
||||
void AddAbsorption() { ++fAbsorption; }
|
||||
void AddMie() { ++fMie; }
|
||||
void AddBoundary() { ++fBoundary; }
|
||||
|
||||
private:
|
||||
G4int fRayleigh;
|
||||
G4int fAbsorption;
|
||||
G4int fMie;
|
||||
G4int fBoundary;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -34,10 +34,10 @@
|
||||
#ifndef OpNovicePrimaryGeneratorAction_h
|
||||
#define OpNovicePrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
class OpNovicePrimaryGeneratorMessenger;
|
||||
|
||||
@@ -45,19 +45,20 @@ class OpNovicePrimaryGeneratorMessenger;
|
||||
|
||||
class OpNovicePrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
OpNovicePrimaryGeneratorAction();
|
||||
virtual ~OpNovicePrimaryGeneratorAction();
|
||||
public:
|
||||
OpNovicePrimaryGeneratorAction();
|
||||
~OpNovicePrimaryGeneratorAction();
|
||||
|
||||
public:
|
||||
virtual void GeneratePrimaries(G4Event*);
|
||||
void GeneratePrimaries(G4Event*) override;
|
||||
|
||||
void SetOptPhotonPolar();
|
||||
void SetOptPhotonPolar(G4double);
|
||||
void SetOptPhotonPolar();
|
||||
void SetOptPhotonPolar(G4double);
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun;
|
||||
OpNovicePrimaryGeneratorMessenger* fGunMessenger;
|
||||
G4ParticleGun* GetParticleGun() { return fParticleGun; }
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun;
|
||||
OpNovicePrimaryGeneratorMessenger* fGunMessenger;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -36,8 +35,8 @@
|
||||
#ifndef OpNovicePrimaryGeneratorMessenger_h
|
||||
#define OpNovicePrimaryGeneratorMessenger_h 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class OpNovicePrimaryGeneratorAction;
|
||||
class G4UIdirectory;
|
||||
@@ -45,18 +44,18 @@ class G4UIcmdWithADoubleAndUnit;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class OpNovicePrimaryGeneratorMessenger: public G4UImessenger
|
||||
class OpNovicePrimaryGeneratorMessenger : public G4UImessenger
|
||||
{
|
||||
public:
|
||||
OpNovicePrimaryGeneratorMessenger(OpNovicePrimaryGeneratorAction* );
|
||||
virtual ~OpNovicePrimaryGeneratorMessenger();
|
||||
|
||||
virtual void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
OpNovicePrimaryGeneratorAction* fOpNoviceAction;
|
||||
G4UIdirectory* fGunDir;
|
||||
G4UIcmdWithADoubleAndUnit* fPolarCmd;
|
||||
public:
|
||||
OpNovicePrimaryGeneratorMessenger(OpNovicePrimaryGeneratorAction*);
|
||||
~OpNovicePrimaryGeneratorMessenger();
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String) override;
|
||||
|
||||
private:
|
||||
OpNovicePrimaryGeneratorAction* fOpNoviceAction;
|
||||
G4UIdirectory* fGunDir;
|
||||
G4UIcmdWithADoubleAndUnit* fPolarCmd;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file OpNovice/include/OpNoviceRun.hh
|
||||
/// \brief Definition of the OpNoviceRun class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef OpNoviceRun_h
|
||||
#define OpNoviceRun_h 1
|
||||
|
||||
#include "G4Run.hh"
|
||||
|
||||
class G4ParticleDefinition;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class OpNoviceRun : public G4Run
|
||||
{
|
||||
public:
|
||||
OpNoviceRun();
|
||||
~OpNoviceRun();
|
||||
|
||||
void SetPrimary(G4ParticleDefinition* particle, G4double energy);
|
||||
|
||||
void AddCerenkov(G4double n)
|
||||
{
|
||||
fCerenkovCounter += n;
|
||||
fCerenkov2 += n * n;
|
||||
};
|
||||
void AddScintillation(G4double n)
|
||||
{
|
||||
fScintillationCounter += n;
|
||||
fScintillation2 += n * n;
|
||||
};
|
||||
void AddRayleigh(G4double n)
|
||||
{
|
||||
fRayleighCounter += n;
|
||||
fRayleigh2 += n * n;
|
||||
};
|
||||
void AddAbsorption(G4double n)
|
||||
{
|
||||
fAbsorptionCounter += n;
|
||||
fAbsorption2 += n * n;
|
||||
};
|
||||
void AddMie(G4double n)
|
||||
{
|
||||
fMieCounter += n;
|
||||
fMie2 += n * n;
|
||||
};
|
||||
void AddBoundary(G4double n)
|
||||
{
|
||||
fBoundaryCounter += n;
|
||||
fBoundary2 += n * n;
|
||||
};
|
||||
|
||||
void Merge(const G4Run*) override;
|
||||
void EndOfRun();
|
||||
|
||||
private:
|
||||
G4double fCerenkovCounter;
|
||||
G4double fCerenkov2;
|
||||
G4double fScintillationCounter;
|
||||
G4double fScintillation2;
|
||||
G4double fRayleighCounter;
|
||||
G4double fRayleigh2;
|
||||
G4double fAbsorptionCounter;
|
||||
G4double fAbsorption2;
|
||||
G4double fMieCounter;
|
||||
G4double fMie2;
|
||||
G4double fBoundaryCounter;
|
||||
G4double fBoundary2;
|
||||
|
||||
G4ParticleDefinition* fParticle;
|
||||
G4double fEnergy;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Definition of the OpNoviceRunAction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -37,25 +37,28 @@
|
||||
#include "globals.hh"
|
||||
#include "G4UserRunAction.hh"
|
||||
|
||||
class OpNovicePrimaryGeneratorAction;
|
||||
class OpNoviceRun;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class G4Timer;
|
||||
class G4Run;
|
||||
|
||||
class OpNoviceRunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
OpNoviceRunAction();
|
||||
virtual ~OpNoviceRunAction();
|
||||
public:
|
||||
OpNoviceRunAction(OpNovicePrimaryGeneratorAction* = nullptr);
|
||||
~OpNoviceRunAction();
|
||||
|
||||
public:
|
||||
virtual void BeginOfRunAction(const G4Run* aRun);
|
||||
virtual void EndOfRunAction(const G4Run* aRun);
|
||||
G4Run* GenerateRun() override;
|
||||
void BeginOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
|
||||
private:
|
||||
G4Timer* fTimer;
|
||||
private:
|
||||
OpNoviceRun* fRun;
|
||||
OpNovicePrimaryGeneratorAction* fPrimary;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif /*OpNoviceRunAction_h*/
|
||||
#endif
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#ifndef OpNoviceStackingAction_H
|
||||
#define OpNoviceStackingAction_H 1
|
||||
#ifndef OpNoviceStackingAction_h
|
||||
#define OpNoviceStackingAction_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UserStackingAction.hh"
|
||||
@@ -40,18 +40,17 @@
|
||||
|
||||
class OpNoviceStackingAction : public G4UserStackingAction
|
||||
{
|
||||
public:
|
||||
OpNoviceStackingAction();
|
||||
virtual ~OpNoviceStackingAction();
|
||||
public:
|
||||
OpNoviceStackingAction();
|
||||
~OpNoviceStackingAction();
|
||||
|
||||
public:
|
||||
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
|
||||
virtual void NewStage();
|
||||
virtual void PrepareNewEvent();
|
||||
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) override;
|
||||
void NewStage() override;
|
||||
void PrepareNewEvent() override;
|
||||
|
||||
private:
|
||||
G4int fScintillationCounter;
|
||||
G4int fCerenkovCounter;
|
||||
private:
|
||||
G4int fScintillationCounter;
|
||||
G4int fCerenkovCounter;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -30,25 +30,21 @@
|
||||
#ifndef OpNoviceSteppingAction_h
|
||||
#define OpNoviceSteppingAction_h 1
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
#include "globals.hh"
|
||||
#include "OpNoviceEventAction.hh"
|
||||
|
||||
/// Stepping action class
|
||||
///
|
||||
#include "globals.hh"
|
||||
#include "G4UserSteppingAction.hh"
|
||||
|
||||
class OpNoviceSteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
OpNoviceSteppingAction();
|
||||
virtual ~OpNoviceSteppingAction();
|
||||
public:
|
||||
OpNoviceSteppingAction(OpNoviceEventAction*);
|
||||
~OpNoviceSteppingAction();
|
||||
|
||||
// method from the base class
|
||||
virtual void UserSteppingAction(const G4Step*);
|
||||
void UserSteppingAction(const G4Step*) override;
|
||||
|
||||
private:
|
||||
G4int fScintillationCounter;
|
||||
G4int fCerenkovCounter;
|
||||
G4int fEventNumber;
|
||||
private:
|
||||
OpNoviceEventAction* fEventAction;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/control/verbose 2
|
||||
/tracking/verbose 2
|
||||
/run/verbose 1
|
||||
/process/optical/verbose 1
|
||||
/control/cout/ignoreThreadsExcept 0
|
||||
#
|
||||
/run/initialize
|
||||
#
|
||||
@@ -8,9 +11,9 @@
|
||||
#
|
||||
/gun/direction 5 -3 0
|
||||
/OpNovice/gun/optPhotonPolar
|
||||
/run/beamOn 1
|
||||
/run/beamOn 10
|
||||
#
|
||||
/tracking/verbose 0
|
||||
/gun/position 30 40 50 cm
|
||||
/gun/direction 1 1 1
|
||||
/OpNovice/gun/optPhotonPolar
|
||||
/run/beamOn 1
|
||||
/run/beamOn 10000
|
||||
|
||||
@@ -28,21 +28,22 @@
|
||||
/// \brief Implementation of the OpNoviceActionInitialization class
|
||||
|
||||
#include "OpNoviceActionInitialization.hh"
|
||||
|
||||
#include "OpNoviceEventAction.hh"
|
||||
#include "OpNovicePrimaryGeneratorAction.hh"
|
||||
#include "OpNoviceRunAction.hh"
|
||||
#include "OpNoviceSteppingAction.hh"
|
||||
#include "OpNoviceStackingAction.hh"
|
||||
#include "OpNoviceSteppingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceActionInitialization::OpNoviceActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceActionInitialization::~OpNoviceActionInitialization()
|
||||
{}
|
||||
OpNoviceActionInitialization::~OpNoviceActionInitialization() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -55,8 +56,12 @@ void OpNoviceActionInitialization::BuildForMaster() const
|
||||
|
||||
void OpNoviceActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new OpNovicePrimaryGeneratorAction());
|
||||
SetUserAction(new OpNoviceRunAction());
|
||||
SetUserAction(new OpNoviceSteppingAction());
|
||||
OpNovicePrimaryGeneratorAction* primary =
|
||||
new OpNovicePrimaryGeneratorAction();
|
||||
SetUserAction(primary);
|
||||
SetUserAction(new OpNoviceRunAction(primary));
|
||||
OpNoviceEventAction* event = new OpNoviceEventAction();
|
||||
SetUserAction(event);
|
||||
SetUserAction(new OpNoviceSteppingAction(event));
|
||||
SetUserAction(new OpNoviceStackingAction());
|
||||
}
|
||||
|
||||
@@ -33,323 +33,264 @@
|
||||
|
||||
#include "OpNoviceDetectorConstruction.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4LogicalBorderSurface.hh"
|
||||
#include "G4LogicalSkinSurface.hh"
|
||||
#include "G4OpticalSurface.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4OpticalSurface.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceDetectorConstruction::OpNoviceDetectorConstruction()
|
||||
: G4VUserDetectorConstruction()
|
||||
: G4VUserDetectorConstruction()
|
||||
{
|
||||
fExpHall_x = fExpHall_y = fExpHall_z = 10.0*m;
|
||||
fTank_x = fTank_y = fTank_z = 5.0*m;
|
||||
fBubble_x = fBubble_y = fBubble_z = 0.5*m;
|
||||
fExpHall_x = fExpHall_y = fExpHall_z = 10.0 * m;
|
||||
fTank_x = fTank_y = fTank_z = 5.0 * m;
|
||||
fBubble_x = fBubble_y = fBubble_z = 0.5 * m;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceDetectorConstruction::~OpNoviceDetectorConstruction(){;}
|
||||
OpNoviceDetectorConstruction::~OpNoviceDetectorConstruction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
|
||||
{
|
||||
|
||||
// ------------- Materials -------------
|
||||
// ------------- Materials -------------
|
||||
|
||||
G4double a, z, density;
|
||||
G4int nelements;
|
||||
|
||||
// Air
|
||||
//
|
||||
G4Element* N = new G4Element("Nitrogen", "N", z=7 , a=14.01*g/mole);
|
||||
G4Element* O = new G4Element("Oxygen" , "O", z=8 , a=16.00*g/mole);
|
||||
// Air
|
||||
//
|
||||
G4Element* N = new G4Element("Nitrogen", "N", z = 7, a = 14.01 * g / mole);
|
||||
G4Element* O = new G4Element("Oxygen", "O", z = 8, a = 16.00 * g / mole);
|
||||
|
||||
G4Material* air = new G4Material("Air", density=1.29*mg/cm3, nelements=2);
|
||||
air->AddElement(N, 70.*perCent);
|
||||
air->AddElement(O, 30.*perCent);
|
||||
G4Material* air =
|
||||
new G4Material("Air", density = 1.29 * mg / cm3, nelements = 2);
|
||||
air->AddElement(N, 70. * perCent);
|
||||
air->AddElement(O, 30. * perCent);
|
||||
|
||||
// Water
|
||||
//
|
||||
G4Element* H = new G4Element("Hydrogen", "H", z=1 , a=1.01*g/mole);
|
||||
// Water
|
||||
//
|
||||
G4Element* H = new G4Element("Hydrogen", "H", z = 1, a = 1.01 * g / mole);
|
||||
|
||||
G4Material* water = new G4Material("Water", density= 1.0*g/cm3, nelements=2);
|
||||
G4Material* water =
|
||||
new G4Material("Water", density = 1.0 * g / cm3, nelements = 2);
|
||||
water->AddElement(H, 2);
|
||||
water->AddElement(O, 1);
|
||||
|
||||
//
|
||||
// ------------ Generate & Add Material Properties Table ------------
|
||||
//
|
||||
G4double photonEnergy[] =
|
||||
{ 2.034*eV, 2.068*eV, 2.103*eV, 2.139*eV,
|
||||
2.177*eV, 2.216*eV, 2.256*eV, 2.298*eV,
|
||||
2.341*eV, 2.386*eV, 2.433*eV, 2.481*eV,
|
||||
2.532*eV, 2.585*eV, 2.640*eV, 2.697*eV,
|
||||
2.757*eV, 2.820*eV, 2.885*eV, 2.954*eV,
|
||||
3.026*eV, 3.102*eV, 3.181*eV, 3.265*eV,
|
||||
3.353*eV, 3.446*eV, 3.545*eV, 3.649*eV,
|
||||
3.760*eV, 3.877*eV, 4.002*eV, 4.136*eV };
|
||||
// ------------ Generate & Add Material Properties Table ------------
|
||||
//
|
||||
std::vector<G4double> photonEnergy = {
|
||||
2.034 * eV, 2.068 * eV, 2.103 * eV, 2.139 * eV, 2.177 * eV, 2.216 * eV,
|
||||
2.256 * eV, 2.298 * eV, 2.341 * eV, 2.386 * eV, 2.433 * eV, 2.481 * eV,
|
||||
2.532 * eV, 2.585 * eV, 2.640 * eV, 2.697 * eV, 2.757 * eV, 2.820 * eV,
|
||||
2.885 * eV, 2.954 * eV, 3.026 * eV, 3.102 * eV, 3.181 * eV, 3.265 * eV,
|
||||
3.353 * eV, 3.446 * eV, 3.545 * eV, 3.649 * eV, 3.760 * eV, 3.877 * eV,
|
||||
4.002 * eV, 4.136 * eV
|
||||
};
|
||||
|
||||
const G4int nEntries = sizeof(photonEnergy)/sizeof(G4double);
|
||||
// Water
|
||||
//
|
||||
std::vector<G4double> refractiveIndex1 = {
|
||||
1.3435, 1.344, 1.3445, 1.345, 1.3455, 1.346, 1.3465, 1.347,
|
||||
1.3475, 1.348, 1.3485, 1.3492, 1.35, 1.3505, 1.351, 1.3518,
|
||||
1.3522, 1.3530, 1.3535, 1.354, 1.3545, 1.355, 1.3555, 1.356,
|
||||
1.3568, 1.3572, 1.358, 1.3585, 1.359, 1.3595, 1.36, 1.3608
|
||||
};
|
||||
|
||||
//
|
||||
// Water
|
||||
//
|
||||
G4double refractiveIndex1[] =
|
||||
{ 1.3435, 1.344, 1.3445, 1.345, 1.3455,
|
||||
1.346, 1.3465, 1.347, 1.3475, 1.348,
|
||||
1.3485, 1.3492, 1.35, 1.3505, 1.351,
|
||||
1.3518, 1.3522, 1.3530, 1.3535, 1.354,
|
||||
1.3545, 1.355, 1.3555, 1.356, 1.3568,
|
||||
1.3572, 1.358, 1.3585, 1.359, 1.3595,
|
||||
1.36, 1.3608};
|
||||
std::vector<G4double> absorption = {
|
||||
3.448 * m, 4.082 * m, 6.329 * m, 9.174 * m, 12.346 * m, 13.889 * m,
|
||||
15.152 * m, 17.241 * m, 18.868 * m, 20.000 * m, 26.316 * m, 35.714 * m,
|
||||
45.455 * m, 47.619 * m, 52.632 * m, 52.632 * m, 55.556 * m, 52.632 * m,
|
||||
52.632 * m, 47.619 * m, 45.455 * m, 41.667 * m, 37.037 * m, 33.333 * m,
|
||||
30.000 * m, 28.500 * m, 27.000 * m, 24.500 * m, 22.000 * m, 19.500 * m,
|
||||
17.500 * m, 14.500 * m
|
||||
};
|
||||
|
||||
assert(sizeof(refractiveIndex1) == sizeof(photonEnergy));
|
||||
std::vector<G4double> scintilFast = {
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00
|
||||
};
|
||||
|
||||
G4double absorption[] =
|
||||
{3.448*m, 4.082*m, 6.329*m, 9.174*m, 12.346*m, 13.889*m,
|
||||
15.152*m, 17.241*m, 18.868*m, 20.000*m, 26.316*m, 35.714*m,
|
||||
45.455*m, 47.619*m, 52.632*m, 52.632*m, 55.556*m, 52.632*m,
|
||||
52.632*m, 47.619*m, 45.455*m, 41.667*m, 37.037*m, 33.333*m,
|
||||
30.000*m, 28.500*m, 27.000*m, 24.500*m, 22.000*m, 19.500*m,
|
||||
17.500*m, 14.500*m };
|
||||
|
||||
assert(sizeof(absorption) == sizeof(photonEnergy));
|
||||
|
||||
G4double scintilFast[] =
|
||||
{ 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00 };
|
||||
|
||||
assert(sizeof(scintilFast) == sizeof(photonEnergy));
|
||||
|
||||
G4double scintilSlow[] =
|
||||
{ 0.01, 1.00, 2.00, 3.00, 4.00, 5.00, 6.00,
|
||||
7.00, 8.00, 9.00, 8.00, 7.00, 6.00, 4.00,
|
||||
3.00, 2.00, 1.00, 0.01, 1.00, 2.00, 3.00,
|
||||
4.00, 5.00, 6.00, 7.00, 8.00, 9.00, 8.00,
|
||||
7.00, 6.00, 5.00, 4.00 };
|
||||
|
||||
assert(sizeof(scintilSlow) == sizeof(photonEnergy));
|
||||
std::vector<G4double> scintilSlow = {
|
||||
0.01, 1.00, 2.00, 3.00, 4.00, 5.00, 6.00, 7.00, 8.00, 9.00, 8.00,
|
||||
7.00, 6.00, 4.00, 3.00, 2.00, 1.00, 0.01, 1.00, 2.00, 3.00, 4.00,
|
||||
5.00, 6.00, 7.00, 8.00, 9.00, 8.00, 7.00, 6.00, 5.00, 4.00
|
||||
};
|
||||
|
||||
G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
|
||||
|
||||
myMPT1->AddProperty("RINDEX", photonEnergy, refractiveIndex1,nEntries)
|
||||
->SetSpline(true);
|
||||
myMPT1->AddProperty("ABSLENGTH", photonEnergy, absorption, nEntries)
|
||||
->SetSpline(true);
|
||||
myMPT1->AddProperty("FASTCOMPONENT",photonEnergy, scintilFast, nEntries)
|
||||
->SetSpline(true);
|
||||
myMPT1->AddProperty("SLOWCOMPONENT",photonEnergy, scintilSlow, nEntries)
|
||||
->SetSpline(true);
|
||||
myMPT1->AddProperty("RINDEX", photonEnergy, refractiveIndex1)
|
||||
->SetSpline(true);
|
||||
myMPT1->AddProperty("ABSLENGTH", photonEnergy, absorption)->SetSpline(true);
|
||||
myMPT1->AddProperty("FASTCOMPONENT", photonEnergy, scintilFast)
|
||||
->SetSpline(true);
|
||||
myMPT1->AddProperty("SLOWCOMPONENT", photonEnergy, scintilSlow)
|
||||
->SetSpline(true);
|
||||
|
||||
myMPT1->AddConstProperty("SCINTILLATIONYIELD",50./MeV);
|
||||
myMPT1->AddConstProperty("RESOLUTIONSCALE",1.0);
|
||||
myMPT1->AddConstProperty("FASTTIMECONSTANT", 1.*ns);
|
||||
myMPT1->AddConstProperty("SLOWTIMECONSTANT",10.*ns);
|
||||
myMPT1->AddConstProperty("YIELDRATIO",0.8);
|
||||
myMPT1->AddConstProperty("SCINTILLATIONYIELD", 50. / MeV);
|
||||
myMPT1->AddConstProperty("RESOLUTIONSCALE", 1.0);
|
||||
myMPT1->AddConstProperty("FASTTIMECONSTANT", 1. * ns);
|
||||
myMPT1->AddConstProperty("SLOWTIMECONSTANT", 10. * ns);
|
||||
myMPT1->AddConstProperty("YIELDRATIO", 0.8);
|
||||
|
||||
G4double energy_water[] = {
|
||||
1.56962*eV, 1.58974*eV, 1.61039*eV, 1.63157*eV,
|
||||
1.65333*eV, 1.67567*eV, 1.69863*eV, 1.72222*eV,
|
||||
1.74647*eV, 1.77142*eV, 1.7971 *eV, 1.82352*eV,
|
||||
1.85074*eV, 1.87878*eV, 1.90769*eV, 1.93749*eV,
|
||||
1.96825*eV, 1.99999*eV, 2.03278*eV, 2.06666*eV,
|
||||
2.10169*eV, 2.13793*eV, 2.17543*eV, 2.21428*eV,
|
||||
2.25454*eV, 2.29629*eV, 2.33962*eV, 2.38461*eV,
|
||||
2.43137*eV, 2.47999*eV, 2.53061*eV, 2.58333*eV,
|
||||
2.63829*eV, 2.69565*eV, 2.75555*eV, 2.81817*eV,
|
||||
2.88371*eV, 2.95237*eV, 3.02438*eV, 3.09999*eV,
|
||||
3.17948*eV, 3.26315*eV, 3.35134*eV, 3.44444*eV,
|
||||
3.54285*eV, 3.64705*eV, 3.75757*eV, 3.87499*eV,
|
||||
3.99999*eV, 4.13332*eV, 4.27585*eV, 4.42856*eV,
|
||||
4.59258*eV, 4.76922*eV, 4.95999*eV, 5.16665*eV,
|
||||
5.39129*eV, 5.63635*eV, 5.90475*eV, 6.19998*eV
|
||||
std::vector<G4double> energy_water = {
|
||||
1.56962 * eV, 1.58974 * eV, 1.61039 * eV, 1.63157 * eV, 1.65333 * eV,
|
||||
1.67567 * eV, 1.69863 * eV, 1.72222 * eV, 1.74647 * eV, 1.77142 * eV,
|
||||
1.7971 * eV, 1.82352 * eV, 1.85074 * eV, 1.87878 * eV, 1.90769 * eV,
|
||||
1.93749 * eV, 1.96825 * eV, 1.99999 * eV, 2.03278 * eV, 2.06666 * eV,
|
||||
2.10169 * eV, 2.13793 * eV, 2.17543 * eV, 2.21428 * eV, 2.25454 * eV,
|
||||
2.29629 * eV, 2.33962 * eV, 2.38461 * eV, 2.43137 * eV, 2.47999 * eV,
|
||||
2.53061 * eV, 2.58333 * eV, 2.63829 * eV, 2.69565 * eV, 2.75555 * eV,
|
||||
2.81817 * eV, 2.88371 * eV, 2.95237 * eV, 3.02438 * eV, 3.09999 * eV,
|
||||
3.17948 * eV, 3.26315 * eV, 3.35134 * eV, 3.44444 * eV, 3.54285 * eV,
|
||||
3.64705 * eV, 3.75757 * eV, 3.87499 * eV, 3.99999 * eV, 4.13332 * eV,
|
||||
4.27585 * eV, 4.42856 * eV, 4.59258 * eV, 4.76922 * eV, 4.95999 * eV,
|
||||
5.16665 * eV, 5.39129 * eV, 5.63635 * eV, 5.90475 * eV, 6.19998 * eV
|
||||
};
|
||||
|
||||
const G4int numentries_water = sizeof(energy_water)/sizeof(G4double);
|
||||
// Rayleigh scattering length calculated by G4OpRayleigh
|
||||
|
||||
//assume 100 times larger than the rayleigh scattering for now.
|
||||
G4double mie_water[] = {
|
||||
167024.4*m, 158726.7*m, 150742 *m,
|
||||
143062.5*m, 135680.2*m, 128587.4*m,
|
||||
121776.3*m, 115239.5*m, 108969.5*m,
|
||||
102958.8*m, 97200.35*m, 91686.86*m,
|
||||
86411.33*m, 81366.79*m, 76546.42*m,
|
||||
71943.46*m, 67551.29*m, 63363.36*m,
|
||||
59373.25*m, 55574.61*m, 51961.24*m,
|
||||
48527.00*m, 45265.87*m, 42171.94*m,
|
||||
39239.39*m, 36462.50*m, 33835.68*m,
|
||||
31353.41*m, 29010.30*m, 26801.03*m,
|
||||
24720.42*m, 22763.36*m, 20924.88*m,
|
||||
19200.07*m, 17584.16*m, 16072.45*m,
|
||||
14660.38*m, 13343.46*m, 12117.33*m,
|
||||
10977.70*m, 9920.416*m, 8941.407*m,
|
||||
8036.711*m, 7202.470*m, 6434.927*m,
|
||||
5730.429*m, 5085.425*m, 4496.467*m,
|
||||
3960.210*m, 3473.413*m, 3032.937*m,
|
||||
2635.746*m, 2278.907*m, 1959.588*m,
|
||||
1675.064*m, 1422.710*m, 1200.004*m,
|
||||
1004.528*m, 833.9666*m, 686.1063*m
|
||||
// assume 100 times larger than the rayleigh scattering for now.
|
||||
std::vector<G4double> mie_water = {
|
||||
167024.4 * m, 158726.7 * m, 150742 * m, 143062.5 * m, 135680.2 * m,
|
||||
128587.4 * m, 121776.3 * m, 115239.5 * m, 108969.5 * m, 102958.8 * m,
|
||||
97200.35 * m, 91686.86 * m, 86411.33 * m, 81366.79 * m, 76546.42 * m,
|
||||
71943.46 * m, 67551.29 * m, 63363.36 * m, 59373.25 * m, 55574.61 * m,
|
||||
51961.24 * m, 48527.00 * m, 45265.87 * m, 42171.94 * m, 39239.39 * m,
|
||||
36462.50 * m, 33835.68 * m, 31353.41 * m, 29010.30 * m, 26801.03 * m,
|
||||
24720.42 * m, 22763.36 * m, 20924.88 * m, 19200.07 * m, 17584.16 * m,
|
||||
16072.45 * m, 14660.38 * m, 13343.46 * m, 12117.33 * m, 10977.70 * m,
|
||||
9920.416 * m, 8941.407 * m, 8036.711 * m, 7202.470 * m, 6434.927 * m,
|
||||
5730.429 * m, 5085.425 * m, 4496.467 * m, 3960.210 * m, 3473.413 * m,
|
||||
3032.937 * m, 2635.746 * m, 2278.907 * m, 1959.588 * m, 1675.064 * m,
|
||||
1422.710 * m, 1200.004 * m, 1004.528 * m, 833.9666 * m, 686.1063 * m
|
||||
};
|
||||
|
||||
assert(sizeof(mie_water) == sizeof(energy_water));
|
||||
|
||||
// gforward, gbackward, forward backward ratio
|
||||
G4double mie_water_const[3]={0.99,0.99,0.8};
|
||||
G4double mie_water_const[3] = { 0.99, 0.99, 0.8 };
|
||||
|
||||
myMPT1->AddProperty("MIEHG",energy_water,mie_water,numentries_water)
|
||||
->SetSpline(true);
|
||||
myMPT1->AddConstProperty("MIEHG_FORWARD",mie_water_const[0]);
|
||||
myMPT1->AddConstProperty("MIEHG_BACKWARD",mie_water_const[1]);
|
||||
myMPT1->AddConstProperty("MIEHG_FORWARD_RATIO",mie_water_const[2]);
|
||||
myMPT1->AddProperty("MIEHG", energy_water, mie_water)->SetSpline(true);
|
||||
myMPT1->AddConstProperty("MIEHG_FORWARD", mie_water_const[0]);
|
||||
myMPT1->AddConstProperty("MIEHG_BACKWARD", mie_water_const[1]);
|
||||
myMPT1->AddConstProperty("MIEHG_FORWARD_RATIO", mie_water_const[2]);
|
||||
|
||||
G4cout << "Water G4MaterialPropertiesTable" << G4endl;
|
||||
G4cout << "Water G4MaterialPropertiesTable:" << G4endl;
|
||||
myMPT1->DumpTable();
|
||||
|
||||
water->SetMaterialPropertiesTable(myMPT1);
|
||||
|
||||
// Set the Birks Constant for the Water scintillator
|
||||
water->GetIonisation()->SetBirksConstant(0.126 * mm / MeV);
|
||||
|
||||
water->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
|
||||
|
||||
//
|
||||
// Air
|
||||
//
|
||||
G4double refractiveIndex2[] =
|
||||
{ 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00 };
|
||||
// Air
|
||||
//
|
||||
std::vector<G4double> refractiveIndex2 = {
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00
|
||||
};
|
||||
|
||||
G4MaterialPropertiesTable* myMPT2 = new G4MaterialPropertiesTable();
|
||||
myMPT2->AddProperty("RINDEX", photonEnergy, refractiveIndex2, nEntries);
|
||||
myMPT2->AddProperty("RINDEX", photonEnergy, refractiveIndex2);
|
||||
|
||||
G4cout << "Air G4MaterialPropertiesTable" << G4endl;
|
||||
G4cout << "Air G4MaterialPropertiesTable:" << G4endl;
|
||||
myMPT2->DumpTable();
|
||||
|
||||
air->SetMaterialPropertiesTable(myMPT2);
|
||||
|
||||
//
|
||||
// ------------- Volumes --------------
|
||||
// ------------- Volumes --------------
|
||||
|
||||
// The experimental Hall
|
||||
//
|
||||
G4Box* expHall_box = new G4Box("World",fExpHall_x,fExpHall_y,fExpHall_z);
|
||||
// The experimental Hall
|
||||
//
|
||||
G4Box* expHall_box = new G4Box("World", fExpHall_x, fExpHall_y, fExpHall_z);
|
||||
|
||||
G4LogicalVolume* expHall_log
|
||||
= new G4LogicalVolume(expHall_box,air,"World",0,0,0);
|
||||
G4LogicalVolume* expHall_log =
|
||||
new G4LogicalVolume(expHall_box, air, "World", 0, 0, 0);
|
||||
|
||||
G4VPhysicalVolume* expHall_phys
|
||||
= new G4PVPlacement(0,G4ThreeVector(),expHall_log,"World",0,false,0);
|
||||
G4VPhysicalVolume* expHall_phys =
|
||||
new G4PVPlacement(0, G4ThreeVector(), expHall_log, "World", 0, false, 0);
|
||||
|
||||
// The Water Tank
|
||||
//
|
||||
G4Box* waterTank_box = new G4Box("Tank",fTank_x,fTank_y,fTank_z);
|
||||
// The Water Tank
|
||||
//
|
||||
G4Box* waterTank_box = new G4Box("Tank", fTank_x, fTank_y, fTank_z);
|
||||
|
||||
G4LogicalVolume* waterTank_log
|
||||
= new G4LogicalVolume(waterTank_box,water,"Tank",0,0,0);
|
||||
G4LogicalVolume* waterTank_log =
|
||||
new G4LogicalVolume(waterTank_box, water, "Tank", 0, 0, 0);
|
||||
|
||||
G4VPhysicalVolume* waterTank_phys
|
||||
= new G4PVPlacement(0,G4ThreeVector(),waterTank_log,"Tank",
|
||||
expHall_log,false,0);
|
||||
G4VPhysicalVolume* waterTank_phys = new G4PVPlacement(
|
||||
0, G4ThreeVector(), waterTank_log, "Tank", expHall_log, false, 0);
|
||||
|
||||
// The Air Bubble
|
||||
//
|
||||
G4Box* bubbleAir_box = new G4Box("Bubble",fBubble_x,fBubble_y,fBubble_z);
|
||||
// The Air Bubble
|
||||
//
|
||||
G4Box* bubbleAir_box = new G4Box("Bubble", fBubble_x, fBubble_y, fBubble_z);
|
||||
|
||||
G4LogicalVolume* bubbleAir_log
|
||||
= new G4LogicalVolume(bubbleAir_box,air,"Bubble",0,0,0);
|
||||
G4LogicalVolume* bubbleAir_log =
|
||||
new G4LogicalVolume(bubbleAir_box, air, "Bubble", 0, 0, 0);
|
||||
|
||||
//G4VPhysicalVolume* bubbleAir_phys =
|
||||
new G4PVPlacement(0,G4ThreeVector(0,2.5*m,0),bubbleAir_log,"Bubble",
|
||||
waterTank_log,false,0);
|
||||
new G4PVPlacement(0, G4ThreeVector(0, 2.5 * m, 0), bubbleAir_log, "Bubble",
|
||||
waterTank_log, false, 0);
|
||||
|
||||
// ------------- Surfaces --------------
|
||||
//
|
||||
// Water Tank
|
||||
//
|
||||
// ------------- Surfaces --------------
|
||||
|
||||
// Water Tank
|
||||
//
|
||||
G4OpticalSurface* opWaterSurface = new G4OpticalSurface("WaterSurface");
|
||||
// opWaterSurface->SetType(dielectric_dielectric);
|
||||
// opWaterSurface->SetFinish(ground);
|
||||
// opWaterSurface->SetModel(unified);
|
||||
opWaterSurface->SetType(dielectric_LUTDAVIS);
|
||||
opWaterSurface->SetFinish(Rough_LUT);
|
||||
opWaterSurface->SetModel(DAVIS);
|
||||
|
||||
G4LogicalBorderSurface* waterSurface =
|
||||
new G4LogicalBorderSurface("WaterSurface",
|
||||
waterTank_phys,expHall_phys,opWaterSurface);
|
||||
G4LogicalBorderSurface* waterSurface = new G4LogicalBorderSurface(
|
||||
"WaterSurface", waterTank_phys, expHall_phys, opWaterSurface);
|
||||
|
||||
G4OpticalSurface* opticalSurface = dynamic_cast <G4OpticalSurface*>
|
||||
(waterSurface->GetSurface(waterTank_phys,expHall_phys)->
|
||||
GetSurfaceProperty());
|
||||
if (opticalSurface) opticalSurface->DumpInfo();
|
||||
G4OpticalSurface* opticalSurface = dynamic_cast<G4OpticalSurface*>(
|
||||
waterSurface->GetSurface(waterTank_phys, expHall_phys)
|
||||
->GetSurfaceProperty());
|
||||
if(opticalSurface)
|
||||
opticalSurface->DumpInfo();
|
||||
|
||||
// Air Bubble
|
||||
//
|
||||
// Air Bubble
|
||||
//
|
||||
G4OpticalSurface* opAirSurface = new G4OpticalSurface("AirSurface");
|
||||
opAirSurface->SetType(dielectric_dielectric);
|
||||
opAirSurface->SetFinish(polished);
|
||||
opAirSurface->SetModel(glisur);
|
||||
|
||||
G4LogicalSkinSurface* airSurface =
|
||||
new G4LogicalSkinSurface("AirSurface", bubbleAir_log, opAirSurface);
|
||||
new G4LogicalSkinSurface("AirSurface", bubbleAir_log, opAirSurface);
|
||||
|
||||
opticalSurface = dynamic_cast <G4OpticalSurface*>
|
||||
(airSurface->GetSurface(bubbleAir_log)->GetSurfaceProperty());
|
||||
if (opticalSurface) opticalSurface->DumpInfo();
|
||||
opticalSurface = dynamic_cast<G4OpticalSurface*>(
|
||||
airSurface->GetSurface(bubbleAir_log)->GetSurfaceProperty());
|
||||
if(opticalSurface)
|
||||
opticalSurface->DumpInfo();
|
||||
|
||||
//
|
||||
// Generate & Add Material Properties Table attached to the optical surfaces
|
||||
//
|
||||
const G4int num = 2;
|
||||
G4double ephoton[num] = {2.034*eV, 4.136*eV};
|
||||
// Generate & Add Material Properties Table attached to the optical surfaces
|
||||
//
|
||||
std::vector<G4double> ephoton = { 2.034 * eV, 4.136 * eV };
|
||||
|
||||
//OpticalWaterSurface
|
||||
// if surface model is unified we can set parameters
|
||||
// G4double refractiveIndex[num] = {1.35, 1.40};
|
||||
// G4double specularLobe[num] = {0.3, 0.3};
|
||||
// G4double specularSpike[num] = {0.2, 0.2};
|
||||
// G4double backScatter[num] = {0.2, 0.2};
|
||||
//
|
||||
// G4MaterialPropertiesTable* myST1 = new G4MaterialPropertiesTable();
|
||||
// myST1->AddProperty("RINDEX", ephoton, refractiveIndex, num);
|
||||
// myST1->AddProperty("SPECULARLOBECONSTANT", ephoton, specularLobe, num);
|
||||
// myST1->AddProperty("SPECULARSPIKECONSTANT", ephoton, specularSpike, num);
|
||||
// myST1->AddProperty("BACKSCATTERCONSTANT", ephoton, backScatter, num);
|
||||
//
|
||||
// G4cout << "Water Surface G4MaterialPropertiesTable" << G4endl;
|
||||
// myST1->DumpTable();
|
||||
// OpticalAirSurface
|
||||
std::vector<G4double> reflectivity = { 0.3, 0.5 };
|
||||
std::vector<G4double> efficiency = { 0.8, 1.0 };
|
||||
|
||||
// opWaterSurface->SetMaterialPropertiesTable(myST1);
|
||||
G4MaterialPropertiesTable* myST2 = new G4MaterialPropertiesTable();
|
||||
|
||||
//OpticalAirSurface
|
||||
G4double reflectivity[num] = {0.3, 0.5};
|
||||
G4double efficiency[num] = {0.8, 1.0};
|
||||
myST2->AddProperty("REFLECTIVITY", ephoton, reflectivity);
|
||||
myST2->AddProperty("EFFICIENCY", ephoton, efficiency);
|
||||
|
||||
G4MaterialPropertiesTable *myST2 = new G4MaterialPropertiesTable();
|
||||
|
||||
myST2->AddProperty("REFLECTIVITY", ephoton, reflectivity, num);
|
||||
myST2->AddProperty("EFFICIENCY", ephoton, efficiency, num);
|
||||
|
||||
G4cout << "Air Surface G4MaterialPropertiesTable" << G4endl;
|
||||
G4cout << "Air Surface G4MaterialPropertiesTable:" << G4endl;
|
||||
myST2->DumpTable();
|
||||
|
||||
opAirSurface->SetMaterialPropertiesTable(myST2);
|
||||
|
||||
//always return the physical World
|
||||
return expHall_phys;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice/src/OpNoviceEventAction.cc
|
||||
/// \brief Implementation of the OpNoviceEventAction class
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "OpNoviceEventAction.hh"
|
||||
|
||||
#include "OpNoviceRun.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceEventAction::OpNoviceEventAction()
|
||||
: G4UserEventAction()
|
||||
{
|
||||
fRayleigh = 0;
|
||||
fAbsorption = 0;
|
||||
fMie = 0;
|
||||
fBoundary = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceEventAction::~OpNoviceEventAction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNoviceEventAction::BeginOfEventAction(const G4Event*)
|
||||
{
|
||||
fRayleigh = 0;
|
||||
fAbsorption = 0;
|
||||
fMie = 0;
|
||||
fBoundary = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNoviceEventAction::EndOfEventAction(const G4Event*)
|
||||
{
|
||||
OpNoviceRun* run = static_cast<OpNoviceRun*>(
|
||||
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
|
||||
run->AddRayleigh(fRayleigh);
|
||||
run->AddAbsorption(fAbsorption);
|
||||
run->AddMie(fMie);
|
||||
run->AddBoundary(fBoundary);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -32,38 +32,38 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "OpNovicePrimaryGeneratorAction.hh"
|
||||
|
||||
#include "OpNovicePrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNovicePrimaryGeneratorAction::OpNovicePrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
: G4VUserPrimaryGeneratorAction()
|
||||
, fParticleGun(nullptr)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
//create a messenger for this class
|
||||
// create a messenger for this class
|
||||
fGunMessenger = new OpNovicePrimaryGeneratorMessenger(this);
|
||||
|
||||
//default kinematic
|
||||
// default kinematic
|
||||
//
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("e+");
|
||||
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleTime(0.0*ns);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.0*cm,0.0*cm,0.0*cm));
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
fParticleGun->SetParticleEnergy(500.0*keV);
|
||||
fParticleGun->SetParticleTime(0.0 * ns);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., 0.));
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
|
||||
fParticleGun->SetParticleEnergy(500.0 * keV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -85,32 +85,37 @@ void OpNovicePrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar()
|
||||
{
|
||||
G4double angle = G4UniformRand() * 360.0*deg;
|
||||
SetOptPhotonPolar(angle);
|
||||
G4double angle = G4UniformRand() * 360.0 * deg;
|
||||
SetOptPhotonPolar(angle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar(G4double angle)
|
||||
{
|
||||
if (fParticleGun->GetParticleDefinition()->GetParticleName()!="opticalphoton")
|
||||
{
|
||||
G4cout << "--> warning from PrimaryGeneratorAction::SetOptPhotonPolar() :"
|
||||
"the particleGun is not an opticalphoton" << G4endl;
|
||||
return;
|
||||
}
|
||||
if(fParticleGun->GetParticleDefinition()->GetParticleName() !=
|
||||
"opticalphoton")
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Warning: the particleGun is not an opticalphoton";
|
||||
G4Exception("OpNovicePrimaryGeneratorAction::SetOptPhotonPolar()",
|
||||
"OpNovice_010", JustWarning, ed);
|
||||
return;
|
||||
}
|
||||
|
||||
G4ThreeVector normal (1., 0., 0.);
|
||||
G4ThreeVector kphoton = fParticleGun->GetParticleMomentumDirection();
|
||||
G4ThreeVector product = normal.cross(kphoton);
|
||||
G4double modul2 = product*product;
|
||||
|
||||
G4ThreeVector e_perpend (0., 0., 1.);
|
||||
if (modul2 > 0.) e_perpend = (1./std::sqrt(modul2))*product;
|
||||
G4ThreeVector e_paralle = e_perpend.cross(kphoton);
|
||||
|
||||
G4ThreeVector polar = std::cos(angle)*e_paralle + std::sin(angle)*e_perpend;
|
||||
fParticleGun->SetParticlePolarization(polar);
|
||||
G4ThreeVector normal(1., 0., 0.);
|
||||
G4ThreeVector kphoton = fParticleGun->GetParticleMomentumDirection();
|
||||
G4ThreeVector product = normal.cross(kphoton);
|
||||
G4double modul2 = product * product;
|
||||
|
||||
G4ThreeVector e_perpend(0., 0., 1.);
|
||||
if(modul2 > 0.)
|
||||
e_perpend = (1. / std::sqrt(modul2)) * product;
|
||||
G4ThreeVector e_paralle = e_perpend.cross(kphoton);
|
||||
|
||||
G4ThreeVector polar =
|
||||
std::cos(angle) * e_paralle + std::sin(angle) * e_perpend;
|
||||
fParticleGun->SetParticlePolarization(polar);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -28,33 +28,32 @@
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "OpNovicePrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "OpNovicePrimaryGeneratorAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNovicePrimaryGeneratorMessenger::
|
||||
OpNovicePrimaryGeneratorMessenger(OpNovicePrimaryGeneratorAction* OpNoviceGun)
|
||||
: G4UImessenger(),
|
||||
fOpNoviceAction(OpNoviceGun)
|
||||
OpNovicePrimaryGeneratorMessenger::OpNovicePrimaryGeneratorMessenger(
|
||||
OpNovicePrimaryGeneratorAction* OpNoviceGun)
|
||||
: G4UImessenger()
|
||||
, fOpNoviceAction(OpNoviceGun)
|
||||
{
|
||||
fGunDir = new G4UIdirectory("/OpNovice/gun/");
|
||||
fGunDir->SetGuidance("PrimaryGenerator control");
|
||||
|
||||
fPolarCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/OpNovice/gun/optPhotonPolar",this);
|
||||
new G4UIcmdWithADoubleAndUnit("/OpNovice/gun/optPhotonPolar", this);
|
||||
fPolarCmd->SetGuidance("Set linear polarization");
|
||||
fPolarCmd->SetGuidance(" angle w.r.t. (k,n) plane");
|
||||
fPolarCmd->SetParameterName("angle",true);
|
||||
fPolarCmd->SetParameterName("angle", true);
|
||||
fPolarCmd->SetUnitCategory("Angle");
|
||||
fPolarCmd->SetDefaultValue(-360.0);
|
||||
fPolarCmd->SetDefaultUnit("deg");
|
||||
@@ -71,16 +70,20 @@ OpNovicePrimaryGeneratorMessenger::~OpNovicePrimaryGeneratorMessenger()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNovicePrimaryGeneratorMessenger::SetNewValue(
|
||||
G4UIcommand* command, G4String newValue)
|
||||
void OpNovicePrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if( command == fPolarCmd ) {
|
||||
G4double angle = fPolarCmd->GetNewDoubleValue(newValue);
|
||||
if ( angle == -360.0*deg ) {
|
||||
fOpNoviceAction->SetOptPhotonPolar();
|
||||
} else {
|
||||
fOpNoviceAction->SetOptPhotonPolar(angle);
|
||||
}
|
||||
if(command == fPolarCmd)
|
||||
{
|
||||
G4double angle = fPolarCmd->GetNewDoubleValue(newValue);
|
||||
if(angle == -360.0 * deg)
|
||||
{
|
||||
fOpNoviceAction->SetOptPhotonPolar();
|
||||
}
|
||||
else
|
||||
{
|
||||
fOpNoviceAction->SetOptPhotonPolar(angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file OpNovice/src/OpNoviceRun.cc
|
||||
/// \brief Implementation of the OpNoviceRun class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "OpNoviceRun.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceRun::OpNoviceRun()
|
||||
: G4Run()
|
||||
{
|
||||
fParticle = nullptr;
|
||||
fEnergy = -1.;
|
||||
fCerenkovCounter = 0.;
|
||||
fCerenkov2 = 0.;
|
||||
fScintillationCounter = 0.;
|
||||
fScintillation2 = 0.;
|
||||
fRayleighCounter = 0.;
|
||||
fRayleigh2 = 0.;
|
||||
fAbsorptionCounter = 0.;
|
||||
fAbsorption2 = 0.;
|
||||
fMieCounter = 0.;
|
||||
fMie2 = 0.;
|
||||
fBoundaryCounter = 0.;
|
||||
fBoundary2 = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceRun::~OpNoviceRun() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNoviceRun::SetPrimary(G4ParticleDefinition* particle, G4double energy)
|
||||
{
|
||||
fParticle = particle;
|
||||
fEnergy = energy;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNoviceRun::Merge(const G4Run* run)
|
||||
{
|
||||
const OpNoviceRun* localRun = static_cast<const OpNoviceRun*>(run);
|
||||
|
||||
fParticle = localRun->fParticle;
|
||||
fEnergy = localRun->fEnergy;
|
||||
|
||||
fCerenkovCounter += localRun->fCerenkovCounter;
|
||||
fCerenkov2 += localRun->fCerenkov2;
|
||||
fScintillationCounter += localRun->fScintillationCounter;
|
||||
fScintillation2 += localRun->fScintillation2;
|
||||
|
||||
fRayleighCounter += localRun->fRayleighCounter;
|
||||
fRayleigh2 += localRun->fRayleigh2;
|
||||
fAbsorptionCounter += localRun->fAbsorptionCounter;
|
||||
fAbsorption2 += localRun->fAbsorption2;
|
||||
fMieCounter += localRun->fMieCounter;
|
||||
fMie2 += localRun->fMie2;
|
||||
fBoundaryCounter += localRun->fBoundaryCounter;
|
||||
fBoundary2 += localRun->fBoundary2;
|
||||
|
||||
G4Run::Merge(run);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void OpNoviceRun::EndOfRun()
|
||||
{
|
||||
if(numberOfEvent == 0)
|
||||
return;
|
||||
G4double TotNbofEvents = G4double(numberOfEvent);
|
||||
|
||||
fCerenkovCounter /= TotNbofEvents;
|
||||
fCerenkov2 /= TotNbofEvents;
|
||||
G4double rmsCerenkov = fCerenkov2 - fCerenkovCounter * fCerenkovCounter;
|
||||
if(rmsCerenkov > 0.)
|
||||
rmsCerenkov = std::sqrt(rmsCerenkov);
|
||||
else
|
||||
rmsCerenkov = 0.;
|
||||
|
||||
fScintillationCounter /= TotNbofEvents;
|
||||
fScintillation2 /= TotNbofEvents;
|
||||
G4double rmsScint =
|
||||
fScintillation2 - fScintillationCounter * fScintillationCounter;
|
||||
if(rmsScint > 0.)
|
||||
rmsScint = std::sqrt(rmsScint);
|
||||
else
|
||||
rmsScint = 0.;
|
||||
|
||||
fRayleighCounter /= TotNbofEvents;
|
||||
fRayleigh2 /= TotNbofEvents;
|
||||
G4double rmsRayleigh = fRayleigh2 - fRayleighCounter * fRayleighCounter;
|
||||
if(rmsRayleigh > 0.)
|
||||
rmsRayleigh = std::sqrt(rmsRayleigh);
|
||||
else
|
||||
rmsRayleigh = 0.;
|
||||
|
||||
fAbsorptionCounter /= TotNbofEvents;
|
||||
fAbsorption2 /= TotNbofEvents;
|
||||
G4double rmsAbsorption =
|
||||
fAbsorption2 - fAbsorptionCounter * fAbsorptionCounter;
|
||||
if(rmsAbsorption > 0.)
|
||||
rmsAbsorption = std::sqrt(rmsAbsorption);
|
||||
else
|
||||
rmsAbsorption = 0.;
|
||||
|
||||
fMieCounter /= TotNbofEvents;
|
||||
fMie2 /= TotNbofEvents;
|
||||
G4double rmsMie = fMie2 - fMieCounter * fMieCounter;
|
||||
if(rmsMie > 0.)
|
||||
rmsMie = std::sqrt(rmsMie);
|
||||
else
|
||||
rmsMie = 0.;
|
||||
|
||||
fBoundaryCounter /= TotNbofEvents;
|
||||
fBoundary2 /= TotNbofEvents;
|
||||
G4double rmsBoundary = fBoundary2 - fBoundaryCounter * fBoundaryCounter;
|
||||
if(rmsBoundary > 0.)
|
||||
rmsBoundary = std::sqrt(rmsBoundary);
|
||||
else
|
||||
rmsBoundary = 0.;
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
G4cout << "\n ======================== run summary ======================\n";
|
||||
|
||||
G4cout << "Primary particle was: " << fParticle->GetParticleName()
|
||||
<< " with energy " << G4BestUnit(fEnergy, "Energy") << "." << G4endl;
|
||||
G4cout << "Number of events: " << numberOfEvent << G4endl;
|
||||
|
||||
G4cout << "Average number of Cerenkov photons created per event: "
|
||||
<< fCerenkovCounter << " +- " << rmsCerenkov << G4endl;
|
||||
G4cout << "Average number of scintillation photons created per event: "
|
||||
<< fScintillationCounter << " +- " << rmsScint << G4endl;
|
||||
|
||||
G4cout << "Average number of optical Rayleigh interactions per event: "
|
||||
<< fRayleighCounter << " +- " << rmsRayleigh << G4endl;
|
||||
G4cout << "Average number of optical absorption interactions per event: "
|
||||
<< fAbsorptionCounter << " +- " << rmsAbsorption << G4endl;
|
||||
G4cout << "Average number of optical Mie interactions per event: "
|
||||
<< fMieCounter << " +- " << rmsMie << G4endl;
|
||||
G4cout << "Average number of optical boundary interactions per event: "
|
||||
<< fBoundaryCounter << " +- " << rmsBoundary << G4endl;
|
||||
|
||||
G4cout << G4endl;
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
@@ -27,48 +27,55 @@
|
||||
/// \brief Implementation of the OpNoviceRunAction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Make this appear first!
|
||||
#include "G4Timer.hh"
|
||||
|
||||
#include "OpNoviceRunAction.hh"
|
||||
|
||||
#include "OpNovicePrimaryGeneratorAction.hh"
|
||||
#include "OpNoviceRun.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Run.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceRunAction::OpNoviceRunAction()
|
||||
: G4UserRunAction(),
|
||||
fTimer(0)
|
||||
OpNoviceRunAction::OpNoviceRunAction(OpNovicePrimaryGeneratorAction* prim)
|
||||
: G4UserRunAction()
|
||||
, fRun(nullptr)
|
||||
, fPrimary(prim)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceRunAction::~OpNoviceRunAction() {}
|
||||
|
||||
G4Run* OpNoviceRunAction::GenerateRun()
|
||||
{
|
||||
fTimer = new G4Timer;
|
||||
fRun = new OpNoviceRun();
|
||||
return fRun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceRunAction::~OpNoviceRunAction()
|
||||
void OpNoviceRunAction::BeginOfRunAction(const G4Run*)
|
||||
{
|
||||
delete fTimer;
|
||||
if(fPrimary)
|
||||
{
|
||||
G4ParticleDefinition* particle =
|
||||
fPrimary->GetParticleGun()->GetParticleDefinition();
|
||||
G4double energy = fPrimary->GetParticleGun()->GetParticleEnergy();
|
||||
fRun->SetPrimary(particle, energy);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNoviceRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
void OpNoviceRunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
fTimer->Start();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNoviceRunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
fTimer->Stop();
|
||||
G4cout << "number of event = " << aRun->GetNumberOfEvent()
|
||||
<< " " << *fTimer << G4endl;
|
||||
if(isMaster)
|
||||
fRun->EndOfRun();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -32,38 +32,40 @@
|
||||
|
||||
#include "OpNoviceStackingAction.hh"
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
#include "OpNoviceRun.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceStackingAction::OpNoviceStackingAction()
|
||||
: G4UserStackingAction(),
|
||||
fScintillationCounter(0), fCerenkovCounter(0)
|
||||
: G4UserStackingAction()
|
||||
, fScintillationCounter(0)
|
||||
, fCerenkovCounter(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceStackingAction::~OpNoviceStackingAction()
|
||||
{}
|
||||
OpNoviceStackingAction::~OpNoviceStackingAction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
OpNoviceStackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
G4ClassificationOfNewTrack OpNoviceStackingAction::ClassifyNewTrack(
|
||||
const G4Track* aTrack)
|
||||
{
|
||||
if(aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
|
||||
{ // particle is optical photon
|
||||
if(aTrack->GetParentID()>0)
|
||||
{ // particle is secondary
|
||||
{ // particle is optical photon
|
||||
if(aTrack->GetParentID() > 0)
|
||||
{ // particle is secondary
|
||||
if(aTrack->GetCreatorProcess()->GetProcessName() == "Scintillation")
|
||||
fScintillationCounter++;
|
||||
if(aTrack->GetCreatorProcess()->GetProcessName() == "Cerenkov")
|
||||
fCerenkovCounter++;
|
||||
++fScintillationCounter;
|
||||
else if(aTrack->GetCreatorProcess()->GetProcessName() == "Cerenkov")
|
||||
++fCerenkovCounter;
|
||||
}
|
||||
}
|
||||
return fUrgent;
|
||||
@@ -73,10 +75,15 @@ OpNoviceStackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
|
||||
void OpNoviceStackingAction::NewStage()
|
||||
{
|
||||
G4cout << "Number of Scintillation photons produced in this event : "
|
||||
<< fScintillationCounter << G4endl;
|
||||
G4cout << "Number of Cerenkov photons produced in this event : "
|
||||
<< fCerenkovCounter << G4endl;
|
||||
// G4cout << "Number of Scintillation photons produced in this event : "
|
||||
// << fScintillationCounter << G4endl;
|
||||
// G4cout << "Number of Cerenkov photons produced in this event : "
|
||||
// << fCerenkovCounter << G4endl;
|
||||
|
||||
OpNoviceRun* run = static_cast<OpNoviceRun*>(
|
||||
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
run->AddScintillation((G4double) fScintillationCounter);
|
||||
run->AddCerenkov((G4double) fCerenkovCounter);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -84,7 +91,7 @@ void OpNoviceStackingAction::NewStage()
|
||||
void OpNoviceStackingAction::PrepareNewEvent()
|
||||
{
|
||||
fScintillationCounter = 0;
|
||||
fCerenkovCounter = 0;
|
||||
fCerenkovCounter = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -29,63 +29,72 @@
|
||||
|
||||
#include "OpNoviceSteppingAction.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
#include "OpNoviceRun.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4OpBoundaryProcess.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceSteppingAction::OpNoviceSteppingAction()
|
||||
: G4UserSteppingAction()
|
||||
{
|
||||
fScintillationCounter = 0;
|
||||
fCerenkovCounter = 0;
|
||||
fEventNumber = -1;
|
||||
}
|
||||
OpNoviceSteppingAction::OpNoviceSteppingAction(OpNoviceEventAction* event)
|
||||
: G4UserSteppingAction()
|
||||
, fEventAction(event)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
OpNoviceSteppingAction::~OpNoviceSteppingAction()
|
||||
{ ; }
|
||||
OpNoviceSteppingAction::~OpNoviceSteppingAction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void OpNoviceSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
{
|
||||
G4int eventNumber = G4RunManager::GetRunManager()->
|
||||
GetCurrentEvent()->GetEventID();
|
||||
static G4ParticleDefinition* opticalphoton =
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
|
||||
if (eventNumber != fEventNumber) {
|
||||
fEventNumber = eventNumber;
|
||||
fScintillationCounter = 0;
|
||||
fCerenkovCounter = 0;
|
||||
}
|
||||
const G4ParticleDefinition* particleDef =
|
||||
step->GetTrack()->GetDynamicParticle()->GetParticleDefinition();
|
||||
|
||||
G4Track* track = step->GetTrack();
|
||||
if(particleDef == opticalphoton)
|
||||
{
|
||||
G4StepPoint* endPoint = step->GetPostStepPoint();
|
||||
const G4VProcess* pds = endPoint->GetProcessDefinedStep();
|
||||
G4String procname = pds->GetProcessName();
|
||||
if(procname.compare("OpRayleigh") == 0)
|
||||
fEventAction->AddRayleigh();
|
||||
else if(procname.compare("OpAbsorption") == 0)
|
||||
fEventAction->AddAbsorption();
|
||||
else if(procname.compare("OpMieHG") == 0)
|
||||
fEventAction->AddMie();
|
||||
|
||||
G4String ParticleName = track->GetDynamicParticle()->
|
||||
GetParticleDefinition()->GetParticleName();
|
||||
// for boundary scattering, process name in 'transportation'.
|
||||
// Need to check differently:
|
||||
if(endPoint->GetStepStatus() == fGeomBoundary)
|
||||
{
|
||||
G4OpBoundaryProcessStatus theStatus = Undefined;
|
||||
G4ProcessManager* opManager = opticalphoton->GetProcessManager();
|
||||
G4int n_proc = opManager->GetPostStepProcessVector(typeDoIt)->entries();
|
||||
G4ProcessVector* postStepDoItVector =
|
||||
opManager->GetPostStepProcessVector(typeDoIt);
|
||||
for(G4int i = 0; i < n_proc; ++i)
|
||||
{
|
||||
G4VProcess* currentProcess = (*postStepDoItVector)[i];
|
||||
|
||||
if (ParticleName == "opticalphoton") return;
|
||||
|
||||
const std::vector<const G4Track*>* secondaries =
|
||||
step->GetSecondaryInCurrentStep();
|
||||
|
||||
if (secondaries->size()>0) {
|
||||
for(unsigned int i=0; i<secondaries->size(); ++i) {
|
||||
if (secondaries->at(i)->GetParentID()>0) {
|
||||
if(secondaries->at(i)->GetDynamicParticle()->GetParticleDefinition()
|
||||
== G4OpticalPhoton::OpticalPhotonDefinition()){
|
||||
if (secondaries->at(i)->GetCreatorProcess()->GetProcessName()
|
||||
== "Scintillation")fScintillationCounter++;
|
||||
if (secondaries->at(i)->GetCreatorProcess()->GetProcessName()
|
||||
== "Cerenkov")fCerenkovCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
G4OpBoundaryProcess* opProc =
|
||||
dynamic_cast<G4OpBoundaryProcess*>(currentProcess);
|
||||
if(opProc)
|
||||
theStatus = opProc->GetStatus();
|
||||
}
|
||||
if(theStatus != Undefined && theStatus != NotAtBoundary &&
|
||||
theStatus != StepTooSmall)
|
||||
{
|
||||
fEventAction->AddBoundary();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user