Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
@@ -1,7 +1,7 @@
|
||||
#----------------------------------------------------------------------------
|
||||
# Setup the project
|
||||
#
|
||||
cmake_minimum_required(VERSION 3.12...3.20)
|
||||
cmake_minimum_required(VERSION 3.16...3.21)
|
||||
project(B4d)
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
@@ -38,7 +38,7 @@ target_link_libraries(exampleB4d ${Geant4_LIBRARIES})
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Copy all scripts to the build directory, i.e. the directory in which we
|
||||
# build B4c. This is so that we can run the executable directly because it
|
||||
# build B4d. This is so that we can run the executable directly because it
|
||||
# relies on these scripts being in the current working directory.
|
||||
#
|
||||
set(EXAMPLEB4D_SCRIPTS
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
/// \file exampleB4d.cc
|
||||
/// \brief Main program of the B4d example
|
||||
|
||||
#include "B4dDetectorConstruction.hh"
|
||||
#include "B4dActionInitialization.hh"
|
||||
#include "B4Analysis.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4RunManagerFactory.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4TScoreNtupleWriter.hh"
|
||||
@@ -46,7 +46,7 @@
|
||||
namespace {
|
||||
void PrintUsage() {
|
||||
G4cerr << " Usage: " << G4endl;
|
||||
G4cerr << " exampleB4a [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
|
||||
G4cerr << " exampleB4d [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
|
||||
<< G4endl;
|
||||
G4cerr << " note: -t option is available only for multi-threaded mode."
|
||||
<< G4endl;
|
||||
@@ -116,13 +116,13 @@ int main(int argc,char** argv)
|
||||
|
||||
// Set mandatory initialization classes
|
||||
//
|
||||
auto detConstruction = new B4dDetectorConstruction();
|
||||
auto detConstruction = new B4d::DetectorConstruction();
|
||||
runManager->SetUserInitialization(detConstruction);
|
||||
|
||||
auto physicsList = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
auto actionInitialization = new B4dActionInitialization();
|
||||
auto actionInitialization = new B4d::ActionInitialization();
|
||||
runManager->SetUserInitialization(actionInitialization);
|
||||
|
||||
// Initialize visualization
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+13
-9
@@ -24,27 +24,31 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4dActionInitialization.hh
|
||||
/// \brief Definition of the B4dActionInitialization class
|
||||
/// \file ActionInitialization.hh
|
||||
/// \brief Definition of the B4d::ActionInitialization class
|
||||
|
||||
#ifndef B4dActionInitialization_h
|
||||
#define B4dActionInitialization_h 1
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
/// Action initialization class.
|
||||
///
|
||||
namespace B4d
|
||||
{
|
||||
|
||||
class B4dActionInitialization : public G4VUserActionInitialization
|
||||
/// Action initialization class.
|
||||
|
||||
class ActionInitialization : public G4VUserActionInitialization
|
||||
{
|
||||
public:
|
||||
B4dActionInitialization();
|
||||
virtual ~B4dActionInitialization();
|
||||
ActionInitialization();
|
||||
~ActionInitialization() override;
|
||||
|
||||
virtual void BuildForMaster() const;
|
||||
virtual void Build() const;
|
||||
void BuildForMaster() const override;
|
||||
void Build() const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4Analysis.hh
|
||||
/// \brief Selection of the analysis technology
|
||||
|
||||
#ifndef B4Analysis_h
|
||||
#define B4Analysis_h 1
|
||||
|
||||
#include "g4root.hh"
|
||||
//#include "g4csv.hh"
|
||||
//#include "g4xml.hh"
|
||||
|
||||
//#include "G4GenericAnalysisManager.hh"
|
||||
//using G4AnalysisManager = G4GenericAnalysisManager;
|
||||
|
||||
#endif
|
||||
+13
-9
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4dDetectorConstruction.hh
|
||||
/// \brief Definition of the B4dDetectorConstruction class
|
||||
/// \file DetectorConstruction.hh
|
||||
/// \brief Definition of the B4d::DetectorConstruction class
|
||||
|
||||
#ifndef B4dDetectorConstruction_h
|
||||
#define B4dDetectorConstruction_h 1
|
||||
@@ -36,6 +36,9 @@
|
||||
class G4VPhysicalVolume;
|
||||
class G4GlobalMagFieldMessenger;
|
||||
|
||||
namespace B4d
|
||||
{
|
||||
|
||||
/// 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.
|
||||
@@ -52,15 +55,15 @@ class G4GlobalMagFieldMessenger;
|
||||
/// and Gap volumes. In addition a transverse uniform magnetic field is defined
|
||||
/// via G4GlobalMagFieldMessenger class.
|
||||
|
||||
class B4dDetectorConstruction : public G4VUserDetectorConstruction
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
B4dDetectorConstruction();
|
||||
virtual ~B4dDetectorConstruction();
|
||||
DetectorConstruction();
|
||||
~DetectorConstruction() override;
|
||||
|
||||
public:
|
||||
virtual G4VPhysicalVolume* Construct();
|
||||
virtual void ConstructSDandField();
|
||||
G4VPhysicalVolume* Construct() override;
|
||||
void ConstructSDandField() override;
|
||||
|
||||
private:
|
||||
// methods
|
||||
@@ -73,10 +76,11 @@ class B4dDetectorConstruction : public G4VUserDetectorConstruction
|
||||
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
|
||||
// magnetic field messenger
|
||||
|
||||
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
|
||||
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
+18
-15
@@ -24,31 +24,34 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4dEventAction.hh
|
||||
/// \brief Definition of the B4dEventAction class
|
||||
/// \file EventAction.hh
|
||||
/// \brief Definition of the EventAction class
|
||||
|
||||
#ifndef B4dEventAction_h
|
||||
#define B4dEventAction_h 1
|
||||
#ifndef EventAction_h
|
||||
#define EventAction_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
|
||||
#include "G4THitsMap.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
namespace B4d
|
||||
{
|
||||
|
||||
/// Event action class
|
||||
///
|
||||
/// In EndOfEventAction(), it prints the accumulated quantities of the energy
|
||||
/// deposit and track lengths of charged particles in Absober and Gap layers
|
||||
/// stored in the hits collections.
|
||||
|
||||
class B4dEventAction : public G4UserEventAction
|
||||
class EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
B4dEventAction();
|
||||
virtual ~B4dEventAction();
|
||||
EventAction();
|
||||
~EventAction() override;
|
||||
|
||||
virtual void BeginOfEventAction(const G4Event* event);
|
||||
virtual void EndOfEventAction(const G4Event* event);
|
||||
void BeginOfEventAction(const G4Event* event) override;
|
||||
void EndOfEventAction(const G4Event* event) override;
|
||||
|
||||
private:
|
||||
// methods
|
||||
@@ -59,14 +62,14 @@ private:
|
||||
G4double gapEdep, G4double gapTrackLength) const;
|
||||
|
||||
// data members
|
||||
G4int fAbsoEdepHCID;
|
||||
G4int fGapEdepHCID;
|
||||
G4int fAbsoTrackLengthHCID;
|
||||
G4int fGapTrackLengthHCID;
|
||||
G4int fAbsoEdepHCID = -1;
|
||||
G4int fGapEdepHCID = -1;
|
||||
G4int fAbsoTrackLengthHCID = -1;
|
||||
G4int fGapTrackLengthHCID = -1;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+12
-7
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the B4PrimaryGeneratorAction class
|
||||
/// \file PrimaryGeneratorAction.hh
|
||||
/// \brief Definition of the PrimaryGeneratorAction class
|
||||
|
||||
#ifndef B4PrimaryGeneratorAction_h
|
||||
#define B4PrimaryGeneratorAction_h 1
|
||||
@@ -36,6 +36,9 @@
|
||||
class G4ParticleGun;
|
||||
class G4Event;
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
/// The primary generator action class with particle gum.
|
||||
///
|
||||
/// It defines a single particle which hits the calorimeter
|
||||
@@ -43,21 +46,23 @@ class G4Event;
|
||||
/// can be changed via the G4 build-in commands of G4ParticleGun class
|
||||
/// (see the macros provided with this example).
|
||||
|
||||
class B4PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
B4PrimaryGeneratorAction();
|
||||
virtual ~B4PrimaryGeneratorAction();
|
||||
PrimaryGeneratorAction();
|
||||
~PrimaryGeneratorAction() override;
|
||||
|
||||
virtual void GeneratePrimaries(G4Event* event);
|
||||
void GeneratePrimaries(G4Event* event) override;
|
||||
|
||||
// set methods
|
||||
void SetRandomFlag(G4bool value);
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun; // G4 particle gun
|
||||
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
+13
-9
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4RunAction.hh
|
||||
/// \brief Definition of the B4RunAction class
|
||||
/// \file RunAction.hh
|
||||
/// \brief Definition of the B4::RunAction class
|
||||
|
||||
#ifndef B4RunAction_h
|
||||
#define B4RunAction_h 1
|
||||
@@ -35,6 +35,9 @@
|
||||
|
||||
class G4Run;
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
/// Run action class
|
||||
///
|
||||
/// It accumulates statistic and computes dispersion of the energy deposit
|
||||
@@ -47,23 +50,24 @@ class G4Run;
|
||||
/// - 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
|
||||
/// accoring to a selected technology in B4Analysis.hh.
|
||||
/// according to a specified file extension.
|
||||
///
|
||||
/// In EndOfRunAction(), the accumulated statistic and computed
|
||||
/// dispersion is printed.
|
||||
///
|
||||
|
||||
class B4RunAction : public G4UserRunAction
|
||||
class RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
B4RunAction();
|
||||
virtual ~B4RunAction();
|
||||
RunAction();
|
||||
~RunAction() override;
|
||||
|
||||
virtual void BeginOfRunAction(const G4Run*);
|
||||
virtual void EndOfRunAction(const G4Run*);
|
||||
void BeginOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
+22
-16
@@ -24,39 +24,45 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4dActionInitialization.cc
|
||||
/// \brief Implementation of the B4dActionInitialization class
|
||||
/// \file ActionInitialization.cc
|
||||
/// \brief Implementation of the B4d::ActionInitialization class
|
||||
|
||||
#include "B4dActionInitialization.hh"
|
||||
#include "B4PrimaryGeneratorAction.hh"
|
||||
#include "B4RunAction.hh"
|
||||
#include "B4dEventAction.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
using namespace B4;
|
||||
|
||||
namespace B4d
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4dActionInitialization::B4dActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
ActionInitialization::ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4dActionInitialization::~B4dActionInitialization()
|
||||
{;}
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4dActionInitialization::BuildForMaster() const
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(new B4RunAction);
|
||||
SetUserAction(new RunAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4dActionInitialization::Build() const
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new B4PrimaryGeneratorAction);
|
||||
SetUserAction(new B4RunAction);
|
||||
SetUserAction(new B4dEventAction);
|
||||
SetUserAction(new PrimaryGeneratorAction);
|
||||
SetUserAction(new RunAction);
|
||||
SetUserAction(new EventAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+16
-13
@@ -24,10 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4dDetectorConstruction.cc
|
||||
/// \brief Implementation of the B4dDetectorConstruction class
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the B4d::DetectorConstruction class
|
||||
|
||||
#include "B4dDetectorConstruction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
@@ -52,28 +52,29 @@
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
namespace B4d
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* B4dDetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4dDetectorConstruction::B4dDetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fCheckOverlaps(true)
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4dDetectorConstruction::~B4dDetectorConstruction()
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* B4dDetectorConstruction::Construct()
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Define materials
|
||||
DefineMaterials();
|
||||
@@ -84,7 +85,7 @@ G4VPhysicalVolume* B4dDetectorConstruction::Construct()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4dDetectorConstruction::DefineMaterials()
|
||||
void DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
// Lead material defined using NIST Manager
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
@@ -107,7 +108,7 @@ void B4dDetectorConstruction::DefineMaterials()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
|
||||
{
|
||||
// Geometry parameters
|
||||
G4int nofLayers = 10;
|
||||
@@ -128,7 +129,7 @@ G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Cannot retrieve materials already defined.";
|
||||
G4Exception("B4DetectorConstruction::DefineVolumes()",
|
||||
G4Exception("DetectorConstruction::DefineVolumes()",
|
||||
"MyCode0001", FatalException, msg);
|
||||
}
|
||||
|
||||
@@ -275,7 +276,7 @@ G4VPhysicalVolume* B4dDetectorConstruction::DefineVolumes()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4dDetectorConstruction::ConstructSDandField()
|
||||
void DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
|
||||
//
|
||||
@@ -327,3 +328,5 @@ void B4dDetectorConstruction::ConstructSDandField()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+17
-17
@@ -24,12 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4dEventAction.cc
|
||||
/// \brief Implementation of the B4dEventAction class
|
||||
/// \file EventAction.cc
|
||||
/// \brief Implementation of the B4d::EventAction class
|
||||
|
||||
#include "B4dEventAction.hh"
|
||||
#include "B4Analysis.hh"
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4SDManager.hh"
|
||||
@@ -39,25 +39,23 @@
|
||||
#include "Randomize.hh"
|
||||
#include <iomanip>
|
||||
|
||||
namespace B4d
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4dEventAction::B4dEventAction()
|
||||
: G4UserEventAction(),
|
||||
fAbsoEdepHCID(-1),
|
||||
fGapEdepHCID(-1),
|
||||
fAbsoTrackLengthHCID(-1),
|
||||
fGapTrackLengthHCID(-1)
|
||||
EventAction::EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4dEventAction::~B4dEventAction()
|
||||
EventAction::~EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4THitsMap<G4double>*
|
||||
B4dEventAction::GetHitsCollection(G4int hcID,
|
||||
EventAction::GetHitsCollection(G4int hcID,
|
||||
const G4Event* event) const
|
||||
{
|
||||
auto hitsCollection
|
||||
@@ -67,7 +65,7 @@ B4dEventAction::GetHitsCollection(G4int hcID,
|
||||
if ( ! hitsCollection ) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Cannot access hitsCollection ID " << hcID;
|
||||
G4Exception("B4dEventAction::GetHitsCollection()",
|
||||
G4Exception("EventAction::GetHitsCollection()",
|
||||
"MyCode0003", FatalException, msg);
|
||||
}
|
||||
|
||||
@@ -76,7 +74,7 @@ B4dEventAction::GetHitsCollection(G4int hcID,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double B4dEventAction::GetSum(G4THitsMap<G4double>* hitsMap) const
|
||||
G4double EventAction::GetSum(G4THitsMap<G4double>* hitsMap) const
|
||||
{
|
||||
G4double sumValue = 0.;
|
||||
for ( auto it : *hitsMap->GetMap() ) {
|
||||
@@ -88,7 +86,7 @@ G4double B4dEventAction::GetSum(G4THitsMap<G4double>* hitsMap) const
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4dEventAction::PrintEventStatistics(
|
||||
void EventAction::PrintEventStatistics(
|
||||
G4double absoEdep, G4double absoTrackLength,
|
||||
G4double gapEdep, G4double gapTrackLength) const
|
||||
{
|
||||
@@ -109,12 +107,12 @@ void B4dEventAction::PrintEventStatistics(
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4dEventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
void EventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4dEventAction::EndOfEventAction(const G4Event* event)
|
||||
void EventAction::EndOfEventAction(const G4Event* event)
|
||||
{
|
||||
// Get hist collections IDs
|
||||
if ( fAbsoEdepHCID == -1 ) {
|
||||
@@ -167,3 +165,5 @@ void B4dEventAction::EndOfEventAction(const G4Event* event)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+11
-9
@@ -24,10 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B4PrimaryGeneratorAction class
|
||||
/// \file PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B4::PrimaryGeneratorAction class
|
||||
|
||||
#include "B4PrimaryGeneratorAction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
@@ -40,11 +40,12 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4PrimaryGeneratorAction::B4PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(nullptr)
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int nofParticles = 1;
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
@@ -60,14 +61,14 @@ B4PrimaryGeneratorAction::B4PrimaryGeneratorAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4PrimaryGeneratorAction::~B4PrimaryGeneratorAction()
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
// This function is called at the begining of event
|
||||
|
||||
@@ -92,7 +93,7 @@ void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
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("B4PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
"MyCode0002", JustWarning, msg);
|
||||
}
|
||||
|
||||
@@ -105,3 +106,4 @@ void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -24,30 +24,31 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4RunAction.cc
|
||||
/// \brief Implementation of the B4RunAction class
|
||||
/// \file RunAction.cc
|
||||
/// \brief Implementation of the B4::RunAction class
|
||||
|
||||
#include "B4RunAction.hh"
|
||||
#include "B4Analysis.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4RunAction::B4RunAction()
|
||||
: G4UserRunAction()
|
||||
RunAction::RunAction()
|
||||
{
|
||||
// set printing event number per each event
|
||||
G4RunManager::GetRunManager()->SetPrintProgress(1);
|
||||
|
||||
// Create analysis manager
|
||||
// The choice of analysis technology is done via selectin of a namespace
|
||||
// in B4Analysis.hh
|
||||
// The choice of the output format is done via the specified
|
||||
// file extension.
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
|
||||
// Create directories
|
||||
//analysisManager->SetHistoDirectoryName("histograms");
|
||||
@@ -77,14 +78,13 @@ B4RunAction::B4RunAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4RunAction::~B4RunAction()
|
||||
RunAction::~RunAction()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
void RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
//inform the runManager to save random number seed
|
||||
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
@@ -94,13 +94,18 @@ void B4RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
|
||||
// Open an output file
|
||||
//
|
||||
G4String fileName = "B4";
|
||||
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 B4RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
void RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
// print histogram statistics
|
||||
//
|
||||
@@ -142,3 +147,5 @@ void B4RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user