Import Geant4 10.1.0 source tree
This commit is contained in:
+34
-31
@@ -23,52 +23,55 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file electromagnetic/TestEm16/src/EventAction.cc
|
||||
/// \brief Implementation of the EventAction class
|
||||
// $Id: ActionInitialization.cc 76346 2013-11-08 15:48:19Z maire $
|
||||
//
|
||||
// $Id: EventAction.cc 67268 2013-02-13 11:38:40Z ihrivnac $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
/// \file ActionInitialization.cc
|
||||
/// \brief Implementation of the ActionInitialization class
|
||||
|
||||
#include "EventAction.hh"
|
||||
|
||||
#include "EventActionMessenger.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
#include "SteppingVerbose.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction()
|
||||
:G4UserEventAction(),fDrawFlag("none"),fPrintModulo(10000),fEventMessenger(0)
|
||||
ActionInitialization::ActionInitialization(DetectorConstruction* det)
|
||||
: G4VUserActionInitialization(),fDetector(det)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
fEventMessenger = new EventActionMessenger(this);
|
||||
SetUserAction(new RunAction());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::~EventAction()
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
delete fEventMessenger;
|
||||
|
||||
PrimaryGeneratorAction* prim = new PrimaryGeneratorAction(fDetector);
|
||||
SetUserAction(prim);
|
||||
|
||||
RunAction* run = new RunAction();
|
||||
SetUserAction(run);
|
||||
|
||||
SetUserAction(new SteppingAction());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
G4VSteppingVerbose* ActionInitialization::InitializeSteppingVerbose() const
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
|
||||
//printing survey
|
||||
if (evtNb%fPrintModulo == 0)
|
||||
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
|
||||
}
|
||||
return new SteppingVerbose();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventAction::EndOfEventAction(const G4Event*)
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file electromagnetic/TestEm16/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
// $Id: DetectorConstruction.cc 67268 2013-02-13 11:38:40Z ihrivnac $
|
||||
// $Id: DetectorConstruction.cc 84365 2014-10-14 12:43:52Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -38,14 +38,15 @@
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4UniformMagField.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
#include "G4UserLimits.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
@@ -54,7 +55,7 @@
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
:G4VUserDetectorConstruction(),
|
||||
fBox(0), fBoxSize(500*m), fMaterial(0), fMagField(0),
|
||||
fLBox(0), fBox(0), fBoxSize(500*m), fMaterial(0),
|
||||
fUserLimits(0), fDetectorMessenger(0)
|
||||
{
|
||||
DefineMaterials();
|
||||
@@ -91,7 +92,7 @@ void DetectorConstruction::DefineMaterials()
|
||||
|
||||
// define a vacuum with a restgas pressure typical for accelerators
|
||||
G4double const Torr = atmosphere/760.; // 1 Torr
|
||||
G4double pressure = 10e-9*Torr, temperature = 296.150*kelvin; // 23 Celsius
|
||||
G4double pressure = 10e-9*Torr, temperature = 296.150*kelvin; // 23 Celsius
|
||||
new G4Material("Vacuum", z=7., a=14.01*g/mole, density= 1.516784e-11*kg/m3,
|
||||
kStateGas, temperature, pressure);
|
||||
|
||||
@@ -111,18 +112,17 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
|
||||
sBox = new G4Box("Container", //its name
|
||||
fBoxSize/2,fBoxSize/2,fBoxSize/2); //its dimensions
|
||||
|
||||
G4LogicalVolume*
|
||||
lBox = new G4LogicalVolume(sBox, //its shape
|
||||
fLBox = new G4LogicalVolume(sBox, //its shape
|
||||
fMaterial, //its material
|
||||
fMaterial->GetName()); //its name
|
||||
|
||||
lBox->SetUserLimits(fUserLimits);
|
||||
fLBox->SetUserLimits(fUserLimits);
|
||||
|
||||
fBox = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
lBox, //its logical volume
|
||||
fLBox, //its logical volume
|
||||
fMaterial->GetName(), //its name
|
||||
0, //its mother volume
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
@@ -148,7 +148,11 @@ void DetectorConstruction::SetMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial) fMaterial = pttoMaterial;
|
||||
if (pttoMaterial) {
|
||||
fMaterial = pttoMaterial;
|
||||
if ( fLBox ) fLBox->SetMaterial(fMaterial);
|
||||
}
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -156,31 +160,27 @@ void DetectorConstruction::SetMaterial(G4String materialChoice)
|
||||
void DetectorConstruction::SetSize(G4double value)
|
||||
{
|
||||
fBoxSize = value;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4GlobalMagFieldMessenger.hh"
|
||||
#include "G4AutoDelete.hh"
|
||||
|
||||
void DetectorConstruction::SetMagField(G4double fieldValue)
|
||||
void DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
//apply a global uniform magnetic field along Z axis
|
||||
G4FieldManager* fieldMgr
|
||||
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
|
||||
if (fMagField) delete fMagField; //delete the existing magn field
|
||||
|
||||
if (fieldValue!=0.) // create a new one if non null
|
||||
{
|
||||
fMagField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
|
||||
fieldMgr->SetDetectorField(fMagField);
|
||||
fieldMgr->CreateChordFinder(fMagField);
|
||||
}
|
||||
else
|
||||
{
|
||||
fMagField = 0;
|
||||
fieldMgr->SetDetectorField(fMagField);
|
||||
if ( fFieldMessenger.Get() == 0 ) {
|
||||
// Create global magnetic field messenger.
|
||||
// Uniform magnetic field is then created automatically if
|
||||
// the field value is not zero.
|
||||
G4ThreeVector fieldValue = G4ThreeVector();
|
||||
G4GlobalMagFieldMessenger* msg =
|
||||
new G4GlobalMagFieldMessenger(fieldValue);
|
||||
//msg->SetVerboseLevel(1);
|
||||
G4AutoDelete::Register(msg);
|
||||
fFieldMessenger.Put( msg );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,12 +216,3 @@ void DetectorConstruction::SetMaxStepLength(G4double val)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
void DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file electromagnetic/TestEm16/src/DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
//
|
||||
// $Id: DetectorMessenger.cc 68208 2013-03-18 18:17:16Z maire $
|
||||
// $Id: DetectorMessenger.cc 84365 2014-10-14 12:43:52Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -48,10 +48,8 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
fTrackdir(0),
|
||||
fMaterCmd(0),
|
||||
fSizeCmd(0),
|
||||
fMagFieldCmd(0),
|
||||
fMaxStepCmd(0),
|
||||
fMaxStepLength(0),
|
||||
fUpdateCmd(0)
|
||||
fMaxStepLength(0)
|
||||
{
|
||||
fTestemDir = new G4UIdirectory("/testem/");
|
||||
fTestemDir->SetGuidance(" detector control.");
|
||||
@@ -71,19 +69,6 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
fSizeCmd->SetUnitCategory("Length");
|
||||
fSizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setField",this);
|
||||
fMagFieldCmd->SetGuidance("Define magnetic field.");
|
||||
fMagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
|
||||
fMagFieldCmd->SetParameterName("Bz",false);
|
||||
fMagFieldCmd->SetUnitCategory("Magnetic flux density");
|
||||
fMagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fUpdateCmd = new G4UIcmdWithoutParameter("/testem/det/update",this);
|
||||
fUpdateCmd->SetGuidance("Update calorimeter geometry.");
|
||||
fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
fUpdateCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
fMaxStepCmd = new G4UIcmdWithADoubleAndUnit("/testem/tracking/stepMax",this);
|
||||
fMaxStepCmd->SetGuidance("Set max allowed step size");
|
||||
fMaxStepCmd->SetParameterName("Size",false);
|
||||
@@ -93,7 +78,8 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
|
||||
fTrackdir = new G4UIdirectory("/testem/tracking/");
|
||||
fTrackdir->SetGuidance("step length");
|
||||
fMaxStepLength= new G4UIcmdWithADoubleAndUnit("/testem/tracking/setMaxStepLength",this);
|
||||
fMaxStepLength =
|
||||
new G4UIcmdWithADoubleAndUnit("/testem/tracking/setMaxStepLength",this);
|
||||
fMaxStepLength->SetGuidance("Set the maximum length of tracking step");
|
||||
fMaxStepLength->SetGuidance("when integrating magnetic field line.");
|
||||
fMaxStepLength->SetParameterName("Size",false);
|
||||
@@ -108,8 +94,6 @@ DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete fMaterCmd;
|
||||
delete fSizeCmd;
|
||||
delete fMagFieldCmd;
|
||||
delete fUpdateCmd;
|
||||
delete fMaxStepCmd;
|
||||
delete fMaxStepLength;
|
||||
delete fDetDir;
|
||||
@@ -127,12 +111,6 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
if( command == fSizeCmd )
|
||||
{ fDetector->SetSize(fSizeCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fMagFieldCmd )
|
||||
{ fDetector->SetMagField(fMagFieldCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fUpdateCmd )
|
||||
{ fDetector->UpdateGeometry(); }
|
||||
|
||||
if( command == fMaxStepCmd )
|
||||
{ fDetector->SetMaxStepSize(fMaxStepCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file electromagnetic/TestEm16/src/PhysicsList.cc
|
||||
/// \brief Implementation of the PhysicsList class
|
||||
//
|
||||
// $Id: PhysicsList.cc 67268 2013-02-13 11:38:40Z ihrivnac $
|
||||
// $Id: PhysicsList.cc 84365 2014-10-14 12:43:52Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -54,12 +54,18 @@
|
||||
#include "G4MuBremsstrahlung.hh"
|
||||
#include "G4MuPairProduction.hh"
|
||||
|
||||
#include "G4hMultipleScattering.hh"
|
||||
#include "G4hIonisation.hh"
|
||||
#include "G4hBremsstrahlung.hh"
|
||||
#include "G4hPairProduction.hh"
|
||||
|
||||
#include "G4SynchrotronRadiation.hh"
|
||||
#include "G4SynchrotronRadiationInMat.hh"
|
||||
|
||||
#include "G4StepLimiter.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4AutoDelete.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -67,7 +73,7 @@ PhysicsList::PhysicsList()
|
||||
: G4VUserPhysicsList(),
|
||||
fMess(0)
|
||||
{
|
||||
defaultCutValue = 1.*km;
|
||||
SetDefaultCutValue(1.*km);
|
||||
|
||||
fSRType = true;
|
||||
fMess = new PhysicsListMessenger(this);
|
||||
@@ -91,6 +97,22 @@ void PhysicsList::ConstructParticle()
|
||||
|
||||
ConstructBosons();
|
||||
ConstructLeptons();
|
||||
|
||||
// charged mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
|
||||
// charged baryons
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
|
||||
// ions
|
||||
//G4Deuteron::DeuteronDefinition();
|
||||
//G4Triton::TritonDefinition();
|
||||
//G4Alpha::AlphaDefinition();
|
||||
G4GenericIon::GenericIonDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -131,10 +153,11 @@ void PhysicsList::ConstructProcess()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
G4SynchrotronRadiation* fSync = new G4SynchrotronRadiation();
|
||||
G4AutoDelete::Register(fSync);
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
@@ -153,9 +176,9 @@ void PhysicsList::ConstructEM()
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
if (fSRType) {
|
||||
pmanager->AddProcess(new G4SynchrotronRadiation, -1,-1, 4);
|
||||
pmanager->AddProcess(fSync, -1,-1, 4);
|
||||
} else {
|
||||
pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 4);
|
||||
pmanager->AddProcess(new G4SynchrotronRadiationInMat,-1,-1, 4);
|
||||
}
|
||||
pmanager->AddProcess(new G4StepLimiter, -1,-1, 5);
|
||||
|
||||
@@ -166,9 +189,9 @@ void PhysicsList::ConstructEM()
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4);
|
||||
if (fSRType) {
|
||||
pmanager->AddProcess(new G4SynchrotronRadiation, -1,-1, 5);
|
||||
pmanager->AddProcess(fSync, -1,-1, 5);
|
||||
} else {
|
||||
pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 5);
|
||||
pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1,-1, 5);
|
||||
}
|
||||
pmanager->AddProcess(new G4StepLimiter, -1,-1, 6);
|
||||
|
||||
@@ -179,7 +202,21 @@ void PhysicsList::ConstructEM()
|
||||
pmanager->AddProcess(new G4MuIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4);
|
||||
|
||||
pmanager->AddProcess(fSync, -1,-1, 5);
|
||||
pmanager->AddProcess(new G4StepLimiter, -1,-1, 6);
|
||||
|
||||
} else if( particleName == "proton") {
|
||||
//proton
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4hPairProduction, -1, 4, 4);
|
||||
pmanager->AddProcess(fSync, -1,-1, 5);
|
||||
pmanager->AddProcess(new G4StepLimiter, -1,-1, 6);
|
||||
}
|
||||
else if (particle->GetPDGCharge() != 0.0 && !particle->IsShortLived())
|
||||
{
|
||||
pmanager->AddProcess(fSync,-1,-1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,20 +243,3 @@ void PhysicsList::ConstructGeneral()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(defaultCutValue, "gamma");
|
||||
SetCutValue(defaultCutValue, "e-");
|
||||
SetCutValue(defaultCutValue, "e+");
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
+53
-46
@@ -23,66 +23,73 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file electromagnetic/TestEm16/src/EventActionMessenger.cc
|
||||
/// \brief Implementation of the EventActionMessenger class
|
||||
//
|
||||
// $Id: EventActionMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
|
||||
/// \file electromagnetic/TestEm11/src/Run.cc
|
||||
/// \brief Implementation of the Run class
|
||||
//
|
||||
// $Id: Run.cc 71376 2013-06-14 07:44:50Z maire $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "EventActionMessenger.hh"
|
||||
#include "Run.hh"
|
||||
|
||||
#include "EventAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventActionMessenger::EventActionMessenger(EventAction* EvAct)
|
||||
:G4UImessenger(),fEventAction(EvAct),
|
||||
fEventDir(0),
|
||||
fDrawCmd(0),
|
||||
fPrintCmd(0)
|
||||
Run::Run()
|
||||
: G4Run(),
|
||||
f_n_gam_sync(0),
|
||||
f_e_gam_sync(0.),
|
||||
f_e_gam_sync2(0.),
|
||||
f_e_gam_sync_max(0.),
|
||||
f_lam_gam_sync(0.)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Run::~Run()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Run::Merge(const G4Run* run)
|
||||
{
|
||||
fEventDir = new G4UIdirectory("/testem/event/");
|
||||
fEventDir->SetGuidance("event control");
|
||||
const Run* localRun = static_cast<const Run*>(run);
|
||||
|
||||
// accumulate sums
|
||||
//
|
||||
f_n_gam_sync += localRun->f_n_gam_sync;
|
||||
f_e_gam_sync += localRun->f_e_gam_sync;
|
||||
f_e_gam_sync2 += localRun->f_e_gam_sync2;
|
||||
f_e_gam_sync_max += localRun->f_e_gam_sync_max;
|
||||
f_lam_gam_sync += localRun->f_lam_gam_sync;
|
||||
|
||||
fDrawCmd = new G4UIcmdWithAString("/testem/event/drawTracks",this);
|
||||
fDrawCmd->SetGuidance("Draw the tracks in the event");
|
||||
fDrawCmd->SetGuidance(" Choice : none,charged, all");
|
||||
fDrawCmd->SetParameterName("choice",true);
|
||||
fDrawCmd->SetDefaultValue("all");
|
||||
fDrawCmd->SetCandidates("none charged all");
|
||||
fDrawCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
fPrintCmd = new G4UIcmdWithAnInteger("/testem/event/printModulo",this);
|
||||
fPrintCmd->SetGuidance("Print events modulo n");
|
||||
fPrintCmd->SetParameterName("EventNb",false);
|
||||
fPrintCmd->SetRange("EventNb>0");
|
||||
fPrintCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
G4Run::Merge(run);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventActionMessenger::~EventActionMessenger()
|
||||
void Run::EndOfRun()
|
||||
{
|
||||
delete fDrawCmd;
|
||||
delete fPrintCmd;
|
||||
delete fEventDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void EventActionMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if(command == fDrawCmd)
|
||||
{fEventAction->SetDrawFlag(newValue);}
|
||||
|
||||
if(command == fPrintCmd)
|
||||
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
|
||||
if (f_n_gam_sync > 0)
|
||||
{
|
||||
G4double Emean = f_e_gam_sync/f_n_gam_sync;
|
||||
G4double E_rms = std::sqrt(f_e_gam_sync2/f_n_gam_sync - Emean*Emean);
|
||||
G4cout
|
||||
<< "Summary for synchrotron radiation :" << '\n' << std::setprecision(4)
|
||||
<< " Number of photons = " << f_n_gam_sync << '\n'
|
||||
<< " Emean = " << Emean/keV << " +/- "
|
||||
<< E_rms/(keV * std::sqrt((G4double) f_n_gam_sync)) << " keV" << '\n'
|
||||
<< " E_rms = " << G4BestUnit(E_rms,"Energy") << '\n'
|
||||
<< " Energy Max / Mean = " << f_e_gam_sync_max / Emean << '\n'
|
||||
<< " MeanFreePath = " << G4BestUnit(f_lam_gam_sync/f_n_gam_sync,
|
||||
"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,20 +26,19 @@
|
||||
/// \file electromagnetic/TestEm16/src/RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
// $Id: RunAction.cc 67797 2013-03-08 09:52:18Z maire $
|
||||
// $Id: RunAction.cc 84365 2014-10-14 12:43:52Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "Run.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "HistoManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -47,11 +46,6 @@ RunAction::RunAction()
|
||||
: G4UserRunAction(),
|
||||
fHistoManager(0)
|
||||
{
|
||||
f_n_gam_sync = 0;
|
||||
f_e_gam_sync = 0;
|
||||
f_e_gam_sync2 = 0;
|
||||
f_e_gam_sync_max = 0;
|
||||
f_lam_gam_sync = 0;
|
||||
fHistoManager = new HistoManager();
|
||||
}
|
||||
|
||||
@@ -64,13 +58,19 @@ RunAction::~RunAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
G4Run* RunAction::GenerateRun()
|
||||
{
|
||||
fRun = new Run();
|
||||
return fRun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run*)
|
||||
{
|
||||
// save Rndm status
|
||||
////G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
if (isMaster) CLHEP::HepRandom::showEngineStatus();
|
||||
|
||||
//histograms
|
||||
//
|
||||
@@ -84,30 +84,18 @@ void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
if (f_n_gam_sync > 0)
|
||||
{
|
||||
G4double Emean = f_e_gam_sync/f_n_gam_sync;
|
||||
G4double E_rms = std::sqrt(f_e_gam_sync2/f_n_gam_sync - Emean*Emean);
|
||||
G4cout
|
||||
<< "Summary for synchrotron radiation :" << '\n' << std::setprecision(4)
|
||||
<< " Number of photons = " << f_n_gam_sync << '\n'
|
||||
<< " Emean = " << Emean/keV << " +/- "
|
||||
<< E_rms/(keV * std::sqrt((G4double) f_n_gam_sync)) << " keV" << '\n'
|
||||
<< " E_rms = " << G4BestUnit(E_rms,"Energy") << '\n'
|
||||
<< " Energy Max / Mean = " << f_e_gam_sync_max / Emean << '\n'
|
||||
<< " MeanFreePath = " << G4BestUnit(f_lam_gam_sync/f_n_gam_sync,"Length")
|
||||
<< G4endl;
|
||||
}
|
||||
// compute and print statistic
|
||||
if (isMaster) fRun->EndOfRun();
|
||||
|
||||
// show Rndm status
|
||||
CLHEP::HepRandom::showEngineStatus();
|
||||
if (isMaster) CLHEP::HepRandom::showEngineStatus();
|
||||
|
||||
//save histograms
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
if ( analysisManager->IsActive() ) {
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -26,13 +26,15 @@
|
||||
/// \file electromagnetic/TestEm16/src/SteppingAction.cc
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
//
|
||||
// $Id: SteppingAction.cc 67797 2013-03-08 09:52:18Z maire $
|
||||
// $Id: SteppingAction.cc 84365 2014-10-14 12:43:52Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "Run.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
@@ -43,8 +45,8 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
SteppingAction::SteppingAction(RunAction* RuAct)
|
||||
:G4UserSteppingAction(),fRunAction(RuAct)
|
||||
SteppingAction::SteppingAction()
|
||||
:G4UserSteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -56,7 +58,10 @@ SteppingAction::~SteppingAction()
|
||||
|
||||
void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
|
||||
Run* run = static_cast<Run*>(
|
||||
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
|
||||
const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
|
||||
if (process == 0) { return; }
|
||||
|
||||
static G4int iCalled=0;
|
||||
@@ -74,14 +79,14 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
if (lp)
|
||||
{
|
||||
G4double Egamma = (*secondary)[lp-1]->GetTotalEnergy();
|
||||
fRunAction->f_n_gam_sync++;
|
||||
fRunAction->f_e_gam_sync += Egamma;
|
||||
fRunAction->f_e_gam_sync2 += Egamma*Egamma;
|
||||
if (Egamma > fRunAction->f_e_gam_sync_max)
|
||||
run->f_n_gam_sync++;
|
||||
run->f_e_gam_sync += Egamma;
|
||||
run->f_e_gam_sync2 += Egamma*Egamma;
|
||||
if (Egamma > run->f_e_gam_sync_max)
|
||||
{
|
||||
fRunAction->f_e_gam_sync_max = Egamma;
|
||||
run->f_e_gam_sync_max = Egamma;
|
||||
}
|
||||
fRunAction->f_lam_gam_sync += aStep->GetStepLength();
|
||||
run->f_lam_gam_sync += aStep->GetStepLength();
|
||||
if (iCalled<nprint)
|
||||
{
|
||||
G4double Eelec = PrePoint->GetTotalEnergy();
|
||||
@@ -90,7 +95,8 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
G4bool IsGamma =
|
||||
((*secondary)[lp-1]->GetDefinition() == G4Gamma::Gamma());
|
||||
|
||||
G4cout << "UserSteppingAction processName=" << process->GetProcessName()
|
||||
G4cout << "UserSteppingAction processName="
|
||||
<< process->GetProcessName()
|
||||
<< " Step Length=" << std::setw(6)
|
||||
<< G4BestUnit(aStep->GetStepLength(),"Length")
|
||||
<< " Eelec=" << G4BestUnit(Eelec,"Energy")
|
||||
@@ -101,8 +107,8 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
<< " #secondaries lp=" << lp
|
||||
<< '\n';
|
||||
}
|
||||
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->FillH1(1,Egamma);
|
||||
|
||||
// power spectrum : gamma weighted with its energy
|
||||
|
||||
Reference in New Issue
Block a user