Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
@@ -0,0 +1,256 @@
// 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: Em2DetectorConstruction.cc,v 1.1.4.1 1999/12/07 20:46:57 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2DetectorConstruction.hh"
#include "Em2DetectorMessenger.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4RunManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2DetectorConstruction::Em2DetectorConstruction()
:solidEcal(NULL) ,logicEcal(NULL) ,physiEcal(NULL),
solidSlice(NULL),logicSlice(NULL),physiSlice(NULL),
solidRing(NULL) ,logicRing(NULL) ,physiRing(NULL),
myMaterial(NULL),magField(NULL) ,
nLtot(20),dLradl(1.),nRtot(20),dRradl(0.25),
EcalLength(0.),EcalRadius(0.)
{
detectorMessenger = new Em2DetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2DetectorConstruction::~Em2DetectorConstruction()
{ delete detectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* Em2DetectorConstruction::Construct()
{
DefineMaterials();
return ConstructVolumes();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::DefineMaterials()
{
G4String name, symbol;
G4double a, z, density;
G4int ncomponents, natoms;
G4double fractionmass;
//
// define few Elements
//
a = 1.01*g/mole;
G4Element* H = new G4Element(name="Hydrogen", symbol="H", z=1., a);
a = 14.01*g/mole;
G4Element* N = new G4Element(name="Nitrogen", symbol="N", z=7., a);
a = 16.00*g/mole;
G4Element* O = new G4Element(name="Oxygen" , symbol="O", z=8., a);
a = 72.59*g/mole;
G4Element* Ge = new G4Element(name="Germanium", symbol="Ge",z=32., a);
a = 183.84*g/mole;
G4Element* W = new G4Element(name="Tungsten" , symbol="W", z=74., a);
a = 207.19*g/mole;
G4Element* Pb = new G4Element(name="Lead" , symbol="Pb",z=82., a);
a = 208.98*g/mole;
G4Element* Bi = new G4Element(name="Bismuth" , symbol="Bi",z=83., a);
//
// define materials
//
//Air
density = 1.29*mg/cm3;
G4Material* Air = new G4Material(name="Air", density, ncomponents=2);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
//H2O
density = 1.00*g/cm3;
G4Material* H2O = new G4Material(name="Water", density, ncomponents=2);
H2O->AddElement(H, natoms=2);
H2O->AddElement(O, natoms=1);
//liquid argon
a = 39.95*g/mole;
density = 1.390*g/cm3;
G4Material* lAr = new G4Material(name="lAr", z=18., a, density);
//Al
a = 26.98*g/mole;
density = 2.7*g/cm3;
G4Material* Al = new G4Material(name="Al", z=13., a, density);
//Fe
a = 55.85*g/mole;
density = 7.87*g/cm3;
G4Material* Fe = new G4Material(name="Fe", z=26., a, density);
//BGO
density = 7.10*g/cm3;
G4Material* BGO = new G4Material(name="BGO", density, ncomponents=3);
BGO->AddElement(O , natoms=12);
BGO->AddElement(Ge, natoms= 3);
BGO->AddElement(Bi, natoms= 4);
//PbWO4
density = 8.28*g/cm3;
G4Material* PbWO = new G4Material(name="PbWO4", density, ncomponents=3);
PbWO->AddElement(O , natoms=4);
PbWO->AddElement(Pb, natoms=1);
PbWO->AddElement(W , natoms=1);
//Pb
density = 11.35*g/cm3;
G4Material* pb = new G4Material(name="Lead", density, ncomponents=1);
pb->AddElement(Pb, fractionmass=1.0);
G4cout << *(G4Material::GetMaterialTable()) << endl;
//choose material
myMaterial = PbWO;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* Em2DetectorConstruction::ConstructVolumes()
{
G4double Radl = myMaterial->GetRadlen();
G4double dL = dLradl*Radl, dR = dRradl*Radl;
EcalLength = nLtot*dL; EcalRadius = nRtot*dR;
//
// Ecal
//
solidEcal = new G4Tubs("Ecal",0.,EcalRadius,0.5*EcalLength,0.,360*deg);
logicEcal = new G4LogicalVolume( solidEcal,myMaterial,"Ecal",0,0,0);
physiEcal = new G4PVPlacement(0,G4ThreeVector(),
"Ecal",logicEcal,0,false,0);
// Ring
solidRing = new G4Tubs("Ring",0.,dR,0.5*EcalLength,0.,360*deg);
logicRing = new G4LogicalVolume(solidRing,myMaterial,"Ring",0,0,0);
if (nRtot >1)
physiRing = new G4PVReplica("Ring",logicRing,physiEcal,
kRho,nRtot,dR);
else
physiRing = new G4PVPlacement(0,G4ThreeVector(),"Ring",logicRing,
physiEcal,false,0);
// Slice
solidSlice = new G4Tubs("Slice",0.,dR,0.5*dL,0.,360*deg);
logicSlice = new G4LogicalVolume(solidSlice,myMaterial,"Slice",0,0,0);
if (nLtot >1)
physiSlice = new G4PVReplica("Slice",logicSlice,physiRing,
kZAxis,nLtot,dL);
else
physiSlice = new G4PVPlacement(0,G4ThreeVector(),"Slice",logicSlice,
physiRing,false,0);
cout << "Absorber is " << G4BestUnit(EcalLength,"Length")
<< " of " << myMaterial->GetName() << endl;
G4VisAttributes* VisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
VisAtt->SetVisibility(true);
logicEcal->SetVisAttributes(VisAtt);
//
//always return the physical World
//
return physiEcal;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::SetMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial)
{myMaterial = pttoMaterial;
logicEcal->SetMaterial(myMaterial);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::SetLBining(G4ThreeVector Value)
{
nLtot = (G4int)Value(0); dLradl = Value(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::SetRBining(G4ThreeVector Value)
{
nRtot = (G4int)Value(0); dRradl = Value(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorConstruction::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 Em2DetectorConstruction::UpdateGeometry()
{
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,98 @@
// 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: Em2DetectorMessenger.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2DetectorMessenger.hh"
#include "Em2DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWith3Vector.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2DetectorMessenger::Em2DetectorMessenger(Em2DetectorConstruction * Det)
:Em2Detector(Det)
{
Em2detDir = new G4UIdirectory("/calor/");
Em2detDir->SetGuidance("Em2 detector control.");
MaterCmd = new G4UIcmdWithAString("/calor/setMat",this);
MaterCmd->SetGuidance("Select Material.");
MaterCmd->SetParameterName("material",false);
MaterCmd->AvailableForStates(PreInit,Idle);
LBinCmd = new G4UIcmdWith3Vector("/calor/setLbin",this);
LBinCmd->SetGuidance("set longitudinal bining");
LBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
LBinCmd->SetParameterName("nLtot","dLradl"," ",true);
LBinCmd->SetRange("nLtot>=1 && dLradl>0");
LBinCmd->AvailableForStates(PreInit,Idle);
RBinCmd = new G4UIcmdWith3Vector("/calor/setRbin",this);
RBinCmd->SetGuidance("set radial bining");
RBinCmd->SetGuidance("nb of bins; bin thickness (in radl)");
RBinCmd->SetParameterName("nRtot","dRradl"," ",true);
RBinCmd->SetRange("nRtot>=1 && dRradl>0");
RBinCmd->AvailableForStates(PreInit,Idle);
FieldCmd = new G4UIcmdWithADoubleAndUnit("/calor/setField",this);
FieldCmd->SetGuidance("Define magnetic field.");
FieldCmd->SetGuidance("Magnetic field will be in Z direction.");
FieldCmd->SetParameterName("Bz",false);
FieldCmd->SetUnitCategory("Magnetic flux density");
FieldCmd->AvailableForStates(PreInit,Idle);
UpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
UpdateCmd->SetGuidance("Update 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....
Em2DetectorMessenger::~Em2DetectorMessenger()
{
delete MaterCmd;
delete LBinCmd;
delete RBinCmd;
delete FieldCmd;
delete UpdateCmd;
delete Em2detDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == MaterCmd )
{ Em2Detector->SetMaterial(newValue);}
if( command == LBinCmd )
{ Em2Detector->SetLBining(LBinCmd->GetNew3VectorValue(newValue));}
if( command == RBinCmd )
{ Em2Detector->SetRBining(RBinCmd->GetNew3VectorValue(newValue));}
if( command == FieldCmd )
{ Em2Detector->SetMagField(FieldCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ Em2Detector->UpdateGeometry();}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,89 @@
// 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: Em2EventAction.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2EventAction.hh"
#include "Em2RunAction.hh"
#include "Em2EventActionMessenger.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2EventAction::Em2EventAction(Em2RunAction* run)
:Em2Run(run),drawFlag("charged"),printModulo(10000)
{
eventMessenger = new Em2EventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2EventAction::~Em2EventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2EventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
if (evtNb%printModulo == 0)
G4cout << "\n---> Begin Of Event: " << evtNb << endl;
Em2Run->initializePerEvent();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2EventAction::EndOfEventAction(const G4Event* evt)
{
Em2Run->fillPerEvent();
if (G4VVisManager::GetConcreteInstance())
{
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);
}
}
//save rndm status
if (Em2Run->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....
@@ -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: Em2EventActionMessenger.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2EventActionMessenger.hh"
#include "Em2EventAction.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2EventActionMessenger::Em2EventActionMessenger(Em2EventAction* EvAct)
:eventAction(EvAct)
{
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("charged");
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....
Em2EventActionMessenger::~Em2EventActionMessenger()
{
delete DrawCmd;
delete PrintCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2EventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
if(command == PrintCmd)
{eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,235 @@
// 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: Em2PhysicsList.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2PhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2PhysicsList::Em2PhysicsList()
: G4VUserPhysicsList()
{
defaultCutValue = 1.*mm;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2PhysicsList::~Em2PhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::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 Em2PhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4RhoZero::RhoZeroDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::ConstructBarions()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::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"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PhysicsList::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);
} 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);
} 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 ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering,-1,1,1);
pmanager->AddProcess(new G4hIonisation, -1,2,2);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4Decay.hh"
void Em2PhysicsList::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 Em2PhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "Em2PhysicsList::SetCuts:";
G4cout << "CutLength : " << defaultCutValue/mm << " (mm)" << 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(defaultCutValue, "gamma");
SetCutValue(defaultCutValue, "e-");
SetCutValue(defaultCutValue, "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
SetCutValue(defaultCutValue, "proton");
SetCutValue(defaultCutValue, "anti_proton");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,60 @@
// 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: Em2PrimaryGeneratorAction.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2PrimaryGeneratorAction.hh"
#include "Em2DetectorConstruction.hh"
#include "G4Event.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2PrimaryGeneratorAction::Em2PrimaryGeneratorAction(
Em2DetectorConstruction* det)
:Em2Detector(det)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
G4ParticleDefinition* particle
= G4ParticleTable::GetParticleTable()->FindParticle("e-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticleEnergy(5.*GeV);
G4double position = -0.5*(Em2Detector->GetfullLength());
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2PrimaryGeneratorAction::~Em2PrimaryGeneratorAction()
{
delete particleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
G4double position = -0.5*(Em2Detector->GetfullLength());
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,389 @@
// 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: Em2RunAction.cc,v 1.1.4.1 1999/12/07 20:46:58 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2RunAction.hh"
#include "Em2DetectorConstruction.hh"
#include "Em2PrimaryGeneratorAction.hh"
#include "Em2RunActionMessenger.hh"
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include <iomanip.h>
#include <assert.h>
#include "Randomize.hh"
#include "CLHEP/Hist/HBookFile.h"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2RunAction::Em2RunAction(Em2DetectorConstruction* det,
Em2PrimaryGeneratorAction* kin)
:Em2Det(det),Em2Kin(kin),hbookManager(NULL)
{
nLbin = Em2Det->GetnLtot();
dEdL = *new MyVector(nLbin);
sumELongit = *new MyVector(nLbin);
sumELongitCumul = *new MyVector(nLbin);
sumE2Longit = *new MyVector(nLbin);
sumE2LongitCumul = *new MyVector(nLbin);
gammaFlux = *new MyVector(nLbin);
electronFlux = *new MyVector(nLbin);
positronFlux = *new MyVector(nLbin);
nRbin = Em2Det->GetnRtot();
dEdR = *new MyVector(nRbin);
sumERadial = *new MyVector(nRbin);
sumERadialCumul = *new MyVector(nRbin);
sumE2Radial = *new MyVector(nRbin);
sumE2RadialCumul = *new MyVector(nRbin);
runMessenger = new Em2RunActionMessenger(this);
saveFlag = "off";
saveRndm = 1;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2RunAction::~Em2RunAction()
{
cleanHisto();
delete runMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::bookHisto()
{
hbookManager = new HBookFile("TestEm2.histo", 68);
assert (hbookManager != 0);
G4double Ekin = Em2Kin->GetParticleGun()->GetParticleEnergy();
G4double dLradl = Em2Det->GetdLradl();
G4double dRradl = Em2Det->GetdRradl();
histo1 = hbookManager->histogram("total energy deposit (percent of E inc)",
100,0.,100.);
histo2 = hbookManager->histogram("total charged tracklength (radl)",
100,0.,100.*Ekin/GeV);
histo3 = hbookManager->histogram("total neutral tracklength (radl)",
100,0.,1000.*Ekin/GeV);
histo4 = hbookManager->histogram("longit energy profile (% of E inc)",
nLbin,0.,nLbin*dLradl);
G4double Zmin=0.5*dLradl, Zmax=Zmin+nLbin*dLradl;
histo5 = hbookManager->histogram("cumul longit energy dep (% of E inc)",
nLbin,Zmin,Zmax);
histo6 = hbookManager->histogram("rms on cumul longit Edep (% of E inc)",
nLbin,Zmin,Zmax);
histo7 = hbookManager->histogram("nb of gamma per plane",
nLbin,Zmin,Zmax);
histo8 = hbookManager->histogram("nb of positron per plane",
nLbin,Zmin,Zmax);
histo9 = hbookManager->histogram("nb of electron per plane",
nLbin,Zmin,Zmax);
hist10 = hbookManager->histogram("radial energy profile (% of E inc)",
nRbin,0.,nRbin*dRradl);
G4double Rmin=0.5*dRradl, Rmax=Rmin+nRbin*dRradl;
hist11 = hbookManager->histogram("cumul radial energy dep (% of E inc)",
nRbin,Rmin,Rmax);
hist12 = hbookManager->histogram("rms on cumul radial Edep (% of E inc)",
nRbin,Rmin,Rmax);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::cleanHisto()
{
delete histo1; delete histo2; delete histo3;
delete histo4; delete histo5; delete histo6;
delete histo7; delete histo8; delete histo9;
delete hist10; delete hist11; delete hist12;
delete hbookManager;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::BeginOfRunAction(const G4Run* aRun)
{
G4cout << "### Run " << aRun->GetRunID() << " start." << endl;
// save Rndm status
if (saveRndm > 0)
{ HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("beginOfRun.rndm");
}
//reshape arrays if needed
//
G4bool rebin(false);
G4int nLtot = Em2Det->GetnLtot();
if(nLbin != nLtot)
{dEdL.reshape(nLbin=nLtot);
sumELongit.reshape(nLbin) ; sumE2Longit.reshape(nLbin);
sumELongitCumul.reshape(nLbin); sumE2LongitCumul.reshape(nLbin);
gammaFlux.reshape(nLbin) ;
electronFlux.reshape(nLbin) ; positronFlux.reshape(nLbin);
rebin=true;
}
G4int nRtot = Em2Det->GetnRtot();
if(nRbin != nRtot)
{dEdR.reshape(nRbin=nRtot);
sumERadial.reshape(nRbin) ; sumE2Radial.reshape(nRbin);
sumERadialCumul.reshape(nRbin); sumE2RadialCumul.reshape(nRbin);
rebin=true;
}
//initialize arrays of cumulative energy deposition
//
for (G4int i=0; i<nLbin; i++)
sumELongit(i)=sumE2Longit(i)=sumELongitCumul(i)=sumE2LongitCumul(i)=0.;
for (G4int j=0; j<nRbin; j++)
sumELongit(j)=sumE2Longit(j)=sumELongitCumul(j)=sumE2LongitCumul(j)=0.;
//initialize track length
sumChargTrLength=sum2ChargTrLength=sumNeutrTrLength=sum2NeutrTrLength=0.;
//histograms
//
if (aRun->GetRunID() == 0) bookHisto();
else if (rebin) {cleanHisto(); bookHisto();}
//drawing
//
if (G4VVisManager::GetConcreteInstance())
{
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/clear/view");
UI->ApplyCommand("/vis/draw/current");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::fillPerEvent()
{
//accumulate statistic
//
G4double dLCumul = 0.;
for (G4int i=0; i<nLbin; i++)
{
sumELongit(i) += dEdL(i);
sumE2Longit(i) += dEdL(i)*dEdL(i);
dLCumul += dEdL(i);
sumELongitCumul(i) += dLCumul;
sumE2LongitCumul(i) += dLCumul*dLCumul;
}
G4double dRCumul = 0.;
for (G4int j=0; j<nRbin; j++)
{
sumERadial(j) += dEdR(j);
sumE2Radial(j) += dEdR(j)*dEdR(j);
dRCumul += dEdR(j);
sumERadialCumul(j) += dRCumul;
sumE2RadialCumul(j) += dRCumul*dRCumul;
}
sumChargTrLength += ChargTrLength;
sum2ChargTrLength += ChargTrLength*ChargTrLength;
sumNeutrTrLength += NeutrTrLength;
sum2NeutrTrLength += NeutrTrLength*NeutrTrLength;
//fill histograms
//
G4double Ekin=Em2Kin->GetParticleGun()->GetParticleEnergy();
G4double mass=Em2Kin->GetParticleGun()->GetParticleDefinition()->GetPDGMass();
G4double radl=Em2Det->GetMaterial()->GetRadlen();
histo1->accumulate(100.*dLCumul/(Ekin+mass));
histo2->accumulate(ChargTrLength/radl);
histo3->accumulate(NeutrTrLength/radl);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunAction::EndOfRunAction(const G4Run* aRun)
{
if (G4VVisManager::GetConcreteInstance())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
//compute and print statistic
//
G4int NbOfEvents = aRun->GetNumberOfEvent();
G4double kinEnergy = Em2Kin->GetParticleGun()->GetParticleEnergy();
assert(NbOfEvents*kinEnergy > 0);
G4double mass=Em2Kin->GetParticleGun()->GetParticleDefinition()->GetPDGMass();
G4double norme = 100./(NbOfEvents*(kinEnergy+mass));
//longitudinal
//
G4double dLradl = Em2Det->GetdLradl();
MyVector MeanELongit (nLbin), rmsELongit (nLbin);
MyVector MeanELongitCumul(nLbin), rmsELongitCumul(nLbin);
G4int i; G4double bin;
for (i=0; i<nLbin; i++)
{
MeanELongit(i) = norme*sumELongit(i);
rmsELongit(i) = norme*sqrt(abs(NbOfEvents*sumE2Longit(i)
- sumELongit(i)*sumELongit(i)));
MeanELongitCumul(i) = norme*sumELongitCumul(i);
rmsELongitCumul(i) = norme*sqrt(abs(NbOfEvents*sumE2LongitCumul(i)
- sumELongitCumul(i)*sumELongitCumul(i)));
gammaFlux (i) /= NbOfEvents;
electronFlux(i) /= NbOfEvents;
positronFlux(i) /= NbOfEvents;
bin = i*dLradl;
histo4->accumulate(bin,MeanELongit(i)/dLradl);
bin = (i+1)*dLradl;
histo5->accumulate(bin,MeanELongitCumul(i));
histo6->accumulate(bin, rmsELongitCumul(i));
histo7->accumulate(bin, gammaFlux(i));
histo8->accumulate(bin, electronFlux(i));
histo9->accumulate(bin, positronFlux(i));
}
//radial
//
G4double dRradl = Em2Det->GetdRradl();
MyVector MeanERadial (nRbin), rmsERadial (nRbin);
MyVector MeanERadialCumul(nRbin), rmsERadialCumul(nRbin);
for (i=0; i<nRbin; i++)
{
MeanERadial(i) = norme*sumERadial(i);
rmsERadial(i) = norme*sqrt(abs(NbOfEvents*sumE2Radial(i)
- sumERadial(i)*sumERadial(i)));
MeanERadialCumul(i) = norme*sumERadialCumul(i);
rmsERadialCumul(i) = norme*sqrt(abs(NbOfEvents*sumE2RadialCumul(i)
- sumERadialCumul(i)*sumERadialCumul(i)));
bin = i*dRradl;
hist10->accumulate(bin,MeanERadial(i)/dRradl);
bin = (i+1)*dRradl;
hist11->accumulate(bin,MeanERadialCumul(i));
hist12->accumulate(bin, rmsERadialCumul(i));
}
//track length
//
norme = 1./(NbOfEvents*(Em2Det->GetMaterial()->GetRadlen()));
G4double MeanChargTrLength = norme*sumChargTrLength;
G4double rmsChargTrLength = norme*sqrt(abs(NbOfEvents*sum2ChargTrLength
- sumChargTrLength*sumChargTrLength));
G4double MeanNeutrTrLength = norme*sumNeutrTrLength;
G4double rmsNeutrTrLength = norme*sqrt(abs(NbOfEvents*sum2NeutrTrLength
- sumNeutrTrLength*sumNeutrTrLength));
//print
//
G4long oldform = G4cout.setf(ios::fixed,ios::floatfield);
G4int oldprec = G4cout.precision(2);
G4cout << " LATERAL PROFILE "
<< " CUMULATIVE LATERAL PROFILE" << endl << endl;
G4cout << " bin " << " Mean rms "
<< " bin " << " Mean rms \n" << endl;
for (i=0; i<nLbin; i++)
{
G4double inf=i*dLradl, sup=inf+dLradl;
G4cout << setw(8) << inf << "->" << setw(5) << sup << " radl: "
<< setw(7) << MeanELongit(i) << "% "
<< setw(9) << rmsELongit(i) << "% "
<< " 0->" << setw(5) << sup << " radl: "
<< setw(7) << MeanELongitCumul(i) << "% "
<< setw(7) << rmsELongitCumul(i) << "% "
<<endl;
}
G4cout << endl << endl << endl;
G4cout << " RADIAL PROFILE "
<< " CUMULATIVE RADIAL PROFILE" << endl << endl;
G4cout << " bin " << " Mean rms "
<< " bin " << " Mean rms \n" << endl;
for (i=0; i<nRbin; i++)
{
G4double inf=i*dRradl, sup=inf+dRradl;
G4cout << setw(8) << inf << "->" << setw(5) << sup << " radl: "
<< setw(7) << MeanERadial(i) << "% "
<< setw(9) << rmsERadial(i) << "% "
<< " 0->" << setw(5) << sup << " radl: "
<< setw(7) << MeanERadialCumul(i) << "% "
<< setw(7) << rmsERadialCumul(i) << "% "
<<endl;
}
G4cout << endl;
G4cout << setw(37) << "SUMMARY" << endl;
G4cout << setw(42) << "energy deposit : "
<< setw(7) << MeanELongitCumul(nLbin-1) << " % E0 +- "
<< setw(7) << rmsELongitCumul(nLbin-1) << " % E0" << endl;
G4cout << setw(42) << "charged traklen: "
<< setw(7) << MeanChargTrLength << " radl +- "
<< setw(7) << rmsChargTrLength << " radl" << endl;
G4cout << setw(42) << "neutral traklen: "
<< setw(7) << MeanNeutrTrLength << " radl +- "
<< setw(7) << rmsNeutrTrLength << " radl" << endl;
G4cout.setf(oldform,ios::floatfield);
G4cout.precision(oldprec);
// Write histogram file
if (saveFlag == "on") hbookManager->write();
// save Rndm status
if (saveRndm == 1)
{ HepRandom::showEngineStatus();
HepRandom::saveEngineStatus("endOfRun.rndm");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,83 @@
// 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: Em2RunActionMessenger.cc,v 1.1.4.1 1999/12/07 20:46:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2RunActionMessenger.hh"
#include "Em2RunAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2RunActionMessenger::Em2RunActionMessenger(Em2RunAction* run)
:Em2Run(run)
{
SaveCmd = new G4UIcmdWithAString("/run/save",this);
SaveCmd->SetGuidance("Save run statistic (histo)");
SaveCmd->SetGuidance(" Choice : on,off(default)");
SaveCmd->SetParameterName("choice",true);
SaveCmd->SetDefaultValue("on");
SaveCmd->SetCandidates("on off");
SaveCmd->AvailableForStates(Idle);
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....
Em2RunActionMessenger::~Em2RunActionMessenger()
{
delete SaveCmd;
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if (command == SaveCmd) Em2Run->SetSaveFlag(newValue);
if (command == RndmSaveCmd)
Em2Run->SetRndmFreq(RndmSaveCmd->GetNewIntValue(newValue));
if (command == RndmReadCmd)
{ G4cout << "\n---> rndm status restored from file: " << newValue << endl;
HepRandom::restoreEngineStatus(newValue);
HepRandom::showEngineStatus();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,64 @@
// 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: Em2SteppingAction.cc,v 1.1.4.1 1999/12/07 20:46:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2SteppingAction.hh"
#include "Em2DetectorConstruction.hh"
#include "Em2RunAction.hh"
#include "G4SteppingManager.hh"
#include "G4VTouchable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2SteppingAction::Em2SteppingAction(Em2DetectorConstruction* det,
Em2RunAction* run)
:Em2Det(det),Em2Run(run)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2SteppingAction::~Em2SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2SteppingAction::UserSteppingAction(const G4Step* aStep)
{
G4Track* aTrack = aStep->GetTrack();
// energy deposit
//
G4int SlideNb(0), RingNb(0);
if (Em2Det->GetnRtot()>1)
RingNb = aStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber(1);
if (Em2Det->GetnLtot()>1)
SlideNb = aStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber();
G4double dEStep = aStep->GetTotalEnergyDeposit();
if (dEStep > 0.) Em2Run->fillPerStep(dEStep,SlideNb,RingNb);
// particle flux
//
if ((Em2Det->GetnLtot()>1)&&
(aStep->GetPostStepPoint()->GetTouchable()->GetVolume()))
{
G4int next = aStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber();
if (next != SlideNb)
Em2Run->particleFlux(aTrack->GetDefinition(), (SlideNb+next)/2);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,40 @@
// 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: Em2TrackingAction.cc,v 1.1.4.1 1999/12/07 20:46:59 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "Em2TrackingAction.hh"
#include "Em2RunAction.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Em2TrackingAction::Em2TrackingAction(Em2RunAction* run)
:Em2Run(run)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
//count total track length
G4double charge = aTrack->GetDefinition()->GetPDGCharge();
G4double TrLeng = aTrack->GetTrackLength();
Em2Run->fillPerTrack(charge,TrLeng);
}
@@ -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: Em2VisManager.cc,v 1.1.4.1 1999/12/07 20:46:59 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 "Em2VisManager.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....
Em2VisManager::Em2VisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Em2VisManager::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....