Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01CalorHit.cc
/// \brief Implementation of the F01CalorHit class
//
// $Id: F01CalorHit.cc,v 1.4 2006-06-29 17:16:21 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -39,10 +41,12 @@ G4Allocator<F01CalorHit> F01CalorHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01CalorHit::F01CalorHit()
{
EdepAbs = 0.; TrackLengthAbs = 0.;
EdepGap = 0.; TrackLengthGap = 0.;
}
: G4VHit(),
fEdepAbs(0.),
fTrackLengthAbs(0.),
fEdepGap(0.),
fTrackLengthGap(0.)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -54,16 +58,16 @@ F01CalorHit::~F01CalorHit()
F01CalorHit::F01CalorHit(const F01CalorHit& right)
: G4VHit()
{
EdepAbs = right.EdepAbs; TrackLengthAbs = right.TrackLengthAbs;
EdepGap = right.EdepGap; TrackLengthGap = right.TrackLengthGap;
fEdepAbs = right.fEdepAbs; fTrackLengthAbs = right.fTrackLengthAbs;
fEdepGap = right.fEdepGap; fTrackLengthGap = right.fTrackLengthGap;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const F01CalorHit& F01CalorHit::operator=(const F01CalorHit& right)
{
EdepAbs = right.EdepAbs; TrackLengthAbs = right.TrackLengthAbs;
EdepGap = right.EdepGap; TrackLengthGap = right.TrackLengthGap;
fEdepAbs = right.fEdepAbs; fTrackLengthAbs = right.fTrackLengthAbs;
fEdepGap = right.fEdepGap; fTrackLengthGap = right.fTrackLengthGap;
return *this;
}
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01CalorimeterSD.cc
/// \brief Implementation of the F01CalorimeterSD class
//
// $Id: F01CalorimeterSD.cc,v 1.6 2006-06-29 17:16:23 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -49,57 +51,59 @@
F01CalorimeterSD::F01CalorimeterSD(G4String name,
F01DetectorConstruction* det)
:G4VSensitiveDetector(name),Detector(det)
: G4VSensitiveDetector(name),
fCalCollection(0),
fDetector(det),
fHitID(new G4int[500])
{
collectionName.insert("CalCollection");
HitID = new G4int[500];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01CalorimeterSD::~F01CalorimeterSD()
{
delete [] HitID;
delete [] fHitID;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01CalorimeterSD::Initialize(G4HCofThisEvent*)
{
CalCollection = new F01CalorHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int j=0;j<1; j++) {HitID[j] = -1;};
fCalCollection = new F01CalorHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int j=0;j<1; j++) {fHitID[j] = -1;};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool F01CalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
G4bool F01CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
G4double edep = step->GetTotalEnergyDeposit();
G4double stepl = 0.;
stepl = aStep->GetStepLength();
stepl = step->GetStepLength();
if ((edep == 0.) && (stepl == 0.) ) return false;
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
= (G4TouchableHistory*)(step->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int F01Number = 0 ;
if (HitID[F01Number]==-1)
if (fHitID[F01Number]==-1)
{
F01CalorHit* calHit = new F01CalorHit();
if (physVol == Detector->GetAbsorber()) calHit->AddAbs(edep,stepl);
HitID[F01Number] = CalCollection->insert(calHit) - 1;
if (physVol == fDetector->GetAbsorber()) calHit->AddAbs(edep,stepl);
fHitID[F01Number] = fCalCollection->insert(calHit) - 1;
if (verboseLevel>0)
G4cout << " New Calorimeter Hit on F01: " << F01Number << G4endl;
}
else
{
if (physVol == Detector->GetAbsorber())
(*CalCollection)[HitID[F01Number]]->AddAbs(edep,stepl);
if (physVol == fDetector->GetAbsorber())
(*fCalCollection)[fHitID[F01Number]]->AddAbs(edep,stepl);
if (verboseLevel>0)
G4cout << " Energy added to F01: " << F01Number << G4endl;
}
@@ -108,12 +112,12 @@ G4bool F01CalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01CalorimeterSD::EndOfEvent(G4HCofThisEvent* HCE)
void F01CalorimeterSD::EndOfEvent(G4HCofThisEvent* hce)
{
static G4int HCID = -1;
if(HCID<0)
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
HCE->AddHitsCollection(HCID,CalCollection);
static G4int hcID = -1;
if (hcID<0)
{ hcID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
hce->AddHitsCollection(hcID,fCalCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,12 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01DetectorConstruction.cc
/// \brief Implementation of the F01DetectorConstruction class
//
// $Id: F01DetectorConstruction.cc,v 1.16 2009-11-05 01:07:41 gum Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F01DetectorConstruction.hh"
#include "F01DetectorMessenger.hh"
@@ -50,32 +55,34 @@
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
/////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01DetectorConstruction::F01DetectorConstruction()
: solidWorld(0), logicWorld(0), physiWorld(0),
solidAbsorber(0),logicAbsorber(0), physiAbsorber(0),
fEmFieldSetup(0), calorimeterSD(0),
AbsorberMaterial(0), worldchanged(false), WorldMaterial(0)
: fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
fSolidAbsorber(0),fLogicAbsorber(0), fPhysiAbsorber(0),
fEmFieldSetup(0), fDetectorMessenger(0), fCalorimeterSD(0),
fAbsorberMaterial(0), fAbsorberThickness(0.),fAbsorberRadius(0.),
fWorldChanged(false), fZAbsorber(0.), fZStartAbs(0.), fZEndAbs(0.),
fWorldMaterial(0), fWorldSizeR(0.), fWorldSizeZ(0.)
{
// default parameter values of the calorimeter
WorldSizeZ = 44000.*mm;
WorldSizeR = 22000.*mm;
fWorldSizeZ = 44000.*mm;
fWorldSizeR = 22000.*mm;
AbsorberThickness = 1.0*mm;
fAbsorberThickness = 1.0*mm;
AbsorberRadius = 20000.*mm;
fAbsorberRadius = 20000.*mm;
zAbsorber = 21990.0*mm ;
fZAbsorber = 21990.0*mm ;
// create commands for interactive definition of the calorimeter
detectorMessenger = new F01DetectorMessenger(this);
fDetectorMessenger = new F01DetectorMessenger(this);
// create materials
@@ -83,33 +90,26 @@ F01DetectorConstruction::F01DetectorConstruction()
}
//////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01DetectorConstruction::~F01DetectorConstruction()
{
delete detectorMessenger;
delete fDetectorMessenger;
if (fEmFieldSetup) delete fEmFieldSetup;
}
//////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* F01DetectorConstruction::Construct()
{
G4VPhysicalVolume* calorWorld= ConstructCalorimeter();
// Construct the field creator - this will register the field it creates
fEmFieldSetup= new F01FieldSetup( // G4ThreeVector(0.0, 0.0, 1.0*tesla) );
G4ThreeVector( 3.3*tesla, 0.0, 0.0 ) ) ;
fEmFieldSetup = new F01FieldSetup(G4ThreeVector( 3.3*tesla, 0.0, 0.0 ) ) ;
return calorWorld;
}
//////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::DefineMaterials()
{
@@ -222,15 +222,13 @@ void F01DetectorConstruction::DefineMaterials()
// default materials of the calorimeter
AbsorberMaterial = Air ; // Kr20CO2 ; // XeCO2CF4 ;
fAbsorberMaterial = Air ; // Kr20CO2 ; // XeCO2CF4 ;
WorldMaterial = Air ;
fWorldMaterial = Air ;
}
/////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter()
{
// complete the Calor parameters definition and Print
@@ -240,7 +238,7 @@ G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter()
// Cleanup old geometry
if (physiWorld)
if (fPhysiWorld)
{
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
@@ -250,75 +248,73 @@ G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter()
// World
solidWorld = new G4Tubs("World", // its name
0.,WorldSizeR,WorldSizeZ/2.,0.,twopi); // its size
fSolidWorld = new G4Tubs("World", // its name
0.,fWorldSizeR,fWorldSizeZ/2.,0.,twopi);// its size
logicWorld = new G4LogicalVolume(solidWorld, // its solid
WorldMaterial, // its material
"World"); // its name
fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid
fWorldMaterial, // its material
"World"); // its name
physiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
"World", // its name
logicWorld, // its logical volume
0, // its mother volume
false, // no boolean operation
0); // copy number
fPhysiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
"World", // its name
fLogicWorld, // its logical volume
0, // its mother volume
false, // no boolean operation
0); // copy number
// Absorber
if (AbsorberThickness > 0.)
if (fAbsorberThickness > 0.)
{
solidAbsorber = new G4Tubs("Absorber", 1.0*mm,
AbsorberRadius,
AbsorberThickness/2.,
fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm,
fAbsorberRadius,
fAbsorberThickness/2.,
0.0,twopi);
logicAbsorber = new G4LogicalVolume(solidAbsorber,
AbsorberMaterial,
"Absorber");
physiAbsorber = new G4PVPlacement(0,
G4ThreeVector(0.,0.,zAbsorber),
"Absorber",
logicAbsorber,
physiWorld,
false,
0);
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber,
fAbsorberMaterial,
"Absorber");
fPhysiAbsorber = new G4PVPlacement(0,
G4ThreeVector(0.,0.,fZAbsorber),
"Absorber",
fLogicAbsorber,
fPhysiWorld,
false,
0);
}
// Sensitive Detectors: Absorber
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4SDManager* theSDman = G4SDManager::GetSDMpointer();
if(!calorimeterSD)
if(!fCalorimeterSD)
{
calorimeterSD = new F01CalorimeterSD("CalorSD",this);
SDman->AddNewDetector( calorimeterSD );
fCalorimeterSD = new F01CalorimeterSD("CalorSD",this);
theSDman->AddNewDetector( fCalorimeterSD );
}
if (logicAbsorber) logicAbsorber->SetSensitiveDetector(calorimeterSD);
if (fLogicAbsorber) fLogicAbsorber->SetSensitiveDetector(fCalorimeterSD);
return physiWorld;
return fPhysiWorld;
}
////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n The WORLD is made of "
<< WorldSizeZ/mm << "mm of " << WorldMaterial->GetName() ;
G4cout << ", the transverse size (R) of the world is " << WorldSizeR/mm << " mm. " << G4endl;
<< fWorldSizeZ/mm << "mm of " << fWorldMaterial->GetName() ;
G4cout << ", the transverse size (R) of the world is " << fWorldSizeR/mm << " mm. "
<< G4endl;
G4cout << " The ABSORBER is made of "
<< AbsorberThickness/mm << "mm of " << AbsorberMaterial->GetName() ;
G4cout << ", the transverse size (R) is " << AbsorberRadius/mm << " mm. " << G4endl;
G4cout << " Z position of the (middle of the) absorber " << zAbsorber/mm << " mm." << G4endl;
<< fAbsorberThickness/mm << "mm of " << fAbsorberMaterial->GetName() ;
G4cout << ", the transverse size (R) is " << fAbsorberRadius/mm << " mm. " << G4endl;
G4cout << " Z position of the (middle of the) absorber " << fZAbsorber/mm << " mm."
<< G4endl;
G4cout << G4endl;
}
///////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
@@ -326,20 +322,18 @@ void F01DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
// search the material by its name
G4Material* pttoMaterial;
for (size_t J=0 ; J<theMaterialTable->size() ; J++)
{ pttoMaterial = (*theMaterialTable)[J];
if(pttoMaterial->GetName() == materialChoice)
G4Material* material;
for (size_t j=0 ; j<theMaterialTable->size() ; j++)
{ material = (*theMaterialTable)[j];
if (material->GetName() == materialChoice)
{
AbsorberMaterial = pttoMaterial;
logicAbsorber->SetMaterial(pttoMaterial);
fAbsorberMaterial = material;
fLogicAbsorber->SetMaterial(material);
}
}
}
////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::SetWorldMaterial(G4String materialChoice)
{
@@ -347,13 +341,13 @@ void F01DetectorConstruction::SetWorldMaterial(G4String materialChoice)
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
// search the material by its name
G4Material* pttoMaterial;
for (size_t J=0 ; J<theMaterialTable->size() ; J++)
{ pttoMaterial = (*theMaterialTable)[J];
if(pttoMaterial->GetName() == materialChoice)
G4Material* material;
for (size_t j=0 ; j<theMaterialTable->size() ; j++)
{ material = (*theMaterialTable)[j];
if(material->GetName() == materialChoice)
{
WorldMaterial = pttoMaterial;
logicWorld->SetMaterial(pttoMaterial);
fWorldMaterial = material;
fLogicWorld->SetMaterial(material);
}
}
}
@@ -365,63 +359,55 @@ void F01DetectorConstruction::SetWorldMaterial(G4String materialChoice)
void F01DetectorConstruction::SetAbsorberThickness(G4double val)
{
// change Absorber thickness and recompute the calorimeter parameters
AbsorberThickness = val;
fAbsorberThickness = val;
ComputeCalorParameters();
}
/////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//
void F01DetectorConstruction::SetAbsorberRadius(G4double val)
{
// change the transverse size and recompute the calorimeter parameters
AbsorberRadius = val;
fAbsorberRadius = val;
ComputeCalorParameters();
}
////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::SetWorldSizeZ(G4double val)
{
worldchanged=true;
WorldSizeZ = val;
fWorldChanged = true;
fWorldSizeZ = val;
ComputeCalorParameters();
}
///////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::SetWorldSizeR(G4double val)
{
worldchanged=true;
WorldSizeR = val;
fWorldChanged = true;
fWorldSizeR = val;
ComputeCalorParameters();
}
//////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::SetAbsorberZpos(G4double val)
{
zAbsorber = val;
fZAbsorber = val;
ComputeCalorParameters();
}
///////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
}
//
//
////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01DetectorMessenger.cc
/// \brief Implementation of the F01DetectorMessenger class
//
// $Id: F01DetectorMessenger.cc,v 1.5 2006-06-29 17:16:27 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -43,63 +45,73 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01DetectorMessenger::F01DetectorMessenger(F01DetectorConstruction * F01Det)
:F01Detector(F01Det)
F01DetectorMessenger::F01DetectorMessenger(F01DetectorConstruction* det)
: G4UImessenger(),
fDetector(det),
fDetDir(0),
fAbsMaterCmd(0),
fAbsThickCmd(0),
fAbsRadCmd(0),
fAbsZposCmd(0),
fWorldMaterCmd(0),
fWorldZCmd(0),
fWorldRCmd(0),
fUpdateCmd(0)
{
F01detDir = new G4UIdirectory("/calor/");
F01detDir->SetGuidance("F01 detector control.");
fDetDir = new G4UIdirectory("/calor/");
fDetDir->SetGuidance("F01 detector control.");
AbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
AbsMaterCmd->SetParameterName("choice",true);
AbsMaterCmd->SetDefaultValue("Lead");
AbsMaterCmd->AvailableForStates(G4State_Idle);
fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("choice",true);
fAbsMaterCmd->SetDefaultValue("Lead");
fAbsMaterCmd->AvailableForStates(G4State_Idle);
WorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
WorldMaterCmd->SetGuidance("Select Material of the World.");
WorldMaterCmd->SetParameterName("wchoice",true);
WorldMaterCmd->SetDefaultValue("Air");
WorldMaterCmd->AvailableForStates(G4State_Idle);
fWorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
fWorldMaterCmd->SetGuidance("Select Material of the World.");
fWorldMaterCmd->SetParameterName("wchoice",true);
fWorldMaterCmd->SetDefaultValue("Air");
fWorldMaterCmd->AvailableForStates(G4State_Idle);
AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
AbsThickCmd->SetParameterName("SizeZ",false,false);
AbsThickCmd->SetDefaultUnit("mm");
AbsThickCmd->SetRange("SizeZ>0.");
AbsThickCmd->AvailableForStates(G4State_Idle);
fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
fAbsThickCmd->SetParameterName("SizeZ",false,false);
fAbsThickCmd->SetDefaultUnit("mm");
fAbsThickCmd->SetRange("SizeZ>0.");
fAbsThickCmd->AvailableForStates(G4State_Idle);
AbsRadCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsRad",this);
AbsRadCmd->SetGuidance("Set radius of the Absorber");
AbsRadCmd->SetParameterName("SizeR",false,false);
AbsRadCmd->SetDefaultUnit("mm");
AbsRadCmd->SetRange("SizeR>0.");
AbsRadCmd->AvailableForStates(G4State_Idle);
fAbsRadCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsRad",this);
fAbsRadCmd->SetGuidance("Set radius of the Absorber");
fAbsRadCmd->SetParameterName("SizeR",false,false);
fAbsRadCmd->SetDefaultUnit("mm");
fAbsRadCmd->SetRange("SizeR>0.");
fAbsRadCmd->AvailableForStates(G4State_Idle);
AbsZposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsZpos",this);
AbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
AbsZposCmd->SetParameterName("Zpos",false,false);
AbsZposCmd->SetDefaultUnit("mm");
AbsZposCmd->AvailableForStates(G4State_Idle);
fAbsZposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsZpos",this);
fAbsZposCmd->SetGuidance("Set Z pos. of the Absorber");
fAbsZposCmd->SetParameterName("Zpos",false,false);
fAbsZposCmd->SetDefaultUnit("mm");
fAbsZposCmd->AvailableForStates(G4State_Idle);
WorldZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldZ",this);
WorldZCmd->SetGuidance("Set Z size of the World");
WorldZCmd->SetParameterName("WSizeZ",false,false);
WorldZCmd->SetDefaultUnit("mm");
WorldZCmd->SetRange("WSizeZ>0.");
WorldZCmd->AvailableForStates(G4State_Idle);
fWorldZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldZ",this);
fWorldZCmd->SetGuidance("Set Z size of the World");
fWorldZCmd->SetParameterName("WSizeZ",false,false);
fWorldZCmd->SetDefaultUnit("mm");
fWorldZCmd->SetRange("WSizeZ>0.");
fWorldZCmd->AvailableForStates(G4State_Idle);
WorldRCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldR",this);
WorldRCmd->SetGuidance("Set R size of the World");
WorldRCmd->SetParameterName("WSizeR",false,false);
WorldRCmd->SetDefaultUnit("mm");
WorldRCmd->SetRange("WSizeR>0.");
WorldRCmd->AvailableForStates(G4State_Idle);
fWorldRCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldR",this);
fWorldRCmd->SetGuidance("Set R size of the World");
fWorldRCmd->SetParameterName("WSizeR",false,false);
fWorldRCmd->SetDefaultUnit("mm");
fWorldRCmd->SetRange("WSizeR>0.");
fWorldRCmd->AvailableForStates(G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
UpdateCmd->SetGuidance("Update calorimeter geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(G4State_Idle);
fUpdateCmd = new G4UIcmdWithoutParameter("/calor/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);
}
@@ -107,44 +119,44 @@ F01DetectorMessenger::F01DetectorMessenger(F01DetectorConstruction * F01Det)
F01DetectorMessenger::~F01DetectorMessenger()
{
delete AbsMaterCmd;
delete AbsThickCmd;
delete AbsRadCmd;
delete AbsZposCmd;
delete WorldMaterCmd;
delete WorldZCmd;
delete WorldRCmd;
delete UpdateCmd;
delete F01detDir;
delete fAbsMaterCmd;
delete fAbsThickCmd;
delete fAbsRadCmd;
delete fAbsZposCmd;
delete fWorldMaterCmd;
delete fWorldZCmd;
delete fWorldRCmd;
delete fUpdateCmd;
delete fDetDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == AbsMaterCmd )
{ F01Detector->SetAbsorberMaterial(newValue);}
if( command == fAbsMaterCmd )
{ fDetector->SetAbsorberMaterial(newValue);}
if( command == WorldMaterCmd )
{ F01Detector->SetWorldMaterial(newValue);}
if( command == fWorldMaterCmd )
{ fDetector->SetWorldMaterial(newValue);}
if( command == AbsThickCmd )
{ F01Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));}
if( command == fAbsThickCmd )
{ fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));}
if( command == AbsRadCmd )
{ F01Detector->SetAbsorberRadius(AbsRadCmd->GetNewDoubleValue(newValue));}
if( command == fAbsRadCmd )
{ fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));}
if( command == AbsZposCmd )
{ F01Detector->SetAbsorberZpos(AbsZposCmd->GetNewDoubleValue(newValue));}
if( command == fAbsZposCmd )
{ fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));}
if( command == WorldZCmd )
{ F01Detector->SetWorldSizeZ(WorldZCmd->GetNewDoubleValue(newValue));}
if( command == fWorldZCmd )
{ fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
if( command == WorldRCmd )
{ F01Detector->SetWorldSizeR(WorldRCmd->GetNewDoubleValue(newValue));}
if( command == fWorldRCmd )
{ fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ F01Detector->UpdateGeometry(); }
if( command == fUpdateCmd )
{ fDetector->UpdateGeometry(); }
}
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01EventAction.cc
/// \brief Implementation of the F01EventAction class
//
// $Id: F01EventAction.cc,v 1.7 2010-06-06 04:55:22 perl Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -51,35 +53,38 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01EventAction::F01EventAction(F01RunAction* F01RA)
: calorimeterCollID(-1), eventMessenger(0),
runaction(F01RA), verboselevel(0),
drawFlag("all"), printModulo(10000)
: G4UserEventAction(),
fCalorimeterCollID(-1),
fEventMessenger(0),
fRunAction(F01RA),
fVerboseLevel(0),
fPrintModulo(10000)
{
eventMessenger = new F01EventActionMessenger(this);
fEventMessenger = new F01EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01EventAction::~F01EventAction()
{
delete eventMessenger;
delete fEventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
if(verboselevel>1)
if (fVerboseLevel>1)
G4cout << "<<< Event " << evtNb << " started." << G4endl;
if (calorimeterCollID==-1)
if (fCalorimeterCollID==-1)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
calorimeterCollID = SDman->GetCollectionID("CalCollection");
fCalorimeterCollID = SDman->GetCollectionID("CalCollection");
}
}
@@ -87,16 +92,16 @@ void F01EventAction::BeginOfEventAction(const G4Event* evt)
void F01EventAction::EndOfEventAction(const G4Event* evt)
{
if(verboselevel>0)
if (fVerboseLevel>0)
G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
//save rndm status
if (runaction->GetRndmFreq() == 2)
if (fRunAction->GetRndmFreq() == 2)
{
CLHEP::HepRandom::saveEngineStatus("endOfEvent.rndm");
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
if (evtNb%fPrintModulo == 0)
{
G4cout << "\n---> End of Event: " << evtNb << G4endl;
CLHEP::HepRandom::showEngineStatus();
@@ -106,17 +111,9 @@ void F01EventAction::EndOfEventAction(const G4Event* evt)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int F01EventAction::GetEventno()
void F01EventAction::SetEventVerbose(G4int level)
{
G4int evno = fpEventManager->GetConstCurrentEvent()->GetEventID() ;
return evno ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01EventAction::setEventVerbose(G4int level)
{
verboselevel = level ;
fVerboseLevel = level ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01EventActionMessenger.cc
/// \brief Implementation of the F01EventActionMessenger class
//
// $Id: F01EventActionMessenger.cc,v 1.4 2006-06-29 17:16:31 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -42,50 +44,41 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01EventActionMessenger::F01EventActionMessenger(F01EventAction* EvAct)
:eventAction(EvAct)
F01EventActionMessenger::F01EventActionMessenger(F01EventAction* evAct)
: G4UImessenger(),
fEventAction(evAct),
fSetVerboseCmd(0),
fPrintCmd(0)
{
setVerboseCmd = new G4UIcmdWithAnInteger("/event/setverbose",this);
setVerboseCmd->SetGuidance("Set verbose level ." );
setVerboseCmd->SetParameterName("level",true);
setVerboseCmd->SetDefaultValue(0);
fSetVerboseCmd = new G4UIcmdWithAnInteger("/event/setverbose",this);
fSetVerboseCmd->SetGuidance("Set verbose level ." );
fSetVerboseCmd->SetParameterName("level",true);
fSetVerboseCmd->SetDefaultValue(0);
DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
DrawCmd->SetGuidance("Draw the tracks in the event");
DrawCmd->SetGuidance(" Choice : none,charged, all");
DrawCmd->SetParameterName("choice",true);
DrawCmd->SetDefaultValue("all");
DrawCmd->SetCandidates("none charged all");
DrawCmd->AvailableForStates(G4State_Idle);
PrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
PrintCmd->SetGuidance("Print events modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
PrintCmd->AvailableForStates(G4State_Idle);
fPrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
fPrintCmd->SetGuidance("Print events modulo n");
fPrintCmd->SetParameterName("EventNb",false);
fPrintCmd->SetRange("EventNb>0");
fPrintCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01EventActionMessenger::~F01EventActionMessenger()
{
delete setVerboseCmd;
delete DrawCmd;
delete PrintCmd;
delete fSetVerboseCmd;
delete fPrintCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if(command == setVerboseCmd)
{eventAction->setEventVerbose(setVerboseCmd->GetNewIntValue(newValue));}
if(command == fSetVerboseCmd)
{fEventAction->SetEventVerbose(fSetVerboseCmd->GetNewIntValue(newValue));}
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
if(command == fPrintCmd)
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,12 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01FieldMessenger.cc
/// \brief Implementation of the F01FieldMessenger class
//
// $Id: F01FieldMessenger.cc,v 1.8 2006-06-29 17:16:33 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F01FieldMessenger.hh"
#include "F01FieldSetup.hh"
@@ -38,85 +43,79 @@
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01FieldMessenger::F01FieldMessenger(F01FieldSetup* pEMfieldSetup)
:fEMfieldSetup(pEMfieldSetup)
F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
: G4UImessenger(),
fEMfieldSetup(fieldSetup),
fFieldDir(0),
fStepperCmd(0),
fMagFieldCmd(0),
fMinStepCmd(0),
fUpdateCmd(0)
{
F01detDir = new G4UIdirectory("/field/");
F01detDir->SetGuidance("F01 field tracking control.");
fFieldDir = new G4UIdirectory("/field/");
fFieldDir->SetGuidance("F01 field tracking control.");
StepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
StepperCmd->SetGuidance("Select stepper type for magnetic field");
StepperCmd->SetParameterName("choice",true);
StepperCmd->SetDefaultValue(4);
StepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fStepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
fStepperCmd->SetGuidance("Select stepper type for magnetic field");
fStepperCmd->SetParameterName("choice",true);
fStepperCmd->SetDefaultValue(4);
fStepperCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/field/update",this);
UpdateCmd->SetGuidance("Update calorimeter geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(G4State_Idle);
fUpdateCmd = new G4UIcmdWithoutParameter("/field/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);
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
MagFieldCmd->SetGuidance("Define magnetic field.");
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
MagFieldCmd->SetParameterName("Bz",false,false);
MagFieldCmd->SetDefaultUnit("tesla");
MagFieldCmd->AvailableForStates(G4State_Idle);
fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
fMagFieldCmd->SetGuidance("Define magnetic field.");
fMagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
fMagFieldCmd->SetParameterName("Bz",false,false);
fMagFieldCmd->SetDefaultUnit("tesla");
fMagFieldCmd->AvailableForStates(G4State_Idle);
MinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
MinStepCmd->SetGuidance("Define minimal step");
MinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
MinStepCmd->SetParameterName("min step",false,false);
MinStepCmd->SetDefaultUnit("mm");
MinStepCmd->AvailableForStates(G4State_Idle);
AbsMaterCmd = new G4UIcmdWithAString("/field/setAbsMat",this);
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
AbsMaterCmd->SetParameterName("choice",true);
AbsMaterCmd->SetDefaultValue("Xe");
AbsMaterCmd->AvailableForStates(G4State_Idle);
fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
fMinStepCmd->SetGuidance("Define minimal step");
fMinStepCmd->SetGuidance("Magnetic field will be in Z direction.");
fMinStepCmd->SetParameterName("min step",false,false);
fMinStepCmd->SetDefaultUnit("mm");
fMinStepCmd->AvailableForStates(G4State_Idle);
}
///////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01FieldMessenger::~F01FieldMessenger()
{
delete StepperCmd;
delete MagFieldCmd;
delete MinStepCmd;
delete F01detDir;
delete UpdateCmd;
delete AbsMaterCmd;
delete fStepperCmd;
delete fMagFieldCmd;
delete fMinStepCmd;
delete fFieldDir;
delete fUpdateCmd;
}
////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
{
if( command == StepperCmd )
if( command == fStepperCmd )
{
fEMfieldSetup->SetStepperType(StepperCmd->GetNewIntValue(newValue));
fEMfieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
}
if( command == UpdateCmd )
if( command == fUpdateCmd )
{
fEMfieldSetup->CreateStepperAndChordFinder();
}
if( command == MagFieldCmd )
if( command == fMagFieldCmd )
{
fEMfieldSetup->SetFieldValue(MagFieldCmd->GetNewDoubleValue(newValue));
fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNewDoubleValue(newValue));
}
if( command == MinStepCmd )
if( command == fMinStepCmd )
{
fEMfieldSetup->SetMinStep(MinStepCmd->GetNewDoubleValue(newValue));
fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
}
}
//
//
/////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,13 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01FieldSetup.cc
/// \brief Implementation of the F01FieldSetup class
//
// $Id: F01FieldSetup.cc,v 1.7 2006-06-29 17:16:36 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
// User Field setup class implementation.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F01FieldSetup.hh"
#include "F01FieldMessenger.hh"
@@ -52,32 +57,50 @@
#include "G4CashKarpRKF45.hh"
#include "G4RKG3_Stepper.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
// #include "G4SIunits.hh"
//////////////////////////////////////////////////////////////////////////
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Constructors:
F01FieldSetup::F01FieldSetup(G4ThreeVector fieldVector)
: fChordFinder(0), fStepper(0)
{
fMagneticField = new G4UniformMagField( fieldVector );
: fFieldManager(0),
fChordFinder(0),
fEquation(0),
fMagneticField(new G4UniformMagField(fieldVector)),
// G4ThreeVector(3.3*tesla, 0.0, 0.0 ));
fStepper(0),
fStepperType(0),
fMinStep(0.),
fFieldMessenger(0)
{
G4cout << " F01FieldSetup: magnetic field set to Uniform( "
<< fieldVector << " ) " << G4endl;
<< fieldVector << " ) " << G4endl;
InitialiseAll();
}
F01FieldSetup::F01FieldSetup()
: fChordFinder(0), fStepper(0)
: fFieldManager(0),
fChordFinder(0),
fEquation(0),
fMagneticField(new G4UniformMagField(G4ThreeVector())),
// G4ThreeVector(0.0, 0.0, 0.0 ));
fStepper(0),
fStepperType(0),
fMinStep(0.),
fFieldMessenger(0)
{
fMagneticField = new G4UniformMagField( G4ThreeVector(0.0, 0.0, 0.0 ) );
G4cout << " F01FieldSetup: magnetic field set to Uniform( 0.0, 0, 0 ) " << G4endl;
G4cout << " F01FieldSetup: magnetic field set to Uniform( 0.0, 0, 0 ) "
<< G4endl;
InitialiseAll();
}
void
F01FieldSetup::InitialiseAll()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01FieldSetup::InitialiseAll()
{
fFieldMessenger = new F01FieldMessenger(this) ;
@@ -88,34 +111,33 @@ F01FieldSetup::InitialiseAll()
fStepperType = 4 ; // ClassicalRK4 is default stepper
fFieldManager = G4TransportationManager::GetTransportationManager()
->GetFieldManager();
->GetFieldManager();
CreateStepperAndChordFinder();
}
////////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01FieldSetup::~F01FieldSetup()
{
// GetGlobalFieldManager()->SetDetectorField(0);
if(fMagneticField) delete fMagneticField;
if(fChordFinder) delete fChordFinder;
if(fStepper) delete fStepper;
if (fMagneticField) delete fMagneticField;
if (fChordFinder) delete fChordFinder;
if (fStepper) delete fStepper;
}
/////////////////////////////////////////////////////////////////////////////
//
// Update field
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01FieldSetup::CreateStepperAndChordFinder()
{
// Update field
SetStepper();
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl ;
fFieldManager->SetDetectorField(fMagneticField );
if(fChordFinder) delete fChordFinder;
if (fChordFinder) delete fChordFinder;
fChordFinder = new G4ChordFinder( fMagneticField, fMinStep,fStepper);
@@ -124,14 +146,13 @@ void F01FieldSetup::CreateStepperAndChordFinder()
return;
}
/////////////////////////////////////////////////////////////////////////////
//
// Set stepper according to the stepper type
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01FieldSetup::SetStepper()
{
if(fStepper) delete fStepper;
// Set stepper according to the stepper type
if (fStepper) delete fStepper;
switch ( fStepperType )
{
@@ -180,16 +201,15 @@ void F01FieldSetup::SetStepper()
return;
}
/////////////////////////////////////////////////////////////////////////////
//
// Set the value of the Global Field to fieldValue along Z
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01FieldSetup::SetFieldValue(G4double fieldStrength)
{
// Set the value of the Global Field to fieldValue along Z
#ifdef G4VERBOSE
G4cout << "Setting Field strength to "
<< fieldStrength / gauss << " Gauss."; // << G4endl;
<< fieldStrength / gauss << " Gauss."; // << G4endl;
#endif
G4ThreeVector fieldSetVec(0.0, 0.0, fieldStrength);
@@ -199,36 +219,35 @@ void F01FieldSetup::SetFieldValue(G4double fieldStrength)
#ifdef G4VERBOSE
G4double fieldValue[6], position[4];
position[0] = position[1] = position[2] = position[3] = 0.0;
if( fieldStrength != 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 )
<< 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.");
"IncorrectForZeroField",
FatalException,
"fMagneticField ptr should be set to 0 for no field.");
}
#endif
}
///////////////////////////////////////////////////////////////////////////////
//
// Set the value of the Global Field
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01FieldSetup::SetFieldValue(G4ThreeVector fieldVector)
{
if(fMagneticField) delete fMagneticField;
// Set the value of the Global Field
if (fMagneticField) delete fMagneticField;
if(fieldVector != G4ThreeVector(0.,0.,0.))
if (fieldVector != G4ThreeVector(0.,0.,0.))
{
fMagneticField = new G4UniformMagField(fieldVector);
fMagneticField = new G4UniformMagField(fieldVector);
// CreateStepperAndChordFinder();
}
else
@@ -246,12 +265,15 @@ void F01FieldSetup::SetFieldValue(G4ThreeVector fieldVector)
}
////////////////////////////////////////////////////////////////////////////////
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4FieldManager* F01FieldSetup::GetGlobalFieldManager()
{
// Utility method
G4FieldManager* F01FieldSetup::GetGlobalFieldManager()
{
return G4TransportationManager::GetTransportationManager()
->GetFieldManager();
->GetFieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01PhysicsList.cc
/// \brief Implementation of the F01PhysicsList class
//
// $Id: F01PhysicsList.cc,v 1.16 2010-08-16 08:24:39 kurasige Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
#include "G4Timer.hh"
@@ -41,6 +43,7 @@
#include "G4Material.hh"
#include "G4EnergyLossTables.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include <iomanip>
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01PhysicsListMessenger.cc
/// \brief Implementation of the F01PhysicsListMessenger class
//
// $Id: F01PhysicsListMessenger.cc,v 1.6 2006-06-29 17:16:41 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01PrimaryGeneratorAction.cc
/// \brief Implementation of the F01PrimaryGeneratorAction class
//
// $Id: F01PrimaryGeneratorAction.cc,v 1.8 2006-06-29 17:16:43 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -42,41 +44,48 @@
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4String F01PrimaryGeneratorAction::thePrimaryParticleName = "e-" ;
G4String F01PrimaryGeneratorAction::fgPrimaryParticleName = "e-" ;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01PrimaryGeneratorAction::F01PrimaryGeneratorAction(
F01DetectorConstruction* F01DC)
: F01Detector(F01DC), rndmFlag("off"),
xvertex(0.), yvertex(0.), zvertex(0.),
vertexdefined(false)
F01DetectorConstruction* det)
: fParticleGun(0),
fDetector(det),
fGunMessenger(0),
fRndmFlag("off"),
fXVertex(0.),
fYVertex(0.),
fZVertex(0.),
fVertexDefined(false)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
// create a messenger for this class
gunMessenger = new F01PrimaryGeneratorMessenger(this);
fGunMessenger = new F01PrimaryGeneratorMessenger(this);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="e-");
particleGun->SetParticleDefinition(particle);
= particleTable->FindParticle(particleName="e-");
fParticleGun->SetParticleDefinition(particle);
thePrimaryParticleName = particle->GetParticleName() ;
fgPrimaryParticleName = particle->GetParticleName() ;
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,-1.));
particleGun->SetParticleEnergy(0.5*GeV);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,-1.));
fParticleGun->SetParticleEnergy(0.5*GeV);
zvertex = F01Detector->GetAbsorberZpos() -0.5*(F01Detector->GetAbsorberThickness());
particleGun->SetParticlePosition(G4ThreeVector(xvertex,yvertex,zvertex));
fZVertex = fDetector->GetAbsorberZpos() -0.5*(fDetector->GetAbsorberThickness());
fParticleGun->SetParticlePosition(G4ThreeVector(fXVertex,fYVertex,fZVertex));
}
@@ -84,8 +93,8 @@ F01PrimaryGeneratorAction::F01PrimaryGeneratorAction(
F01PrimaryGeneratorAction::~F01PrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
delete fParticleGun;
delete fGunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -94,74 +103,70 @@ void F01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// this function is called at the begining of event
//
thePrimaryParticleName = particleGun->GetParticleDefinition()->
GetParticleName() ;
fgPrimaryParticleName
= fParticleGun->GetParticleDefinition()->GetParticleName() ;
G4double x0,y0,z0 ;
if(vertexdefined)
if (fVertexDefined)
{
x0 = xvertex ;
y0 = yvertex ;
z0 = zvertex ;
x0 = fXVertex ;
y0 = fYVertex ;
z0 = fZVertex ;
}
else
{
x0 = 0. ;
y0 = 0. ;
z0 = F01Detector->GetAbsorberZpos()-0.5*(F01Detector->GetAbsorberThickness());
z0 = fDetector->GetAbsorberZpos()-0.5*(fDetector->GetAbsorberThickness());
}
G4double r0,phi0 ;
if (rndmFlag == "on")
if (fRndmFlag == "on")
{
r0 = (F01Detector->GetAbsorberRadius())*std::sqrt(G4UniformRand());
phi0 = twopi*G4UniformRand();
x0 = r0*std::cos(phi0);
y0 = r0*std::sin(phi0);
r0 = (fDetector->GetAbsorberRadius())*std::sqrt(G4UniformRand());
phi0 = twopi*G4UniformRand();
x0 = r0*std::cos(phi0);
y0 = r0*std::sin(phi0);
}
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
///////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4String F01PrimaryGeneratorAction::GetPrimaryName()
{
return thePrimaryParticleName ;
return fgPrimaryParticleName ;
}
void F01PrimaryGeneratorAction::Setzvertex(G4double z)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01PrimaryGeneratorAction::SetZVertex(G4double z)
{
vertexdefined = true ;
zvertex = z ;
G4cout << " Z coordinate of the primary vertex = " << zvertex/mm <<
" mm." << G4endl;
}
void F01PrimaryGeneratorAction::Setxvertex(G4double x)
{
vertexdefined = true ;
xvertex = x ;
G4cout << " X coordinate of the primary vertex = " << xvertex/mm <<
fVertexDefined = true ;
fZVertex = z ;
G4cout << " Z coordinate of the primary vertex = " << fZVertex/mm <<
" mm." << G4endl;
}
void F01PrimaryGeneratorAction::Setyvertex(G4double y)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01PrimaryGeneratorAction::SetXVertex(G4double x)
{
vertexdefined = true ;
yvertex = y ;
G4cout << " Y coordinate of the primary vertex = " << yvertex/mm <<
fVertexDefined = true ;
fXVertex = x ;
G4cout << " X coordinate of the primary vertex = " << fXVertex/mm <<
" mm." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01PrimaryGeneratorAction::SetYVertex(G4double y)
{
fVertexDefined = true ;
fYVertex = y ;
G4cout << " Y coordinate of the primary vertex = " << fYVertex/mm <<
" mm." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01PrimaryGeneratorMessenger.cc
/// \brief Implementation of the F01PrimaryGeneratorMessenger class
//
// $Id: F01PrimaryGeneratorMessenger.cc,v 1.5 2006-06-29 17:16:45 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -37,34 +39,41 @@
#include "F01PrimaryGeneratorAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01PrimaryGeneratorMessenger::F01PrimaryGeneratorMessenger(F01PrimaryGeneratorAction* F01Gun)
: F01Action(F01Gun)
F01PrimaryGeneratorMessenger::F01PrimaryGeneratorMessenger(
F01PrimaryGeneratorAction* action)
: G4UImessenger(),
fAction(action),
fRndmCmd(0),
fSetXVertexCmd(0),
fSetYVertexCmd(0),
fSetZVertexCmd(0)
{
RndmCmd = new G4UIcmdWithAString("/gun/random",this);
RndmCmd->SetGuidance("Shoot randomly the incident particle.");
RndmCmd->SetGuidance(" Choice : on, off(default)");
RndmCmd->SetParameterName("choice",true);
RndmCmd->SetDefaultValue("off");
RndmCmd->SetCandidates("on off");
RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRndmCmd = new G4UIcmdWithAString("/gun/random",this);
fRndmCmd->SetGuidance("Shoot randomly the incident particle.");
fRndmCmd->SetGuidance(" Choice : on, off(default)");
fRndmCmd->SetParameterName("choice",true);
fRndmCmd->SetDefaultValue("off");
fRndmCmd->SetCandidates("on off");
fRndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
setxvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
setxvertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
setxvertexCmd->SetParameterName("xv",true);
setxvertexCmd->SetDefaultValue(0.0*mm) ;
fSetXVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
fSetXVertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
fSetXVertexCmd->SetParameterName("xv",true);
fSetXVertexCmd->SetDefaultValue(0.0*mm) ;
setyvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
setyvertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
setyvertexCmd->SetParameterName("yv",true);
setyvertexCmd->SetDefaultValue(0.0*mm) ;
fSetYVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
fSetYVertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
fSetYVertexCmd->SetParameterName("yv",true);
fSetYVertexCmd->SetDefaultValue(0.0*mm) ;
setzvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
setzvertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
setzvertexCmd->SetParameterName("zv",true);
setzvertexCmd->SetDefaultValue(0.0*mm) ;
fSetZVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
fSetZVertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
fSetZVertexCmd->SetParameterName("zv",true);
fSetZVertexCmd->SetDefaultValue(0.0*mm) ;
}
@@ -72,24 +81,24 @@ F01PrimaryGeneratorMessenger::F01PrimaryGeneratorMessenger(F01PrimaryGeneratorAc
F01PrimaryGeneratorMessenger::~F01PrimaryGeneratorMessenger()
{
delete RndmCmd;
delete setxvertexCmd;
delete setyvertexCmd;
delete setzvertexCmd;
delete fRndmCmd;
delete fSetXVertexCmd;
delete fSetYVertexCmd;
delete fSetZVertexCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if( command == RndmCmd )
{ F01Action->SetRndmFlag(newValue);}
if( command == setxvertexCmd)
{ F01Action->Setxvertex(setxvertexCmd->GetNewDoubleValue(newValue));}
if( command == setyvertexCmd)
{ F01Action->Setyvertex(setyvertexCmd->GetNewDoubleValue(newValue));}
if( command == setzvertexCmd)
{ F01Action->Setzvertex(setzvertexCmd->GetNewDoubleValue(newValue));}
if( command == fRndmCmd )
{ fAction->SetRndmFlag(newValue);}
if( command == fSetXVertexCmd)
{ fAction->SetXVertex(fSetXVertexCmd->GetNewDoubleValue(newValue));}
if( command == fSetYVertexCmd)
{ fAction->SetYVertex(fSetYVertexCmd->GetNewDoubleValue(newValue));}
if( command == fSetZVertexCmd)
{ fAction->SetZVertex(fSetZVertexCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,12 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01RunAction.cc
/// \brief Implementation of the F01RunAction class
//
// $Id: F01RunAction.cc,v 1.10 2006-06-29 17:16:49 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F01RunAction.hh"
#include "F01RunMessenger.hh"
@@ -41,29 +45,31 @@
#include "Randomize.hh"
//////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01RunAction::F01RunAction()
: saveRndm(0)
: G4UserRunAction(),
fMessenger(0),
fSaveRndm(0)
{
runMessenger = new F01RunMessenger(this);
fMessenger = new F01RunMessenger(this);
}
////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01RunAction::~F01RunAction()
{
delete runMessenger;
delete fMessenger;
}
/////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01RunAction::BeginOfRunAction(const G4Run* aRun)
void F01RunAction::BeginOfRunAction(const G4Run* run)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
// save Rndm status
if (saveRndm > 0)
if (fSaveRndm > 0)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
@@ -75,7 +81,7 @@ void F01RunAction::BeginOfRunAction(const G4Run* aRun)
if(pVVisManager) UI->ApplyCommand("/vis/scene/notifyHandlers");
}
/////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01RunAction::EndOfRunAction(const G4Run*)
{
@@ -86,13 +92,11 @@ void F01RunAction::EndOfRunAction(const G4Run*)
// save Rndm status
if (saveRndm == 1)
if (fSaveRndm == 1)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
}
}
//
//
////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01RunMessenger.cc
/// \brief Implementation of the F01RunMessenger class
//
// $Id: F01RunMessenger.cc,v 1.6 2006-06-29 17:16:51 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//
@@ -44,44 +46,50 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01RunMessenger::F01RunMessenger(F01RunAction* RA)
: runAction (RA)
F01RunMessenger::F01RunMessenger(F01RunAction* action)
: G4UImessenger(),
fRunAction(action),
fRndmDir(0),
fRndmSaveCmd(0),
fRndmReadCmd(0)
{
RndmDir = new G4UIdirectory("/rndm/");
RndmDir->SetGuidance("Rndm status control.");
fRndmDir = new G4UIdirectory("/rndm/");
fRndmDir->SetGuidance("Rndm status control.");
RndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
RndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
RndmSaveCmd->SetGuidance("freq = 0 not saved");
RndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
RndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
RndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
RndmSaveCmd->SetParameterName("frequency",false);
RndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
RndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
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);
RndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
RndmReadCmd->SetGuidance("get rndm status from an external file.");
RndmReadCmd->SetParameterName("fileName",true);
RndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
RndmReadCmd->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 RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
delete fRndmSaveCmd;
delete fRndmReadCmd;
delete fRndmDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
if (command == RndmSaveCmd)
runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
if (command == RndmReadCmd)
if (command == fRndmSaveCmd)
fRunAction->SetRndmFreq(fRndmSaveCmd->GetNewIntValue(newValues));
if (command == fRndmReadCmd)
{ G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
CLHEP::HepRandom::restoreEngineStatus(newValues);
CLHEP::HepRandom::showEngineStatus();
@@ -23,10 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01StepCut.cc
/// \brief Implementation of the F01StepCut class
//
// $Id: F01StepCut.cc,v 1.3 2006-06-29 17:16:53 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F01StepCut.hh"
@@ -35,25 +40,35 @@
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01StepCut::F01StepCut(const G4String& aName)
: G4VDiscreteProcess(aName),MaxChargedStep(DBL_MAX)
: G4VDiscreteProcess(aName),
fMaxChargedStep(DBL_MAX)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01StepCut::~F01StepCut()
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01StepCut::F01StepCut(F01StepCut& right)
:G4VDiscreteProcess(right)
: G4VDiscreteProcess(right)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01StepCut::SetMaxStep(G4double step)
{
MaxChargedStep = step ;
fMaxChargedStep = step ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,61 +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. *
// ********************************************************************
//
//
// $Id: F01SteppingAction.cc,v 1.7 2006-06-29 17:16:55 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F01SteppingAction.hh"
#include "F01SteppingMessenger.hh"
#include "G4ios.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01SteppingAction::F01SteppingAction()
: steppingMessenger(0)
{
steppingMessenger = new F01SteppingMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01SteppingAction::~F01SteppingAction()
{
delete steppingMessenger ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01SteppingAction::UserSteppingAction(const G4Step*)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -1,63 +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. *
// ********************************************************************
//
//
// $Id: F01SteppingMessenger.cc,v 1.4 2006-06-29 17:16:58 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F01SteppingMessenger.hh"
#include "F01SteppingAction.hh"
#include "G4UIdirectory.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01SteppingMessenger::F01SteppingMessenger(F01SteppingAction* SA)
:steppingAction (SA)
{
steppingDir = new G4UIdirectory("/stepping/");
steppingDir->SetGuidance("stepping control");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F01SteppingMessenger::~F01SteppingMessenger()
{
delete steppingDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01SteppingMessenger::SetNewValue(G4UIcommand*, G4String)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,9 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file field/field01/src/F01SteppingVerbose.cc
/// \brief Implementation of the F01SteppingVerbose class
//
// $Id: F01SteppingVerbose.cc,v 1.7 2006-06-29 17:17:00 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// $Id$
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -58,32 +60,32 @@ void F01SteppingVerbose::StepInfo()
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw(10) << "X" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Z" << " "
<< std::setw(10) << "Direction x" << " "
<< std::setw(10) << "dir y" << " "
<< std::setw(10) << "dir z" << " "
<< std::setw( 8) << "KineE" << " "
<< std::setw( 6) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << " "
<< G4endl;
<< std::setw(10) << "X" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Z" << " "
<< std::setw(10) << "Direction x" << " "
<< std::setw(10) << "dir y" << " "
<< std::setw(10) << "dir z" << " "
<< std::setw( 8) << "KineE" << " "
<< std::setw( 6) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << " "
<< G4endl;
}
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().z(),"Length");
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().z(),"Length");
G4cout << std::setw(10) << fTrack->GetMomentumDirection().x() << " "
<< std::setw(10) << fTrack->GetMomentumDirection().y() << " "
<< std::setw(10) << fTrack->GetMomentumDirection().z() << " ";
<< std::setw(10) << fTrack->GetMomentumDirection().y() << " "
<< std::setw(10) << fTrack->GetMomentumDirection().z() << " ";
G4cout << std::setw( 8) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if( fTrack->GetNextVolume() != 0 ) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
@@ -94,7 +96,7 @@ void F01SteppingVerbose::StepInfo()
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
G4cout << " "
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
->GetProcessName();
} else {
G4cout << " UserLimit";
}
@@ -102,40 +104,40 @@ void F01SteppingVerbose::StepInfo()
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++)
{
G4cout << " : "
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< std::setw(10)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " : "
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< std::setw(10)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
@@ -149,35 +151,35 @@ void F01SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(6);
G4int prec = G4cout.precision(6);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw(10) << "X" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Z" << " "
<< std::setw(10) << "Direction x" << " "
<< std::setw(10) << "dir y" << " "
<< std::setw(10) << "dir z" << " "
<< std::setw(10) << "KineE" << " "
<< std::setw(10) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process"
<< G4endl;
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Z" << " "
<< std::setw(10) << "Direction x" << " "
<< std::setw(10) << "dir y" << " "
<< std::setw(10) << "dir z" << " "
<< std::setw(10) << "KineE" << " "
<< std::setw(10) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process"
<< G4endl;
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().z(),"Length");
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().z(),"Length");
G4cout << std::setw(10) << fTrack->GetMomentumDirection().x() << " "
<< std::setw(10) << fTrack->GetMomentumDirection().y() << " "
<< std::setw(10) << fTrack->GetMomentumDirection().z() << " ";
<< std::setw(10) << fTrack->GetMomentumDirection().y() << " "
<< std::setw(10) << fTrack->GetMomentumDirection().z() << " ";
G4cout << std::setw( 8) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if(fTrack->GetNextVolume()){
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();