initial
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.16...3.21)
|
||||
project(B4a)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Find Geant4 package, activating all available UI and Vis drivers by default
|
||||
# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
|
||||
# to build a batch mode only executable
|
||||
#
|
||||
option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
|
||||
if(WITH_GEANT4_UIVIS)
|
||||
find_package(Geant4 REQUIRED ui_all vis_all)
|
||||
else()
|
||||
find_package(Geant4 REQUIRED)
|
||||
endif()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup Geant4 include directories and compile definitions
|
||||
# Setup include directory for this project
|
||||
#
|
||||
include(${Geant4_USE_FILE})
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Locate sources and headers for this project
|
||||
# NB: headers are included so they will show up in IDEs
|
||||
#
|
||||
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
|
||||
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Add the executable, and link it to the Geant4 libraries
|
||||
#
|
||||
add_executable(exampleB4a exampleB4a.cc ${sources} ${headers})
|
||||
target_link_libraries(exampleB4a ${Geant4_LIBRARIES})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build B4a. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(EXAMPLEB4A_SCRIPTS
|
||||
exampleB4a.out
|
||||
exampleB4.in
|
||||
gui.mac
|
||||
init_vis.mac
|
||||
plotHisto.C
|
||||
plotNtuple.C
|
||||
run1.mac
|
||||
run2.mac
|
||||
vis.mac
|
||||
)
|
||||
|
||||
foreach(_script ${EXAMPLEB4A_SCRIPTS})
|
||||
configure_file(
|
||||
${PROJECT_SOURCE_DIR}/${_script}
|
||||
${PROJECT_BINARY_DIR}/${_script}
|
||||
COPYONLY
|
||||
)
|
||||
endforeach()
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
|
||||
#
|
||||
install(TARGETS exampleB4a DESTINATION bin)
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
name := exampleB4a
|
||||
G4TARGET := $(name)
|
||||
G4EXLIB := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: lib bin
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
|
||||
visclean:
|
||||
rm -f g4*.prim g4*.eps g4*.wrl
|
||||
rm -f .DAWN_*
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Macro file for example B4 test
|
||||
|
||||
/run/initialize
|
||||
|
||||
# e+ 300MeV
|
||||
/gun/particle e+
|
||||
/gun/energy 300 MeV
|
||||
/run/beamOn 1
|
||||
#
|
||||
# list the existing physics processes
|
||||
/process/list
|
||||
#
|
||||
# switch off MultipleScattering
|
||||
/process/inactivate msc
|
||||
/run/beamOn 1
|
||||
#
|
||||
# switch on MultipleScattering
|
||||
/process/activate msc
|
||||
#
|
||||
# change detector parameter
|
||||
/gun/particle gamma
|
||||
/gun/energy 500 MeV
|
||||
/run/beamOn 1
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 exampleB4a.cc
|
||||
/// \brief Main program of the B4a example
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
namespace {
|
||||
void PrintUsage() {
|
||||
G4cerr << " Usage: " << G4endl;
|
||||
G4cerr << " exampleB4a [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
|
||||
<< G4endl;
|
||||
G4cerr << " note: -t option is available only for multi-threaded mode."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// Evaluate arguments
|
||||
//
|
||||
if ( argc > 7 ) {
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
G4String macro;
|
||||
G4String session;
|
||||
G4bool verboseBestUnits = true;
|
||||
#ifdef G4MULTITHREADED
|
||||
G4int nThreads = 0;
|
||||
#endif
|
||||
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];
|
||||
#ifdef G4MULTITHREADED
|
||||
else if ( G4String(argv[i]) == "-t" ) {
|
||||
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
|
||||
}
|
||||
#endif
|
||||
else if ( G4String(argv[i]) == "-vDefault" ) {
|
||||
verboseBestUnits = false;
|
||||
--i; // this option is not followed with a parameter
|
||||
}
|
||||
else {
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Detect interactive mode (if no macro provided) and define UI session
|
||||
//
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( ! macro.size() ) {
|
||||
ui = new G4UIExecutive(argc, argv, session);
|
||||
}
|
||||
|
||||
// Optionally: choose a different Random engine...
|
||||
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
|
||||
|
||||
// Use G4SteppingVerboseWithUnits
|
||||
if ( verboseBestUnits ) {
|
||||
G4int precision = 4;
|
||||
G4SteppingVerbose::UseBestUnit(precision);
|
||||
}
|
||||
|
||||
// Construct the default run manager
|
||||
//
|
||||
auto* runManager =
|
||||
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
#ifdef G4MULTITHREADED
|
||||
if ( nThreads > 0 ) {
|
||||
runManager->SetNumberOfThreads(nThreads);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
auto detConstruction = new B4::DetectorConstruction();
|
||||
runManager->SetUserInitialization(detConstruction);
|
||||
|
||||
auto physicsList = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
auto actionInitialization = new B4a::ActionInitialization(detConstruction);
|
||||
runManager->SetUserInitialization(actionInitialization);
|
||||
|
||||
// Initialize visualization
|
||||
//
|
||||
auto visManager = new G4VisExecutive;
|
||||
// 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
|
||||
auto UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
// Process macro or start UI session
|
||||
//
|
||||
if ( macro.size() ) {
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command+macro);
|
||||
}
|
||||
else {
|
||||
// interactive mode : define UI session
|
||||
UImanager->ApplyCommand("/control/execute init_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;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
||||
+1111
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# This file permits to customize, with commands,
|
||||
# the menu bar of the G4UIXm, G4UIQt, G4UIWin32 sessions.
|
||||
# It has no effect with G4UIterminal.
|
||||
#
|
||||
# File menu :
|
||||
/gui/addMenu file File
|
||||
/gui/addButton file Quit exit
|
||||
#
|
||||
# Run menu :
|
||||
/gui/addMenu run Run
|
||||
/gui/addButton run "beamOn 1" "/run/beamOn 1"
|
||||
/gui/addButton run run1 "/control/execute run1.mac"
|
||||
#
|
||||
# Gun menu :
|
||||
/gui/addMenu gun Gun
|
||||
/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 "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"
|
||||
#
|
||||
# Viewer menu :
|
||||
/gui/addMenu viewer Viewer
|
||||
/gui/addButton viewer "Set style surface" "/vis/viewer/set/style surface"
|
||||
/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wireframe"
|
||||
/gui/addButton viewer "Refresh viewer" "/vis/viewer/refresh"
|
||||
/gui/addButton viewer "Update viewer (interaction or end-of-file)" "/vis/viewer/update"
|
||||
/gui/addButton viewer "Flush viewer (= refresh + update)" "/vis/viewer/flush"
|
||||
/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
|
||||
#
|
||||
# To limit the output flow in the "dump" widget :
|
||||
/run/printProgress 100
|
||||
#
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/include/ActionInitialization.hh
|
||||
/// \brief Definition of the B4a::ActionInitialization class
|
||||
|
||||
#ifndef B4aActionInitialization_h
|
||||
#define B4aActionInitialization_h 1
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
|
||||
namespace B4
|
||||
{
|
||||
class DetectorConstruction;
|
||||
}
|
||||
|
||||
namespace B4a
|
||||
{
|
||||
|
||||
/// Action initialization class.
|
||||
|
||||
class ActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
ActionInitialization(B4::DetectorConstruction*);
|
||||
~ActionInitialization() override = default;
|
||||
|
||||
void BuildForMaster() const override;
|
||||
void Build() const override;
|
||||
|
||||
private:
|
||||
B4::DetectorConstruction* fDetConstruction = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4/B4a/include/DetectorConstruction.hh
|
||||
/// \brief Definition of the B4::DetectorConstruction class
|
||||
|
||||
#ifndef B4DetectorConstruction_h
|
||||
#define B4DetectorConstruction_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4GlobalMagFieldMessenger;
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
/// Detector construction class to define materials and geometry.
|
||||
/// The calorimeter is a box made of a given number of layers. A layer consists
|
||||
/// of an absorber plate and of a detection gap. The layer is replicated.
|
||||
///
|
||||
/// Four parameters define the geometry of the calorimeter :
|
||||
///
|
||||
/// - the thickness of an absorber plate,
|
||||
/// - the thickness of a gap,
|
||||
/// - the number of layers,
|
||||
/// - the transverse size of the calorimeter (the input face is a square).
|
||||
///
|
||||
/// In addition a transverse uniform magnetic field is defined
|
||||
/// via G4GlobalMagFieldMessenger class.
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
DetectorConstruction() = default;
|
||||
~DetectorConstruction() override = default;
|
||||
|
||||
public:
|
||||
G4VPhysicalVolume* Construct() override;
|
||||
void ConstructSDandField() override;
|
||||
|
||||
// get methods
|
||||
//
|
||||
const G4VPhysicalVolume* GetAbsorberPV() const;
|
||||
const G4VPhysicalVolume* GetGapPV() const;
|
||||
|
||||
private:
|
||||
// methods
|
||||
//
|
||||
void DefineMaterials();
|
||||
G4VPhysicalVolume* DefineVolumes();
|
||||
|
||||
// data members
|
||||
//
|
||||
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
|
||||
// magnetic field messenger
|
||||
|
||||
G4VPhysicalVolume* fAbsorberPV = nullptr; // the absorber physical volume
|
||||
G4VPhysicalVolume* fGapPV = nullptr; // the gap physical volume
|
||||
|
||||
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline const G4VPhysicalVolume* DetectorConstruction::GetAbsorberPV() const {
|
||||
return fAbsorberPV;
|
||||
}
|
||||
|
||||
inline const G4VPhysicalVolume* DetectorConstruction::GetGapPV() const {
|
||||
return fGapPV;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4/B4a/include/EventAction.hh
|
||||
/// \brief Definition of the B4a::EventAction class
|
||||
|
||||
#ifndef B4aEventAction_h
|
||||
#define B4aEventAction_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
namespace B4a
|
||||
{
|
||||
|
||||
/// Event action class
|
||||
///
|
||||
/// It defines data members to hold the energy deposit and track lengths
|
||||
/// of charged particles in Absober and Gap layers:
|
||||
/// - fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap
|
||||
/// which are collected step by step via the functions
|
||||
/// - AddAbs(), AddGap()
|
||||
|
||||
class EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
EventAction() = default;
|
||||
~EventAction() override = default;
|
||||
|
||||
void BeginOfEventAction(const G4Event* event) override;
|
||||
void EndOfEventAction(const G4Event* event) override;
|
||||
|
||||
void AddAbs(G4double de, G4double dl);
|
||||
void AddGap(G4double de, G4double dl);
|
||||
|
||||
private:
|
||||
G4double fEnergyAbs = 0.;
|
||||
G4double fEnergyGap = 0.;
|
||||
G4double fTrackLAbs = 0.;
|
||||
G4double fTrackLGap = 0.;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
inline void EventAction::AddAbs(G4double de, G4double dl) {
|
||||
fEnergyAbs += de;
|
||||
fTrackLAbs += dl;
|
||||
}
|
||||
|
||||
inline void EventAction::AddGap(G4double de, G4double dl) {
|
||||
fEnergyGap += de;
|
||||
fTrackLGap += dl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/include/PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the B4::PrimaryGeneratorAction class
|
||||
|
||||
#ifndef B4PrimaryGeneratorAction_h
|
||||
#define B4PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
/// The primary generator action class with particle gum.
|
||||
///
|
||||
/// It defines a single particle which hits the calorimeter
|
||||
/// perpendicular to the input face. The type of the particle
|
||||
/// can be changed via the G4 build-in commands of G4ParticleGun class
|
||||
/// (see the macros provided with this example).
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorAction();
|
||||
~PrimaryGeneratorAction() override;
|
||||
|
||||
void GeneratePrimaries(G4Event* event) override;
|
||||
|
||||
// set methods
|
||||
void SetRandomFlag(G4bool value);
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/include/RunAction.hh
|
||||
/// \brief Definition of the B4::RunAction class
|
||||
|
||||
#ifndef B4RunAction_h
|
||||
#define B4RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4Run;
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
/// Run action class
|
||||
///
|
||||
/// It accumulates statistic and computes dispersion of the energy deposit
|
||||
/// and track lengths of charged particles with use of analysis tools:
|
||||
/// H1D histograms are created in BeginOfRunAction() for the following
|
||||
/// physics quantities:
|
||||
/// - Edep in absorber
|
||||
/// - Edep in gap
|
||||
/// - Track length in absorber
|
||||
/// - Track length in gap
|
||||
/// The same values are also saved in the ntuple.
|
||||
/// The histograms and ntuple are saved in the output file in a format
|
||||
/// according to a specified file extension.
|
||||
///
|
||||
/// In EndOfRunAction(), the accumulated statistic and computed
|
||||
/// dispersion is printed.
|
||||
///
|
||||
|
||||
class RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
RunAction();
|
||||
~RunAction() override = default;
|
||||
|
||||
void BeginOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/include/SteppingAction.hh
|
||||
/// \brief Definition of the B4a::SteppingAction class
|
||||
|
||||
#ifndef B4aSteppingAction_h
|
||||
#define B4aSteppingAction_h 1
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
class DetectorConstruction;
|
||||
}
|
||||
|
||||
namespace B4a
|
||||
{
|
||||
|
||||
class EventAction;
|
||||
|
||||
/// Stepping action class.
|
||||
///
|
||||
/// In UserSteppingAction() there are collected the energy deposit and track
|
||||
/// lengths of charged particles in Absober and Gap layers and
|
||||
/// updated in EventAction.
|
||||
|
||||
class SteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
SteppingAction(const B4::DetectorConstruction* detConstruction,
|
||||
EventAction* eventAction);
|
||||
~SteppingAction() override = default;
|
||||
|
||||
void UserSteppingAction(const G4Step* step) override;
|
||||
|
||||
private:
|
||||
const B4::DetectorConstruction* fDetConstruction = nullptr;
|
||||
EventAction* fEventAction = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
# Macro file for the initialization of example B4
|
||||
# in interactive session
|
||||
#
|
||||
# Set some default verbose
|
||||
#
|
||||
/control/verbose 2
|
||||
/control/saveHistory
|
||||
/run/verbose 2
|
||||
#
|
||||
# Change the default number of threads (in multi-threaded mode)
|
||||
#/run/numberOfThreads 4
|
||||
#
|
||||
# Initialize kernel
|
||||
/run/initialize
|
||||
#
|
||||
# Visualization setting
|
||||
/control/execute vis.mac
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
// ROOT macro file for plotting example B4 histograms
|
||||
//
|
||||
// Can be run from ROOT session:
|
||||
// root[0] .x plotHisto.C
|
||||
|
||||
{
|
||||
gROOT->Reset();
|
||||
gROOT->SetStyle("Plain");
|
||||
|
||||
// Draw histos filled by Geant4 simulation
|
||||
//
|
||||
|
||||
// Open file filled by Geant4 simulation
|
||||
TFile f("B4.root");
|
||||
|
||||
// Create a canvas and divide it into 2x2 pads
|
||||
TCanvas* c1 = new TCanvas("c1", "", 20, 20, 1000, 1000);
|
||||
c1->Divide(2,2);
|
||||
|
||||
// Draw Eabs histogram in the pad 1
|
||||
c1->cd(1);
|
||||
TH1D* hist1 = (TH1D*)f.Get("Eabs");
|
||||
hist1->Draw("HIST");
|
||||
|
||||
// Draw Labs histogram in the pad 2
|
||||
c1->cd(2);
|
||||
TH1D* hist2 = (TH1D*)f.Get("Labs");
|
||||
hist2->Draw("HIST");
|
||||
|
||||
// Draw Egap histogram in the pad 3
|
||||
// with logaritmic scale for y
|
||||
TH1D* hist3 = (TH1D*)f.Get("Egap");
|
||||
c1->cd(3);
|
||||
gPad->SetLogy(1);
|
||||
hist3->Draw("HIST");
|
||||
|
||||
// Draw Lgap histogram in the pad 4
|
||||
// with logaritmic scale for y
|
||||
c1->cd(4);
|
||||
gPad->SetLogy(1);
|
||||
TH1D* hist4 = (TH1D*)f.Get("Lgap");
|
||||
hist4->Draw("HIST");
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// ROOT macro file for plotting example B4 ntuple
|
||||
//
|
||||
// Can be run from ROOT session:
|
||||
// root[0] .x plotNtuple.C
|
||||
|
||||
{
|
||||
gROOT->Reset();
|
||||
gROOT->SetStyle("Plain");
|
||||
|
||||
// Draw histos filled by Geant4 simulation
|
||||
//
|
||||
|
||||
// Open file filled by Geant4 simulation
|
||||
TFile f("B4.root");
|
||||
|
||||
// Create a canvas and divide it into 2x2 pads
|
||||
TCanvas* c1 = new TCanvas("c1", "", 20, 20, 1000, 1000);
|
||||
c1->Divide(2,2);
|
||||
|
||||
// Get ntuple
|
||||
TNtuple* ntuple = (TNtuple*)f.Get("B4");
|
||||
|
||||
// Draw Eabs histogram in the pad 1
|
||||
c1->cd(1);
|
||||
ntuple->Draw("Eabs");
|
||||
|
||||
// Draw Labs histogram in the pad 2
|
||||
c1->cd(2);
|
||||
ntuple->Draw("Labs");
|
||||
|
||||
// Draw Egap histogram in the pad 3
|
||||
// with logaritmic scale for y ?? how to do this?
|
||||
c1->cd(3);
|
||||
gPad->SetLogy(1);
|
||||
ntuple->Draw("Egap");
|
||||
|
||||
// Draw Lgap histogram in the pad 4
|
||||
// with logaritmic scale for y ?? how to do this?
|
||||
c1->cd(4);
|
||||
gPad->SetLogy(1);
|
||||
ntuple->Draw("Egap");
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
# Macro file for example B4
|
||||
#
|
||||
# Can be run in batch, without graphic
|
||||
# or interactively: Idle> /control/execute run1.mac
|
||||
#
|
||||
# Change the default number of workers (in multi-threading mode)
|
||||
#/run/numberOfThreads 4
|
||||
#
|
||||
# Initialize kernel
|
||||
/run/initialize
|
||||
#
|
||||
# Default kinematics:
|
||||
# electron 50 MeV in direction (0.,0.,1.)
|
||||
# 1 event with tracking/verbose
|
||||
#
|
||||
/tracking/verbose 1
|
||||
/run/beamOn 1
|
||||
#
|
||||
#
|
||||
# muon 300 MeV in direction (0.,0.,1.)
|
||||
# 3 events
|
||||
#
|
||||
/gun/particle mu+
|
||||
/gun/energy 3 MeV
|
||||
/run/beamOn 3
|
||||
#
|
||||
# 20 events
|
||||
#
|
||||
/tracking/verbose 0
|
||||
/run/printProgress 5
|
||||
/run/beamOn 20
|
||||
#
|
||||
# Magnetic field
|
||||
#
|
||||
/globalField/setValue 0.2 0 0 tesla
|
||||
/run/beamOn 3
|
||||
#
|
||||
# Activate/inactivate physics processes
|
||||
#
|
||||
/process/list
|
||||
/process/inactivate eBrem
|
||||
#
|
||||
/run/beamOn 20
|
||||
#
|
||||
@@ -0,0 +1,17 @@
|
||||
# Macro file for example B4
|
||||
#
|
||||
# To be run preferably in batch, without graphics:
|
||||
# % exampleB4[a,b,c,d] run2.mac
|
||||
#
|
||||
#/run/numberOfThreads 4
|
||||
#/control/cout/ignoreThreadsExcept 0
|
||||
#
|
||||
/run/initialize
|
||||
#
|
||||
# Default kinemtics:
|
||||
# electron 50 MeV in direction (0.,0.,1.)
|
||||
# 1000 events
|
||||
#
|
||||
/run/printProgress 100
|
||||
/run/beamOn 1000
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/src/ActionInitialization.cc
|
||||
/// \brief Implementation of the B4a::ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
using namespace B4;
|
||||
|
||||
namespace B4a
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization(DetectorConstruction* detConstruction)
|
||||
: fDetConstruction(detConstruction)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(new RunAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new PrimaryGeneratorAction);
|
||||
SetUserAction(new RunAction);
|
||||
auto eventAction = new EventAction;
|
||||
SetUserAction(eventAction);
|
||||
SetUserAction(new SteppingAction(fDetConstruction,eventAction));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the B4::DetectorConstruction class
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVReplica.hh"
|
||||
#include "G4GlobalMagFieldMessenger.hh"
|
||||
#include "G4AutoDelete.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Define materials
|
||||
DefineMaterials();
|
||||
|
||||
// Define volumes
|
||||
return DefineVolumes();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
// Lead material defined using NIST Manager
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
nistManager->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
// Liquid argon material
|
||||
G4double a; // mass of a mole;
|
||||
G4double z; // z=mean number of protons;
|
||||
G4double density;
|
||||
new G4Material("liquidArgon", z=18., a= 39.95*g/mole, density= 1.390*g/cm3);
|
||||
// The argon by NIST Manager is a gas with a different density
|
||||
|
||||
// Vacuum
|
||||
new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density,
|
||||
kStateGas, 2.73*kelvin, 3.e-18*pascal);
|
||||
|
||||
// Print materials
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
|
||||
{
|
||||
// Geometry parameters
|
||||
G4int nofLayers = 10;
|
||||
G4double absoThickness = 10.*mm;
|
||||
G4double gapThickness = 5.*mm;
|
||||
G4double calorSizeXY = 10.*cm;
|
||||
|
||||
auto layerThickness = absoThickness + gapThickness;
|
||||
auto calorThickness = nofLayers * layerThickness;
|
||||
auto worldSizeXY = 1.2 * calorSizeXY;
|
||||
auto worldSizeZ = 1.2 * calorThickness;
|
||||
|
||||
// Get materials
|
||||
auto defaultMaterial = G4Material::GetMaterial("Galactic");
|
||||
auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
|
||||
auto gapMaterial = G4Material::GetMaterial("liquidArgon");
|
||||
|
||||
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Cannot retrieve materials already defined.";
|
||||
G4Exception("DetectorConstruction::DefineVolumes()",
|
||||
"MyCode0001", FatalException, msg);
|
||||
}
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
auto worldS
|
||||
= new G4Box("World", // its name
|
||||
worldSizeXY/2, worldSizeXY/2, worldSizeZ/2); // its size
|
||||
|
||||
auto worldLV
|
||||
= new G4LogicalVolume(
|
||||
worldS, // its solid
|
||||
defaultMaterial, // its material
|
||||
"World"); // its name
|
||||
|
||||
auto worldPV = new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
worldLV, // its logical volume
|
||||
"World", // its name
|
||||
nullptr, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// Calorimeter
|
||||
//
|
||||
auto calorimeterS
|
||||
= new G4Box("Calorimeter", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, calorThickness/2); // its size
|
||||
|
||||
auto calorLV
|
||||
= new G4LogicalVolume(
|
||||
calorimeterS, // its solid
|
||||
defaultMaterial, // its material
|
||||
"Calorimeter"); // its name
|
||||
|
||||
new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
calorLV, // its logical volume
|
||||
"Calorimeter", // its name
|
||||
worldLV, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// Layer
|
||||
//
|
||||
auto layerS
|
||||
= new G4Box("Layer", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
|
||||
|
||||
auto layerLV
|
||||
= new G4LogicalVolume(
|
||||
layerS, // its solid
|
||||
defaultMaterial, // its material
|
||||
"Layer"); // its name
|
||||
|
||||
new G4PVReplica(
|
||||
"Layer", // its name
|
||||
layerLV, // its logical volume
|
||||
calorLV, // its mother
|
||||
kZAxis, // axis of replication
|
||||
nofLayers, // number of replica
|
||||
layerThickness); // witdth of replica
|
||||
|
||||
//
|
||||
// Absorber
|
||||
//
|
||||
auto absorberS
|
||||
= new G4Box("Abso", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
|
||||
|
||||
auto absorberLV
|
||||
= new G4LogicalVolume(
|
||||
absorberS, // its solid
|
||||
absorberMaterial, // its material
|
||||
"Abso"); // its name
|
||||
|
||||
fAbsorberPV = new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(0., 0., -gapThickness / 2), // its position
|
||||
absorberLV, // its logical volume
|
||||
"Abso", // its name
|
||||
layerLV, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// Gap
|
||||
//
|
||||
auto gapS
|
||||
= new G4Box("Gap", // its name
|
||||
calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
|
||||
|
||||
auto gapLV
|
||||
= new G4LogicalVolume(
|
||||
gapS, // its solid
|
||||
gapMaterial, // its material
|
||||
"Gap"); // its name
|
||||
|
||||
fGapPV = new G4PVPlacement(nullptr, // no rotation
|
||||
G4ThreeVector(0., 0., absoThickness / 2), // its position
|
||||
gapLV, // its logical volume
|
||||
"Gap", // its name
|
||||
layerLV, // its mother volume
|
||||
false, // no boolean operation
|
||||
0, // copy number
|
||||
fCheckOverlaps); // checking overlaps
|
||||
|
||||
//
|
||||
// print parameters
|
||||
//
|
||||
G4cout
|
||||
<< G4endl
|
||||
<< "------------------------------------------------------------" << G4endl
|
||||
<< "---> The calorimeter is " << nofLayers << " layers of: [ "
|
||||
<< absoThickness/mm << "mm of " << absorberMaterial->GetName()
|
||||
<< " + "
|
||||
<< gapThickness/mm << "mm of " << gapMaterial->GetName() << " ] " << G4endl
|
||||
<< "------------------------------------------------------------" << G4endl;
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
worldLV->SetVisAttributes (G4VisAttributes::GetInvisible());
|
||||
|
||||
auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
calorLV->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
//
|
||||
// Always return the physical World
|
||||
//
|
||||
return worldPV;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
// Create global magnetic field messenger.
|
||||
// Uniform magnetic field is then created automatically if
|
||||
// the field value is not zero.
|
||||
G4ThreeVector fieldValue;
|
||||
fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
|
||||
fMagFieldMessenger->SetVerboseLevel(1);
|
||||
|
||||
// Register the field messenger for deleting
|
||||
G4AutoDelete::Register(fMagFieldMessenger);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/src/EventAction.cc
|
||||
/// \brief Implementation of the B4a::EventAction class
|
||||
|
||||
#include "EventAction.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include <iomanip>
|
||||
|
||||
namespace B4a
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
{
|
||||
// initialisation per event
|
||||
fEnergyAbs = 0.;
|
||||
fEnergyGap = 0.;
|
||||
fTrackLAbs = 0.;
|
||||
fTrackLGap = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::EndOfEventAction(const G4Event* event)
|
||||
{
|
||||
// Accumulate statistics
|
||||
//
|
||||
|
||||
// get analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// fill histograms
|
||||
analysisManager->FillH1(0, fEnergyAbs);
|
||||
analysisManager->FillH1(1, fEnergyGap);
|
||||
analysisManager->FillH1(2, fTrackLAbs);
|
||||
analysisManager->FillH1(3, fTrackLGap);
|
||||
|
||||
// fill ntuple
|
||||
analysisManager->FillNtupleDColumn(0, fEnergyAbs);
|
||||
analysisManager->FillNtupleDColumn(1, fEnergyGap);
|
||||
analysisManager->FillNtupleDColumn(2, fTrackLAbs);
|
||||
analysisManager->FillNtupleDColumn(3, fTrackLGap);
|
||||
analysisManager->AddNtupleRow();
|
||||
|
||||
// Print per event (modulo n)
|
||||
//
|
||||
auto eventID = event->GetEventID();
|
||||
auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
|
||||
if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
|
||||
G4cout << "---> End of event: " << eventID << G4endl;
|
||||
|
||||
G4cout
|
||||
<< " Absorber: total energy: " << std::setw(7)
|
||||
<< G4BestUnit(fEnergyAbs,"Energy")
|
||||
<< " total track length: " << std::setw(7)
|
||||
<< G4BestUnit(fTrackLAbs,"Length")
|
||||
<< G4endl
|
||||
<< " Gap: total energy: " << std::setw(7)
|
||||
<< G4BestUnit(fEnergyGap,"Energy")
|
||||
<< " total track length: " << std::setw(7)
|
||||
<< G4BestUnit(fTrackLGap,"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4/B4a/src/PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B4::PrimaryGeneratorAction class
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int nofParticles = 1;
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
|
||||
// default particle kinematic
|
||||
//
|
||||
auto particleDefinition
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
|
||||
fParticleGun->SetParticleDefinition(particleDefinition);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
fParticleGun->SetParticleEnergy(50.*MeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
// This function is called at the begining of event
|
||||
|
||||
// In order to avoid dependence of PrimaryGeneratorAction
|
||||
// on DetectorConstruction class we get world volume
|
||||
// from G4LogicalVolumeStore
|
||||
//
|
||||
G4double worldZHalfLength = 0.;
|
||||
auto worldLV = G4LogicalVolumeStore::GetInstance()->GetVolume("World");
|
||||
|
||||
// Check that the world volume has box shape
|
||||
G4Box* worldBox = nullptr;
|
||||
if ( worldLV ) {
|
||||
worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
|
||||
}
|
||||
|
||||
if ( worldBox ) {
|
||||
worldZHalfLength = worldBox->GetZHalfLength();
|
||||
}
|
||||
else {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "World volume of box shape not found." << G4endl;
|
||||
msg << "Perhaps you have changed geometry." << G4endl;
|
||||
msg << "The gun will be place in the center.";
|
||||
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
"MyCode0002", JustWarning, msg);
|
||||
}
|
||||
|
||||
// Set gun position
|
||||
fParticleGun
|
||||
->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
|
||||
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/src/RunAction.cc
|
||||
/// \brief Implementation of the B4::RunAction class
|
||||
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction()
|
||||
{
|
||||
// set printing event number per each event
|
||||
G4RunManager::GetRunManager()->SetPrintProgress(1);
|
||||
|
||||
// Create analysis manager
|
||||
// The choice of the output format is done via the specified
|
||||
// file extension.
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Create directories
|
||||
//analysisManager->SetHistoDirectoryName("histograms");
|
||||
//analysisManager->SetNtupleDirectoryName("ntuple");
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetNtupleMerging(true);
|
||||
// Note: merging ntuples is available only with Root output
|
||||
|
||||
// Book histograms, ntuple
|
||||
//
|
||||
|
||||
// Creating histograms
|
||||
analysisManager->CreateH1("Eabs","Edep in absorber", 100, 0., 800*MeV);
|
||||
analysisManager->CreateH1("Egap","Edep in gap", 100, 0., 100*MeV);
|
||||
analysisManager->CreateH1("Labs","trackL in absorber", 100, 0., 1*m);
|
||||
analysisManager->CreateH1("Lgap","trackL in gap", 100, 0., 50*cm);
|
||||
|
||||
// Creating ntuple
|
||||
//
|
||||
analysisManager->CreateNtuple("B4", "Edep and TrackL");
|
||||
analysisManager->CreateNtupleDColumn("Eabs");
|
||||
analysisManager->CreateNtupleDColumn("Egap");
|
||||
analysisManager->CreateNtupleDColumn("Labs");
|
||||
analysisManager->CreateNtupleDColumn("Lgap");
|
||||
analysisManager->FinishNtuple();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
//inform the runManager to save random number seed
|
||||
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
|
||||
// Get analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
// Open an output file
|
||||
//
|
||||
G4String fileName = "B4.root";
|
||||
// Other supported output types:
|
||||
// G4String fileName = "B4.csv";
|
||||
// G4String fileName = "B4.hdf5";
|
||||
// G4String fileName = "B4.xml";
|
||||
analysisManager->OpenFile(fileName);
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
// print histogram statistics
|
||||
//
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
if ( analysisManager->GetH1(1) ) {
|
||||
G4cout << G4endl << " ----> print histograms statistic ";
|
||||
if(isMaster) {
|
||||
G4cout << "for the entire run " << G4endl << G4endl;
|
||||
}
|
||||
else {
|
||||
G4cout << "for the local thread " << G4endl << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " EAbs : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(0)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(0)->rms(), "Energy") << G4endl;
|
||||
|
||||
G4cout << " EGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(1)->mean(), "Energy")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
|
||||
|
||||
G4cout << " LAbs : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->mean(), "Length")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(2)->rms(), "Length") << G4endl;
|
||||
|
||||
G4cout << " LGap : mean = "
|
||||
<< G4BestUnit(analysisManager->GetH1(3)->mean(), "Length")
|
||||
<< " rms = "
|
||||
<< G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
|
||||
}
|
||||
|
||||
// save histograms & ntuple
|
||||
//
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 B4/B4a/src/SteppingAction.cc
|
||||
/// \brief Implementation of the B4a::SteppingAction class
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
using namespace B4;
|
||||
|
||||
namespace B4a
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::SteppingAction(const DetectorConstruction* detConstruction,
|
||||
EventAction* eventAction)
|
||||
: fDetConstruction(detConstruction),
|
||||
fEventAction(eventAction)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
{
|
||||
// Collect energy and track length step by step
|
||||
|
||||
// get volume of the current step
|
||||
auto volume = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
|
||||
|
||||
// energy deposit
|
||||
auto edep = step->GetTotalEnergyDeposit();
|
||||
|
||||
// step length
|
||||
G4double stepLength = 0.;
|
||||
if ( step->GetTrack()->GetDefinition()->GetPDGCharge() != 0. ) {
|
||||
stepLength = step->GetStepLength();
|
||||
}
|
||||
|
||||
if ( volume == fDetConstruction->GetAbsorberPV() ) {
|
||||
fEventAction->AddAbs(edep,stepLength);
|
||||
}
|
||||
|
||||
if ( volume == fDetConstruction->GetGapPV() ) {
|
||||
fEventAction->AddGap(edep,stepLength);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
# Macro file for the visualization setting for the initialization phase
|
||||
# of the B4 example when running in interactive mode
|
||||
#
|
||||
|
||||
# Use these open statements to open selected visualization
|
||||
#
|
||||
# Use this open statement to create an OpenGL view:
|
||||
/vis/open OGL 600x600-0+0
|
||||
#
|
||||
# Use this open statement to create an OpenInventor view:
|
||||
#/vis/open OIX
|
||||
#
|
||||
# Use this open statement to create a .prim file suitable for
|
||||
# viewing in DAWN:
|
||||
#/vis/open DAWNFILE
|
||||
#
|
||||
# Use this open statement to create a .heprep file suitable for
|
||||
# viewing in HepRApp:
|
||||
#/vis/open HepRepFile
|
||||
#
|
||||
# Use this open statement to create a .wrl file suitable for
|
||||
# viewing in a VRML viewer:
|
||||
#/vis/open VRML2FILE
|
||||
#
|
||||
# Disable auto refresh and quieten vis messages whilst scene and
|
||||
# trajectories are established:
|
||||
/vis/viewer/set/autoRefresh false
|
||||
/vis/verbose errors
|
||||
#
|
||||
# Draw geometry:
|
||||
/vis/drawVolume
|
||||
#
|
||||
# Specify view angle:
|
||||
/vis/viewer/set/viewpointThetaPhi 90. 180.
|
||||
#
|
||||
# Specify zoom value:
|
||||
#/vis/viewer/zoom 2.
|
||||
#
|
||||
# Specify style (surface, wireframe, auxiliary edges,...)
|
||||
#/vis/viewer/set/style wireframe
|
||||
#/vis/viewer/set/auxiliaryEdge true
|
||||
#/vis/viewer/set/lineSegmentsPerCircle 100
|
||||
#
|
||||
# Draw coordinate axes:
|
||||
#/vis/scene/add/axes 0 0 0 1 m
|
||||
#
|
||||
# Draw smooth trajectories at end of event, showing trajectory points
|
||||
# as markers 2 pixels wide:
|
||||
/vis/scene/add/trajectories smooth
|
||||
/vis/modeling/trajectories/create/drawByCharge
|
||||
/vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true
|
||||
/vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 1
|
||||
# (if too many tracks cause core dump => /tracking/storeTrajectory 0)
|
||||
#
|
||||
# Draw hits at end of event:
|
||||
#/vis/scene/add/hits
|
||||
#
|
||||
# To draw only gammas:
|
||||
#/vis/filtering/trajectories/create/particleFilter
|
||||
#/vis/filtering/trajectories/particleFilter-0/add gamma
|
||||
#
|
||||
# To invert the above, drawing all particles except gammas,
|
||||
# keep the above two lines but also add:
|
||||
#/vis/filtering/trajectories/particleFilter-0/invert true
|
||||
#
|
||||
# Many other options are available with /vis/modeling and /vis/filtering.
|
||||
# For example, to select colour by particle ID:
|
||||
#/vis/modeling/trajectories/create/drawByParticleID
|
||||
#/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true
|
||||
# To select or override default colours (note: e+ is blue by default):
|
||||
#/vis/modeling/trajectories/list
|
||||
#/vis/modeling/trajectories/drawByParticleID-0/set e+ yellow
|
||||
#
|
||||
# To superimpose all of the events from a given run:
|
||||
/vis/scene/endOfEventAction accumulate
|
||||
#
|
||||
# Re-establish auto refreshing and verbosity:
|
||||
/vis/viewer/set/autoRefresh true
|
||||
/vis/verbose warnings
|
||||
#
|
||||
# For file-based drivers, use this to create an empty detector view:
|
||||
#/vis/viewer/flush
|
||||
Reference in New Issue
Block a user