Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02CalorHit.cc,v 1.2 2001/07/11 09:58:03 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02CalorHit.hh"
G4Allocator<F02CalorHit> F02CalorHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02CalorHit::F02CalorHit()
{
EdepAbs = 0.; TrackLengthAbs = 0.;
EdepGap = 0.; TrackLengthGap = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02CalorHit::~F02CalorHit()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02CalorHit::F02CalorHit(const F02CalorHit& right)
{
EdepAbs = right.EdepAbs; TrackLengthAbs = right.TrackLengthAbs;
EdepGap = right.EdepGap; TrackLengthGap = right.TrackLengthGap;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const F02CalorHit& F02CalorHit::operator=(const F02CalorHit& right)
{
EdepAbs = right.EdepAbs; TrackLengthAbs = right.TrackLengthAbs;
EdepGap = right.EdepGap; TrackLengthGap = right.TrackLengthGap;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int F02CalorHit::operator==(const F02CalorHit& right) const
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02CalorHit::Print()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,134 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02CalorimeterSD.cc,v 1.4 2001/11/07 16:36:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02CalorimeterSD.hh"
#include "F02CalorHit.hh"
#include "F02DetectorConstruction.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02CalorimeterSD::F02CalorimeterSD(G4String name,
F02DetectorConstruction* det)
: G4VSensitiveDetector(name), Detector(det)
{
collectionName.insert("CalCollection");
HitID = new G4int[500];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02CalorimeterSD::~F02CalorimeterSD()
{
delete [] HitID;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02CalorimeterSD::Initialize(G4HCofThisEvent*HCE)
{
CalCollection = new F02CalorHitsCollection(SensitiveDetectorName,
collectionName[0]);
for (G4int j=0;j<1; j++)
{
HitID[j] = -1;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool F02CalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
{
G4double edep = aStep->GetTotalEnergyDeposit();
G4double stepl = 0.;
stepl = aStep->GetStepLength();
if ((edep == 0.) && (stepl == 0.) ) return false;
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
G4int F02Number = 0 ;
if (HitID[F02Number]==-1)
{
F02CalorHit* calHit = new F02CalorHit();
if (physVol == Detector->GetAbsorber()) calHit->AddAbs(edep,stepl);
HitID[F02Number] = CalCollection->insert(calHit) - 1;
if (verboseLevel>0)
G4cout << " New Calorimeter Hit on F02: " << F02Number << G4endl;
}
else
{
if (physVol == Detector->GetAbsorber())
(*CalCollection)[HitID[F02Number]]->AddAbs(edep,stepl);
if (verboseLevel>0)
G4cout << " Energy added to F02: " << F02Number << G4endl;
}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02CalorimeterSD::EndOfEvent(G4HCofThisEvent* HCE)
{
static G4int HCID = -1;
if(HCID<0)
{
HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
}
HCE->AddHitsCollection(HCID,CalCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02CalorimeterSD::clear()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02CalorimeterSD::PrintAll()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,410 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02DetectorConstruction.cc,v 1.5 2001/10/26 13:42:45 grichine Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
#include "F02DetectorConstruction.hh"
#include "F02DetectorMessenger.hh"
#include "F02CalorimeterSD.hh"
#include "F02ElectroMagneticField.hh"
#include "G4VClusterModel.hh"
#include "G4PAIclusterModel.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 "G4ios.hh"
/////////////////////////////////////////////////////////////////////////////
//
//
F02DetectorConstruction::F02DetectorConstruction()
: solidWorld(0), logicWorld(0), physiWorld(0),
solidAbsorber(0),logicAbsorber(0), physiAbsorber(0),
magField(0), fEmField(0), calorimeterSD(0),
AbsorberMaterial(0), worldchanged(false), WorldMaterial(0)
{
// default parameter values of the calorimeter
WorldSizeZ = 80.*cm;
WorldSizeR = 20.*cm;
AbsorberThickness = 40.0*mm;
AbsorberRadius = 10.*cm;
zAbsorber = 36.*cm ;
// create commands for interactive definition of the calorimeter
detectorMessenger = new F02DetectorMessenger(this);
// fEmField = new F02ElectroMagneticField() ;
}
//////////////////////////////////////////////////////////////////////////
//
//
F02DetectorConstruction::~F02DetectorConstruction()
{
delete detectorMessenger;
if (fEmField) delete fEmField ;
}
//////////////////////////////////////////////////////////////////////////
//
//
G4VPhysicalVolume* F02DetectorConstruction::Construct()
{
DefineMaterials();
return ConstructCalorimeter();
}
//////////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::DefineMaterials()
{
//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;
G4int ncomponents;
G4double fractionmass, pressure, temperature;
//
// define Elements
//
a = 1.01*g/mole;
G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
a = 6.01*g/mole;
G4Element* elC = new G4Element(name="Carbon", symbol="C", z=6., a);
a = 14.01*g/mole;
G4Element* elN = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
a = 16.00*g/mole;
G4Element* elO = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
a = 39.948*g/mole;
G4Element* elAr = new G4Element(name="Argon", symbol="Ar", z=18., a);
//
// define simple materials
//
// 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);
// Polypropelene
G4Material* CH2 = new G4Material ("Polypropelene" , 0.91*g/cm3, 2);
CH2->AddElement(elH,2);
CH2->AddElement(elC,1);
// Krypton as detector gas, STP
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.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.2928*mg/cm3 ; // STP
temperature = STP_Temperature;
pressure = 1.0e-0*STP_Pressure;
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 ) ;
// Xenon as detector gas, STP
density = 5.858*mg/cm3 ;
a = 131.29*g/mole ;
G4Material* Xe = new G4Material(name="Xenon",z=54., a, density );
// Carbon dioxide, STP
density = 1.977*mg/cm3;
G4Material* CarbonDioxide = new G4Material(name="CO2", density, nel=2);
CarbonDioxide->AddElement(elC,1);
CarbonDioxide->AddElement(elO,2);
// 80% Xe + 20% CO2, STP
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 ) ;
// 80% Kr + 20% CO2, STP
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 ) ;
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
AbsorberMaterial = Kr20CO2 ; // XeCO2CF4 ;
WorldMaterial = Air ;
}
/////////////////////////////////////////////////////////////////////////
//
//
G4VPhysicalVolume* F02DetectorConstruction::ConstructCalorimeter()
{
// complete the Calor parameters definition and Print
ComputeCalorParameters();
PrintCalorParameters();
// World
if(solidWorld) delete solidWorld ;
if(logicWorld) delete logicWorld ;
if(physiWorld) delete physiWorld ;
solidWorld = new G4Tubs("World", //its name
0.,WorldSizeR,WorldSizeZ/2.,0.,twopi) ;//its size
logicWorld = new G4LogicalVolume(solidWorld, //its solid
WorldMaterial, //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
// Absorber
if (AbsorberThickness > 0.)
{
if(solidAbsorber) delete solidAbsorber ;
if(logicAbsorber) delete logicAbsorber ;
if(physiAbsorber) delete physiAbsorber ;
solidAbsorber = new G4Tubs("Absorber",
0.,AbsorberRadius,AbsorberThickness/2.,0.,twopi);
logicAbsorber = new G4LogicalVolume(solidAbsorber,
AbsorberMaterial,
"Absorber");
physiAbsorber = new G4PVPlacement(0,
G4ThreeVector(0.,0.,zAbsorber),
"Absorber",
logicAbsorber,
physiWorld,
false,
0);
}
// Sensitive Detectors: Absorber
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if(!calorimeterSD)
{
calorimeterSD = new F02CalorimeterSD("CalorSD",this);
SDman->AddNewDetector( calorimeterSD );
}
if (logicAbsorber) logicAbsorber->SetSensitiveDetector(calorimeterSD);
return physiWorld;
}
////////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::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;
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;
G4cout << G4endl;
}
///////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
{
// get the pointer to the material table
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)
{
AbsorberMaterial = pttoMaterial;
logicAbsorber->SetMaterial(pttoMaterial);
}
}
}
////////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::SetWorldMaterial(G4String materialChoice)
{
// get the pointer to the material table
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)
{
WorldMaterial = pttoMaterial;
logicWorld->SetMaterial(pttoMaterial);
}
}
}
///////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::SetAbsorberThickness(G4double val)
{
// change Absorber thickness and recompute the calorimeter parameters
AbsorberThickness = val;
ComputeCalorParameters();
}
/////////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::SetAbsorberRadius(G4double val)
{
// change the transverse size and recompute the calorimeter parameters
AbsorberRadius = val;
ComputeCalorParameters();
}
////////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::SetWorldSizeZ(G4double val)
{
worldchanged=true;
WorldSizeZ = val;
ComputeCalorParameters();
}
///////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::SetWorldSizeR(G4double val)
{
worldchanged=true;
WorldSizeR = val;
ComputeCalorParameters();
}
//////////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::SetAbsorberZpos(G4double val)
{
zAbsorber = val;
ComputeCalorParameters();
}
////////////////////////////////////////////////////////////////////////////
//
//
void F02DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
}
//
//
////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,160 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02DetectorMessenger.cc,v 1.3 2001/10/25 09:30:39 grichine Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02DetectorMessenger.hh"
#include "F02DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02DetectorMessenger::F02DetectorMessenger(F02DetectorConstruction * F02Det)
:F02Detector(F02Det)
{
F02detDir = new G4UIdirectory("/calor/");
F02detDir->SetGuidance("F02 detector control.");
AbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
AbsMaterCmd->SetParameterName("choice",true);
AbsMaterCmd->SetDefaultValue("Lead");
AbsMaterCmd->AvailableForStates(Idle);
WorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
WorldMaterCmd->SetGuidance("Select Material of the World.");
WorldMaterCmd->SetParameterName("wchoice",true);
WorldMaterCmd->SetDefaultValue("Air");
WorldMaterCmd->AvailableForStates(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(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(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(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(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(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(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02DetectorMessenger::~F02DetectorMessenger()
{
delete AbsMaterCmd;
delete AbsThickCmd;
delete AbsRadCmd;
delete AbsZposCmd;
delete WorldMaterCmd;
delete WorldZCmd;
delete WorldRCmd;
delete UpdateCmd;
delete F02detDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == AbsMaterCmd )
{ F02Detector->SetAbsorberMaterial(newValue);}
if( command == WorldMaterCmd )
{ F02Detector->SetWorldMaterial(newValue);}
if( command == AbsThickCmd )
{ F02Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));}
if( command == AbsRadCmd )
{ F02Detector->SetAbsorberRadius(AbsRadCmd->GetNewDoubleValue(newValue));}
if( command == AbsZposCmd )
{ F02Detector->SetAbsorberZpos(AbsZposCmd->GetNewDoubleValue(newValue));}
if( command == WorldZCmd )
{ F02Detector->SetWorldSizeZ(WorldZCmd->GetNewDoubleValue(newValue));}
if( command == WorldRCmd )
{ F02Detector->SetWorldSizeR(WorldRCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ F02Detector->UpdateGeometry(); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,219 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02ElectroMagneticField.cc,v 1.5 2001/11/12 09:41:26 grichine Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// User Field class implementation.
//
#include "F02ElectroMagneticField.hh"
#include "F02FieldMessenger.hh"
#include "G4UniformElectricField.hh"
#include "G4UniformMagField.hh"
#include "G4MagneticField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4EquationOfMotion.hh"
#include "G4EqMagElectricField.hh"
#include "G4Mag_UsualEqRhs.hh"
#include "G4MagIntegratorStepper.hh"
#include "G4ChordFinder.hh"
#include "G4ExplicitEuler.hh"
#include "G4ImplicitEuler.hh"
#include "G4SimpleRunge.hh"
#include "G4SimpleHeum.hh"
#include "G4ClassicalRK4.hh"
#include "G4HelixExplicitEuler.hh"
#include "G4HelixImplicitEuler.hh"
#include "G4HelixSimpleRunge.hh"
#include "G4CashKarpRKF45.hh"
#include "G4RKG3_Stepper.hh"
//////////////////////////////////////////////////////////////////////////
//
// Constructors:
F02ElectroMagneticField::F02ElectroMagneticField()
: G4UniformElectricField(G4ThreeVector(0.0,100000.0*kilovolt/cm,0.0)),
fChordFinder(0), fStepper(0)
{
fEMfield = new G4UniformElectricField(
G4ThreeVector(0.0,100000.0*kilovolt/cm,0.0));
fFieldMessenger = new F02FieldMessenger(this) ;
fEquation = new G4EqMagElectricField(fEMfield);
fMinStep = 1.0*mm ; // minimal step of 1 mm is default
fStepperType = 4 ; // ClassicalRK4 is default stepper
fFieldManager = GetGlobalFieldManager();
UpdateField();
}
/////////////////////////////////////////////////////////////////////////////////
F02ElectroMagneticField::F02ElectroMagneticField(G4ThreeVector pFV)
: G4UniformElectricField(pFV)
{
fEMfield = new G4UniformElectricField(pFV);
GetGlobalFieldManager()->CreateChordFinder(this);
}
////////////////////////////////////////////////////////////////////////////////
F02ElectroMagneticField::~F02ElectroMagneticField()
{
if(fEMfield) delete fEMfield;
if(fChordFinder) delete fChordFinder;
if(fStepper) delete fStepper;
}
/////////////////////////////////////////////////////////////////////////////
//
// Update field
//
void F02ElectroMagneticField::UpdateField()
{
SetStepper();
G4cout<<"The minimal step is equal to "<<fMinStep/mm<<" mm"<<G4endl ;
fFieldManager->SetDetectorField(fEMfield );
if(fChordFinder) delete fChordFinder;
fChordFinder = new G4ChordFinder( fEMfield, fMinStep,fStepper);
fFieldManager->SetChordFinder( fChordFinder );
}
/////////////////////////////////////////////////////////////////////////////
//
// Set stepper according to the stepper type
//
void F02ElectroMagneticField::SetStepper()
{
G4int nvar = 8;
if(fStepper) delete fStepper;
switch ( fStepperType )
{
case 0:
fStepper = new G4ExplicitEuler( fEquation, nvar );
G4cout<<"G4ExplicitEuler is calledS"<<G4endl;
break;
case 1:
fStepper = new G4ImplicitEuler( fEquation, nvar );
G4cout<<"G4ImplicitEuler is called"<<G4endl;
break;
case 2:
fStepper = new G4SimpleRunge( fEquation, nvar );
G4cout<<"G4SimpleRunge is called"<<G4endl;
break;
case 3:
fStepper = new G4SimpleHeum( fEquation, nvar );
G4cout<<"G4SimpleHeum is called"<<G4endl;
break;
case 4:
fStepper = new G4ClassicalRK4( fEquation, nvar );
G4cout<<"G4ClassicalRK4 (default) is called"<<G4endl;
break;
case 5:
fStepper = new G4CashKarpRKF45( fEquation, nvar );
G4cout<<"G4CashKarpRKF45 is called"<<G4endl;
break;
/* ***********************************
case 6:
fStepper = new G4RKG3_Stepper( fEquation, nvar );
G4cout<<"G4RKG3_Stepper is called"<<G4endl;
break;
case 7:
fStepper = new G4HelixExplicitEuler( fEquation );
G4cout<<"G4HelixExplicitEuler is called"<<G4endl;
break;
case 8:
fStepper = new G4HelixImplicitEuler( fEquation );
G4cout<<"G4HelixImplicitEuler is called"<<G4endl;
break;
case 9:
fStepper = new G4HelixSimpleRunge( fEquation );
G4cout<<"G4HelixSimpleRunge is called"<<G4endl;
break;
****************************************** */
default: fStepper = 0;
}
}
/////////////////////////////////////////////////////////////////////////////
//
// Set the value of the Global Field to fieldValue along Z
//
void F02ElectroMagneticField::SetFieldValue(G4double fieldValue)
{
if(fEMfield) delete fEMfield;
fEMfield = new G4UniformElectricField(G4ThreeVector(0,0,fieldValue));
// UpdateField();
}
///////////////////////////////////////////////////////////////////////////////
//
// Set the value of the Global Field
//
void F02ElectroMagneticField::SetFieldValue(G4ThreeVector fieldVector)
{
// Find the Field Manager for the global field
G4FieldManager* fieldMgr= GetGlobalFieldManager();
if(fieldVector != G4ThreeVector(0.,0.,0.))
{
if(fEMfield) delete fEMfield;
fEMfield = new G4UniformElectricField(fieldVector);
// UpdateField();
fieldMgr->SetDetectorField(this);
}
else
{
// If the new field's value is Zero, then it is best to
// insure that it is not used for propagation.
G4MagneticField* fEMfield = 0;
fieldMgr->SetDetectorField(fEMfield);
}
}
////////////////////////////////////////////////////////////////////////////////
//
// Utility method
G4FieldManager* F02ElectroMagneticField::GetGlobalFieldManager()
{
return G4TransportationManager::GetTransportationManager()
->GetFieldManager();
}
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02EventAction.cc,v 1.4 2001/11/07 16:36:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02EventAction.hh"
#include "F02RunAction.hh"
#include "F02CalorHit.hh"
#include "F02EventActionMessenger.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02EventAction::F02EventAction(F02RunAction* F02RA)
: calorimeterCollID(-1), eventMessenger(0),
runaction(F02RA), verboselevel(0),
drawFlag("all"), printModulo(10000)
{
eventMessenger = new F02EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02EventAction::~F02EventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
if(verboselevel>1)
G4cout << "<<< Event " << evtNb << " started." << G4endl;
if (calorimeterCollID==-1)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
calorimeterCollID = SDman->GetCollectionID("CalCollection");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02EventAction::EndOfEventAction(const G4Event* evt)
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
for(G4int i=0; i<n_trajectories; i++)
{ G4Trajectory* trj = (G4Trajectory *)((*(evt->GetTrajectoryContainer()))[i]);
if (drawFlag == "all") trj->DrawTrajectory(50);
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
trj->DrawTrajectory(50);
}
}
if(verboselevel>0)
G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
// save rndm status
if (runaction->GetRndmFreq() == 2)
{
HepRandom::saveEngineStatus("endOfEvent.rndm");
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
{
G4cout << "\n---> End of Event: " << evtNb << G4endl;
HepRandom::showEngineStatus();
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int F02EventAction::GetEventno()
{
G4int evno = fpEventManager->GetConstCurrentEvent()->GetEventID() ;
return evno ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02EventAction::setEventVerbose(G4int level)
{
verboselevel = level ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,88 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02EventActionMessenger.cc,v 1.3 2001/10/15 17:20:43 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "globals.hh"
#include "F02EventActionMessenger.hh"
#include "F02EventAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02EventActionMessenger::F02EventActionMessenger(F02EventAction* EvAct)
:eventAction(EvAct)
{
setVerboseCmd = new G4UIcmdWithAnInteger("/event/setverbose",this);
setVerboseCmd->SetGuidance("Set verbose level ." );
setVerboseCmd->SetParameterName("level",true);
setVerboseCmd->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(Idle);
PrintCmd = new G4UIcmdWithAnInteger("/event/printModulo",this);
PrintCmd->SetGuidance("Print events modulo n");
PrintCmd->SetParameterName("EventNb",false);
PrintCmd->SetRange("EventNb>0");
PrintCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02EventActionMessenger::~F02EventActionMessenger()
{
delete setVerboseCmd;
delete DrawCmd;
delete PrintCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if(command == setVerboseCmd)
{eventAction->setEventVerbose(setVerboseCmd->GetNewIntValue(newValue));}
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,121 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02FieldMessenger.cc,v 1.3 2001/10/15 17:20:43 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
#include "F02FieldMessenger.hh"
#include "F02ElectroMagneticField.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//////////////////////////////////////////////////////////////////////////////
F02FieldMessenger::F02FieldMessenger(F02ElectroMagneticField* pEMfield)
:fEMfield(pEMfield)
{
F02detDir = new G4UIdirectory("/field/");
F02detDir->SetGuidance("F02 field tracking control.");
StepperCmd = new G4UIcmdWithAnInteger("/field/setStepperType",this);
StepperCmd->SetGuidance("Select stepper type for electric field");
StepperCmd->SetParameterName("choice",true);
StepperCmd->SetDefaultValue(4);
StepperCmd->AvailableForStates(PreInit,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(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(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(Idle);
AbsMaterCmd = new G4UIcmdWithAString("/field/setAbsMat",this);
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
AbsMaterCmd->SetParameterName("choice",true);
AbsMaterCmd->SetDefaultValue("Xe");
AbsMaterCmd->AvailableForStates(Idle);
}
///////////////////////////////////////////////////////////////////////////////
F02FieldMessenger::~F02FieldMessenger()
{
delete StepperCmd;
delete MagFieldCmd;
delete MinStepCmd;
delete F02detDir;
delete UpdateCmd;
delete AbsMaterCmd;
}
////////////////////////////////////////////////////////////////////////////
//
//
void F02FieldMessenger::SetNewValue( G4UIcommand* command, G4String newValue)
{
if( command == StepperCmd )
{
fEMfield->SetStepperType(StepperCmd->GetNewIntValue(newValue));
}
if( command == UpdateCmd )
{
fEMfield->UpdateField();
}
if( command == MagFieldCmd )
{
fEMfield->SetFieldValue(MagFieldCmd->GetNewDoubleValue(newValue));
}
if( command == MinStepCmd )
{
fEMfield->SetMinStep(MinStepCmd->GetNewDoubleValue(newValue));
}
}
//
//
/////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,457 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02PhysicsList.cc,v 1.4 2001/10/25 09:30:53 grichine Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "G4Timer.hh"
#include "F02PhysicsList.hh"
#include "F02DetectorConstruction.hh"
#include "F02PhysicsListMessenger.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4EnergyLossTables.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
#include "g4std/iomanip"
#include "G4FastSimulationManagerProcess.hh"
/////////////////////////////////////////////////////////////
//
//
F02PhysicsList::F02PhysicsList(F02DetectorConstruction* p)
: G4VUserPhysicsList(), MaxChargedStep(DBL_MAX),
thePhotoElectricEffect(0), theComptonScattering(0), theGammaConversion(0),
theeminusMultipleScattering(0), theeminusIonisation(0),
theeminusBremsstrahlung(0),
theeplusMultipleScattering(0), theeplusIonisation(0),
theeplusBremsstrahlung(0), theeplusAnnihilation(0),
theeminusStepCut(0), theeplusStepCut(0)
{
pDet = p;
defaultCutValue = 1.000*mm ;
cutForGamma = defaultCutValue ;
cutForElectron = defaultCutValue ;
cutForProton = defaultCutValue ;
SetVerboseLevel(1);
physicsListMessenger = new F02PhysicsListMessenger(this);
}
/////////////////////////////////////////////////////////////////////////
//
//
F02PhysicsList::~F02PhysicsList()
{
delete physicsListMessenger;
}
///////////////////////////////////////////////////////////////////////////
//
//
void F02PhysicsList::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.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBarions();
}
////////////////////////////////////////////////////////////////////////////
//
//
void F02PhysicsList::ConstructBosons()
{
// gamma
G4Gamma::GammaDefinition();
// charged geantino
G4ChargedGeantino::ChargedGeantinoDefinition();
}
void F02PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
void F02PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
}
void F02PhysicsList::ConstructBarions()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
}
///////////////////////////////////////////////////////////////////////
//
//
void F02PhysicsList::ConstructProcess()
{
AddTransportation();
AddParameterisation();
ConstructEM();
ConstructGeneral();
}
/////////////////////////////////////////////////////////////////////////////
//
//
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
#include "G4PAIonisation.hh"
#include "G4ForwardXrayTR.hh"
#include "F02StepCut.hh"
#include "G4IonisationByLogicalVolume.hh"
void F02PhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma")
{
// Construct processes for gamma
thePhotoElectricEffect = new G4PhotoElectricEffect();
theComptonScattering = new G4ComptonScattering();
theGammaConversion = new G4GammaConversion();
pmanager->AddDiscreteProcess(thePhotoElectricEffect);
pmanager->AddDiscreteProcess(theComptonScattering);
pmanager->AddDiscreteProcess(theGammaConversion);
}
else if (particleName == "e-")
{
// Construct processes for electron
theeminusIonisation = new G4eIonisation();
theeminusBremsstrahlung = new G4eBremsstrahlung();
theeminusStepCut = new F02StepCut();
pmanager->AddProcess(theeminusIonisation,-1,2,2);
pmanager->AddProcess(theeminusBremsstrahlung,-1,1,1);
pmanager->AddProcess(theeminusStepCut,-1,-1,4);
theeminusStepCut->SetMaxStep(MaxChargedStep) ;
}
else if (particleName == "e+")
{
// Construct processes for positron
theeplusIonisation = new G4eIonisation();
theeplusBremsstrahlung = new G4eBremsstrahlung();
theeplusStepCut = new F02StepCut();
pmanager->AddProcess(theeplusIonisation,-1,2,2);
pmanager->AddProcess(theeplusBremsstrahlung,-1,-1,3);
pmanager->AddProcess(theeplusStepCut,-1,-1,5);
theeplusStepCut->SetMaxStep(MaxChargedStep) ;
}
else if( particleName == "mu+" ||
particleName == "mu-" )
{
// Construct processes for muon+
F02StepCut* muonStepCut = new F02StepCut();
G4MuIonisation* themuIonisation = new G4MuIonisation() ;
pmanager->AddProcess(new G4MultipleScattering(),-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-"
)
{
F02StepCut* thehadronStepCut = new F02StepCut();
G4hIonisation* thehIonisation = new G4hIonisation() ;
G4MultipleScattering* thehMultipleScattering =
new G4MultipleScattering() ;
pmanager->AddProcess(thehMultipleScattering,-1,1,1);
pmanager->AddProcess(thehIonisation,-1,2,2);
pmanager->AddProcess( thehadronStepCut,-1,-1,3);
thehadronStepCut->SetMaxStep(MaxChargedStep) ;
}
}
}
#include "G4Decay.hh"
void F02PhysicsList::ConstructGeneral()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle))
{
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
/////////////////////////////////////////////////////////////////////////////
void F02PhysicsList::AddParameterisation()
{
G4FastSimulationManagerProcess* theFastSimulationManagerProcess =
new G4FastSimulationManagerProcess() ;
theParticleIterator->reset();
while( (*theParticleIterator)() )
{
G4ParticleDefinition* particle = theParticleIterator->value() ;
G4ProcessManager* pmanager = particle->GetProcessManager() ;
// both postStep and alongStep action are required: because
// of the use of ghost volumes. If no ghost, the postStep is sufficient.
pmanager->AddProcess(theFastSimulationManagerProcess, -1, 1, 1);
}
}
/////////////////////////////////////////////////////////////////////////////
void F02PhysicsList::SetCuts()
{
G4Timer theTimer ;
theTimer.Start() ;
if (verboseLevel >0)
{
G4cout << "F02PhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cutForGamma,"gamma");
SetCutValue(cutForElectron,"e-");
SetCutValue(cutForElectron,"e+");
SetCutValue(defaultCutValue,"mu-");
SetCutValue(defaultCutValue,"mu+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
SetCutValue(defaultCutValue, "proton");
SetCutValue(defaultCutValue, "anti_proton");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel>1) DumpCutValuesTable();
theTimer.Stop();
G4cout.precision(6);
G4cout << G4endl ;
G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<G4endl;
}
///////////////////////////////////////////////////////////////////////////
void F02PhysicsList::SetGammaCut(G4double val)
{
ResetCuts();
cutForGamma = val;
}
///////////////////////////////////////////////////////////////////////////
void F02PhysicsList::SetElectronCut(G4double val)
{
ResetCuts();
cutForElectron = val;
}
//////////////////////////////////////////////////////////////////////
void F02PhysicsList::SetProtonCut(G4double val)
{
ResetCuts();
cutForProton = val;
}
////////////////////////////////////////////////////////////////////////////
void F02PhysicsList::SetCutsByEnergy(G4double val)
{
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
G4Material* currMat = pDet->GetAbsorberMaterial();
// 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
G4ParticleDefinition* part;
G4double cut;
part = theParticleTable->FindParticle("e-");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
SetCutValue(cut, "e-");
part = theParticleTable->FindParticle("e+");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
SetCutValue(cut, "e+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
part = theParticleTable->FindParticle("proton");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
SetCutValue(cut, "proton");
part = theParticleTable->FindParticle("anti_proton");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
SetCutValue(cut, "anti_proton");
SetCutValueForOthers(cut);
}
//////////////////////////////////////////////////////////////////////////////
void F02PhysicsList::GetRange(G4double val)
{
G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
G4Material* currMat = pDet->GetAbsorberMaterial();
G4ParticleDefinition* part;
G4double cut;
part = theParticleTable->FindParticle("e-");
cut = G4EnergyLossTables::GetRange(part,val,currMat);
G4cout << "material : " << currMat->GetName() << G4endl;
G4cout << "particle : " << part->GetParticleName() << G4endl;
G4cout << "energy : " << val / keV << " (keV)" << G4endl;
G4cout << "range : " << cut / mm << " (mm)" << G4endl;
}
////////////////////////////////////////////////////////////////////////////
void F02PhysicsList::SetMaxStep(G4double step)
{
MaxChargedStep = step ;
G4cout << " MaxChargedStep=" << MaxChargedStep << G4endl;
G4cout << G4endl;
}
@@ -0,0 +1,120 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02PhysicsListMessenger.cc,v 1.3 2001/10/15 17:20:44 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02PhysicsListMessenger.hh"
#include "F02PhysicsList.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02PhysicsListMessenger::F02PhysicsListMessenger(F02PhysicsList * List)
: F02List(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(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(Idle);
cutPCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutP",this);
cutPCmd->SetGuidance("Set cut values by RANGE for proton and others.");
cutPCmd->SetParameterName("range",true);
cutPCmd->SetDefaultValue(1.);
cutPCmd->SetDefaultUnit("mm");
cutPCmd->AvailableForStates(Idle);
eCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutEnergy",this);
eCmd->SetGuidance("Set cut values by ENERGY for charged particles.");
eCmd->SetParameterName("energy",true);
eCmd->SetDefaultValue(10.);
eCmd->SetDefaultUnit("keV");
eCmd->AvailableForStates(Idle);
rCmd = new G4UIcmdWithADoubleAndUnit("/calor/range",this);
rCmd->SetGuidance("Display the RANGE of Electron for the current material.");
rCmd->SetParameterName("energy",true);
rCmd->SetDefaultValue(10.);
rCmd->SetDefaultUnit("keV");
rCmd->AvailableForStates(Idle);
setMaxStepCmd = new G4UIcmdWithADoubleAndUnit("/step/setMaxStep",this);
setMaxStepCmd->SetGuidance("Set max. step length in the detector");
setMaxStepCmd->SetParameterName("mxStep",true);
setMaxStepCmd->SetDefaultUnit("mm");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02PhysicsListMessenger::~F02PhysicsListMessenger()
{
delete setMaxStepCmd;
delete cutGCmd;
delete cutECmd;
delete cutPCmd;
delete rCmd;
delete eCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02PhysicsListMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if(command == cutGCmd)
{ F02List->SetGammaCut(cutGCmd->GetNewDoubleValue(newValue));}
if(command == cutECmd)
{ F02List->SetElectronCut(eCmd->GetNewDoubleValue(newValue));}
if(command == cutPCmd)
{ F02List->SetProtonCut(eCmd->GetNewDoubleValue(newValue));}
if(command == eCmd)
{ F02List->SetCutsByEnergy(cutECmd->GetNewDoubleValue(newValue));}
if(command == rCmd)
{ F02List->GetRange(rCmd->GetNewDoubleValue(newValue));}
if(command == setMaxStepCmd)
{ F02List->SetMaxStep(setMaxStepCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,154 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02PrimaryGeneratorAction.cc,v 1.3 2001/10/15 17:20:44 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02PrimaryGeneratorAction.hh"
#include "F02DetectorConstruction.hh"
#include "F02PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4String F02PrimaryGeneratorAction::thePrimaryParticleName = "proton" ;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02PrimaryGeneratorAction::F02PrimaryGeneratorAction(
F02DetectorConstruction* F02DC)
: F02Detector(F02DC), rndmFlag("off"),
xvertex(0.),yvertex(0.),zvertex(0.),
vertexdefined(false)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
// create a messenger for this class
//
gunMessenger = new F02PrimaryGeneratorMessenger(this);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="proton");
particleGun->SetParticleDefinition(particle);
thePrimaryParticleName = particle->GetParticleName() ;
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticleEnergy(100.*GeV);
zvertex = 0. ; // -0.5*(F02Detector->GetAbsorberThickness());
particleGun->SetParticlePosition(G4ThreeVector(xvertex,yvertex,zvertex));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02PrimaryGeneratorAction::~F02PrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// this function is called at the begining of event
//
thePrimaryParticleName = particleGun->GetParticleDefinition()->
GetParticleName() ;
G4double x0,y0,z0 ;
if(vertexdefined)
{
x0 = xvertex ;
y0 = yvertex ;
z0 = zvertex ;
}
else
{
x0 = 0. ;
y0 = 0. ;
z0 = 0. ; // -0.5*(F02Detector->GetWorldSizeZ()) ;
}
G4double r0,phi0 ;
if (rndmFlag == "on")
{
r0 = (F02Detector->GetAbsorberRadius())*sqrt(G4UniformRand());
phi0 = twopi*G4UniformRand();
x0 = r0*cos(phi0);
y0 = r0*sin(phi0);
}
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
particleGun->GeneratePrimaryVertex(anEvent);
}
///////////////////////////////////////////////////////////////////////
//
//
G4String F02PrimaryGeneratorAction::GetPrimaryName()
{
return thePrimaryParticleName ;
}
void F02PrimaryGeneratorAction::Setzvertex(G4double z)
{
vertexdefined = true ;
zvertex = z ;
G4cout << " Z coordinate of the primary vertex = " << zvertex/mm <<
" mm." << G4endl;
}
void F02PrimaryGeneratorAction::Setxvertex(G4double x)
{
vertexdefined = true ;
xvertex = x ;
G4cout << " X coordinate of the primary vertex = " << xvertex/mm <<
" mm." << G4endl;
}
void F02PrimaryGeneratorAction::Setyvertex(G4double y)
{
vertexdefined = true ;
yvertex = y ;
G4cout << " Y coordinate of the primary vertex = " << yvertex/mm <<
" mm." << G4endl;
}
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02PrimaryGeneratorMessenger.cc,v 1.3 2001/10/15 17:20:44 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02PrimaryGeneratorMessenger.hh"
#include "F02PrimaryGeneratorAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02PrimaryGeneratorMessenger::F02PrimaryGeneratorMessenger(F02PrimaryGeneratorAction* F02Gun)
: F02Action(F02Gun)
{
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(PreInit,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) ;
setyvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
setyvertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
setyvertexCmd->SetParameterName("yv",true);
setyvertexCmd->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) ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02PrimaryGeneratorMessenger::~F02PrimaryGeneratorMessenger()
{
delete RndmCmd;
delete setxvertexCmd;
delete setyvertexCmd;
delete setzvertexCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if( command == RndmCmd )
{ F02Action->SetRndmFlag(newValue);}
if( command == setxvertexCmd)
{ F02Action->Setxvertex(setxvertexCmd->GetNewDoubleValue(newValue));}
if( command == setyvertexCmd)
{ F02Action->Setyvertex(setyvertexCmd->GetNewDoubleValue(newValue));}
if( command == setzvertexCmd)
{ F02Action->Setzvertex(setzvertexCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02RunAction.cc,v 1.4 2001/11/07 16:36:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
#include "F02RunAction.hh"
#include "F02RunMessenger.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "g4std/iomanip"
#include "Randomize.hh"
//////////////////////////////////////////////////////////////////////////////
F02RunAction::F02RunAction()
: saveRndm(0)
{
runMessenger = new F02RunMessenger(this);
}
////////////////////////////////////////////////////////////////////////////
F02RunAction::~F02RunAction()
{
delete runMessenger;
}
/////////////////////////////////////////////////////////////////////////////
void F02RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
// save Rndm status
if (saveRndm > 0)
{
HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("beginOfRun.rndm");
}
G4UImanager* UI = G4UImanager::GetUIpointer();
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager) UI->ApplyCommand("/vis/scene/notifyHandlers");
}
/////////////////////////////////////////////////////////////////////////////
void F02RunAction::EndOfRunAction(const G4Run* aRun)
{
if (G4VVisManager::GetConcreteInstance())
{
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
// save Rndm status
if (saveRndm == 1)
{
HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("endOfRun.rndm");
}
}
//
//
////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02RunMessenger.cc,v 1.3 2001/10/15 17:20:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02RunMessenger.hh"
#include "F02RunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02RunMessenger::F02RunMessenger(F02RunAction* RA)
:runAction (RA)
{
RndmDir = new G4UIdirectory("/rndm/");
RndmDir->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(PreInit,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(PreInit,Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02RunMessenger::~F02RunMessenger()
{
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
{
if (command == RndmSaveCmd)
runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
if (command == RndmReadCmd)
{ G4cout << "\n---> rndm status restored from file: "
<< newValues << G4endl;
HepRandom::restoreEngineStatus(newValues);
HepRandom::showEngineStatus();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02StepCut.cc,v 1.2 2001/07/11 09:58:04 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
#include "F02StepCut.hh"
#include "G4Step.hh"
#include "G4UserLimits.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
F02StepCut::F02StepCut(const G4String& aName)
: G4VDiscreteProcess(aName),MaxChargedStep(DBL_MAX)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
}
F02StepCut::~F02StepCut()
{
}
F02StepCut::F02StepCut(F02StepCut& right)
:G4VDiscreteProcess(right)
{}
void F02StepCut::SetMaxStep(G4double step)
{
MaxChargedStep = step ;
}
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02SteppingAction.cc,v 1.4 2001/11/07 16:36:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02SteppingAction.hh"
#include "F02SteppingMessenger.hh"
#include "G4ios.hh"
#include "g4std/iomanip"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02SteppingAction::F02SteppingAction()
: steppingMessenger(0)
{
steppingMessenger = new F02SteppingMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02SteppingAction::~F02SteppingAction()
{
delete steppingMessenger ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02SteppingAction::UserSteppingAction(const G4Step*)
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,60 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02SteppingMessenger.cc,v 1.2 2001/07/11 09:58:04 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "F02SteppingMessenger.hh"
#include "F02SteppingAction.hh"
#include "G4UIdirectory.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02SteppingMessenger::F02SteppingMessenger(F02SteppingAction* SA)
:steppingAction (SA)
{
steppingDir = new G4UIdirectory("/stepping/");
steppingDir->SetGuidance("stepping control");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02SteppingMessenger::~F02SteppingMessenger()
{
delete steppingDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02SteppingMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,168 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02SteppingVerbose.cc,v 1.4 2001/10/15 17:20:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//---------------------------------------------------------------
//
// F02SteppingVerbose.cc
//
// Description:
// Implementation of the F02SteppingVerbose class
// Contact:
// Questions and comments to this code should be sent to
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
//
//---------------------------------------------------------------
#include "F02SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.hh"
////////////////////////////////////////////////
F02SteppingVerbose::F02SteppingVerbose()
////////////////////////////////////////////////
{
}
//////////////////////////////////////////////////
F02SteppingVerbose::~F02SteppingVerbose()
//////////////////////////////////////////////////
{
}
/////////////////////////////////////////
void F02SteppingVerbose::StepInfo()
/////////////////////////////////////////
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << G4std::setw( 5) << "#Step#" << " "
<< G4std::setw( 6) << "X" << " "
<< G4std::setw( 6) << "Y" << " "
<< G4std::setw( 6) << "Z" << " "
<< G4std::setw( 9) << "KineE" << " "
<< G4std::setw( 9) << "dEStep" << " "
<< G4std::setw(10) << "StepLeng"
<< G4std::setw(10) << "TrakLeng"
<< G4std::setw(10) << "NextVolu"
<< G4std::setw(10) << "Process" << G4endl;
}
G4cout << G4std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< G4std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< G4std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << G4std::setw(10) << fTrack->GetNextVolume()->GetName();
} else {
G4cout << G4std::setw(10) << "OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
G4cout << G4std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << "User Limit";
}
G4cout << G4endl;
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << G4std::setw(3) << tN2ndariesTot
<< "(Rest=" << G4std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << G4std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << G4std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< " ---------------"
<< G4endl;
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
////////////////////////////////////////////////
void F02SteppingVerbose::TrackingStarted()
////////////////////////////////////////////////
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4cout << G4std::setw( 5) << "Step#" << " "
<< G4std::setw( 6) << "X" << " "
<< G4std::setw( 6) << "Y" << " "
<< G4std::setw( 6) << "Z" << " "
<< G4std::setw( 9) << "KineE" << " "
<< G4std::setw( 9) << "dEStep" << " "
<< G4std::setw(10) << "StepLeng"
<< G4std::setw(10) << "TrakLeng"
<< G4std::setw(10) << "NextVolu"
<< G4std::setw(10) << "Process" << G4endl;
G4cout << G4std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< G4std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< G4std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< G4std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
if(fTrack->GetNextVolume()){
G4cout << G4std::setw(10) << fTrack->GetNextVolume()->GetName() << " ";
} else {
G4cout << G4std::setw(10) << "OutOfWorld" << " ";
}
G4cout << G4std::setw(10) << "initStep" << G4endl;
}
G4cout.precision(prec);
}
@@ -0,0 +1,153 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: F02VisManager.cc,v 1.3 2001/12/12 15:22:31 johna Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// John Allison 24th January 1998.
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4VIS_USE
#include "F02VisManager.hh"
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh"
#include "G4DAWNFILE.hh"
#include "G4GAGTree.hh"
#include "G4HepRepFile.hh"
#include "G4RayTracer.hh"
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
// Needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_OPACS
#include "G4Wo.hh"
#include "G4Xo.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
F02VisManager::F02VisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void F02VisManager::RegisterGraphicsSystems () {
// Graphics Systems not needing external packages or libraries...
RegisterGraphicsSystem (new G4ASCIITree);
RegisterGraphicsSystem (new G4DAWNFILE);
RegisterGraphicsSystem (new G4GAGTree);
RegisterGraphicsSystem (new G4HepRepFile);
RegisterGraphicsSystem (new G4RayTracer);
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
// Graphics systems needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_OPACS
RegisterGraphicsSystem (new G4Wo);
RegisterGraphicsSystem (new G4Xo);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....