Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -49,8 +49,8 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
@@ -60,9 +60,9 @@
|
||||
// the non-extensible factory to the exensible factory. All other changes
|
||||
// relative to the "factory" example are there to demonstrate new features.
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//non-extensible: #include "G4PhysListFactory.hh"
|
||||
// non-extensible: #include "G4PhysListFactory.hh"
|
||||
#include "G4PhysListFactoryAlt.hh"
|
||||
//use this for drop-in replacement: using namespace g4alt;
|
||||
// use this for drop-in replacement: using namespace g4alt;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// headers needed to demonstrate new featues
|
||||
@@ -78,63 +78,63 @@
|
||||
// pull in a user defined physics list definition into the main program
|
||||
// and register it with the factory (doesn't have to be the main program
|
||||
// but the .o containing the declaration _must_ get linked/loaded)
|
||||
#include "G4PhysListStamper.hh" // defines macro for factory registration
|
||||
#include "MySpecialPhysList.hh"
|
||||
|
||||
#include "G4PhysListStamper.hh" // defines macro for factory registration
|
||||
G4_DECLARE_PHYSLIST_FACTORY(MySpecialPhysList);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4VModularPhysicsList.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VModularPhysicsList.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
namespace {
|
||||
namespace
|
||||
{
|
||||
|
||||
void PrintAvailable(G4int verbosity) {
|
||||
void PrintAvailable(G4int verbosity)
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "extensibleFactory: here are the available physics lists:" << G4endl;
|
||||
g4alt::G4PhysListFactory factory;
|
||||
factory.PrintAvailablePhysLists();
|
||||
|
||||
// if user asked for extra verbosity then print physics ctors as well
|
||||
if (verbosity > 1) {
|
||||
G4cout << G4endl;
|
||||
G4cout << "extensibleFactory: here are the available physics lists:"
|
||||
<< G4endl;
|
||||
g4alt::G4PhysListFactory factory;
|
||||
factory.PrintAvailablePhysLists();
|
||||
|
||||
// if user asked for extra verbosity then print physics ctors as well
|
||||
if ( verbosity > 1 ) {
|
||||
G4cout << G4endl;
|
||||
G4cout << "extensibleFactory: "
|
||||
<< "here are the available physics ctors that can be added:"
|
||||
<< G4endl;
|
||||
G4PhysicsConstructorRegistry* g4pctorFactory =
|
||||
G4PhysicsConstructorRegistry::Instance();
|
||||
g4pctorFactory->PrintAvailablePhysicsConstructors();
|
||||
}
|
||||
G4cout << "extensibleFactory: "
|
||||
<< "here are the available physics ctors that can be added:" << G4endl;
|
||||
G4PhysicsConstructorRegistry* g4pctorFactory = G4PhysicsConstructorRegistry::Instance();
|
||||
g4pctorFactory->PrintAvailablePhysicsConstructors();
|
||||
}
|
||||
|
||||
void PrintUsage(G4int verbosity) {
|
||||
G4cerr << " Usage: " << G4endl;
|
||||
G4cerr << " extensibleFactory [-m macro ] [-p physList ]"
|
||||
<< " [-u UIsession] [-t nThreads]" << G4endl
|
||||
<< " [-v | --verbose] [-h | --help]" << G4endl;
|
||||
G4cerr << " note: -t option is available only for multi-threaded mode."
|
||||
<< G4endl;
|
||||
G4cerr << " note: -v can be repeated to increase verbosity." << G4endl;
|
||||
G4cerr << G4endl;
|
||||
|
||||
if (verbosity>0) PrintAvailable(verbosity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PrintUsage(G4int verbosity)
|
||||
{
|
||||
G4cerr << " Usage: " << G4endl;
|
||||
G4cerr << " extensibleFactory [-m macro ] [-p physList ]"
|
||||
<< " [-u UIsession] [-t nThreads]" << G4endl << " [-v | --verbose] [-h | --help]"
|
||||
<< G4endl;
|
||||
G4cerr << " note: -t option is available only for multi-threaded mode." << G4endl;
|
||||
G4cerr << " note: -v can be repeated to increase verbosity." << G4endl;
|
||||
G4cerr << G4endl;
|
||||
|
||||
if (verbosity > 0) PrintAvailable(verbosity);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Evaluate arguments
|
||||
//
|
||||
if ( argc > 13 ) {
|
||||
if (argc > 13) {
|
||||
PrintUsage(0);
|
||||
return 1;
|
||||
}
|
||||
@@ -142,29 +142,32 @@ int main(int argc,char** argv)
|
||||
G4String macro;
|
||||
G4String session;
|
||||
G4String physListName;
|
||||
char* physListNameEnv = nullptr;
|
||||
char* physListNameEnv = nullptr;
|
||||
G4String gdmlFileName;
|
||||
#ifdef G4MULTITHREADED
|
||||
G4int nofThreads = 0;
|
||||
#endif
|
||||
G4int verbosity = 0;
|
||||
|
||||
for ( G4int i=1; i<argc; i=i+2 ) {
|
||||
for (G4int i = 1; i < argc; i = i + 2) {
|
||||
G4String g4argv(argv[i]); // convert only once
|
||||
if ( g4argv == "-m" ) macro = argv[i+1];
|
||||
else if ( g4argv == "-u" ) session = argv[i+1];
|
||||
else if ( g4argv == "-p" ) physListName = argv[i+1];
|
||||
if (g4argv == "-m")
|
||||
macro = argv[i + 1];
|
||||
else if (g4argv == "-u")
|
||||
session = argv[i + 1];
|
||||
else if (g4argv == "-p")
|
||||
physListName = argv[i + 1];
|
||||
#ifdef G4MULTITHREADED
|
||||
else if ( g4argv == "-t" ) {
|
||||
nofThreads = G4UIcommand::ConvertToInt(argv[i+1]);
|
||||
else if (g4argv == "-t") {
|
||||
nofThreads = G4UIcommand::ConvertToInt(argv[i + 1]);
|
||||
}
|
||||
#endif
|
||||
else if ( g4argv == "-v" || g4argv == "--verbose" ) {
|
||||
else if (g4argv == "-v" || g4argv == "--verbose") {
|
||||
++verbosity; // verbose flag doesn't take an argument
|
||||
--i ; // don't increment argc by two, just the one
|
||||
--i; // don't increment argc by two, just the one
|
||||
}
|
||||
else if ( g4argv == "-h" || g4argv == "--help" ) {
|
||||
PrintUsage(verbosity+1);
|
||||
else if (g4argv == "-h" || g4argv == "--help") {
|
||||
PrintUsage(verbosity + 1);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
@@ -176,7 +179,7 @@ int main(int argc,char** argv)
|
||||
// Detect interactive mode (if no arguments) and define UI session
|
||||
//
|
||||
G4UIExecutive* ui = nullptr;
|
||||
if ( ! macro.size() ) {
|
||||
if (!macro.size()) {
|
||||
ui = new G4UIExecutive(argc, argv, session);
|
||||
}
|
||||
|
||||
@@ -186,7 +189,7 @@ int main(int argc,char** argv)
|
||||
// Construct the run manager
|
||||
auto* runManager = G4RunManagerFactory::CreateRunManager();
|
||||
#ifdef G4MULTITHREADED
|
||||
if ( nofThreads > 0 ) {
|
||||
if (nofThreads > 0) {
|
||||
runManager->SetNumberOfThreads(nofThreads);
|
||||
}
|
||||
#endif
|
||||
@@ -204,67 +207,60 @@ int main(int argc,char** argv)
|
||||
// This is what is used when no -p flag is given and $PHYSLIST
|
||||
// is not defined in the environment.
|
||||
G4String defaultPhysListName = "FTFP_BERT";
|
||||
if ( verbosity > 0 ) {
|
||||
G4cout << "extensibleFactory: SetDefaultReferencePhysList to '"
|
||||
<< defaultPhysListName << "' ('' = system default)"
|
||||
<< G4endl << G4endl;
|
||||
if (verbosity > 0) {
|
||||
G4cout << "extensibleFactory: SetDefaultReferencePhysList to '" << defaultPhysListName
|
||||
<< "' ('' = system default)" << G4endl << G4endl;
|
||||
}
|
||||
factory.SetDefaultReferencePhysList(defaultPhysListName);
|
||||
|
||||
// set a short name for G4RadioactiveDecayPhysics
|
||||
G4PhysListRegistry* plreg = G4PhysListRegistry::Instance();
|
||||
plreg->AddPhysicsExtension("RADIO","G4RadioactiveDecayPhysics");
|
||||
plreg->AddPhysicsExtension("MYPHYSICS","MyG4PhysicsPhysics");
|
||||
if ( verbosity > 0 ) {
|
||||
plreg->AddPhysicsExtension("RADIO", "G4RadioactiveDecayPhysics");
|
||||
plreg->AddPhysicsExtension("MYPHYSICS", "MyG4PhysicsPhysics");
|
||||
if (verbosity > 0) {
|
||||
G4cout << "extensibleFactory: adding extensions" << G4endl
|
||||
<< " RADIO ===> G4RadioactiveDecayPhysics" << G4endl
|
||||
<< " MYPHYSICS ===> MyG4PhysicsPhysics" << G4endl
|
||||
<< G4endl;
|
||||
<< " MYPHYSICS ===> MyG4PhysicsPhysics" << G4endl << G4endl;
|
||||
}
|
||||
|
||||
// Get Reference PhysicsList via its name, or if none given
|
||||
// from environment varialb e$PHYSLIST, with fall back to a default
|
||||
if ( physListName.size() ) {
|
||||
if ( verbosity > 0 ) {
|
||||
G4cout << "extensibleFactory: explicitly using '"
|
||||
<< physListName << "'" << G4endl;
|
||||
if (physListName.size()) {
|
||||
if (verbosity > 0) {
|
||||
G4cout << "extensibleFactory: explicitly using '" << physListName << "'" << G4endl;
|
||||
}
|
||||
physList = factory.GetReferencePhysList(physListName);
|
||||
} else {
|
||||
if ( verbosity > 0 ) {
|
||||
}
|
||||
else {
|
||||
if (verbosity > 0) {
|
||||
G4cout << "extensibleFactory: no -p flag;"
|
||||
<< " using ReferencePhysList() ($PHYSLIST or default)" << G4endl;
|
||||
}
|
||||
physList = factory.ReferencePhysList();
|
||||
|
||||
if ( ! physList ) {
|
||||
if (!physList) {
|
||||
// failed? get what the user set, but we couldn't find
|
||||
physListNameEnv = std::getenv("PHYSLIST");
|
||||
if ( physListNameEnv ) {
|
||||
G4cout << "extensibleFactory: $PHYSLIST="
|
||||
<< physListNameEnv << G4endl;
|
||||
if (physListNameEnv) {
|
||||
G4cout << "extensibleFactory: $PHYSLIST=" << physListNameEnv << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// deal with failure to get what the user wanted
|
||||
// print what they _could_ use
|
||||
if ( ! physList ) {
|
||||
if (!physList) {
|
||||
G4cerr << "extensibleFactory: PhysicsList '"
|
||||
<< ( physListNameEnv ? physListNameEnv : physListName )
|
||||
<< (physListNameEnv ? physListNameEnv : physListName)
|
||||
<< "' was not available in g4alt::PhysListFactory." << G4endl;
|
||||
PrintAvailable(verbosity);
|
||||
|
||||
// if we can't get what the user asked for...
|
||||
// don't go on to use something else, that's confusing
|
||||
G4ExceptionDescription ED;
|
||||
ED << "The factory for the physicslist ["
|
||||
<< ( physListNameEnv ? physListNameEnv : physListName )
|
||||
<< "] does not exist!"
|
||||
<< G4endl;
|
||||
G4Exception("extensibleFactory",
|
||||
"extensibleFactory001", FatalException, ED);
|
||||
ED << "The factory for the physicslist [" << (physListNameEnv ? physListNameEnv : physListName)
|
||||
<< "] does not exist!" << G4endl;
|
||||
G4Exception("extensibleFactory", "extensibleFactory001", FatalException, ED);
|
||||
exit(42);
|
||||
}
|
||||
|
||||
@@ -273,11 +269,10 @@ int main(int argc,char** argv)
|
||||
runManager->SetUserInitialization(physList);
|
||||
|
||||
// set user action classes
|
||||
auto actinit =
|
||||
new ActionInitialization("extensibleFactory");
|
||||
auto actinit = new ActionInitialization("extensibleFactory");
|
||||
runManager->SetUserInitialization(actinit);
|
||||
|
||||
// Initialize visualization
|
||||
// Initialize visualization
|
||||
G4VisManager* visManager = new G4VisExecutive;
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
// G4VisManager* visManager = new G4VisExecutive("Quiet");
|
||||
@@ -286,10 +281,10 @@ int main(int argc,char** argv)
|
||||
// Get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
if ( macro.size() ) {
|
||||
if (macro.size()) {
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command+macro);
|
||||
UImanager->ApplyCommand(command + macro);
|
||||
}
|
||||
else {
|
||||
// interactive mode : define UI session
|
||||
|
||||
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
|
||||
|
||||
|
||||
**************************************************************
|
||||
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
|
||||
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
|
||||
Copyright : Geant4 Collaboration
|
||||
References : NIM A 506 (2003), 250-303
|
||||
: IEEE-TNS 53 (2006), 270-278
|
||||
@@ -47,14 +47,21 @@ Registered graphics systems are:
|
||||
RayTracerX (RayTracerX)
|
||||
Qt3D (Qt3D)
|
||||
TOOLSSG_X11_GLES (TSG_X11_GLES, TSGX11, TSG_XT_GLES_FALLBACK)
|
||||
TOOLSSG_X11_ZB (TSG_X11_ZB, TSGX11ZB)
|
||||
TOOLSSG_XT_GLES (TSG_XT_GLES, TSGXt, TSG_QT_GLES_FALLBACK)
|
||||
TOOLSSG_XT_ZB (TSG_XT_ZB, TSGXtZB)
|
||||
TOOLSSG_QT_GLES (TSG_QT_GLES, TSGQt, TSG)
|
||||
TOOLSSG_QT_ZB (TSG_QT_ZB, TSGQtZB)
|
||||
Default graphics system is: TSG_OFFSCREEN (based on batch session).
|
||||
Default window size hint is: 600x600-0+0 (based on G4VisManager initialisation).
|
||||
Note: Parameters specified on the command line will override these defaults.
|
||||
Use "vis/open" without parameters to get these defaults.
|
||||
You may choose a graphics system (driver) with a parameter of
|
||||
the command "/vis/open" or "/vis/sceneHandler/create",
|
||||
or you may omit the driver parameter and choose at run time:
|
||||
- by argument in the construction of G4VisExecutive
|
||||
- by environment variable "G4VIS_DEFAULT_DRIVER"
|
||||
- by entry in "~/.g4session"
|
||||
- by build flags.
|
||||
- Note: This feature is not allowed in batch mode.
|
||||
For further information see "examples/basic/B1/exampleB1.cc"
|
||||
and "vis.mac".
|
||||
|
||||
Registering model factories...
|
||||
|
||||
@@ -278,7 +285,7 @@ eBrem: for e+ XStype:4 SubType=3
|
||||
eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai
|
||||
eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai
|
||||
|
||||
annihil: for e+ XStype:2 SubType=5 BuildTable=0
|
||||
annihil: for e+ XStype:2 SubType=5 AtRestModel:Simple BuildTable=0
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eplus2gg : Emin= 0 eV Emax= 100 TeV
|
||||
|
||||
@@ -839,7 +846,7 @@ Min energy per nucleon for multifragmentation 200 GeV
|
||||
Limit excitation energy for Fermi BreakUp 20 MeV
|
||||
Level density (1/MeV) 0.075
|
||||
Use simple level density model 1
|
||||
Use discrete excitation energy of the residual 1
|
||||
Use discrete excitation energy of the residual 0
|
||||
Time limit for long lived isomeres 1 ns
|
||||
Isomer production flag 1
|
||||
Internal e- conversion flag 1
|
||||
|
||||
@@ -58,4 +58,3 @@
|
||||
using MySpecialPhysList = QBBC;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+1
-3
@@ -30,8 +30,8 @@
|
||||
#ifndef ActionInitialization_h
|
||||
#define ActionInitialization_h 1
|
||||
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
#include "G4String.hh"
|
||||
#include "G4VUserActionInitialization.hh"
|
||||
|
||||
/// Action initialization class.
|
||||
///
|
||||
@@ -50,5 +50,3 @@ class ActionInitialization : public G4VUserActionInitialization
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -65,10 +65,9 @@ class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
private:
|
||||
// data members
|
||||
//
|
||||
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
|
||||
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+8
-8
@@ -45,17 +45,17 @@ class G4Event;
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorAction();
|
||||
~PrimaryGeneratorAction() override;
|
||||
public:
|
||||
PrimaryGeneratorAction();
|
||||
~PrimaryGeneratorAction() override;
|
||||
|
||||
void GeneratePrimaries(G4Event* event) override;
|
||||
void GeneratePrimaries(G4Event* event) override;
|
||||
|
||||
// set methods
|
||||
void SetRandomFlag(G4bool value);
|
||||
// set methods
|
||||
void SetRandomFlag(G4bool value);
|
||||
|
||||
private:
|
||||
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
|
||||
private:
|
||||
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -59,7 +59,7 @@ class RunAction : public G4UserRunAction
|
||||
~RunAction() override = default;
|
||||
|
||||
void BeginOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
void EndOfRunAction(const G4Run*) override;
|
||||
|
||||
private:
|
||||
G4String fFileName;
|
||||
@@ -68,4 +68,3 @@ class RunAction : public G4UserRunAction
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ class ScreenSD : public G4VSensitiveDetector
|
||||
ScreenSD(const G4String& name);
|
||||
~ScreenSD() override = default;
|
||||
|
||||
void Initialize(G4HCofThisEvent* hce) override;
|
||||
void Initialize(G4HCofThisEvent* hce) override;
|
||||
G4bool ProcessHits(G4Step* step, G4TouchableHistory* history) override;
|
||||
void EndOfEvent(G4HCofThisEvent* hce) override;
|
||||
void EndOfEvent(G4HCofThisEvent* hce) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,14 +28,13 @@
|
||||
/// \brief Implementation of the ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization(const G4String& fileName)
|
||||
: fFileName(fileName)
|
||||
{}
|
||||
ActionInitialization::ActionInitialization(const G4String& fileName) : fFileName(fileName) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
+30
-34
@@ -28,25 +28,24 @@
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "ScreenSD.hh"
|
||||
|
||||
#include "G4AutoDelete.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4GlobalMagFieldMessenger.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4GlobalMagFieldMessenger.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4AutoDelete.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
G4ThreadLocal G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -58,9 +57,9 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
// Build materials
|
||||
G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* csi = nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
|
||||
// There is no need to test if materials were built/found
|
||||
// as G4NistManager would issue an error otherwise
|
||||
// Try the code with "XYZ".
|
||||
// There is no need to test if materials were built/found
|
||||
// as G4NistManager would issue an error otherwise
|
||||
// Try the code with "XYZ".
|
||||
|
||||
// Print all materials
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
@@ -73,62 +72,59 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
//
|
||||
|
||||
// The world dimensions
|
||||
G4double worldHxyz = 2.*m;
|
||||
G4double worldHxyz = 2. * m;
|
||||
|
||||
// world volume
|
||||
auto worldS = new G4Box("World", worldHxyz, worldHxyz, worldHxyz);
|
||||
auto worldS = new G4Box("World", worldHxyz, worldHxyz, worldHxyz);
|
||||
|
||||
auto worldLV = new G4LogicalVolume(worldS, air, "World");
|
||||
auto worldLV = new G4LogicalVolume(worldS, air, "World");
|
||||
|
||||
G4VPhysicalVolume* worldPV
|
||||
= new G4PVPlacement(
|
||||
nullptr, G4ThreeVector(), worldLV, "World", nullptr, false, 0, checkOverlaps);
|
||||
G4VPhysicalVolume* worldPV =
|
||||
new G4PVPlacement(nullptr, G4ThreeVector(), worldLV, "World", nullptr, false, 0, checkOverlaps);
|
||||
|
||||
//
|
||||
// Box
|
||||
//
|
||||
|
||||
// The box dimensions
|
||||
G4double boxHxy = 1.*m;
|
||||
G4double boxHz = 10.*cm;
|
||||
G4double boxHxy = 1. * m;
|
||||
G4double boxHz = 10. * cm;
|
||||
|
||||
// box volume
|
||||
auto boxS = new G4Box("World", boxHxy, boxHxy, boxHz);
|
||||
auto boxS = new G4Box("World", boxHxy, boxHxy, boxHz);
|
||||
|
||||
auto boxLV = new G4LogicalVolume(boxS, csi, "Box");
|
||||
auto boxLV = new G4LogicalVolume(boxS, csi, "Box");
|
||||
|
||||
// The box position
|
||||
G4double posz = 0.*m;
|
||||
G4double posz = 0. * m;
|
||||
|
||||
new G4PVPlacement(
|
||||
nullptr, G4ThreeVector(0, 0, posz),
|
||||
boxLV, "Box", worldLV, false, 0, checkOverlaps);
|
||||
new G4PVPlacement(nullptr, G4ThreeVector(0, 0, posz), boxLV, "Box", worldLV, false, 0,
|
||||
checkOverlaps);
|
||||
|
||||
//
|
||||
// Scoring screen
|
||||
//
|
||||
// The screen dimensions
|
||||
G4double screenHxy = 1.999*m;
|
||||
G4double screenHz = 1.*mm;
|
||||
G4double screenHxy = 1.999 * m;
|
||||
G4double screenHz = 1. * mm;
|
||||
|
||||
// Screen volume
|
||||
auto screenS = new G4Box("World", screenHxy, screenHxy, screenHz);
|
||||
auto screenS = new G4Box("World", screenHxy, screenHxy, screenHz);
|
||||
|
||||
auto screenLV = new G4LogicalVolume(screenS, air, "Screen");
|
||||
auto screenLV = new G4LogicalVolume(screenS, air, "Screen");
|
||||
|
||||
// The screen position
|
||||
posz += boxHz + screenHz;
|
||||
|
||||
new G4PVPlacement(
|
||||
nullptr, G4ThreeVector(0, 0, posz),
|
||||
screenLV, "Screen", worldLV, false, 0, checkOverlaps);
|
||||
new G4PVPlacement(nullptr, G4ThreeVector(0, 0, posz), screenLV, "Screen", worldLV, false, 0,
|
||||
checkOverlaps);
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
worldLV->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
|
||||
auto simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
|
||||
auto simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
boxLV->SetVisAttributes(simpleBoxVisAtt);
|
||||
screenLV->SetVisAttributes(simpleBoxVisAtt);
|
||||
|
||||
+10
-13
@@ -29,14 +29,14 @@
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Proton.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
@@ -48,8 +48,8 @@ PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
|
||||
// default particle kinematic
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
fParticleGun->SetParticleEnergy(1.*GeV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
|
||||
fParticleGun->SetParticleEnergy(1. * GeV);
|
||||
fParticleGun->SetParticleDefinition(G4Proton::Proton());
|
||||
}
|
||||
|
||||
@@ -75,28 +75,25 @@ void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
// Check that the world volume has box shape
|
||||
G4Box* worldBox = nullptr;
|
||||
if ( worldLV ) {
|
||||
if (worldLV) {
|
||||
worldBox = dynamic_cast<G4Box*>(worldLV->GetSolid());
|
||||
}
|
||||
|
||||
if ( worldBox ) {
|
||||
if (worldBox) {
|
||||
worldZHalfLength = worldBox->GetZHalfLength();
|
||||
}
|
||||
else {
|
||||
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);
|
||||
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()", "MyCode0002", JustWarning, msg);
|
||||
}
|
||||
|
||||
// Set gun position
|
||||
fParticleGun
|
||||
->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., -worldZHalfLength));
|
||||
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -29,16 +29,15 @@
|
||||
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction(const G4String& fileName)
|
||||
: fFileName(fileName)
|
||||
RunAction::RunAction(const G4String& fileName) : fFileName(fileName)
|
||||
{
|
||||
// Create analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
@@ -46,7 +45,7 @@ RunAction::RunAction(const G4String& fileName)
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetNtupleMerging(true);
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
// Note: merging ntuples is available only with Root output
|
||||
// Note: merging ntuples is available only with Root output
|
||||
|
||||
// Set default fileName
|
||||
analysisManager->SetFileName(fFileName);
|
||||
@@ -54,12 +53,12 @@ RunAction::RunAction(const G4String& fileName)
|
||||
// Create ntuple
|
||||
//
|
||||
analysisManager->CreateNtuple("Screen", "Screen hits");
|
||||
analysisManager->CreateNtupleIColumn("ID"); // column id = 0
|
||||
analysisManager->CreateNtupleIColumn("PDG"); // column id = 1
|
||||
analysisManager->CreateNtupleDColumn("Ekin"); // column id = 2
|
||||
analysisManager->CreateNtupleDColumn("Xpos"); // column id = 3
|
||||
analysisManager->CreateNtupleDColumn("Ypos"); // column id = 4
|
||||
analysisManager->CreateNtupleDColumn("time"); // column id = 5
|
||||
analysisManager->CreateNtupleIColumn("ID"); // column id = 0
|
||||
analysisManager->CreateNtupleIColumn("PDG"); // column id = 1
|
||||
analysisManager->CreateNtupleDColumn("Ekin"); // column id = 2
|
||||
analysisManager->CreateNtupleDColumn("Xpos"); // column id = 3
|
||||
analysisManager->CreateNtupleDColumn("Ypos"); // column id = 4
|
||||
analysisManager->CreateNtupleDColumn("time"); // column id = 5
|
||||
analysisManager->FinishNtuple();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,24 +30,20 @@
|
||||
|
||||
#include "ScreenSD.hh"
|
||||
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4AnalysisManager.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ScreenSD::ScreenSD(const G4String& name)
|
||||
: G4VSensitiveDetector(name)
|
||||
{}
|
||||
ScreenSD::ScreenSD(const G4String& name) : G4VSensitiveDetector(name) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ScreenSD::Initialize(G4HCofThisEvent* /*hce*/)
|
||||
{}
|
||||
void ScreenSD::Initialize(G4HCofThisEvent* /*hce*/) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -66,13 +62,13 @@ G4bool ScreenSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/)
|
||||
G4StepPoint* preStepPoint = step->GetPreStepPoint();
|
||||
|
||||
// Ekin:
|
||||
G4double Ekin = preStepPoint->GetKineticEnergy();
|
||||
G4double Ekin = preStepPoint->GetKineticEnergy();
|
||||
|
||||
// Obtain local coordinates:
|
||||
const G4VTouchable* touchable = preStepPoint->GetTouchable();
|
||||
G4ThreeVector globalPosition = preStepPoint->GetPosition();
|
||||
G4ThreeVector localPosition
|
||||
= touchable->GetHistory()->GetTopTransform().TransformPoint(globalPosition);
|
||||
G4ThreeVector localPosition =
|
||||
touchable->GetHistory()->GetTopTransform().TransformPoint(globalPosition);
|
||||
// // Example for obtaining the local direction:
|
||||
// G4ThreeVector globalDirection = preStepPoint->GetMomentumDirection();
|
||||
// G4ThreeVector localDirection
|
||||
@@ -85,10 +81,10 @@ G4bool ScreenSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/)
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->FillNtupleIColumn(0, ID);
|
||||
analysisManager->FillNtupleIColumn(1, pdgCode);
|
||||
analysisManager->FillNtupleDColumn(2, Ekin/MeV);
|
||||
analysisManager->FillNtupleDColumn(3, localPosition.x()/cm);
|
||||
analysisManager->FillNtupleDColumn(4, localPosition.y()/cm);
|
||||
analysisManager->FillNtupleDColumn(5, time/ns);
|
||||
analysisManager->FillNtupleDColumn(2, Ekin / MeV);
|
||||
analysisManager->FillNtupleDColumn(3, localPosition.x() / cm);
|
||||
analysisManager->FillNtupleDColumn(4, localPosition.y() / cm);
|
||||
analysisManager->FillNtupleDColumn(5, time / ns);
|
||||
analysisManager->AddNtupleRow();
|
||||
|
||||
return true;
|
||||
@@ -96,7 +92,6 @@ G4bool ScreenSD::ProcessHits(G4Step* step, G4TouchableHistory* /*history*/)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ScreenSD::EndOfEvent(G4HCofThisEvent* /*hce*/)
|
||||
{}
|
||||
void ScreenSD::EndOfEvent(G4HCofThisEvent* /*hce*/) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user