Import Geant4 10.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2018-12-07 15:15:39 +01:00
parent 6aa23be517
commit db49709b53
11370 changed files with 187480 additions and 160142 deletions
@@ -29,8 +29,6 @@
#include "F01ActionInitialization.hh"
#include "F01PrimaryGeneratorAction.hh"
#include "F01RunAction.hh"
#include "F01EventAction.hh"
#include "F01SteppingVerbose.hh"
#include "F01DetectorConstruction.hh"
@@ -52,7 +50,6 @@ F01ActionInitialization::~F01ActionInitialization()
void F01ActionInitialization::BuildForMaster() const
{
SetUserAction(new F01RunAction());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -60,11 +57,6 @@ void F01ActionInitialization::BuildForMaster() const
void F01ActionInitialization::Build() const
{
SetUserAction(new F01PrimaryGeneratorAction(fDetConstruction));
F01RunAction* runAction = new F01RunAction();
SetUserAction(runAction);
F01EventAction* eventAction = new F01EventAction(runAction);
SetUserAction(eventAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01CalorHit class
//
//
// $Id: F01CalorHit.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01CalorimeterSD class
//
//
// $Id: F01CalorimeterSD.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01DetectorConstruction class
//
//
// $Id: F01DetectorConstruction.cc 101664 2016-11-21 09:10:32Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -395,7 +394,8 @@ void F01DetectorConstruction::ConstructSDandField()
// Construct the field creator - this will register the field it creates
if (!fEmFieldSetup.Get()) {
F01FieldSetup* fieldSetup
= new F01FieldSetup(G4ThreeVector( 3.3*tesla, 0.0, 0.0 ) );
= new F01FieldSetup(G4ThreeVector( 3.3*tesla, 0.0, 0.0 ),
fUseFSALstepper );
G4AutoDelete::Register(fieldSetup); // Kernel will delete the F01FieldSetup
fEmFieldSetup.Put(fieldSetup);
}
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01DetectorMessenger class
//
//
// $Id: F01DetectorMessenger.cc 77115 2013-11-21 15:06:37Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -1,79 +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 field/field01/src/F01EventAction.cc
/// \brief Implementation of the F01EventAction class
//
//
// $Id: F01EventAction.cc 92496 2015-09-02 07:22:25Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01EventAction.hh"
#include "F01RunAction.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01EventAction::F01EventAction(F01RunAction* action)
: G4UserEventAction(),
fRunAction(action)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01EventAction::~F01EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01EventAction::BeginOfEventAction(const G4Event*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01EventAction::EndOfEventAction(const G4Event* evt)
{
// save rndm status
if (fRunAction->GetRndmFreq() == 2)
{
G4Random::saveEngineStatus("endOfEvent.rndm");
G4int evtNb = evt->GetEventID();
G4int printProgress = G4RunManager::GetRunManager()->GetPrintProgress();
if (evtNb%printProgress == 0)
{
G4cout << "\n---> End of Event: " << evtNb << G4endl;
G4Random::showEngineStatus();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01FieldMessenger class
//
//
// $Id: F01FieldMessenger.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -38,6 +37,7 @@
#include "F01FieldSetup.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -47,6 +47,7 @@ F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
fEMfieldSetup(fieldSetup),
fFieldDir(0),
fStepperCmd(0),
fMagFieldZCmd(0),
fMagFieldCmd(0),
fMinStepCmd(0),
fUpdateCmd(0)
@@ -66,10 +67,16 @@ F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
fUpdateCmd->AvailableForStates(G4State_Idle);
fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
fMagFieldZCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
fMagFieldZCmd->SetGuidance("Define magnetic field.");
fMagFieldZCmd->SetGuidance("Magnetic field will be in Z direction.");
fMagFieldZCmd->SetParameterName("Bz",false,false);
fMagFieldZCmd->SetDefaultUnit("tesla");
fMagFieldZCmd->AvailableForStates(G4State_Idle);
fMagFieldCmd = new G4UIcmdWith3VectorAndUnit("/field/setField",this);
fMagFieldCmd->SetGuidance("Define magnetic field.");
fMagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
fMagFieldCmd->SetParameterName("Bz",false,false);
fMagFieldCmd->SetParameterName("Bx", "By", "Bz" ,false,false);
fMagFieldCmd->SetDefaultUnit("tesla");
fMagFieldCmd->AvailableForStates(G4State_Idle);
@@ -86,6 +93,7 @@ F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
F01FieldMessenger::~F01FieldMessenger()
{
delete fStepperCmd;
delete fMagFieldZCmd;
delete fMagFieldCmd;
delete fMinStepCmd;
delete fFieldDir;
@@ -100,8 +108,10 @@ void F01FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
fEMfieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
if( command == fUpdateCmd )
fEMfieldSetup->CreateStepperAndChordFinder();
if( command == fMagFieldZCmd )
fEMfieldSetup->SetFieldZValue(fMagFieldZCmd->GetNewDoubleValue(newValue));
if( command == fMagFieldCmd )
fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNewDoubleValue(newValue));
fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNew3VectorValue(newValue));
if( command == fMinStepCmd )
fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
}
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01FieldSetup class
//
//
// $Id: F01FieldSetup.cc 104350 2017-05-26 07:20:25Z gcosmo $
//
// User Field setup class implementation.
//
@@ -65,40 +64,62 @@
#include "G4BogackiShampine23.hh"
#include "G4BogackiShampine45.hh"
#include "G4DormandPrince745.hh"
#include "G4DormandPrinceRK56.hh"
#include "G4DormandPrinceRK78.hh"
#include "G4TsitourasRK45.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
enum EStepperNumber { kDormandPrince45 = 17, kBogackiShampine45= 45, kClassicalRK4 = 4,
kNystromRK4 = 13 /*soon 40*/,
kDormandPrince56 = 56, kBogackiShampine23= 23, kCashKarp = 8,
kDormandPrince78 = 78, kTsitouras45 = 145
} ;
// Constructors:
F01FieldSetup::F01FieldSetup(G4ThreeVector fieldVector)
: fFieldManager(0),
fChordFinder(0),
fEquation(0),
fMagneticField(new G4UniformMagField(fieldVector)),
fStepper(0),
F01FieldSetup::F01FieldSetup(G4ThreeVector fieldVector,
G4int stepperNum,
G4bool useFSALstepper )
: fMagneticField(new G4UniformMagField(fieldVector)),
fUseFSALstepper(useFSALstepper),
fStepperType(0),
fMinStep(0.),
fFieldMessenger(0)
fMinStep(0.)
{
G4cout << " F01FieldSetup: magnetic field set to Uniform( "
<< fieldVector << " ) " << G4endl;
if( stepperNum == -1000 )
{
fUseFSALstepper = useFSALstepper;
if( !useFSALstepper )
fStepperType= 17; // Use Dormand Prince (7) 4/5 as default stepper
else
fStepperType = 101;
}
else
{
fUseFSALstepper = ( stepperNum > 0 );
if( stepperNum > 0 )
fStepperType = stepperNum;
else
fStepperType = - stepperNum;
}
InitialiseAll();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldSetup::F01FieldSetup()
: fFieldManager(0),
fChordFinder(0),
fEquation(0),
fMagneticField(new G4UniformMagField(G4ThreeVector())),
fStepper(0),
fStepperType(0),
fMinStep(0.),
fFieldMessenger(0)
: fMagneticField(new G4UniformMagField(G4ThreeVector())),
fUseFSALstepper(false),
fStepperType(17), // Use Dormand Prince (7) 4/5 as default stepper
fMinStep(0.)
{
G4cout << " F01FieldSetup: magnetic field set to Uniform( 0.0, 0, 0 ) "
<< G4endl;
@@ -115,11 +136,20 @@ void F01FieldSetup::InitialiseAll()
fMinStep = 1.0*mm; // minimal step of 1 mm is default
fStepperType = 4; // ClassicalRK4 is default stepper
fFieldManager = G4TransportationManager::GetTransportationManager()
->GetFieldManager();
CreateStepperAndChordFinder();
if( fUseFSALstepper ) {
CreateFSALStepperAndChordFinder();
}
else
{
CreateStepperAndChordFinder();
}
G4cout << " 4. Updating Field Manager." << G4endl;
fFieldManager->SetChordFinder( fChordFinder );
fFieldManager->SetDetectorField(fMagneticField );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -164,6 +194,14 @@ void F01FieldSetup::SetStepper()
switch ( fStepperType )
{
// The new default in G4 and here ( since G4 10.4 Dec 2017 )
case 17:
case 457:
case 745:
fStepper = new G4DormandPrince745( fEquation );
G4cout<<"G4DormandPrince745 Stepper is chosen"<<G4endl;
break;
case 0:
fStepper = new G4ExplicitEuler( fEquation );
G4cout<<"G4ExplicitEuler is chosen."<<G4endl;
@@ -217,6 +255,7 @@ void F01FieldSetup::SetStepper()
G4cout<<"G4ConstRK4 Stepper is chosen"<<G4endl;
break;
case 13:
case 40:
fStepper = new G4NystromRK4( fEquation );
G4cout<<" G4NystromRK4 Stepper is chosen"<<G4endl;
break;
@@ -225,58 +264,142 @@ void F01FieldSetup::SetStepper()
fStepper = new G4BogackiShampine23( fEquation );
G4cout<<"G4BogackiShampine23 Stepper is chosen"<<G4endl;
break;
// Other optimised 4/5th order embedded drivers
case 15:
case 45:
fStepper = new G4BogackiShampine45( fEquation );
G4cout<<"G4BogackiShampine45 Stepper is chosen"<<G4endl;
break;
case 457:
case 745:
fStepper = new G4DormandPrince745( fEquation );
G4cout<<"G4DormandPrince745 Stepper is chosen"<<G4endl;
// case 145:
case kTsitouras45:
fStepper = new G4TsitourasRK45( fEquation );
G4cout<<"G4TsitourasRK45 Stepper is chosen"<<G4endl;
break;
// Higher order embedded drivers - for very smooth fields
case 56:
fStepper = new G4DormandPrinceRK56( fEquation );
G4cout<<"G4DormandPrinceRK56 Stepper is chosen"<<G4endl;
break;
case 78:
fStepper = new G4DormandPrinceRK78( fEquation );
G4cout<<"G4DormandPrinceRK78 Stepper is chosen"<<G4endl;
break;
default:
fStepper = new G4ClassicalRK4( fEquation );
G4cout<<"G4ClassicalRK4 Stepper (default) is chosen"<<G4endl;
// fStepper = new G4DormandPrince745( fEquation );
// G4cout<<"G4DormandPrince745 (default) Stepper is chosen"<<G4endl;
// fStepper = new G4ClassicalRK4( fEquation );
// G4cout<<"G4ClassicalRK4 Stepper (default) is chosen"<<G4endl;
fStepper = new G4DormandPrince745( fEquation );
G4cout<<"G4DormandPrince745 (default) Stepper is chosen"<<G4endl;
break;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::SetFieldValue(G4double fieldStrength)
#include "G4VIntegrationDriver.hh"
#include "G4FSALIntegrationDriver.hh"
#include "G4RK547FEq1.hh"
#include "G4RK547FEq2.hh"
#include "G4RK547FEq3.hh"
G4VIntegrationDriver*
F01FieldSetup::CreateFSALStepperAndDriver()
{
// using FsalStepperType = G4RK547FEq1;
const char *methodName= "F01FieldSetup::CreateFSALStepperAndDriver()";
if (fStepper) delete fStepper;
fStepper = nullptr;
G4cout << " F01FieldSetup::CreateFSALStepperAndDriver() called. " << G4endl;
G4cout << " 1. Creating Stepper." << G4endl;
// auto fsalStepper = new FsalStepperType( fEquation );
G4RK547FEq1* stepper1 = nullptr;
G4RK547FEq2* stepper2 = nullptr;
G4RK547FEq3* stepper3 = nullptr;
G4cout << " 2. Creating FSAL Driver." << G4endl;
G4VIntegrationDriver* fsalDriver = nullptr;
switch ( fStepperType )
{
case 1:
case 101:
stepper1 = new G4RK547FEq1( fEquation );
fsalDriver = new G4FSALIntegrationDriver<G4RK547FEq1>( fMinStep, stepper1 );
G4cout << " Stepper type '1' is G4RK547FEq1 stepper (in FSAL mode) with FSAL driver. "
<< G4endl;
fStepper = stepper1;
stepper1 = nullptr;
break;
case 2:
case 102:
stepper2= new G4RK547FEq2( fEquation );
fsalDriver = new G4FSALIntegrationDriver<G4RK547FEq2>( fMinStep, stepper2 );
G4cout << " Stepper type '2' is G4RK547FEq2 stepper (in FSAL mode) with FSAL driver. "
<< G4endl;
fStepper = stepper2;
stepper2 = nullptr;
break;
case 3:
case 103:
stepper3 = new G4RK547FEq3( fEquation );
fsalDriver = new G4FSALIntegrationDriver<G4RK547FEq3>( fMinStep, stepper3 );
G4cout << " Stepper type '3' is G4RK547FEq3 stepper (in FSAL mode) with FSAL driver. "
<< G4endl;
fStepper = stepper3;
stepper3 = nullptr;
break;
default:
G4cout << " Warning from " << methodName << " : stepperType (= "
<< fStepperType << " ) is unknown. " << G4endl
<< " Using value '1' instead - i.e. G4RK547FEq1 stepper. "
<< G4endl;
stepper1 = new G4RK547FEq1( fEquation );
fsalDriver = new G4FSALIntegrationDriver<G4RK547FEq1>( fMinStep, stepper1 );
fStepper = stepper1;
stepper1 = nullptr;
break;
}
delete stepper1; stepper1 = nullptr;
delete stepper2; stepper2 = nullptr;
delete stepper3; stepper3 = nullptr;
if( fsalDriver )
fStepper = fsalDriver->GetStepper();
return fsalDriver;
}
void F01FieldSetup::CreateFSALStepperAndChordFinder()
{
// using FsalStepperType = G4DormandPrince745; // eventually ?
delete fChordFinder;
fChordFinder= nullptr;
G4cout << " F01FieldSetup::CreateFSALStepperAndChordFinder() called. " << G4endl;
auto FSALdriver= CreateFSALStepperAndDriver();
fDriver = FSALdriver;
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl;
G4cout << " 3. Creating ChordFinder." << G4endl;
fChordFinder = new G4ChordFinder( FSALdriver ); // ( fMagneticField, fMinStep, fStepper );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::SetFieldZValue(G4double fieldStrength)
{
// Set the value of the Global Field to fieldValue along Z
#ifdef G4VERBOSE
G4cout << "Setting Field strength to "
<< fieldStrength / gauss << " Gauss."; // << G4endl;
#endif
G4ThreeVector fieldSetVec(0.0, 0.0, fieldStrength);
this->SetFieldValue( fieldSetVec );
#ifdef G4VERBOSE
G4double fieldValue[6], position[4];
position[0] = position[1] = position[2] = position[3] = 0.0;
if ( fieldStrength != 0.0 ) {
fMagneticField->GetFieldValue( position, fieldValue);
G4ThreeVector fieldVec(fieldValue[0], fieldValue[1], fieldValue[2]);
// G4cout << " fMagneticField is now " << fMagneticField
G4cout << " Magnetic field vector is "
<< fieldVec / gauss << " G " << G4endl;
} else {
if ( fMagneticField == 0 )
G4cout << " Magnetic field pointer is null." << G4endl;
else
G4Exception("F01FieldSetup::SetFieldValue(double)",
"IncorrectForZeroField",
FatalException,
"fMagneticField ptr should be set to 0 for no field.");
}
#endif
SetFieldValue(G4ThreeVector(0, 0, fieldStrength));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -287,12 +410,20 @@ void F01FieldSetup::SetFieldValue(G4ThreeVector fieldVector)
if (fMagneticField) delete fMagneticField;
#ifdef G4VERBOSE
G4cout << "Setting Field strength to "
<< fieldVector / gauss << " Gauss." << G4endl;
#endif
if (fieldVector != G4ThreeVector(0.,0.,0.))
{
fMagneticField = new G4UniformMagField(fieldVector);
}
else
{
#ifdef G4VERBOSE
G4cout << " Magnetic field pointer is null." << G4endl;
#endif
// If the new field's value is Zero, signal it as below
// so that it is not used for propagation.
fMagneticField = 0;
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01PrimaryGeneratorAction class
//
//
// $Id: F01PrimaryGeneratorAction.cc 77881 2013-11-29 08:37:53Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01PrimaryGeneratorMessenger class
//
//
// $Id: F01PrimaryGeneratorMessenger.cc 77881 2013-11-29 08:37:53Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,65 +23,111 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01RunAction.cc
/// \brief Implementation of the F01RunAction class
//
//
// $Id: F01RunAction.cc 110139 2018-05-16 07:33:34Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01RunAction.hh"
#include "F01RunMessenger.hh"
#include "globals.hh"
#include "G4SystemOfUnits.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "Randomize.hh"
#include "G4ParticleDefinition.hh"
#include "G4Electron.hh"
#include "G4ProcessManager.hh"
#include "G4Transportation.hh"
#include "G4CoupledTransportation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01RunAction::F01RunAction()
: G4UserRunAction(),
fMessenger(0),
fSaveRndm(0)
{
fMessenger = new F01RunMessenger(this);
F01RunAction::F01RunAction() {
theWarningEnergy = 1.0 * CLHEP::kiloelectronvolt; // Arbitrary
theImportantEnergy = 10.0 * CLHEP::kiloelectronvolt; // Arbitrary
theNumberOfTrials = 15; // Arbitrary
// Applications should determine these thresholds according to
// - physics requirements, and
// - the computing cost of continuing integration for looping tracks
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01RunAction::~F01RunAction() {}
F01RunAction::~F01RunAction()
{
delete fMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void F01RunAction::BeginOfRunAction( const G4Run* aRun ) {
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
G4cout << " Calling F01RunAction::ChangeLooperParameters() " << G4endl;
ChangeLooperParameters( G4Electron::Definition() );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void F01RunAction::BeginOfRunAction(const G4Run*)
void F01RunAction::
ChangeLooperParameters(const G4ParticleDefinition* particleDef )
{
// save Rndm status
if (fSaveRndm > 0)
{
G4Random::showEngineStatus();
G4Random::saveEngineStatus("beginOfRun.rndm");
if( particleDef == nullptr )
particleDef = G4Electron::Definition();
auto transportPair= findTransportation( particleDef );
auto transport = transportPair.first;
auto coupledTransport = transportPair.second;
if( transport != nullptr )
{
// Change the values of the looping particle parameters of Transportation
if( theWarningEnergy >= 0.0 )
transport->SetThresholdWarningEnergy( theWarningEnergy );
if( theImportantEnergy >= 0.0 )
transport->SetThresholdImportantEnergy( theImportantEnergy );
if( theNumberOfTrials > 0 )
transport->SetThresholdTrials( theNumberOfTrials );
}
else if( coupledTransport != nullptr )
{
// Change the values for Coupled Transport
if( theWarningEnergy >= 0.0 )
coupledTransport->SetThresholdWarningEnergy( theWarningEnergy );
if( theImportantEnergy >= 0.0 )
coupledTransport->SetThresholdImportantEnergy( theImportantEnergy );
if( theNumberOfTrials > 0 )
coupledTransport->SetThresholdTrials( theNumberOfTrials );
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void F01RunAction::EndOfRunAction(const G4Run*)
{
// save Rndm status
void F01RunAction::EndOfRunAction( const G4Run* ) {
if( theVerboseLevel > 1 )
G4cout << G4endl << G4endl
<< " ########### Track Statistics for Transportation process(es) "
<< " ########### " << G4endl
<< " ############################################## "
<< " ####################### " << G4endl << G4endl;
if (fSaveRndm == 1)
{
G4Random::showEngineStatus();
G4Random::saveEngineStatus("endOfRun.rndm");
}
auto transportPair= findTransportation( G4Electron::Definition() );
auto transport = transportPair.first;
auto coupledTransport = transportPair.second;
if( transport) { transport->PrintStatistics(G4cout); }
else if( coupledTransport) { coupledTransport->PrintStatistics(G4cout); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
std::pair<G4Transportation*, G4CoupledTransportation*>
F01RunAction::findTransportation( const G4ParticleDefinition* particleDef,
bool reportError )
{
const auto *partPM= particleDef->GetProcessManager();
G4VProcess* partTransport = partPM->GetProcess("Transportation");
auto transport= dynamic_cast<G4Transportation*>(partTransport);
partTransport = partPM->GetProcess("CoupledTransportation");
auto coupledTransport=
dynamic_cast<G4CoupledTransportation*>(partTransport);
if( reportError && !transport && !coupledTransport )
{
G4cerr << "Unable to find Transportation process for particle type "
<< particleDef->GetParticleName()
<< " ( PDG code = " << particleDef->GetPDGEncoding() << " ) "
<< G4endl;
}
return
std::make_pair( transport, coupledTransport );
// <G4Transportation*, G4CoupledTransportation*>
}
@@ -1,96 +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 field/field01/src/F01RunMessenger.cc
/// \brief Implementation of the F01RunMessenger class
//
//
// $Id: F01RunMessenger.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01RunMessenger.hh"
#include "F01RunAction.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01RunMessenger::F01RunMessenger(F01RunAction* action)
: G4UImessenger(),
fRunAction(action),
fRndmDir(0),
fRndmSaveCmd(0),
fRndmReadCmd(0)
{
fRndmDir = new G4UIdirectory("/rndm/");
fRndmDir->SetGuidance("Rndm status control.");
fRndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
fRndmSaveCmd->
SetGuidance("set frequency to save rndm status on external files.");
fRndmSaveCmd->SetGuidance("freq = 0 not saved");
fRndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
fRndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
fRndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
fRndmSaveCmd->SetParameterName("frequency",false);
fRndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
fRndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
fRndmReadCmd->SetGuidance("get rndm status from an external file.");
fRndmReadCmd->SetParameterName("fileName",true);
fRndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
fRndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01RunMessenger::~F01RunMessenger()
{
delete fRndmSaveCmd;
delete fRndmReadCmd;
delete fRndmDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
if (command == fRndmSaveCmd)
fRunAction->SetRndmFreq(fRndmSaveCmd->GetNewIntValue(newValues));
if (command == fRndmReadCmd)
{G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
G4Random::restoreEngineStatus(newValues);
G4Random::showEngineStatus();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,7 +27,6 @@
/// \brief Implementation of the F01SteppingVerbose class
//
//
// $Id: F01SteppingVerbose.cc 77483 2013-11-25 10:10:57Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......