Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// 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: Em5CalorHit.cc,v 1.1.4.1 1999/12/07 20:47:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5CalorHit.hh"
|
||||
|
||||
G4Allocator<Em5CalorHit> Em5CalorHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5CalorHit::Em5CalorHit()
|
||||
{
|
||||
EdepAbs = 0.; TrackLengthAbs = 0.;
|
||||
EdepGap = 0.; TrackLengthGap = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5CalorHit::~Em5CalorHit()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5CalorHit::Em5CalorHit(const Em5CalorHit& right)
|
||||
{
|
||||
EdepAbs = right.EdepAbs; TrackLengthAbs = right.TrackLengthAbs;
|
||||
EdepGap = right.EdepGap; TrackLengthGap = right.TrackLengthGap;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
const Em5CalorHit& Em5CalorHit::operator=(const Em5CalorHit& right)
|
||||
{
|
||||
EdepAbs = right.EdepAbs; TrackLengthAbs = right.TrackLengthAbs;
|
||||
EdepGap = right.EdepGap; TrackLengthGap = right.TrackLengthGap;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
int Em5CalorHit::operator==(const Em5CalorHit& right) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5CalorHit::Print()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
// 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: Em5CalorimeterSD.cc,v 1.1.4.1 1999/12/07 20:47:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5CalorimeterSD.hh"
|
||||
|
||||
#include "Em5CalorHit.hh"
|
||||
#include "Em5DetectorConstruction.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5CalorimeterSD::Em5CalorimeterSD(G4String name,
|
||||
Em5DetectorConstruction* det)
|
||||
:G4VSensitiveDetector(name),Detector(det)
|
||||
{
|
||||
collectionName.insert("CalCollection");
|
||||
HitID = new G4int[500];
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5CalorimeterSD::~Em5CalorimeterSD()
|
||||
{
|
||||
delete [] HitID;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5CalorimeterSD::Initialize(G4HCofThisEvent*HCE)
|
||||
{
|
||||
CalCollection = new Em5CalorHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
for (G4int j=0;j<1; j++) {HitID[j] = -1;};
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4bool Em5CalorimeterSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
G4double stepl = 0.;
|
||||
if (aStep->GetTrack()->GetDefinition()->GetPDGCharge() != 0.)
|
||||
stepl = aStep->GetStepLength();
|
||||
|
||||
if ((edep==0.)&&(stepl==0.)) return false;
|
||||
|
||||
G4TouchableHistory* theTouchable
|
||||
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
|
||||
|
||||
G4VPhysicalVolume* physVol = theTouchable->GetVolume();
|
||||
//theTouchable->MoveUpHistory();
|
||||
G4int Em5Number = 0 ;
|
||||
|
||||
if (HitID[Em5Number]==-1)
|
||||
{
|
||||
Em5CalorHit* calHit = new Em5CalorHit();
|
||||
if (physVol == Detector->GetAbsorber()) calHit->AddAbs(edep,stepl);
|
||||
HitID[Em5Number] = CalCollection->insert(calHit) - 1;
|
||||
if (verboseLevel>0)
|
||||
G4cout << " New Calorimeter Hit on Em5: " << Em5Number << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (physVol == Detector->GetAbsorber())
|
||||
(*CalCollection)[HitID[Em5Number]]->AddAbs(edep,stepl);
|
||||
if (verboseLevel>0)
|
||||
G4cout << " Energy added to Em5: " << Em5Number << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5CalorimeterSD::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 Em5CalorimeterSD::clear()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
void Em5CalorimeterSD::PrintAll()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
// 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: Em5DetectorConstruction.cc,v 1.1.4.1 1999/12/07 20:47:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5DetectorConstruction.hh"
|
||||
#include "Em5DetectorMessenger.hh"
|
||||
|
||||
#include "Em5CalorimeterSD.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4UniformMagField.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5DetectorConstruction::Em5DetectorConstruction()
|
||||
:solidWorld(NULL),logicWorld(NULL),physiWorld(NULL),
|
||||
solidAbsorber(NULL),logicAbsorber(NULL),physiAbsorber(NULL),
|
||||
AbsorberMaterial(NULL),WorldMaterial(NULL),
|
||||
magField(NULL),calorimeterSD(NULL),defaultWorld(true)
|
||||
{
|
||||
// default parameter values of the calorimeter
|
||||
AbsorberThickness = 1.*cm;
|
||||
AbsorberSizeYZ = 2.*cm;
|
||||
XposAbs = 0.*cm ;
|
||||
ComputeCalorParameters();
|
||||
|
||||
// create commands for interactive definition of the calorimeter
|
||||
detectorMessenger = new Em5DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5DetectorConstruction::~Em5DetectorConstruction()
|
||||
{
|
||||
delete detectorMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* Em5DetectorConstruction::Construct()
|
||||
{
|
||||
DefineMaterials();
|
||||
return ConstructCalorimeter();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::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 iz, n; //iz=number of protons in an isotope;
|
||||
// n=number of nucleons in an isotope;
|
||||
|
||||
G4int ncomponents, natoms;
|
||||
G4double abundance, fractionmass;
|
||||
G4double temperature, pressure;
|
||||
|
||||
//
|
||||
// define Elements
|
||||
//
|
||||
|
||||
a = 1.01*g/mole;
|
||||
G4Element* elH = new G4Element(name="Hydrogen",symbol="H" , z= 1., 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);
|
||||
|
||||
//
|
||||
// define simple materials
|
||||
//
|
||||
density = 1.848*g/cm3;
|
||||
a = 9.01*g/mole;
|
||||
G4Material* Be = new G4Material(name="Beryllium", z=4., a, density);
|
||||
|
||||
density = 2.700*g/cm3;
|
||||
a = 26.98*g/mole;
|
||||
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
|
||||
|
||||
density = 2.330*g/cm3;
|
||||
a = 28.09*g/mole;
|
||||
G4Material* Si = new G4Material(name="Silicon", z=14., a, density);
|
||||
|
||||
density = 1.390*g/cm3;
|
||||
a = 39.95*g/mole;
|
||||
G4Material* lAr = new G4Material(name="liquidArgon", z=18., a, density);
|
||||
|
||||
density = 7.870*g/cm3;
|
||||
a = 55.85*g/mole;
|
||||
G4Material* Fe = new G4Material(name="Iron" , z=26., a, density);
|
||||
|
||||
density = 8.960*g/cm3;
|
||||
a = 63.55*g/mole;
|
||||
G4Material* Cu = new G4Material(name="Copper" , z=29., a, density);
|
||||
|
||||
density = 19.32*g/cm3;
|
||||
a =196.97*g/mole;
|
||||
G4Material* Au = new G4Material(name="Gold" , z=79., a, density);
|
||||
|
||||
density = 11.35*g/cm3;
|
||||
a = 207.19*g/mole;
|
||||
G4Material* Pb = new G4Material(name="Lead" , z=82., a, density);
|
||||
|
||||
//
|
||||
// define a material from elements. case 1: chemical molecule
|
||||
//
|
||||
|
||||
density = 1.000*g/cm3;
|
||||
G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
|
||||
H2O->AddElement(elH, natoms=2);
|
||||
H2O->AddElement(elO, natoms=1);
|
||||
|
||||
//
|
||||
// define a material from elements. case 2: mixture by fractional mass
|
||||
//
|
||||
|
||||
density = 1.290*mg/cm3;
|
||||
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
|
||||
Air->AddElement(elN, fractionmass=0.7);
|
||||
Air->AddElement(elO, fractionmass=0.3);
|
||||
|
||||
//
|
||||
// example of vacuum
|
||||
//
|
||||
|
||||
density = universe_mean_density; //from PhysicalConstants.h
|
||||
pressure = 3.e-18*pascal;
|
||||
temperature = 2.73*kelvin;
|
||||
G4Material* Vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,
|
||||
kStateGas,temperature,pressure);
|
||||
|
||||
G4cout << *(G4Material::GetMaterialTable()) << endl;
|
||||
|
||||
//default materials of the calorimeter
|
||||
AbsorberMaterial = Si;
|
||||
WorldMaterial = Vacuum;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* Em5DetectorConstruction::ConstructCalorimeter()
|
||||
{
|
||||
// complete the Calor parameters definition and Print
|
||||
ComputeCalorParameters();
|
||||
|
||||
//
|
||||
// World
|
||||
//
|
||||
solidWorld = new G4Box("World", //its name
|
||||
WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2); //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
|
||||
NULL, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Absorber
|
||||
//
|
||||
solidAbsorber = new G4Box("Absorber",
|
||||
AbsorberThickness/2,AbsorberSizeYZ/2,AbsorberSizeYZ/2);
|
||||
|
||||
logicAbsorber = new G4LogicalVolume(solidAbsorber, //its solid
|
||||
AbsorberMaterial, //its material
|
||||
"Absorber"); //its name
|
||||
|
||||
physiAbsorber = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(XposAbs,0.,0.), //its position
|
||||
"Absorber", //its name
|
||||
logicAbsorber, //its logical volume
|
||||
physiWorld, //its mother
|
||||
false, //no boulean operat
|
||||
0); //copy number
|
||||
|
||||
|
||||
//
|
||||
// Sensitive Detectors: Absorber
|
||||
//
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
if(!calorimeterSD)
|
||||
{
|
||||
calorimeterSD = new Em5CalorimeterSD("CalorSD",this);
|
||||
SDman->AddNewDetector( calorimeterSD );
|
||||
}
|
||||
if (logicAbsorber)
|
||||
logicAbsorber->SetSensitiveDetector(calorimeterSD);
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
G4VisAttributes* VisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
VisAtt->SetVisibility(true);
|
||||
logicWorld->SetVisAttributes(VisAtt);
|
||||
|
||||
//
|
||||
//always return the physical World
|
||||
//
|
||||
PrintCalorParameters();
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::PrintCalorParameters()
|
||||
{
|
||||
G4cout << "\n The WORLD is made of "
|
||||
<< G4BestUnit(WorldSizeX,"Length") << " of " << WorldMaterial->GetName();
|
||||
G4cout << ". The transverse size (YZ) of the world is "
|
||||
<< G4BestUnit(WorldSizeYZ,"Length") << endl;
|
||||
G4cout << " The ABSORBER is made of "
|
||||
<<G4BestUnit(AbsorberThickness,"Length")<< " of " << AbsorberMaterial->GetName();
|
||||
G4cout << ". The transverse size (YZ) is "
|
||||
<< G4BestUnit(AbsorberSizeYZ,"Length") << endl;
|
||||
G4cout << " X position of the middle of the absorber " << G4BestUnit(XposAbs,"Length");
|
||||
G4cout << endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial)
|
||||
{AbsorberMaterial = pttoMaterial;
|
||||
logicAbsorber->SetMaterial(pttoMaterial);
|
||||
PrintCalorParameters();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::SetWorldMaterial(G4String materialChoice)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
|
||||
if (pttoMaterial)
|
||||
{WorldMaterial = pttoMaterial;
|
||||
logicWorld->SetMaterial(pttoMaterial);
|
||||
PrintCalorParameters();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::SetAbsorberThickness(G4double val)
|
||||
{
|
||||
// change Absorber thickness and recompute the calorimeter parameters
|
||||
AbsorberThickness = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::SetAbsorberSizeYZ(G4double val)
|
||||
{
|
||||
// change the transverse size and recompute the calorimeter parameters
|
||||
AbsorberSizeYZ = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::SetWorldSizeX(G4double val)
|
||||
{
|
||||
WorldSizeX = val;
|
||||
defaultWorld = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::SetWorldSizeYZ(G4double val)
|
||||
{
|
||||
WorldSizeYZ = val;
|
||||
defaultWorld = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::SetAbsorberXpos(G4double val)
|
||||
{
|
||||
XposAbs = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::SetMagField(G4double fieldValue)
|
||||
{
|
||||
//apply a global uniform magnetic field along Z axis
|
||||
G4FieldManager* fieldMgr
|
||||
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
|
||||
if(magField) delete magField; //delete the existing magn field
|
||||
|
||||
if(fieldValue!=0.) // create a new one if non nul
|
||||
{ magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
|
||||
fieldMgr->SetDetectorField(magField);
|
||||
fieldMgr->CreateChordFinder(magField);
|
||||
} else {
|
||||
magField = NULL;
|
||||
fieldMgr->SetDetectorField(magField);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
// 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: Em5DetectorMessenger.cc,v 1.1.4.1 1999/12/07 20:47:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5DetectorMessenger.hh"
|
||||
|
||||
#include "Em5DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5DetectorMessenger::Em5DetectorMessenger(Em5DetectorConstruction * Em5Det)
|
||||
:Em5Detector(Em5Det)
|
||||
{
|
||||
Em5detDir = new G4UIdirectory("/calor/");
|
||||
Em5detDir->SetGuidance("Em5 detector control.");
|
||||
|
||||
AbsMaterCmd = new G4UIcmdWithAString("/calor/setAbsMat",this);
|
||||
AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
|
||||
AbsMaterCmd->SetParameterName("choice",false);
|
||||
AbsMaterCmd->AvailableForStates(Idle);
|
||||
|
||||
WorldMaterCmd = new G4UIcmdWithAString("/calor/setWorldMat",this);
|
||||
WorldMaterCmd->SetGuidance("Select Material of the World.");
|
||||
WorldMaterCmd->SetParameterName("wchoice",false);
|
||||
WorldMaterCmd->AvailableForStates(Idle);
|
||||
|
||||
AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsThick",this);
|
||||
AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
|
||||
AbsThickCmd->SetParameterName("SizeZ",false);
|
||||
AbsThickCmd->SetRange("SizeZ>0.");
|
||||
AbsThickCmd->SetUnitCategory("Length");
|
||||
AbsThickCmd->AvailableForStates(Idle);
|
||||
|
||||
AbsSizYZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsYZ",this);
|
||||
AbsSizYZCmd->SetGuidance("Set sizeYZ of the Absorber");
|
||||
AbsSizYZCmd->SetParameterName("SizeYZ",false);
|
||||
AbsSizYZCmd->SetRange("SizeYZ>0.");
|
||||
AbsSizYZCmd->SetUnitCategory("Length");
|
||||
AbsSizYZCmd->AvailableForStates(Idle);
|
||||
|
||||
AbsXposCmd = new G4UIcmdWithADoubleAndUnit("/calor/setAbsXpos",this);
|
||||
AbsXposCmd->SetGuidance("Set X pos. of the Absorber");
|
||||
AbsXposCmd->SetParameterName("Xpos",false);
|
||||
AbsXposCmd->SetUnitCategory("Length");
|
||||
AbsXposCmd->AvailableForStates(Idle);
|
||||
|
||||
WorldXCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldX",this);
|
||||
WorldXCmd->SetGuidance("Set X size of the World");
|
||||
WorldXCmd->SetParameterName("WSizeX",false);
|
||||
WorldXCmd->SetRange("WSizeX>0.");
|
||||
WorldXCmd->SetUnitCategory("Length");
|
||||
WorldXCmd->AvailableForStates(Idle);
|
||||
|
||||
WorldYZCmd = new G4UIcmdWithADoubleAndUnit("/calor/setWorldYZ",this);
|
||||
WorldYZCmd->SetGuidance("Set sizeYZ of the World");
|
||||
WorldYZCmd->SetParameterName("WSizeYZ",false);
|
||||
WorldYZCmd->SetRange("WSizeYZ>0.");
|
||||
WorldYZCmd->SetUnitCategory("Length");
|
||||
WorldYZCmd->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);
|
||||
|
||||
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/calor/setField",this);
|
||||
MagFieldCmd->SetGuidance("Define magnetic field.");
|
||||
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
|
||||
MagFieldCmd->SetParameterName("Bz",false);
|
||||
MagFieldCmd->SetUnitCategory("Magnetic flux density");
|
||||
MagFieldCmd->AvailableForStates(Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5DetectorMessenger::~Em5DetectorMessenger()
|
||||
{
|
||||
delete AbsMaterCmd;
|
||||
delete AbsThickCmd;
|
||||
delete AbsSizYZCmd;
|
||||
delete AbsXposCmd;
|
||||
delete WorldMaterCmd;
|
||||
delete WorldXCmd;
|
||||
delete WorldYZCmd;
|
||||
delete UpdateCmd;
|
||||
delete MagFieldCmd;
|
||||
delete Em5detDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == AbsMaterCmd )
|
||||
{ Em5Detector->SetAbsorberMaterial(newValue);}
|
||||
|
||||
if( command == WorldMaterCmd )
|
||||
{ Em5Detector->SetWorldMaterial(newValue);}
|
||||
|
||||
if( command == AbsThickCmd )
|
||||
{ Em5Detector->SetAbsorberThickness(AbsThickCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == AbsSizYZCmd )
|
||||
{ Em5Detector->SetAbsorberSizeYZ(AbsSizYZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == AbsXposCmd )
|
||||
{ Em5Detector->SetAbsorberXpos(AbsXposCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == WorldXCmd )
|
||||
{ Em5Detector->SetWorldSizeX(WorldXCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == WorldYZCmd )
|
||||
{ Em5Detector->SetWorldSizeYZ(WorldYZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == UpdateCmd )
|
||||
{ Em5Detector->UpdateGeometry(); }
|
||||
|
||||
if( command == MagFieldCmd )
|
||||
{ Em5Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,233 @@
|
||||
// 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: Em5EventAction.cc,v 1.1.2.1.2.1 1999/12/07 20:47:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5EventAction.hh"
|
||||
|
||||
#include "Em5RunAction.hh"
|
||||
|
||||
#include "Em5CalorHit.hh"
|
||||
#include "Em5EventActionMessenger.hh"
|
||||
|
||||
#include "g4rw/tvordvec.h"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5EventAction::Em5EventAction(Em5RunAction* Em5RA)
|
||||
:calorimeterCollID(-1),eventMessenger(NULL),
|
||||
verboselevel(0),runaction(Em5RA),drawFlag("all"),printModulo(10000)
|
||||
{
|
||||
eventMessenger = new Em5EventActionMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5EventAction::~Em5EventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%printModulo == 0)
|
||||
G4cout << "\n---> Begin of Event: " << evtNb << endl;
|
||||
|
||||
if(verboselevel>1)
|
||||
G4cout << "<<< Event " << evtNb << " started." << endl;
|
||||
|
||||
if (calorimeterCollID==-1)
|
||||
{
|
||||
G4SDManager * SDman = G4SDManager::GetSDMpointer();
|
||||
calorimeterCollID = SDman->GetCollectionID("CalCollection");
|
||||
}
|
||||
|
||||
nstep = 0. ;
|
||||
nstepCharged = 0. ;
|
||||
nstepNeutral = 0. ;
|
||||
Nch = 0. ;
|
||||
Nne = 0. ;
|
||||
NE=0.;
|
||||
NP=0.;
|
||||
Transmitted=0.;
|
||||
Reflected =0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
||||
Em5CalorHitsCollection* CHC = NULL;
|
||||
if (HCE)
|
||||
CHC = (Em5CalorHitsCollection*)(HCE->GetHC(calorimeterCollID));
|
||||
|
||||
if (CHC)
|
||||
{
|
||||
int n_hit = CHC->entries();
|
||||
// if(verboselevel==2)
|
||||
// G4cout << " " << n_hit
|
||||
// << " hits are stored in Em5CalorHitsCollection." << endl;
|
||||
|
||||
G4double totEAbs=0, totLAbs=0;
|
||||
for (int i=0;i<n_hit;i++)
|
||||
{ totEAbs += (*CHC)[i]->GetEdepAbs();
|
||||
totLAbs += (*CHC)[i]->GetTrakAbs();
|
||||
}
|
||||
if(verboselevel==2)
|
||||
G4cout
|
||||
<< " Absorber: total energy: " << setw(7) <<
|
||||
G4BestUnit(totEAbs,"Energy")
|
||||
<< " total track length: " << setw(7) <<
|
||||
G4BestUnit(totLAbs,"Length")
|
||||
<< endl;
|
||||
|
||||
// count event, add deposits to the sum ...
|
||||
runaction->CountEvent() ;
|
||||
runaction->AddTrackLength(totLAbs) ;
|
||||
runaction->AddnStepsCharged(nstepCharged) ;
|
||||
runaction->AddnStepsNeutral(nstepNeutral) ;
|
||||
if(verboselevel==2)
|
||||
G4cout << " Ncharged=" << Nch << " , Nneutral=" << Nne << endl;
|
||||
runaction->CountParticles(Nch,Nne);
|
||||
runaction->AddEP(NE,NP);
|
||||
runaction->AddTrRef(Transmitted,Reflected) ;
|
||||
runaction->AddEdeps(totEAbs) ;
|
||||
runaction->FillEn(totEAbs) ;
|
||||
|
||||
nstep=nstepCharged+nstepNeutral ;
|
||||
runaction->FillNbOfSteps(nstep);
|
||||
}
|
||||
|
||||
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." << endl;
|
||||
|
||||
|
||||
//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 << endl;
|
||||
HepRandom::showEngineStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4int Em5EventAction::GetEventno()
|
||||
{
|
||||
G4int evno = fpEventManager->GetConstCurrentEvent()->GetEventID() ;
|
||||
return evno ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::setEventVerbose(G4int level)
|
||||
{
|
||||
verboselevel = level ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::CountStepsCharged()
|
||||
{
|
||||
nstepCharged += 1. ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::CountStepsNeutral()
|
||||
{
|
||||
nstepNeutral += 1. ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::AddCharged()
|
||||
{
|
||||
Nch += 1.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::AddNeutral()
|
||||
{
|
||||
Nne += 1.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::AddE()
|
||||
{
|
||||
NE += 1.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::AddP()
|
||||
{
|
||||
NP += 1.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::SetTr()
|
||||
{
|
||||
Transmitted = 1.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventAction::SetRef()
|
||||
{
|
||||
Reflected = 1.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
// 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: Em5EventActionMessenger.cc,v 1.1.4.1 1999/12/07 20:47:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5EventActionMessenger.hh"
|
||||
|
||||
#include "Em5EventAction.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5EventActionMessenger::Em5EventActionMessenger(Em5EventAction* 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....
|
||||
|
||||
Em5EventActionMessenger::~Em5EventActionMessenger()
|
||||
{
|
||||
delete setVerboseCmd;
|
||||
delete DrawCmd;
|
||||
delete PrintCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5EventActionMessenger::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,361 @@
|
||||
// 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: Em5PhysicsList.cc,v 1.1.4.1 1999/12/07 20:47:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5PhysicsList.hh"
|
||||
#include "Em5DetectorConstruction.hh"
|
||||
#include "Em5PhysicsListMessenger.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 "G4Timer.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <iomanip.h>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5PhysicsList::Em5PhysicsList(Em5DetectorConstruction* p)
|
||||
:G4VUserPhysicsList()
|
||||
{
|
||||
pDet = p;
|
||||
|
||||
currentDefaultCut = defaultCutValue = 1*mm;
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForProton = defaultCutValue;
|
||||
|
||||
MaxChargedStep = DBL_MAX;
|
||||
|
||||
SetVerboseLevel(1);
|
||||
physicsListMessenger = new Em5PhysicsListMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5PhysicsList::~Em5PhysicsList()
|
||||
{
|
||||
delete physicsListMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::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();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::ConstructBosons()
|
||||
{
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::ConstructMesons()
|
||||
{
|
||||
// mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::ConstructBarions()
|
||||
{
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#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 "Em5StepCut.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
// gamma
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering);
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
|
||||
|
||||
Em5StepCut* theeminusStepCut = new Em5StepCut();
|
||||
theeminusStepCut->SetMaxStep(MaxChargedStep);
|
||||
pmanager->AddProcess(theeminusStepCut, -1,-1,4);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);
|
||||
|
||||
Em5StepCut* theeplusStepCut = new Em5StepCut();
|
||||
theeplusStepCut->SetMaxStep(MaxChargedStep) ;
|
||||
pmanager->AddProcess(theeplusStepCut, -1,-1,5);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
//muon
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
|
||||
pmanager->AddProcess(new G4MuIonisation, -1, 2,2);
|
||||
pmanager->AddProcess(new G4MuBremsstrahlung, -1,-1,3);
|
||||
pmanager->AddProcess(new G4MuPairProduction, -1,-1,4);
|
||||
|
||||
} else if (
|
||||
particleName == "proton"
|
||||
|| particleName == "antiproton"
|
||||
|| particleName == "pi+"
|
||||
|| particleName == "pi-"
|
||||
|| particleName == "kaon+"
|
||||
|| particleName == "kaon-"
|
||||
)
|
||||
{
|
||||
pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1,2,2);
|
||||
|
||||
Em5StepCut* thehadronStepCut = new Em5StepCut();
|
||||
thehadronStepCut->SetMaxStep(MaxChargedStep);
|
||||
pmanager->AddProcess( thehadronStepCut, -1,-1,3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4Decay.hh"
|
||||
|
||||
void Em5PhysicsList::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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::SetCuts()
|
||||
{
|
||||
G4Timer theTimer ;
|
||||
theTimer.Start() ;
|
||||
|
||||
// reactualise cutValues
|
||||
if (currentDefaultCut != defaultCutValue)
|
||||
{
|
||||
if(cutForGamma == currentDefaultCut) cutForGamma = defaultCutValue;
|
||||
if(cutForElectron == currentDefaultCut) cutForElectron = defaultCutValue;
|
||||
currentDefaultCut = defaultCutValue;
|
||||
}
|
||||
|
||||
if (verboseLevel >0){
|
||||
G4cout << "Em5PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << endl;
|
||||
}
|
||||
// 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>0) DumpCutValuesTable();
|
||||
|
||||
theTimer.Stop();
|
||||
G4cout.precision(6);
|
||||
G4cout << endl ;
|
||||
G4cout << "total time(SetCuts)=" << theTimer.GetUserElapsed() << " s " <<endl;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::SetGammaCut(G4double val)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForGamma = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::SetElectronCut(G4double val)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForElectron = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::SetProtonCut(G4double val)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForProton = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::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);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::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() << endl;
|
||||
G4cout << "particle : " << part->GetParticleName() << endl;
|
||||
G4cout << "energy : " << val / keV << " (keV)" << endl;
|
||||
G4cout << "range : " << cut / mm << " (mm)" << endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsList::SetMaxStep(G4double step)
|
||||
{
|
||||
MaxChargedStep = step ;
|
||||
G4cout << " MaxChargedStep=" << MaxChargedStep << endl;
|
||||
G4cout << endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,99 @@
|
||||
// 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: Em5PhysicsListMessenger.cc,v 1.1.4.1 1999/12/07 20:47:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5PhysicsListMessenger.hh"
|
||||
|
||||
#include "Em5PhysicsList.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5PhysicsListMessenger::Em5PhysicsListMessenger(Em5PhysicsList * List)
|
||||
:Em5List(List)
|
||||
{
|
||||
cutGCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutG",this);
|
||||
cutGCmd->SetGuidance("Set cut values by RANGE for Gamma.");
|
||||
cutGCmd->SetParameterName("range",false);
|
||||
cutGCmd->SetRange("range>0.");
|
||||
cutGCmd->SetUnitCategory("Length");
|
||||
cutGCmd->AvailableForStates(Idle);
|
||||
|
||||
cutECmd = new G4UIcmdWithADoubleAndUnit("/calor/cutE",this);
|
||||
cutECmd->SetGuidance("Set cut values by RANGE for e- e+.");
|
||||
cutECmd->SetParameterName("range",false);
|
||||
cutECmd->SetRange("range>0.");
|
||||
cutECmd->SetUnitCategory("Length");
|
||||
cutECmd->AvailableForStates(Idle);
|
||||
|
||||
cutPCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutP",this);
|
||||
cutPCmd->SetGuidance("Set cut values by RANGE for proton and others.");
|
||||
cutPCmd->SetParameterName("range",false);
|
||||
cutPCmd->SetRange("range>0.");
|
||||
cutPCmd->SetUnitCategory("Length");
|
||||
cutPCmd->AvailableForStates(Idle);
|
||||
|
||||
eCmd = new G4UIcmdWithADoubleAndUnit("/calor/cutEnergy",this);
|
||||
eCmd->SetGuidance("Set cut values by ENERGY for charged particles.");
|
||||
eCmd->SetParameterName("energy",false);
|
||||
eCmd->SetRange("energy>0.");
|
||||
eCmd->SetUnitCategory("Energy");
|
||||
eCmd->AvailableForStates(Idle);
|
||||
|
||||
rCmd = new G4UIcmdWithADoubleAndUnit("/calor/range",this);
|
||||
rCmd->SetGuidance("Display the RANGE of Electron for the current material.");
|
||||
rCmd->SetParameterName("energy",false);
|
||||
rCmd->SetRange("energy>0.");
|
||||
rCmd->SetUnitCategory("Energy");
|
||||
rCmd->AvailableForStates(Idle);
|
||||
|
||||
setMaxStepCmd = new G4UIcmdWithADoubleAndUnit("/step/setMaxStep",this);
|
||||
setMaxStepCmd->SetGuidance("Set max. step length in the detector");
|
||||
setMaxStepCmd->SetParameterName("mxStep",false);
|
||||
setMaxStepCmd->SetRange("mxStep>0.");
|
||||
setMaxStepCmd->SetUnitCategory("Length");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5PhysicsListMessenger::~Em5PhysicsListMessenger()
|
||||
{
|
||||
delete cutGCmd;
|
||||
delete cutECmd;
|
||||
delete cutPCmd;
|
||||
delete rCmd;
|
||||
delete eCmd;
|
||||
delete setMaxStepCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PhysicsListMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if(command == cutGCmd)
|
||||
{ Em5List->SetGammaCut(cutGCmd->GetNewDoubleValue(newValue));}
|
||||
if(command == cutECmd)
|
||||
{ Em5List->SetElectronCut(eCmd->GetNewDoubleValue(newValue));}
|
||||
if(command == cutPCmd)
|
||||
{ Em5List->SetProtonCut(eCmd->GetNewDoubleValue(newValue));}
|
||||
if(command == eCmd)
|
||||
{ Em5List->SetCutsByEnergy(cutECmd->GetNewDoubleValue(newValue));}
|
||||
if(command == rCmd)
|
||||
{ Em5List->GetRange(rCmd->GetNewDoubleValue(newValue));}
|
||||
if(command == setMaxStepCmd)
|
||||
{ Em5List->SetMaxStep(setMaxStepCmd->GetNewDoubleValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
// 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: Em5PrimaryGeneratorAction.cc,v 1.1.4.1 1999/12/07 20:47:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "Em5DetectorConstruction.hh"
|
||||
#include "Em5PrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4String Em5PrimaryGeneratorAction::thePrimaryParticleName="e-" ;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5PrimaryGeneratorAction::Em5PrimaryGeneratorAction(
|
||||
Em5DetectorConstruction* Em5DC)
|
||||
:Em5Detector(Em5DC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
SetDefaultKinematic();
|
||||
|
||||
//create a messenger for this class
|
||||
gunMessenger = new Em5PrimaryGeneratorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5PrimaryGeneratorAction::~Em5PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete gunMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PrimaryGeneratorAction::SetDefaultKinematic()
|
||||
{
|
||||
// default particle kinematic
|
||||
//
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="e-");
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
|
||||
thePrimaryParticleName = particle->GetParticleName();
|
||||
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
particleGun->SetParticleEnergy(30.*MeV);
|
||||
G4double x0 = -0.5*(Em5Detector->GetWorldSizeX());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(x0, 0*cm, 0*cm));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
thePrimaryParticleName = particleGun->GetParticleDefinition()->
|
||||
GetParticleName();
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4String Em5PrimaryGeneratorAction::GetPrimaryName()
|
||||
{
|
||||
return thePrimaryParticleName;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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: Em5PrimaryGeneratorMessenger.cc,v 1.1.4.1 1999/12/07 20:47:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5PrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "Em5PrimaryGeneratorAction.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5PrimaryGeneratorMessenger::Em5PrimaryGeneratorMessenger(Em5PrimaryGeneratorAction* Em5Gun)
|
||||
:Em5Action(Em5Gun)
|
||||
{
|
||||
DefaultCmd = new G4UIcmdWithoutParameter("/gun/setDefault",this);
|
||||
DefaultCmd->SetGuidance("set/reset the kinematic defined in PrimaryGenerator");
|
||||
DefaultCmd->AvailableForStates(PreInit,Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5PrimaryGeneratorMessenger::~Em5PrimaryGeneratorMessenger()
|
||||
{
|
||||
delete DefaultCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
if( command == DefaultCmd )
|
||||
{ Em5Action->SetDefaultKinematic();}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,374 @@
|
||||
// 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: Em5RunMessenger.cc,v 1.1.4.1 1999/12/07 20:47:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5RunMessenger.hh"
|
||||
|
||||
#include "Em5RunAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5RunMessenger::Em5RunMessenger(Em5RunAction* RA)
|
||||
:runAction (RA)
|
||||
{
|
||||
plotDir = new G4UIdirectory("/plots/");
|
||||
plotDir->SetGuidance("plot control");
|
||||
|
||||
sethistNameCmd = new G4UIcmdWithAString("/plots/sethistName",this);
|
||||
sethistNameCmd->SetGuidance("set name for the histogram file");
|
||||
|
||||
setnbinStepCmd = new G4UIcmdWithAnInteger("/plots/setnbinStep",this);
|
||||
setnbinStepCmd->SetGuidance("set nb of bins in #step plot");
|
||||
setnbinStepCmd->SetParameterName("nbinStep",false);
|
||||
|
||||
setSteplowCmd = new G4UIcmdWithADouble("/plots/setSteplow",this);
|
||||
setSteplowCmd->SetGuidance("set lower limit for #step plot ");
|
||||
setSteplowCmd->SetParameterName("Steplow",false);
|
||||
|
||||
setStephighCmd = new G4UIcmdWithADouble("/plots/setStephigh",this);
|
||||
setStephighCmd->SetGuidance("set upper limit for #step plot ");
|
||||
setStephighCmd->SetParameterName("Stephigh",false);
|
||||
|
||||
setnbinEnCmd = new G4UIcmdWithAnInteger("/plots/setnbinEn",this);
|
||||
setnbinEnCmd->SetGuidance("set nb of bins in Edep plot");
|
||||
setnbinEnCmd->SetParameterName("nbinE",false);
|
||||
|
||||
setEnlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEnlow",this);
|
||||
setEnlowCmd->SetGuidance("set lower limit for Edep plot ");
|
||||
setEnlowCmd->SetParameterName("Elow",false);
|
||||
setEnlowCmd->SetUnitCategory("Energy");
|
||||
|
||||
setEnhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEnhigh",this);
|
||||
setEnhighCmd->SetGuidance("set upper limit for Edep plot ");
|
||||
setEnhighCmd->SetParameterName("Ehigh",false);
|
||||
setEnhighCmd->SetUnitCategory("Energy");
|
||||
|
||||
setnbinGammaCmd = new G4UIcmdWithAnInteger("/plots/setnbinGamma",this);
|
||||
setnbinGammaCmd->SetGuidance("set nb of bins in gamma spectrum plot");
|
||||
setnbinGammaCmd->SetParameterName("nbinGamma",false);
|
||||
|
||||
setElowGammaCmd = new G4UIcmdWithADoubleAndUnit("/plots/setElowGamma",this);
|
||||
setElowGammaCmd->SetGuidance("set lower limit for gamma spectrum plot ");
|
||||
setElowGammaCmd->SetParameterName("ElowGamma",false);
|
||||
setElowGammaCmd->SetUnitCategory("Energy");
|
||||
|
||||
setEhighGammaCmd = new G4UIcmdWithADoubleAndUnit("/plots/setEhighGamma",this);
|
||||
setEhighGammaCmd->SetGuidance("set upper limit for gamma spectrum plot ");
|
||||
setEhighGammaCmd->SetParameterName("EhighGamma",false);
|
||||
setEhighGammaCmd->SetUnitCategory("Energy");
|
||||
|
||||
setnbinTtCmd = new G4UIcmdWithAnInteger("/plots/setnbinTt",this);
|
||||
setnbinTtCmd->SetGuidance("set nb of bins in Etransmitted plot");
|
||||
setnbinTtCmd->SetParameterName("nbinTt",false);
|
||||
|
||||
setTtlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTtlow",this);
|
||||
setTtlowCmd->SetGuidance("set lower limit for Etransmitted plot ");
|
||||
setTtlowCmd->SetParameterName("Ttlow",false);
|
||||
|
||||
setTthighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTthigh",this);
|
||||
setTthighCmd->SetGuidance("set upper limit for Etransmitted plot ");
|
||||
setTthighCmd->SetParameterName("Tthigh",false);
|
||||
|
||||
setnbinTbCmd = new G4UIcmdWithAnInteger("/plots/setnbinTb",this);
|
||||
setnbinTbCmd->SetGuidance("set nb of bins in Ebackscattering plot");
|
||||
setnbinTbCmd->SetParameterName("nbinTb",false);
|
||||
|
||||
setTblowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTblow",this);
|
||||
setTblowCmd->SetGuidance("set lower limit for Ebackscattered plot ");
|
||||
setTblowCmd->SetParameterName("Tblow",false);
|
||||
|
||||
setTbhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTbhigh",this);
|
||||
setTbhighCmd->SetGuidance("set upper limit for Ebackscattered plot ");
|
||||
setTbhighCmd->SetParameterName("Tbhigh",false);
|
||||
|
||||
setnbinTsecCmd = new G4UIcmdWithAnInteger("/plots/setnbinTsec",this);
|
||||
setnbinTsecCmd->SetGuidance("set nb of bins in charged Tsecondary plot");
|
||||
setnbinTsecCmd->SetParameterName("nbinTsec",false);
|
||||
|
||||
setTseclowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTseclow",this);
|
||||
setTseclowCmd->SetGuidance("set lower limit for charged Tsecondary plot ");
|
||||
setTseclowCmd->SetParameterName("Tseclow",false);
|
||||
|
||||
setTsechighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setTsechigh",this);
|
||||
setTsechighCmd->SetGuidance("set upper limit for charged Tsecondary plot ");
|
||||
setTsechighCmd->SetParameterName("Tsechigh",false);
|
||||
|
||||
setnbinRCmd = new G4UIcmdWithAnInteger("/plots/setnbinR",this);
|
||||
setnbinRCmd->SetGuidance("set nb of bins in R plot");
|
||||
setnbinRCmd->SetParameterName("nbinR",false);
|
||||
|
||||
setRlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setRlow",this);
|
||||
setRlowCmd->SetGuidance("set lower limit for R plot ");
|
||||
setRlowCmd->SetParameterName("Rlow",false);
|
||||
|
||||
setRhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setRhigh",this);
|
||||
setRhighCmd->SetGuidance("set upper limit for R plot ");
|
||||
setRhighCmd->SetParameterName("Rhigh",false);
|
||||
|
||||
setnbinzvertexCmd = new G4UIcmdWithAnInteger("/plots/setnbinzvertex",this);
|
||||
setnbinzvertexCmd->SetGuidance("set nb of bins in Z vertex plot");
|
||||
setnbinzvertexCmd->SetParameterName("nbinZ",false);
|
||||
|
||||
setzlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setzlow",this);
|
||||
setzlowCmd->SetGuidance("set lower limit for Z vertex plot ");
|
||||
setzlowCmd->SetParameterName("zlow",false);
|
||||
|
||||
setzhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setzhigh",this);
|
||||
setzhighCmd->SetGuidance("set upper limit for Z vertex plot ");
|
||||
setzhighCmd->SetParameterName("zhigh",false);
|
||||
|
||||
setnbinThCmd = new G4UIcmdWithAnInteger("/plots/setnbinTh",this);
|
||||
setnbinThCmd->SetGuidance("set nb of bins in Theta transmitted plot");
|
||||
setnbinThCmd->SetParameterName("nbinTh",false);
|
||||
|
||||
setThlowCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThlow",this);
|
||||
setThlowCmd->SetGuidance("set lower limit for Theta transmitted plot ");
|
||||
setThlowCmd->SetParameterName("Thlow",false);
|
||||
|
||||
setThhighCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThhigh",this);
|
||||
setThhighCmd->SetGuidance("set upper limit for Theta transmitted plot ");
|
||||
setThhighCmd->SetParameterName("Thhigh",false);
|
||||
|
||||
setnbinThbackCmd = new G4UIcmdWithAnInteger("/plots/setnbinThback",this);
|
||||
setnbinThbackCmd->SetGuidance("set nb of bins in backscattering Theta plot");
|
||||
setnbinThbackCmd->SetParameterName("nbinThback",false);
|
||||
|
||||
setThlowbackCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThlowback",this);
|
||||
setThlowbackCmd->SetGuidance("set lower limit for backscattering Theta plot ");
|
||||
setThlowbackCmd->SetParameterName("Thlowback",false);
|
||||
|
||||
setThhighbackCmd = new G4UIcmdWithADoubleAndUnit("/plots/setThhighback",this);
|
||||
setThhighbackCmd->SetGuidance("set upper limit for backscattering Theta plot ");
|
||||
setThhighbackCmd->SetParameterName("Thhighback",false);
|
||||
|
||||
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....
|
||||
|
||||
Em5RunMessenger::~Em5RunMessenger()
|
||||
{
|
||||
delete sethistNameCmd;
|
||||
|
||||
delete setnbinStepCmd;
|
||||
delete setSteplowCmd;
|
||||
delete setStephighCmd;
|
||||
|
||||
delete setnbinEnCmd;
|
||||
delete setEnlowCmd;
|
||||
delete setEnhighCmd;
|
||||
|
||||
delete setnbinGammaCmd;
|
||||
delete setElowGammaCmd;
|
||||
delete setEhighGammaCmd;
|
||||
|
||||
delete setnbinTtCmd;
|
||||
delete setTtlowCmd;
|
||||
delete setTthighCmd;
|
||||
|
||||
delete setnbinTbCmd;
|
||||
delete setTblowCmd;
|
||||
delete setTbhighCmd;
|
||||
|
||||
delete setnbinTsecCmd;
|
||||
delete setTseclowCmd;
|
||||
delete setTsechighCmd;
|
||||
|
||||
delete setnbinRCmd;
|
||||
delete setRlowCmd;
|
||||
delete setRhighCmd;
|
||||
|
||||
delete setnbinzvertexCmd;
|
||||
delete setzlowCmd;
|
||||
delete setzhighCmd;
|
||||
|
||||
delete setnbinThCmd;
|
||||
delete setThlowCmd;
|
||||
delete setThhighCmd;
|
||||
|
||||
delete setnbinThbackCmd;
|
||||
delete setThlowbackCmd;
|
||||
delete setThhighbackCmd;
|
||||
|
||||
delete plotDir;
|
||||
|
||||
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5RunMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
|
||||
{
|
||||
if( command == sethistNameCmd)
|
||||
runAction
|
||||
->SethistName(newValues) ;
|
||||
|
||||
if( command == setnbinStepCmd)
|
||||
runAction
|
||||
->SetnbinStep(setnbinStepCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setSteplowCmd)
|
||||
runAction
|
||||
->SetSteplow( setSteplowCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setStephighCmd)
|
||||
runAction
|
||||
->SetStephigh( setStephighCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinEnCmd)
|
||||
runAction
|
||||
->SetnbinEn(setnbinEnCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setEnlowCmd)
|
||||
runAction
|
||||
->SetEnlow( setEnlowCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setEnhighCmd)
|
||||
runAction
|
||||
->SetEnhigh( setEnhighCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinGammaCmd)
|
||||
runAction
|
||||
->SetnbinGamma(setnbinGammaCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setElowGammaCmd)
|
||||
runAction
|
||||
->SetElowGamma( setElowGammaCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setEhighGammaCmd)
|
||||
runAction
|
||||
->SetEhighGamma( setEhighGammaCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinTtCmd)
|
||||
runAction
|
||||
->SetnbinTt(setnbinTtCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setTtlowCmd)
|
||||
runAction
|
||||
->SetTtlow( setTtlowCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setTthighCmd)
|
||||
runAction
|
||||
->SetTthigh( setTthighCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinTbCmd)
|
||||
runAction
|
||||
->SetnbinTb(setnbinTbCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setTblowCmd)
|
||||
runAction
|
||||
->SetTblow( setTblowCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setTbhighCmd)
|
||||
runAction
|
||||
->SetTbhigh( setTbhighCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinTsecCmd)
|
||||
runAction
|
||||
->SetnbinTsec(setnbinTsecCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setTseclowCmd)
|
||||
runAction
|
||||
->SetTseclow( setTseclowCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setTsechighCmd)
|
||||
runAction
|
||||
->SetTsechigh( setTsechighCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinRCmd)
|
||||
runAction
|
||||
->SetnbinR(setnbinRCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setRlowCmd)
|
||||
runAction
|
||||
->SetRlow( setRlowCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setRhighCmd)
|
||||
runAction
|
||||
->SetRhigh( setRhighCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinzvertexCmd)
|
||||
runAction
|
||||
->Setnbinzvertex(setnbinzvertexCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setzlowCmd)
|
||||
runAction
|
||||
->Setzlow( setzlowCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setzhighCmd)
|
||||
runAction
|
||||
->Setzhigh( setzhighCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinThCmd)
|
||||
runAction
|
||||
->SetnbinTh(setnbinThCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setThlowCmd)
|
||||
runAction
|
||||
->SetThlow( setThlowCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setThhighCmd)
|
||||
runAction
|
||||
->SetThhigh( setThhighCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setnbinThbackCmd)
|
||||
runAction
|
||||
->SetnbinThBack(setnbinThbackCmd->GetNewIntValue(newValues));
|
||||
|
||||
if( command == setThlowbackCmd)
|
||||
runAction
|
||||
->SetThlowBack( setThlowbackCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if( command == setThhighbackCmd)
|
||||
runAction
|
||||
->SetThhighBack( setThhighbackCmd->GetNewDoubleValue(newValues));
|
||||
|
||||
if (command == RndmSaveCmd)
|
||||
runAction->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValues));
|
||||
|
||||
if (command == RndmReadCmd)
|
||||
{ G4cout << "\n---> rndm status restored from file: " << newValues << endl;
|
||||
HepRandom::restoreEngineStatus(newValues);
|
||||
HepRandom::showEngineStatus();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// 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: Em5StepCut.cc,v 1.1.4.1 1999/12/07 20:47:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5StepCut.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4UserLimits.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5StepCut::Em5StepCut(const G4String& aName)
|
||||
: G4VDiscreteProcess(aName),MaxChargedStep(DBL_MAX)
|
||||
{
|
||||
if (verboseLevel>0) {
|
||||
G4cout << GetProcessName() << " is created "<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5StepCut::~Em5StepCut()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5StepCut::Em5StepCut(Em5StepCut& right)
|
||||
:G4VDiscreteProcess(right)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5StepCut::SetMaxStep(G4double step)
|
||||
{
|
||||
MaxChargedStep = step ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -0,0 +1,192 @@
|
||||
// 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: Em5SteppingAction.cc,v 1.1.4.1 1999/12/07 20:47:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5DetectorConstruction.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4TrackVector.hh"
|
||||
#include "Em5SteppingAction.hh"
|
||||
#include "Em5PrimaryGeneratorAction.hh"
|
||||
#include "Em5EventAction.hh"
|
||||
#include "Em5RunAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "Em5SteppingMessenger.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <iomanip.h>
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5SteppingAction::Em5SteppingAction(Em5DetectorConstruction* DET,
|
||||
Em5EventAction* EA,
|
||||
Em5RunAction* RA)
|
||||
:detector (DET),eventaction (EA),runaction (RA),steppingMessenger(NULL),
|
||||
IDold(-1) ,evnoold(-1)
|
||||
{
|
||||
steppingMessenger = new Em5SteppingMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5SteppingAction::~Em5SteppingAction()
|
||||
{
|
||||
delete steppingMessenger ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
|
||||
G4double Edep,Theta,Thetaback,Ttrans,Tback,Tsec,Egamma,xend,yend,zend,rend ;
|
||||
G4double Tkin ;
|
||||
G4int evno = eventaction->GetEventno() ;
|
||||
|
||||
IDnow = evno+10000*(aStep->GetTrack()->GetTrackID())+
|
||||
100000000*(aStep->GetTrack()->GetParentID());
|
||||
if(IDnow != IDold)
|
||||
{
|
||||
IDold=IDnow ;
|
||||
if(
|
||||
(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName()) == "e-") &&
|
||||
((aStep->GetTrack()->GetTrackID() != 1) ||
|
||||
(aStep->GetTrack()->GetParentID() != 0)) )
|
||||
||
|
||||
(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName()) == "e+") &&
|
||||
((aStep->GetTrack()->GetTrackID() != 1) ||
|
||||
(aStep->GetTrack()->GetParentID() != 0)) )
|
||||
)
|
||||
runaction->Fillvertexz(aStep->GetTrack()->GetVertexPosition().x());
|
||||
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber")
|
||||
{
|
||||
if(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName()) == "e-") &&
|
||||
((aStep->GetTrack()->GetTrackID() != 1) ||
|
||||
(aStep->GetTrack()->GetParentID() != 0)) )
|
||||
{
|
||||
eventaction->AddCharged() ;
|
||||
eventaction->AddE() ;
|
||||
Tsec = aStep->GetTrack()->GetKineticEnergy() ; // !!!!!!!!!!!!
|
||||
Tsec += aStep->GetTotalEnergyDeposit() ; // !!!!!!!!!!!!
|
||||
runaction->FillTsec(Tsec) ;
|
||||
}
|
||||
else
|
||||
if(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName()) == "e+") &&
|
||||
((aStep->GetTrack()->GetTrackID() != 1) ||
|
||||
(aStep->GetTrack()->GetParentID() != 0)) )
|
||||
{
|
||||
eventaction->AddCharged() ;
|
||||
eventaction->AddP() ;
|
||||
Tsec = aStep->GetTrack()->GetKineticEnergy() ; // !!!!!!!!!!!!
|
||||
Tsec += aStep->GetTotalEnergyDeposit() ; // !!!!!!!!!!!!
|
||||
runaction->FillTsec(Tsec) ;
|
||||
}
|
||||
else
|
||||
if(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName()) == "gamma") &&
|
||||
((aStep->GetTrack()->GetTrackID() != 1) ||
|
||||
(aStep->GetTrack()->GetParentID() != 0)) )
|
||||
{
|
||||
eventaction->AddNeutral() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber")
|
||||
{
|
||||
if(((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName()) == "e-")
|
||||
||
|
||||
((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName()) == "e+"))
|
||||
eventaction->CountStepsCharged() ;
|
||||
|
||||
if ((aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName()) == "gamma")
|
||||
eventaction->CountStepsNeutral() ;
|
||||
}
|
||||
|
||||
if (
|
||||
(((aStep->GetTrack()->GetTrackID() == 1) &&
|
||||
(aStep->GetTrack()->GetParentID()== 0)) ||
|
||||
(aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName() ==
|
||||
Em5PrimaryGeneratorAction::GetPrimaryName()))
|
||||
&&
|
||||
(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber")
|
||||
&&
|
||||
(aStep->GetTrack()->GetNextVolume()->GetName()=="World") &&
|
||||
(aStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName() == "Transportation") &&
|
||||
(aStep->GetTrack()->GetMomentumDirection().x()>0.)
|
||||
)
|
||||
{
|
||||
eventaction->SetTr();
|
||||
Theta = acos(aStep->GetTrack()->GetMomentumDirection().x()) ;
|
||||
runaction->FillTh(Theta) ;
|
||||
Ttrans = aStep->GetTrack()->GetKineticEnergy() ;
|
||||
runaction->FillTt(Ttrans) ;
|
||||
yend= aStep->GetTrack()->GetPosition().y() ;
|
||||
zend= aStep->GetTrack()->GetPosition().z() ;
|
||||
rend = sqrt(yend*yend+zend*zend) ;
|
||||
runaction->FillR(rend);
|
||||
}
|
||||
|
||||
if (
|
||||
(((aStep->GetTrack()->GetTrackID() == 1) &&
|
||||
(aStep->GetTrack()->GetParentID()== 0)) ||
|
||||
(aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->
|
||||
GetParticleName() ==
|
||||
Em5PrimaryGeneratorAction::GetPrimaryName()))
|
||||
&&
|
||||
(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber") &&
|
||||
(aStep->GetTrack()->GetNextVolume()->GetName()=="World") &&
|
||||
(aStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName() == "Transportation") &&
|
||||
(aStep->GetTrack()->GetMomentumDirection().z()<0.)
|
||||
)
|
||||
{
|
||||
eventaction->SetRef();
|
||||
Thetaback = acos(aStep->GetTrack()->GetMomentumDirection().x()) ;
|
||||
Thetaback -= 0.5*pi ;
|
||||
runaction->FillThBack(Thetaback) ;
|
||||
Tback = aStep->GetTrack()->GetKineticEnergy() ;
|
||||
runaction->FillTb(Tback) ;
|
||||
}
|
||||
|
||||
|
||||
if (
|
||||
((aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()=="Absorber") &&
|
||||
(aStep->GetTrack()->GetNextVolume()->GetName()=="World") &&
|
||||
(aStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName() == "Transportation") &&
|
||||
(aStep->GetTrack()->GetMomentumDirection().x()>0.) &&
|
||||
(aStep->GetTrack()->GetDynamicParticle()->GetDefinition()
|
||||
->GetParticleName() == "gamma"))
|
||||
)
|
||||
{
|
||||
Egamma = aStep->GetTrack()->GetKineticEnergy() ;
|
||||
runaction->FillGammaSpectrum(Egamma) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// 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: Em5SteppingMessenger.cc,v 1.1.4.1 1999/12/07 20:47:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em5SteppingMessenger.hh"
|
||||
|
||||
#include "Em5SteppingAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5SteppingMessenger::Em5SteppingMessenger(Em5SteppingAction* SA)
|
||||
:steppingAction (SA)
|
||||
{
|
||||
steppingDir = new G4UIdirectory("/stepping/");
|
||||
steppingDir->SetGuidance("stepping control");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5SteppingMessenger::~Em5SteppingMessenger()
|
||||
{
|
||||
delete steppingDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5SteppingMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
// 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: Em5VisManager.cc,v 1.1.4.1 1999/12/07 20:47:12 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 24th January 1998.
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#ifdef G4VIS_USE
|
||||
|
||||
#include "Em5VisManager.hh"
|
||||
|
||||
// Supported drivers...
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
#include "G4FukuiRenderer.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
#include "G4DAWNFILE.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_RAYX
|
||||
#include "G4RayX.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
#include "G4VRML1.hh"
|
||||
// #include "G4VRML2.hh"
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
#include "G4VRML1File.hh"
|
||||
//#include "G4VRML2File.hh"
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em5VisManager::Em5VisManager () {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em5VisManager::RegisterGraphicsSystems () {
|
||||
|
||||
#ifdef G4VIS_USE_DAWN
|
||||
RegisterGraphicsSystem (new G4FukuiRenderer);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_DAWNFILE
|
||||
RegisterGraphicsSystem (new G4DAWNFILE);
|
||||
#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_RAYX
|
||||
RegisterGraphicsSystem (new G4RayX);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRML
|
||||
RegisterGraphicsSystem (new G4VRML1);
|
||||
// RegisterGraphicsSystem (new G4VRML2);
|
||||
#endif
|
||||
|
||||
#ifdef G4VIS_USE_VRMLFILE
|
||||
RegisterGraphicsSystem (new G4VRML1File);
|
||||
// RegisterGraphicsSystem (new G4VRML2File);
|
||||
#endif
|
||||
|
||||
if (fVerbose > 0) {
|
||||
G4cout <<
|
||||
"\nYou have successfully chosen to use the following graphics systems."
|
||||
<< endl;
|
||||
PrintAvailableGraphicsSystems ();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
Reference in New Issue
Block a user