Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file F01ActionInitialization.cc
/// \brief Implementation of the F01ActionInitialization class
#include "F01ActionInitialization.hh"
#include "F01PrimaryGeneratorAction.hh"
#include "F01RunAction.hh"
#include "F01EventAction.hh"
#include "F01SteppingVerbose.hh"
#include "F01DetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01ActionInitialization::F01ActionInitialization
(F01DetectorConstruction* detConstruction)
: G4VUserActionInitialization(),
fDetConstruction(detConstruction)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01ActionInitialization::~F01ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01ActionInitialization::BuildForMaster() const
{
SetUserAction(new F01RunAction());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01ActionInitialization::Build() const
{
SetUserAction(new F01PrimaryGeneratorAction(fDetConstruction));
F01RunAction* runAction = new F01RunAction();
SetUserAction(runAction);
F01EventAction* eventAction = new F01EventAction(runAction);
SetUserAction(eventAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VSteppingVerbose* F01ActionInitialization::InitializeSteppingVerbose() const
{
return new F01SteppingVerbose();
}
@@ -27,42 +27,42 @@
/// \brief Implementation of the F01CalorHit class
//
//
// $Id$
// $Id: F01CalorHit.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01CalorHit.hh"
G4Allocator<F01CalorHit> F01CalorHitAllocator;
G4ThreadLocal G4Allocator<F01CalorHit>* F01CalorHitAllocator=0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01CalorHit::F01CalorHit()
: G4VHit(),
fEdepAbs(0.),
fEdepAbs(0.),
fTrackLengthAbs(0.),
fEdepGap(0.),
fEdepGap(0.),
fTrackLengthGap(0.)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01CalorHit::~F01CalorHit()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01CalorHit::F01CalorHit(const F01CalorHit& right)
: G4VHit()
{
fEdepAbs = right.fEdepAbs; fTrackLengthAbs = right.fTrackLengthAbs;
fEdepGap = right.fEdepGap; fTrackLengthGap = right.fTrackLengthGap;
}
: G4VHit(),
fEdepAbs(right.fEdepAbs),
fTrackLengthAbs(right.fTrackLengthAbs),
fEdepGap(right.fEdepGap),
fTrackLengthGap(right.fTrackLengthGap)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const F01CalorHit& F01CalorHit::operator=(const F01CalorHit& right)
{
@@ -71,17 +71,16 @@ const F01CalorHit& F01CalorHit::operator=(const F01CalorHit& right)
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int F01CalorHit::operator==(const F01CalorHit& right) const
{
return (this==&right) ? 1 : 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01CalorHit::Print()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,12 +27,11 @@
/// \brief Implementation of the F01CalorimeterSD class
//
//
// $Id$
// $Id: F01CalorimeterSD.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01CalorimeterSD.hh"
@@ -44,10 +43,8 @@
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01CalorimeterSD::F01CalorimeterSD(G4String name,
F01DetectorConstruction* det)
@@ -59,23 +56,23 @@ F01CalorimeterSD::F01CalorimeterSD(G4String name,
collectionName.insert("CalCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01CalorimeterSD::~F01CalorimeterSD()
{
delete [] fHitID;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01CalorimeterSD::Initialize(G4HCofThisEvent*)
{
fCalCollection = new F01CalorHitsCollection
(SensitiveDetectorName,collectionName[0]);
(SensitiveDetectorName,collectionName[0]);
for (G4int j=0;j<1; j++) {fHitID[j] = -1;};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool F01CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
{
@@ -84,33 +81,33 @@ G4bool F01CalorimeterSD::ProcessHits(G4Step* step, G4TouchableHistory*)
stepl = step->GetStepLength();
if ((edep == 0.) && (stepl == 0.) ) return false;
if ((edep == 0.) && (stepl == 0.) ) return false;
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(step->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int F01Number = 0 ;
if (fHitID[F01Number]==-1)
{
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int number = 0;
if (fHitID[number]==-1)
{
F01CalorHit* calHit = new F01CalorHit();
if (physVol == fDetector->GetAbsorber()) calHit->AddAbs(edep,stepl);
fHitID[F01Number] = fCalCollection->insert(calHit) - 1;
fHitID[number] = fCalCollection->insert(calHit) - 1;
if (verboseLevel>0)
G4cout << " New Calorimeter Hit on F01: " << F01Number << G4endl;
G4cout << " New Calorimeter Hit on F01: " << number << G4endl;
}
else
{
{
if (physVol == fDetector->GetAbsorber())
(*fCalCollection)[fHitID[F01Number]]->AddAbs(edep,stepl);
(*fCalCollection)[fHitID[number]]->AddAbs(edep,stepl);
if (verboseLevel>0)
G4cout << " Energy added to F01: " << F01Number << G4endl;
G4cout << " Energy added to F01: " << number << G4endl;
}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01CalorimeterSD::EndOfEvent(G4HCofThisEvent* hce)
{
@@ -120,15 +117,4 @@ void F01CalorimeterSD::EndOfEvent(G4HCofThisEvent* hce)
hce->AddHitsCollection(hcID,fCalCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01CalorimeterSD::clear()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01CalorimeterSD::PrintAll()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,12 +27,11 @@
/// \brief Implementation of the F01DetectorConstruction class
//
//
// $Id$
// $Id: F01DetectorConstruction.cc 77881 2013-11-29 08:37:53Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01DetectorConstruction.hh"
#include "F01DetectorMessenger.hh"
@@ -40,33 +39,30 @@
#include "F01CalorimeterSD.hh"
#include "F01FieldSetup.hh"
#include "G4Material.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
#include "G4Material.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4RunManager.hh"
#include "G4AutoDelete.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01DetectorConstruction::F01DetectorConstruction()
: 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.),
: G4VUserDetectorConstruction(),
fDetectorMessenger(0),
fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
fSolidAbsorber(0), fLogicAbsorber(0), fPhysiAbsorber(0),
fAbsorberMaterial(0), fAbsorberThickness(0.), fAbsorberRadius(0.),
fZAbsorber(0.), fZStartAbs(0.), fZEndAbs(0.),
fWorldMaterial(0), fWorldSizeR(0.), fWorldSizeZ(0.)
{
// default parameter values of the calorimeter
@@ -77,12 +73,11 @@ F01DetectorConstruction::F01DetectorConstruction()
fAbsorberThickness = 1.0*mm;
fAbsorberRadius = 20000.*mm;
fZAbsorber = 21990.0*mm;
fZAbsorber = 21990.0*mm ;
// create commands for interactive definition of the calorimeter
// create commands for interactive definition of the calorimeter
fDetectorMessenger = new F01DetectorMessenger(this);
fDetectorMessenger = new F01DetectorMessenger(this);
// create materials
@@ -90,34 +85,29 @@ F01DetectorConstruction::F01DetectorConstruction()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01DetectorConstruction::~F01DetectorConstruction()
{
{
delete fDetectorMessenger;
if (fEmFieldSetup) delete fEmFieldSetup;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....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( 3.3*tesla, 0.0, 0.0 ) ) ;
return calorWorld;
return ConstructCalorimeter();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::DefineMaterials()
{
//This function illustrates the possible ways to define materials
{
//This function illustrates the possible ways to define materials
G4String name, symbol ; // a=mass of a mole;
G4double a, z, density ; // z=mean number of protons;
G4int nel ;
G4String name, symbol; // a=mass of a mole;
G4double a, z, density; // z=mean number of protons;
G4int nel;
G4int ncomponents;
G4double fractionmass, pressure, temperature;
@@ -147,10 +137,10 @@ void F01DetectorConstruction::DefineMaterials()
// Mylar
density = 1.39*g/cm3;
G4Material* Mylar = new G4Material(name="Mylar", density, nel=3);
Mylar->AddElement(elO,2);
Mylar->AddElement(elC,5);
Mylar->AddElement(elH,4);
G4Material* mylar = new G4Material(name="Mylar", density, nel=3);
mylar->AddElement(elO,2);
mylar->AddElement(elC,5);
mylar->AddElement(elH,4);
// Polypropelene
@@ -160,40 +150,41 @@ void F01DetectorConstruction::DefineMaterials()
// Krypton as detector gas, STP
density = 3.700*mg/cm3 ;
a = 83.80*g/mole ;
density = 3.700*mg/cm3;
a = 83.80*g/mole;
G4Material* Kr = new G4Material(name="Kr",z=36., a, density );
// Dry air (average composition)
density = 1.7836*mg/cm3 ; // STP
G4Material* Argon = new G4Material(name="Argon" , density, ncomponents=1);
Argon->AddElement(elAr, 1);
density = 1.7836*mg/cm3; // STP
G4Material* argon = new G4Material(name="Argon" , density, ncomponents=1);
argon->AddElement(elAr, 1);
density = 1.25053*mg/cm3 ; // STP
G4Material* Nitrogen = new G4Material(name="N2" , density, ncomponents=1);
Nitrogen->AddElement(elN, 2);
density = 1.25053*mg/cm3; // STP
G4Material* nitrogen = new G4Material(name="N2" , density, ncomponents=1);
nitrogen->AddElement(elN, 2);
density = 1.4289*mg/cm3 ; // STP
G4Material* Oxygen = new G4Material(name="O2" , density, ncomponents=1);
Oxygen->AddElement(elO, 2);
density = 1.4289*mg/cm3; // STP
G4Material* oxygen = new G4Material(name="O2" , density, ncomponents=1);
oxygen->AddElement(elO, 2);
density = 1.2928*mg/cm3 ; // STP
density *= 1.0e-8 ; // pumped vacuum
density = 1.2928*mg/cm3; // STP
density *= 1.0e-8; // pumped vacuum
temperature = STP_Temperature;
pressure = 1.0e-8*STP_Pressure;
G4Material* Air = new G4Material(name="Air" , density, ncomponents=3,
G4Material* air = new G4Material(name="Air" , density, ncomponents=3,
kStateGas,temperature,pressure);
Air->AddMaterial( Nitrogen, fractionmass = 0.7557 ) ;
Air->AddMaterial( Oxygen, fractionmass = 0.2315 ) ;
Air->AddMaterial( Argon, fractionmass = 0.0128 ) ;
air->AddMaterial( nitrogen, fractionmass = 0.7557 );
air->AddMaterial( oxygen, fractionmass = 0.2315 );
air->AddMaterial( argon, fractionmass = 0.0128 );
// Xenon as detector gas, STP
density = 5.858*mg/cm3 ;
a = 131.29*g/mole ;
density = 5.858*mg/cm3;
a = 131.29*g/mole;
G4Material* Xe = new G4Material(name="Xenon",z=54., a, density );
// Carbon dioxide, STP
@@ -205,37 +196,31 @@ void F01DetectorConstruction::DefineMaterials()
// 80% Xe + 20% CO2, STP
density = 5.0818*mg/cm3 ;
density = 5.0818*mg/cm3;
G4Material* Xe20CO2 = new G4Material(name="Xe20CO2", density, ncomponents=2);
Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 ) ;
Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 ) ;
Xe20CO2->AddMaterial( Xe, fractionmass = 0.922 );
Xe20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.078 );
// 80% Kr + 20% CO2, STP
density = 3.601*mg/cm3 ;
density = 3.601*mg/cm3;
G4Material* Kr20CO2 = new G4Material(name="Kr20CO2", density, ncomponents=2);
Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 ) ;
Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 ) ;
Kr20CO2->AddMaterial( Kr, fractionmass = 0.89 );
Kr20CO2->AddMaterial( CarbonDioxide, fractionmass = 0.11 );
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
// default materials of the calorimeter
fAbsorberMaterial = Air ; // Kr20CO2 ; // XeCO2CF4 ;
fAbsorberMaterial = air; // Kr20CO2; // XeCO2CF4;
fWorldMaterial = Air ;
fWorldMaterial = air;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter()
{
// complete the Calor parameters definition and Print
ComputeCalorParameters();
PrintCalorParameters();
// Cleanup old geometry
if (fPhysiWorld)
@@ -246,168 +231,172 @@ G4VPhysicalVolume* F01DetectorConstruction::ConstructCalorimeter()
G4SolidStore::GetInstance()->Clean();
}
// complete the Calor parameters definition and Print
ComputeCalorParameters();
PrintCalorParameters();
// World
fSolidWorld = new G4Tubs("World", // its name
0.,fWorldSizeR,fWorldSizeZ/2.,0.,twopi);// its size
fLogicWorld = new G4LogicalVolume(fSolidWorld, // its solid
fWorldMaterial, // its material
"World"); // its name
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
false, // no boolean op.
0); // copy number
// Absorber
if (fAbsorberThickness > 0.)
{
fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm,
fAbsorberRadius,
fAbsorberThickness/2.,
0.0,twopi);
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber,
fAbsorberMaterial,
"Absorber");
fPhysiAbsorber = new G4PVPlacement(0,
G4ThreeVector(0.,0.,fZAbsorber),
"Absorber",
fLogicAbsorber,
fPhysiWorld,
false,
0);
}
// Sensitive Detectors: Absorber
G4SDManager* theSDman = G4SDManager::GetSDMpointer();
fSolidAbsorber = new G4Tubs("Absorber", 1.0*mm,
fAbsorberRadius,
fAbsorberThickness/2.,
0.0,twopi);
if(!fCalorimeterSD)
{
fCalorimeterSD = new F01CalorimeterSD("CalorSD",this);
theSDman->AddNewDetector( fCalorimeterSD );
}
if (fLogicAbsorber) fLogicAbsorber->SetSensitiveDetector(fCalorimeterSD);
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber,
fAbsorberMaterial,
"Absorber");
fPhysiAbsorber = new G4PVPlacement(0,
G4ThreeVector(0.,0.,fZAbsorber),
"Absorber",
fLogicAbsorber,
fPhysiWorld,
false,
0);
return fPhysiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::PrintCalorParameters()
{
G4cout << "\n The WORLD is made of "
<< 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 "
<< 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 << "\n The WORLD is made of "
<< 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 "
<< 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....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
// get the pointer to the material table
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
// search the material by its name
// search the material by its name
G4Material* material;
for (size_t j=0 ; j<theMaterialTable->size() ; j++)
{ material = (*theMaterialTable)[j];
{ material = (*theMaterialTable)[j];
if (material->GetName() == materialChoice)
{
fAbsorberMaterial = material;
fLogicAbsorber->SetMaterial(material);
}
fLogicAbsorber->SetMaterial(material);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::SetWorldMaterial(G4String materialChoice)
{
// get the pointer to the material table
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
// search the material by its name
// search the material by its name
G4Material* material;
for (size_t j=0 ; j<theMaterialTable->size() ; j++)
{ material = (*theMaterialTable)[j];
{ material = (*theMaterialTable)[j];
if(material->GetName() == materialChoice)
{
fWorldMaterial = material;
fLogicWorld->SetMaterial(material);
}
fLogicWorld->SetMaterial(material);
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
}
}
}
///////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::SetAbsorberThickness(G4double val)
{
// change Absorber thickness and recompute the calorimeter parameters
fAbsorberThickness = val;
ComputeCalorParameters();
}
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::SetAbsorberRadius(G4double val)
{
// change the transverse size and recompute the calorimeter parameters
fAbsorberRadius = val;
ComputeCalorParameters();
}
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::SetWorldSizeZ(G4double val)
{
fWorldChanged = true;
fWorldSizeZ = val;
ComputeCalorParameters();
}
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::SetWorldSizeR(G4double val)
{
fWorldChanged = true;
fWorldSizeR = val;
ComputeCalorParameters();
}
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::SetAbsorberZpos(G4double val)
{
fZAbsorber = val;
ComputeCalorParameters();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorConstruction::ConstructSDandField()
{
// Sensitive Detectors: Absorber
if (!fCalorimeterSD.Get()) {
F01CalorimeterSD* calorimeterSD = new F01CalorimeterSD("CalorSD",this);
fCalorimeterSD.Put(calorimeterSD);
}
SetSensitiveDetector(fLogicAbsorber, fCalorimeterSD.Get());
// Construct the field creator - this will register the field it creates
if (!fEmFieldSetup.Get()) {
F01FieldSetup* fieldSetup
= new F01FieldSetup(G4ThreeVector( 3.3*tesla, 0.0, 0.0 ) );
G4AutoDelete::Register(fieldSetup); // Kernel will delete the F01FieldSetup
fEmFieldSetup.Put(fieldSetup);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,23 +27,20 @@
/// \brief Implementation of the F01DetectorMessenger class
//
//
// $Id$
// $Id: F01DetectorMessenger.cc 77115 2013-11-21 15:06:37Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01DetectorMessenger.hh"
#include "F01DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01DetectorMessenger::F01DetectorMessenger(F01DetectorConstruction* det)
: G4UImessenger(),
@@ -55,109 +52,103 @@ F01DetectorMessenger::F01DetectorMessenger(F01DetectorConstruction* det)
fAbsZposCmd(0),
fWorldMaterCmd(0),
fWorldZCmd(0),
fWorldRCmd(0),
fUpdateCmd(0)
{
fWorldRCmd(0)
{
fDetDir = new G4UIdirectory("/calor/");
fDetDir->SetGuidance("F01 detector control.");
fAbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
fAbsMaterCmd->SetParameterName("choice",true);
fAbsMaterCmd->SetDefaultValue("Lead");
fAbsMaterCmd->AvailableForStates(G4State_Idle);
fAbsMaterCmd->SetToBeBroadcasted(false);
fWorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
fWorldMaterCmd->SetGuidance("Select Material of the World.");
fWorldMaterCmd->SetParameterName("wchoice",true);
fWorldMaterCmd->SetDefaultValue("Air");
fWorldMaterCmd->AvailableForStates(G4State_Idle);
fWorldMaterCmd->SetToBeBroadcasted(false);
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);
fAbsThickCmd->SetToBeBroadcasted(false);
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);
fAbsRadCmd->SetToBeBroadcasted(false);
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);
fAbsZposCmd->SetToBeBroadcasted(false);
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);
fWorldZCmd->SetToBeBroadcasted(false);
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);
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);
fWorldRCmd->SetToBeBroadcasted(false);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01DetectorMessenger::~F01DetectorMessenger()
{
delete fAbsMaterCmd;
delete fAbsThickCmd;
delete fAbsRadCmd;
delete fAbsZposCmd;
delete fAbsMaterCmd;
delete fAbsThickCmd;
delete fAbsRadCmd;
delete fAbsZposCmd;
delete fWorldMaterCmd;
delete fWorldZCmd;
delete fWorldRCmd;
delete fUpdateCmd;
delete fDetDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
{
if( command == fAbsMaterCmd )
{ fDetector->SetAbsorberMaterial(newValue);}
if( command == fWorldMaterCmd )
{ fDetector->SetWorldMaterial(newValue);}
if( command == fAbsThickCmd )
{ fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));}
{fDetector->SetAbsorberThickness(fAbsThickCmd->GetNewDoubleValue(newValue));}
if( command == fAbsRadCmd )
{ fDetector->SetAbsorberRadius(fAbsRadCmd->GetNewDoubleValue(newValue));}
if( command == fAbsZposCmd )
{ fDetector->SetAbsorberZpos(fAbsZposCmd->GetNewDoubleValue(newValue));}
if( command == fWorldZCmd )
{ fDetector->SetWorldSizeZ(fWorldZCmd->GetNewDoubleValue(newValue));}
if( command == fWorldRCmd )
{ fDetector->SetWorldSizeR(fWorldRCmd->GetNewDoubleValue(newValue));}
if( command == fUpdateCmd )
{ fDetector->UpdateGeometry(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,12 +27,11 @@
/// \brief Implementation of the F01EventAction class
//
//
// $Id$
// $Id: F01EventAction.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01EventAction.hh"
@@ -46,74 +45,64 @@
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01EventAction::F01EventAction(F01RunAction* F01RA)
F01EventAction::F01EventAction(F01RunAction* action)
: G4UserEventAction(),
fCalorimeterCollID(-1),
fCalorimeterCollID(-1),
fEventMessenger(0),
fRunAction(F01RA),
fRunAction(action),
fVerboseLevel(0),
fPrintModulo(10000)
{
fEventMessenger = new F01EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01EventAction::~F01EventAction()
{
delete fEventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0)
if (evtNb%fPrintModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
if (fVerboseLevel>1)
G4cout << "<<< Event " << evtNb << " started." << G4endl;
if (fCalorimeterCollID==-1)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
fCalorimeterCollID = SDman->GetCollectionID("CalCollection");
}
G4SDManager * sdManager = G4SDManager::GetSDMpointer();
fCalorimeterCollID = sdManager->GetCollectionID("CalCollection");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01EventAction::EndOfEventAction(const G4Event* evt)
{
if (fVerboseLevel>0)
G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
//save rndm status
// save rndm status
if (fRunAction->GetRndmFreq() == 2)
{
CLHEP::HepRandom::saveEngineStatus("endOfEvent.rndm");
{
G4Random::saveEngineStatus("endOfEvent.rndm");
G4int evtNb = evt->GetEventID();
if (evtNb%fPrintModulo == 0)
{
{
G4cout << "\n---> End of Event: " << evtNb << G4endl;
CLHEP::HepRandom::showEngineStatus();
G4Random::showEngineStatus();
}
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F01EventAction::SetEventVerbose(G4int level)
{
fVerboseLevel = level ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,58 +27,55 @@
/// \brief Implementation of the F01EventActionMessenger class
//
//
// $Id$
// $Id: F01EventActionMessenger.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01EventActionMessenger.hh"
#include "F01EventAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01EventActionMessenger::F01EventActionMessenger(F01EventAction* evAct)
: G4UImessenger(),
fEventAction(evAct),
fSetVerboseCmd(0),
fPrintCmd(0)
{
fPrintCmd(0)
{
fSetVerboseCmd = new G4UIcmdWithAnInteger("/event/setverbose",this);
fSetVerboseCmd->SetGuidance("Set verbose level ." );
fSetVerboseCmd->SetGuidance("Set verbose level .");
fSetVerboseCmd->SetParameterName("level",true);
fSetVerboseCmd->SetDefaultValue(0);
fPrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
fPrintCmd->SetGuidance("Print events modulo n");
fPrintCmd->SetParameterName("EventNb",false);
fPrintCmd->SetRange("EventNb>0");
fPrintCmd->AvailableForStates(G4State_Idle);
fPrintCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01EventActionMessenger::~F01EventActionMessenger()
{
delete fSetVerboseCmd;
delete fPrintCmd;
delete fPrintCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
void F01EventActionMessenger::SetNewValue(G4UIcommand * command,
G4String newValue)
{
if(command == fSetVerboseCmd)
{fEventAction->SetEventVerbose(fSetVerboseCmd->GetNewIntValue(newValue));}
if(command == fPrintCmd)
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
{fEventAction->SetPrintModulo(fPrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,23 +27,20 @@
/// \brief Implementation of the F01FieldMessenger class
//
//
// $Id$
// $Id: F01FieldMessenger.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01FieldMessenger.hh"
#include "F01FieldSetup.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
: G4UImessenger(),
@@ -53,7 +50,7 @@ F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
fMagFieldCmd(0),
fMinStepCmd(0),
fUpdateCmd(0)
{
{
fFieldDir = new G4UIdirectory("/field/");
fFieldDir->SetGuidance("F01 field tracking control.");
@@ -63,29 +60,28 @@ F01FieldMessenger::F01FieldMessenger(F01FieldSetup* fieldSetup)
fStepperCmd->SetDefaultValue(4);
fStepperCmd->AvailableForStates(G4State_PreInit,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);
fMagFieldCmd = new G4UIcmdWithADoubleAndUnit("/field/setFieldZ",this);
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);
fMagFieldCmd->AvailableForStates(G4State_Idle);
fMinStepCmd = new G4UIcmdWithADoubleAndUnit("/field/setMinStep",this);
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);
fMinStepCmd->AvailableForStates(G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldMessenger::~F01FieldMessenger()
{
@@ -96,26 +92,18 @@ F01FieldMessenger::~F01FieldMessenger()
delete fUpdateCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
{
{
if( command == fStepperCmd )
{
fEMfieldSetup->SetStepperType(fStepperCmd->GetNewIntValue(newValue));
}
if( command == fUpdateCmd )
{
fEMfieldSetup->CreateStepperAndChordFinder();
}
fEMfieldSetup->CreateStepperAndChordFinder();
if( command == fMagFieldCmd )
{
fEMfieldSetup->SetFieldValue(fMagFieldCmd->GetNewDoubleValue(newValue));
}
if( command == fMinStepCmd )
{
fEMfieldSetup->SetMinStep(fMinStepCmd->GetNewDoubleValue(newValue));
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,13 +27,13 @@
/// \brief Implementation of the F01FieldSetup class
//
//
// $Id$
// $Id: F01FieldSetup.cc 77115 2013-11-21 15:06:37Z gcosmo $
//
// User Field setup class implementation.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01FieldSetup.hh"
#include "F01FieldMessenger.hh"
@@ -60,18 +60,15 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
// #include "G4SIunits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// Constructors:
F01FieldSetup::F01FieldSetup(G4ThreeVector fieldVector)
: fFieldManager(0),
fChordFinder(0),
fEquation(0),
fEquation(0),
fMagneticField(new G4UniformMagField(fieldVector)),
// G4ThreeVector(3.3*tesla, 0.0, 0.0 ));
fStepper(0),
fStepperType(0),
fMinStep(0.),
@@ -82,71 +79,69 @@ F01FieldSetup::F01FieldSetup(G4ThreeVector fieldVector)
InitialiseAll();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldSetup::F01FieldSetup()
: fFieldManager(0),
fChordFinder(0),
fEquation(0),
fEquation(0),
fMagneticField(new G4UniformMagField(G4ThreeVector())),
// G4ThreeVector(0.0, 0.0, 0.0 ));
fStepper(0),
fStepperType(0),
fMinStep(0.),
fFieldMessenger(0)
{
G4cout << " F01FieldSetup: magnetic field set to Uniform( 0.0, 0, 0 ) "
G4cout << " F01FieldSetup: magnetic field set to Uniform( 0.0, 0, 0 ) "
<< G4endl;
InitialiseAll();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::InitialiseAll()
{
fFieldMessenger = new F01FieldMessenger(this) ;
fFieldMessenger = new F01FieldMessenger(this);
fEquation = new G4Mag_UsualEqRhs(fMagneticField);
fEquation = new G4Mag_UsualEqRhs(fMagneticField);
fMinStep = 1.0*mm ; // minimal step of 1 mm is default
fMinStep = 1.0*mm; // minimal step of 1 mm is default
fStepperType = 4 ; // ClassicalRK4 is default stepper
fStepperType = 4; // ClassicalRK4 is default stepper
fFieldManager = G4TransportationManager::GetTransportationManager()
->GetFieldManager();
CreateStepperAndChordFinder();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01FieldSetup::~F01FieldSetup()
{
// GetGlobalFieldManager()->SetDetectorField(0);
if (fMagneticField) delete fMagneticField;
if (fChordFinder) delete fChordFinder;
if (fStepper) delete fStepper;
delete fMagneticField;
delete fChordFinder;
delete fStepper;
delete fFieldMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::CreateStepperAndChordFinder()
{
// Update field
// Update field
SetStepper();
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl ;
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl;
fFieldManager->SetDetectorField(fMagneticField );
if (fChordFinder) delete fChordFinder;
fChordFinder = new G4ChordFinder( fMagneticField, fMinStep,fStepper);
fChordFinder = new G4ChordFinder( fMagneticField, fMinStep,fStepper );
fFieldManager->SetChordFinder( fChordFinder );
return;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::SetStepper()
{
@@ -154,77 +149,75 @@ void F01FieldSetup::SetStepper()
if (fStepper) delete fStepper;
switch ( fStepperType )
switch ( fStepperType )
{
case 0:
fStepper = new G4ExplicitEuler( fEquation );
G4cout<<"G4ExplicitEuler is calledS"<<G4endl;
case 0:
fStepper = new G4ExplicitEuler( fEquation );
G4cout<<"G4ExplicitEuler is calledS"<<G4endl;
break;
case 1:
fStepper = new G4ImplicitEuler( fEquation );
G4cout<<"G4ImplicitEuler is called"<<G4endl;
case 1:
fStepper = new G4ImplicitEuler( fEquation );
G4cout<<"G4ImplicitEuler is called"<<G4endl;
break;
case 2:
fStepper = new G4SimpleRunge( fEquation );
G4cout<<"G4SimpleRunge is called"<<G4endl;
case 2:
fStepper = new G4SimpleRunge( fEquation );
G4cout<<"G4SimpleRunge is called"<<G4endl;
break;
case 3:
fStepper = new G4SimpleHeum( fEquation );
G4cout<<"G4SimpleHeum is called"<<G4endl;
case 3:
fStepper = new G4SimpleHeum( fEquation );
G4cout<<"G4SimpleHeum is called"<<G4endl;
break;
case 4:
fStepper = new G4ClassicalRK4( fEquation );
G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
case 4:
fStepper = new G4ClassicalRK4( fEquation );
G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
break;
case 5:
fStepper = new G4HelixExplicitEuler( fEquation );
G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
case 5:
fStepper = new G4HelixExplicitEuler( fEquation );
G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
break;
case 6:
fStepper = new G4HelixImplicitEuler( fEquation );
G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
case 6:
fStepper = new G4HelixImplicitEuler( fEquation );
G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
break;
case 7:
fStepper = new G4HelixSimpleRunge( fEquation );
G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
case 7:
fStepper = new G4HelixSimpleRunge( fEquation );
G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
break;
case 8:
fStepper = new G4CashKarpRKF45( fEquation );
G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
case 8:
fStepper = new G4CashKarpRKF45( fEquation );
G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
break;
case 9:
fStepper = new G4RKG3_Stepper( fEquation );
G4cout<<"G4RKG3_Stepper is called"<<G4endl;
case 9:
fStepper = new G4RKG3_Stepper( fEquation );
G4cout<<"G4RKG3_Stepper is called"<<G4endl;
break;
default: fStepper = 0;
}
return;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::SetFieldValue(G4double fieldStrength)
{
// Set the value of the Global Field to fieldValue along Z
// Set the value of the Global Field to fieldValue along Z
#ifdef G4VERBOSE
G4cout << "Setting Field strength to "
G4cout << "Setting Field strength to "
<< fieldStrength / gauss << " Gauss."; // << G4endl;
#endif
G4ThreeVector fieldSetVec(0.0, 0.0, fieldStrength);
this->SetFieldValue( fieldSetVec );
// *************
this->SetFieldValue( fieldSetVec );
#ifdef G4VERBOSE
G4double fieldValue[6], position[4];
position[0] = position[1] = position[2] = position[3] = 0.0;
G4double fieldValue[6], position[4];
position[0] = position[1] = position[2] = position[3] = 0.0;
if ( fieldStrength != 0.0 ) {
fMagneticField->GetFieldValue( position, fieldValue);
G4ThreeVector fieldVec(fieldValue[0], fieldValue[1], fieldValue[2]);
// G4cout << " fMagneticField is now " << fMagneticField
G4cout << " Magnetic field vector is "
<< fieldVec / gauss << " G " << G4endl;
G4ThreeVector fieldVec(fieldValue[0], fieldValue[1], fieldValue[2]);
// G4cout << " fMagneticField is now " << fMagneticField
G4cout << " Magnetic field vector is "
<< fieldVec / gauss << " G " << G4endl;
} else {
if ( fMagneticField == 0 )
G4cout << " Magnetic field pointer is null." << G4endl;
@@ -232,48 +225,46 @@ void F01FieldSetup::SetFieldValue(G4double fieldStrength)
G4Exception("F01FieldSetup::SetFieldValue(double)",
"IncorrectForZeroField",
FatalException,
"fMagneticField ptr should be set to 0 for no field.");
"fMagneticField ptr should be set to 0 for no field.");
}
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01FieldSetup::SetFieldValue(G4ThreeVector fieldVector)
{
// Set the value of the Global Field
// Set the value of the Global Field
if (fMagneticField) delete fMagneticField;
if (fieldVector != G4ThreeVector(0.,0.,0.))
{
{
fMagneticField = new G4UniformMagField(fieldVector);
// CreateStepperAndChordFinder();
}
else
else
{
// If the new field's value is Zero, signal it as below
// so that it is not used for propagation.
// so that it is not used for propagation.
fMagneticField = 0;
}
// Set this as the field of the global Field Manager
// Set this as the field of the global Field Manager
GetGlobalFieldManager()->SetDetectorField(fMagneticField);
// Now notify equation of new field
fEquation->SetFieldObj( fMagneticField );
fEquation->SetFieldObj( fMagneticField );
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4FieldManager* F01FieldSetup::GetGlobalFieldManager()
{
// Utility method
// Utility method
return G4TransportationManager::GetTransportationManager()
->GetFieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,11 +27,14 @@
/// \brief Implementation of the F01PhysicsList class
//
//
// $Id$
//
// $Id: F01PhysicsList.cc 77792 2013-11-28 09:53:09Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Timer.hh"
#include "F01PhysicsList.hh"
#include "F01DetectorConstruction.hh"
#include "F01PhysicsListMessenger.hh"
@@ -44,63 +47,48 @@
#include "G4EnergyLossTables.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include <iomanip>
/////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PhysicsList::F01PhysicsList(F01DetectorConstruction* p)
: G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
thePhotoElectricEffect(0), theComptonScattering(0),
theGammaConversion(0), theeminusIonisation(0),
theeminusBremsstrahlung(0), theeplusIonisation(0),
theeplusBremsstrahlung(0), theeplusAnnihilation(0),
theeminusStepCut(0),theeplusStepCut(0)
: G4VUserPhysicsList(), fMaxChargedStep(DBL_MAX)
{
pDet = p;
fDet = p;
defaultCutValue = 1.000*mm ;
defaultCutValue = 1.000*mm;
cutForGamma = defaultCutValue ;
cutForElectron = defaultCutValue ;
fCutForGamma = defaultCutValue;
fCutForElectron = defaultCutValue;
SetVerboseLevel(1);
physicsListMessenger = new F01PhysicsListMessenger(this);
fPhysicsListMessenger = new F01PhysicsListMessenger(this);
}
/////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PhysicsList::~F01PhysicsList()
{
delete physicsListMessenger;
delete fPhysicsListMessenger;
}
///////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
// created in the program.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBarions();
G4GenericIon::GenericIonDefinition();
}
////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::ConstructBosons()
{
@@ -112,9 +100,10 @@ void F01PhysicsList::ConstructBosons()
G4ChargedGeantino::ChargedGeantinoDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::ConstructLeptons()
{
// leptons
@@ -130,9 +119,11 @@ void F01PhysicsList::ConstructLeptons()
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::ConstructMesons()
{
// mesons
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
@@ -141,32 +132,27 @@ void F01PhysicsList::ConstructMesons()
G4KaonMinus::KaonMinusDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::ConstructBarions()
{
// barions
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
}
///////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::ConstructProcess()
{
AddTransportation();
// AddParameterisation();
ConstructEM();
ConstructGeneral();
}
/////////////////////////////////////////////////////////////////////////////
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
@@ -198,110 +184,82 @@ void F01PhysicsList::ConstructEM()
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma")
if (particleName == "gamma")
{
// Construct processes for gamma
thePhotoElectricEffect = new G4PhotoElectricEffect();
theComptonScattering = new G4ComptonScattering();
theGammaConversion = new G4GammaConversion();
pmanager->AddDiscreteProcess(thePhotoElectricEffect);
pmanager->AddDiscreteProcess(theComptonScattering);
G4PhotoElectricEffect* fPhotoElectricEffect = new G4PhotoElectricEffect();
G4ComptonScattering* fComptonScattering = new G4ComptonScattering();
G4GammaConversion* fGammaConversion = new G4GammaConversion();
pmanager->AddDiscreteProcess(theGammaConversion);
}
else if (particleName == "e-")
pmanager->AddDiscreteProcess(fPhotoElectricEffect);
pmanager->AddDiscreteProcess(fComptonScattering);
pmanager->AddDiscreteProcess(fGammaConversion);
}
else if (particleName == "e-")
{
// Construct processes for electron
// Construct processes for electron
// theeminusMultipleScattering = new G4eMultipleScattering();
theeminusIonisation = new G4eIonisation();
theeminusBremsstrahlung = new G4eBremsstrahlung();
G4eIonisation* feminusIonisation = new G4eIonisation();
G4eBremsstrahlung* feminusBremsstrahlung = new G4eBremsstrahlung();
F01StepCut* feminusStepCut = new F01StepCut();
feminusStepCut->SetMaxStep(fMaxChargedStep);
theeminusStepCut = new F01StepCut();
// pmanager->AddProcess(theeminusMultipleScattering,-1,1,1);
pmanager->AddProcess(theeminusIonisation,-1,2,2);
pmanager->AddProcess(theeminusBremsstrahlung,-1,-1,3);
pmanager->AddProcess(theeminusStepCut,-1,-1,4);
theeminusStepCut->SetMaxStep(MaxChargedStep) ;
}
else if (particleName == "e+")
pmanager->AddProcess(feminusIonisation,-1,2,2);
pmanager->AddProcess(feminusBremsstrahlung,-1,-1,3);
pmanager->AddProcess(feminusStepCut,-1,-1,4);
}
else if (particleName == "e+")
{
// Construct processes for positron
// theeplusMultipleScattering = new G4eMultipleScattering();
theeplusIonisation = new G4eIonisation();
theeplusBremsstrahlung = new G4eBremsstrahlung();
// theeplusAnnihilation = new G4eplusAnnihilation();
G4eIonisation* feplusIonisation = new G4eIonisation();
G4eBremsstrahlung* feplusBremsstrahlung = new G4eBremsstrahlung();
F01StepCut* feplusStepCut = new F01StepCut();
feplusStepCut->SetMaxStep(fMaxChargedStep);
theeplusStepCut = new F01StepCut();
// pmanager->AddProcess(theeplusMultipleScattering,-1,1,1);
pmanager->AddProcess(theeplusIonisation,-1,2,2);
pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
// pmanager->AddProcess(theeplusAnnihilation,0,-1,4);
pmanager->AddProcess(theeplusStepCut,-1,-1,5);
theeplusStepCut->SetMaxStep(MaxChargedStep) ;
}
else if( particleName == "mu+" ||
particleName == "mu-" )
pmanager->AddProcess(feplusIonisation,-1,2,2);
pmanager->AddProcess(feplusBremsstrahlung,-1,-1,3);
pmanager->AddProcess(feplusStepCut,-1,-1,5);
}
else if( particleName == "mu+" || particleName == "mu-" )
{
// Construct processes for muon+
// Construct processes for muon+
F01StepCut* muonStepCut = new F01StepCut();
muonStepCut->SetMaxStep(fMaxChargedStep);
G4MuIonisation* muIonisation = new G4MuIonisation();
G4MuIonisation* themuIonisation = new G4MuIonisation() ;
pmanager->AddProcess(new G4MuMultipleScattering(),-1,1,1);
pmanager->AddProcess(themuIonisation,-1,2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
pmanager->AddProcess( muonStepCut,-1,-1,3);
muonStepCut->SetMaxStep(MaxChargedStep) ;
}
else if (
particleName == "proton"
|| particleName == "antiproton"
|| particleName == "pi+"
|| particleName == "pi-"
|| particleName == "kaon+"
|| particleName == "kaon-"
)
pmanager->AddProcess(new G4MuMultipleScattering(),-1,1,1);
pmanager->AddProcess(muIonisation,-1,2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(),-1,-1,3);
pmanager->AddProcess(new G4MuPairProduction(),-1,-1,4);
pmanager->AddProcess(muonStepCut,-1,-1,3);
}
else if ( particleName == "proton"
|| particleName == "antiproton"
|| particleName == "pi+"
|| particleName == "pi-"
|| particleName == "kaon+"
|| particleName == "kaon-"
)
{
F01StepCut* thehadronStepCut = new F01StepCut();
G4hIonisation* thehIonisation = new G4hIonisation() ;
F01StepCut* theHadronStepCut = new F01StepCut();
theHadronStepCut->SetMaxStep(10*mm);
G4hIonisation* thehIonisation = new G4hIonisation();
G4hMultipleScattering* thehMultipleScattering =
new G4hMultipleScattering() ;
new G4hMultipleScattering();
pmanager->AddProcess(thehMultipleScattering,-1,1,1);
pmanager->AddProcess(thehIonisation,-1,2,2);
pmanager->AddProcess( thehadronStepCut,-1,-1,3);
thehadronStepCut->SetMaxStep(MaxChargedStep) ;
thehadronStepCut->SetMaxStep(10*mm) ;
pmanager->AddProcess(theHadronStepCut,-1,-1,3);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Decay.hh"
@@ -309,7 +267,7 @@ void F01PhysicsList::ConstructGeneral()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() )
@@ -318,7 +276,7 @@ void F01PhysicsList::ConstructGeneral()
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle))
{
{
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
@@ -329,14 +287,12 @@ void F01PhysicsList::ConstructGeneral()
}
}
/////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::SetCuts()
{
G4Timer theTimer ;
theTimer.Start() ;
G4Timer theTimer;
theTimer.Start();
if (verboseLevel >0)
{
G4cout << "F01PhysicsList::SetCuts:";
@@ -344,41 +300,42 @@ void F01PhysicsList::SetCuts()
}
// 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(fCutForGamma,"gamma");
SetCutValue(cutForGamma,"gamma");
SetCutValue(cutForElectron,"e-");
SetCutValue(cutForElectron,"e+");
SetCutValue(fCutForElectron,"e-");
SetCutValue(fCutForElectron,"e+");
if (verboseLevel>1) DumpCutValuesTable();
theTimer.Stop();
G4cout.precision(6);
G4cout << G4endl ;
G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
G4cout << G4endl;
G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed()
<< " s " <<G4endl;
}
///////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::SetGammaCut(G4double val)
{
cutForGamma = val;
fCutForGamma = val;
}
///////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::SetElectronCut(G4double val)
{
cutForElectron = val;
fCutForElectron = val;
}
////////////////////////////////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsList::SetMaxStep(G4double step)
{
MaxChargedStep = step ;
G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
fMaxChargedStep = step;
G4cout << " MaxChargedStep=" << fMaxChargedStep << G4endl;
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,69 +27,62 @@
/// \brief Implementation of the F01PhysicsListMessenger class
//
//
// $Id$
// $Id: F01PhysicsListMessenger.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01PhysicsListMessenger.hh"
#include "F01PhysicsList.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PhysicsListMessenger::F01PhysicsListMessenger(F01PhysicsList * List)
: F01List(List)
: fF01List(List)
{
cutGCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutG",this);
cutGCmd->SetGuidance("Set cut values by RANGE for Gamma.");
cutGCmd->SetParameterName("range",true);
cutGCmd->SetDefaultValue(1.);
cutGCmd->SetDefaultUnit("mm");
cutGCmd->AvailableForStates(G4State_Idle);
fCutGCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutG",this);
fCutGCmd->SetGuidance("Set cut values by RANGE for Gamma.");
fCutGCmd->SetParameterName("range",true);
fCutGCmd->SetDefaultValue(1.);
fCutGCmd->SetDefaultUnit("mm");
fCutGCmd->AvailableForStates(G4State_Idle);
cutECmd = new G4UIcmdWithADoubleAndUnit("/calor/cutE",this);
cutECmd->SetGuidance("Set cut values by RANGE for e- e+.");
cutECmd->SetParameterName("range",true);
cutECmd->SetDefaultValue(1.);
cutECmd->SetDefaultUnit("mm");
cutECmd->AvailableForStates(G4State_Idle);
setMaxStepCmd = new G4UIcmdWithADoubleAndUnit("/step/setMaxStep",this);
setMaxStepCmd->SetGuidance("Set max. step length in the detector");
setMaxStepCmd->SetParameterName("mxStep",true);
setMaxStepCmd->SetDefaultUnit("mm");
fCutECmd = new G4UIcmdWithADoubleAndUnit("/calor/cutE",this);
fCutECmd->SetGuidance("Set cut values by RANGE for e- e+.");
fCutECmd->SetParameterName("range",true);
fCutECmd->SetDefaultValue(1.);
fCutECmd->SetDefaultUnit("mm");
fCutECmd->AvailableForStates(G4State_Idle);
fSetMaxStepCmd = new G4UIcmdWithADoubleAndUnit("/step/setMaxStep",this);
fSetMaxStepCmd->SetGuidance("Set max. step length in the detector");
fSetMaxStepCmd->SetParameterName("mxStep",true);
fSetMaxStepCmd->SetDefaultUnit("mm");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PhysicsListMessenger::~F01PhysicsListMessenger()
{
delete setMaxStepCmd;
delete cutGCmd;
delete cutECmd;
delete fSetMaxStepCmd;
delete fCutGCmd;
delete fCutECmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PhysicsListMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
void F01PhysicsListMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if(command == cutGCmd)
{ F01List->SetGammaCut(cutGCmd->GetNewDoubleValue(newValue));}
if(command == cutECmd)
{ F01List->SetElectronCut(eCmd->GetNewDoubleValue(newValue));}
if(command == setMaxStepCmd)
{ F01List->SetMaxStep(setMaxStepCmd->GetNewDoubleValue(newValue));}
if(command == fCutGCmd)
{fF01List->SetGammaCut(fCutGCmd->GetNewDoubleValue(newValue));}
if(command == fCutECmd)
{fF01List->SetElectronCut(fCutECmd->GetNewDoubleValue(newValue));}
if(command == fSetMaxStepCmd)
{fF01List->SetMaxStep(fSetMaxStepCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,12 +27,11 @@
/// \brief Implementation of the F01PrimaryGeneratorAction class
//
//
// $Id$
// $Id: F01PrimaryGeneratorAction.cc 77881 2013-11-29 08:37:53Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01PrimaryGeneratorAction.hh"
@@ -43,31 +42,32 @@
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4ios.hh"
#include "G4PhysicalConstants.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String F01PrimaryGeneratorAction::fgPrimaryParticleName = "e-" ;
G4ParticleDefinition* F01PrimaryGeneratorAction::fgPrimaryParticle = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PrimaryGeneratorAction::F01PrimaryGeneratorAction(
F01DetectorConstruction* det)
: fParticleGun(0),
fDetector(det),
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0),
fDetector(det),
fGunMessenger(0),
fRndmFlag("off"),
fXVertex(0.),
fYVertex(0.),
fXVertex(0.),
fYVertex(0.),
fZVertex(0.),
fVertexDefined(false)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
// create a messenger for this class
fGunMessenger = new F01PrimaryGeneratorMessenger(this);
@@ -78,18 +78,19 @@ F01PrimaryGeneratorAction::F01PrimaryGeneratorAction(
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="e-");
fParticleGun->SetParticleDefinition(particle);
fgPrimaryParticleName = particle->GetParticleName() ;
fgPrimaryParticle = particle;
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,-1.));
fParticleGun->SetParticleEnergy(0.5*GeV);
fZVertex = fDetector->GetAbsorberZpos() -0.5*(fDetector->GetAbsorberThickness());
fZVertex = fDetector->GetAbsorberZpos() -
0.5*(fDetector->GetAbsorberThickness());
fParticleGun->SetParticlePosition(G4ThreeVector(fXVertex,fYVertex,fZVertex));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PrimaryGeneratorAction::~F01PrimaryGeneratorAction()
{
@@ -97,76 +98,76 @@ F01PrimaryGeneratorAction::~F01PrimaryGeneratorAction()
delete fGunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// this function is called at the begining of event
//
fgPrimaryParticleName
= fParticleGun->GetParticleDefinition()->GetParticleName() ;
G4double x0,y0,z0 ;
//
fgPrimaryParticle = fParticleGun->GetParticleDefinition();
G4double x0,y0,z0;
if (fVertexDefined)
{
x0 = fXVertex ;
y0 = fYVertex ;
z0 = fZVertex ;
x0 = fXVertex;
y0 = fYVertex;
z0 = fZVertex;
}
else
{
x0 = 0. ;
y0 = 0. ;
x0 = 0.;
y0 = 0.;
z0 = fDetector->GetAbsorberZpos()-0.5*(fDetector->GetAbsorberThickness());
}
G4double r0,phi0 ;
G4double r0,phi0;
if (fRndmFlag == "on")
{
r0 = (fDetector->GetAbsorberRadius())*std::sqrt(G4UniformRand());
phi0 = twopi*G4UniformRand();
x0 = r0*std::cos(phi0);
y0 = r0*std::sin(phi0);
}
}
fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String F01PrimaryGeneratorAction::GetPrimaryName()
{
return fgPrimaryParticleName ;
return fgPrimaryParticle->GetParticleName();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PrimaryGeneratorAction::SetZVertex(G4double z)
{
fVertexDefined = true ;
fZVertex = z ;
fVertexDefined = true;
fZVertex = z;
G4cout << " Z coordinate of the primary vertex = " << fZVertex/mm <<
" mm." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PrimaryGeneratorAction::SetXVertex(G4double x)
{
fVertexDefined = true ;
fXVertex = x ;
fVertexDefined = true;
fXVertex = x;
G4cout << " X coordinate of the primary vertex = " << fXVertex/mm <<
" mm." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PrimaryGeneratorAction::SetYVertex(G4double y)
{
fVertexDefined = true ;
fYVertex = y ;
fVertexDefined = true;
fYVertex = y;
G4cout << " Y coordinate of the primary vertex = " << fYVertex/mm <<
" mm." << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,12 +27,11 @@
/// \brief Implementation of the F01PrimaryGeneratorMessenger class
//
//
// $Id$
// $Id: F01PrimaryGeneratorMessenger.cc 77881 2013-11-29 08:37:53Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01PrimaryGeneratorMessenger.hh"
@@ -41,7 +40,7 @@
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PrimaryGeneratorMessenger::F01PrimaryGeneratorMessenger(
F01PrimaryGeneratorAction* action)
@@ -51,7 +50,7 @@ F01PrimaryGeneratorMessenger::F01PrimaryGeneratorMessenger(
fSetXVertexCmd(0),
fSetYVertexCmd(0),
fSetZVertexCmd(0)
{
{
fRndmCmd = new G4UIcmdWithAString("/gun/random",this);
fRndmCmd->SetGuidance("Shoot randomly the incident particle.");
fRndmCmd->SetGuidance(" Choice : on, off(default)");
@@ -63,21 +62,24 @@ F01PrimaryGeneratorMessenger::F01PrimaryGeneratorMessenger(
fSetXVertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
fSetXVertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
fSetXVertexCmd->SetParameterName("xv",true);
fSetXVertexCmd->SetDefaultValue(0.0*mm) ;
fSetXVertexCmd->SetDefaultValue(0.0*mm);
fSetXVertexCmd->SetDefaultUnit("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) ;
fSetYVertexCmd->SetDefaultValue(0.0*mm);
fSetYVertexCmd->SetDefaultUnit("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) ;
fSetZVertexCmd->SetDefaultValue(0.0*mm);
fSetZVertexCmd->SetDefaultUnit("mm");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01PrimaryGeneratorMessenger::~F01PrimaryGeneratorMessenger()
{
@@ -87,19 +89,19 @@ F01PrimaryGeneratorMessenger::~F01PrimaryGeneratorMessenger()
delete fSetZVertexCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
void F01PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,
G4String newValue)
{
if( command == fRndmCmd )
{ fAction->SetRndmFlag(newValue);}
if( command == fSetXVertexCmd)
if( command == fSetXVertexCmd )
{ fAction->SetXVertex(fSetXVertexCmd->GetNewDoubleValue(newValue));}
if( command == fSetYVertexCmd)
if( command == fSetYVertexCmd )
{ fAction->SetYVertex(fSetYVertexCmd->GetNewDoubleValue(newValue));}
if( command == fSetZVertexCmd)
if( command == fSetZVertexCmd )
{ fAction->SetZVertex(fSetZVertexCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,12 +27,11 @@
/// \brief Implementation of the F01RunAction class
//
//
// $Id$
// $Id: F01RunAction.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01RunAction.hh"
#include "F01RunMessenger.hh"
@@ -40,12 +39,10 @@
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include <iomanip>
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01RunAction::F01RunAction()
: G4UserRunAction(),
@@ -55,33 +52,33 @@ F01RunAction::F01RunAction()
fMessenger = new F01RunMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01RunAction::~F01RunAction()
{
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01RunAction::BeginOfRunAction(const G4Run* run)
{
{
G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
// save Rndm status
if (fSaveRndm > 0)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
}
G4UImanager* UI = G4UImanager::GetUIpointer();
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
{
G4Random::showEngineStatus();
G4Random::saveEngineStatus("beginOfRun.rndm");
}
G4UImanager* ui = G4UImanager::GetUIpointer();
G4VVisManager* visManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager) UI->ApplyCommand("/vis/scene/notifyHandlers");
if (visManager) ui->ApplyCommand("/vis/scene/notifyHandlers");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01RunAction::EndOfRunAction(const G4Run*)
{
@@ -93,10 +90,10 @@ void F01RunAction::EndOfRunAction(const G4Run*)
// save Rndm status
if (fSaveRndm == 1)
{
CLHEP::HepRandom::showEngineStatus();
CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
}
{
G4Random::showEngineStatus();
G4Random::saveEngineStatus("endOfRun.rndm");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,24 +27,20 @@
/// \brief Implementation of the F01RunMessenger class
//
//
// $Id$
// $Id: F01RunMessenger.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01RunMessenger.hh"
#include "F01RunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01RunMessenger::F01RunMessenger(F01RunAction* action)
: G4UImessenger(),
@@ -55,45 +51,46 @@ F01RunMessenger::F01RunMessenger(F01RunAction* action)
{
fRndmDir = new G4UIdirectory("/rndm/");
fRndmDir->SetGuidance("Rndm status control.");
fRndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
fRndmSaveCmd->SetGuidance("set frequency to save rndm status on external files.");
fRndmSaveCmd->
SetGuidance("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->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
fRndmSaveCmd->SetParameterName("frequency",false);
fRndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
fRndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
fRndmReadCmd->SetGuidance("get rndm status from an external file.");
fRndmReadCmd->SetParameterName("fileName",true);
fRndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
fRndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fRndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01RunMessenger::~F01RunMessenger()
{
delete fRndmSaveCmd;
delete fRndmReadCmd;
delete fRndmDir;
delete fRndmSaveCmd;
delete fRndmReadCmd;
delete fRndmDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
{
if (command == fRndmSaveCmd)
fRunAction->SetRndmFreq(fRndmSaveCmd->GetNewIntValue(newValues));
if (command == fRndmReadCmd)
{ G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
CLHEP::HepRandom::restoreEngineStatus(newValues);
CLHEP::HepRandom::showEngineStatus();
}
{G4cout << "\n---> rndm status restored from file: " << newValues << G4endl;
G4Random::restoreEngineStatus(newValues);
G4Random::showEngineStatus();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,11 +27,10 @@
/// \brief Implementation of the F01StepCut class
//
//
// $Id$
// $Id: F01StepCut.cc 76248 2013-11-08 11:19:52Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01StepCut.hh"
@@ -40,7 +39,7 @@
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01StepCut::F01StepCut(const G4String& aName)
: G4VDiscreteProcess(aName),
@@ -51,24 +50,22 @@ F01StepCut::F01StepCut(const G4String& aName)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01StepCut::~F01StepCut()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01StepCut::F01StepCut(F01StepCut& right)
: G4VDiscreteProcess(right)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01StepCut::SetMaxStep(G4double step)
{
fMaxChargedStep = step ;
fMaxChargedStep = step;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -27,52 +27,53 @@
/// \brief Implementation of the F01SteppingVerbose class
//
//
// $Id$
// $Id: F01SteppingVerbose.cc 77483 2013-11-25 10:10:57Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "F01SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01SteppingVerbose::F01SteppingVerbose()
: G4SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
F01SteppingVerbose::~F01SteppingVerbose()
{}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(6);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw(10) << "X" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Z" << " "
<< std::setw(10) << "Direction x" << " "
<< std::setw(10) << "dir y" << " "
<< 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( 6) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "NextVolu"
<< std::setw(10) << "Process" << " "
<< G4endl;
<< G4endl;
}
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
@@ -83,20 +84,22 @@ void F01SteppingVerbose::StepInfo()
<< 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( 6) << G4BestUnit(
fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if( fTrack->GetNextVolume() != 0 ) {
if( fTrack->GetNextVolume() != 0 ) {
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
G4cout << " "
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
G4cout << " "
<< std::setw(10)
<< fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << " UserLimit";
}
@@ -108,7 +111,7 @@ void F01SteppingVerbose::StepInfo()
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
@@ -117,7 +120,7 @@ void F01SteppingVerbose::StepInfo()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++)
{
G4cout << " : "
@@ -133,41 +136,40 @@ void F01SteppingVerbose::StepInfo()
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void F01SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(6);
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw(10) << "X" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Y" << " "
<< std::setw(10) << "Z" << " "
<< std::setw(10) << "Direction x" << " "
<< std::setw(10) << "dir y" << " "
<< 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) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process"
<< G4endl;
<< std::setw(10) << "Process"
<< G4endl;
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(10) << G4BestUnit(fTrack->GetPosition().x(),"Length")
@@ -177,7 +179,8 @@ void F01SteppingVerbose::TrackingStarted()
<< 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( 6) << G4BestUnit(
fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(10) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(10) << G4BestUnit(fTrack->GetTrackLength(),"Length");
@@ -191,4 +194,4 @@ void F01SteppingVerbose::TrackingStarted()
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......