Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -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: Em4DetectorConstruction.cc,v 1.1.4.1 1999/12/07 20:47:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em4DetectorConstruction.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4DetectorConstruction::Em4DetectorConstruction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4DetectorConstruction::~Em4DetectorConstruction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* Em4DetectorConstruction::Construct()
|
||||
{
|
||||
//
|
||||
// define a material from elements. case 1: chemical molecule
|
||||
//
|
||||
|
||||
G4String name, symbol; //a=mass of a mole;
|
||||
G4double a, z; //z=mean number of protons;
|
||||
G4int ncomponents, natoms;
|
||||
|
||||
a = 12.01*g/mole;
|
||||
G4Element* elC = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
|
||||
|
||||
a = 18.99*g/mole;
|
||||
G4Element* elF = new G4Element(name="Fluorine",symbol="N" , z= 9., a);
|
||||
|
||||
G4double density = 1.61*g/cm3;
|
||||
G4Material* matC6F6 = new G4Material(name="FluorCarbonate",density,ncomponents=2);
|
||||
matC6F6->AddElement(elC, natoms=6);
|
||||
matC6F6->AddElement(elF, natoms=6);
|
||||
|
||||
G4cout << matC6F6 << endl;
|
||||
|
||||
//
|
||||
// Container
|
||||
//
|
||||
|
||||
G4double Rmin=0., Rmax=5*cm, deltaZ= 5*cm, Phimin=0., deltaPhi=360*degree;
|
||||
|
||||
G4Tubs*
|
||||
solidWorld = new G4Tubs("C6F6", //its name
|
||||
Rmin,Rmax,deltaZ,Phimin,deltaPhi); //its size
|
||||
|
||||
G4LogicalVolume*
|
||||
logicWorld = new G4LogicalVolume(solidWorld, //its solid
|
||||
matC6F6, //its material
|
||||
"C6F6"); //its name
|
||||
G4VPhysicalVolume*
|
||||
physiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"C6F6", //its name
|
||||
logicWorld, //its logical volume
|
||||
NULL, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
|
||||
G4VisAttributes* visAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
visAtt->SetVisibility(true);
|
||||
logicWorld->SetVisAttributes(visAtt);
|
||||
|
||||
//
|
||||
//always return the physical World
|
||||
//
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
@@ -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: Em4EventAction.cc,v 1.1.4.1 1999/12/07 20:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em4EventAction.hh"
|
||||
|
||||
#include "Em4RunAction.hh"
|
||||
#include "Em4EventActionMessenger.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"
|
||||
|
||||
#include "CLHEP/Hist/HBookFile.h"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4EventAction::Em4EventAction(Em4RunAction* run)
|
||||
:Em4Run(run),drawFlag("all"),printModulo(10000),eventMessenger(NULL)
|
||||
{
|
||||
eventMessenger = new Em4EventActionMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4EventAction::~Em4EventAction()
|
||||
{
|
||||
delete eventMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4EventAction::BeginOfEventAction( const G4Event* evt)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
if (evtNb%printModulo == 0)
|
||||
G4cout << "\n---> Begin of Event: " << evtNb << endl;
|
||||
|
||||
TotalEnergyDeposit = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4EventAction::EndOfEventAction( const G4Event* evt)
|
||||
{
|
||||
if (drawFlag != "none")
|
||||
G4cout << " Energy deposit: "
|
||||
<< G4BestUnit(TotalEnergyDeposit,"Energy") << endl;
|
||||
|
||||
Em4Run->GetHisto(0)->accumulate(TotalEnergyDeposit/MeV);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//save rndm status
|
||||
if (Em4Run->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,62 @@
|
||||
// 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: Em4EventActionMessenger.cc,v 1.1.4.1 1999/12/07 20:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em4EventActionMessenger.hh"
|
||||
|
||||
#include "Em4EventAction.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4EventActionMessenger::Em4EventActionMessenger(Em4EventAction* 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("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....
|
||||
|
||||
Em4EventActionMessenger::~Em4EventActionMessenger()
|
||||
{
|
||||
delete DrawCmd;
|
||||
delete PrintCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4EventActionMessenger::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,154 @@
|
||||
// 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: Em4PhysicsList.cc,v 1.2.4.1 1999/12/07 20:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em4PhysicsList.hh"
|
||||
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleWithCuts.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4PhysicsList::Em4PhysicsList()
|
||||
: G4VUserPhysicsList()
|
||||
{
|
||||
defaultCutValue = 1.0*mm;
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4PhysicsList::~Em4PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4PhysicsList::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();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4PhysicsList::ConstructBosons()
|
||||
{
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
}
|
||||
|
||||
//....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"
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4PhysicsList::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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4PhysicsList::SetCuts()
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "Em4PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << defaultCutValue/mm << " (mm)" << endl;
|
||||
}
|
||||
|
||||
//special for low energy physics
|
||||
//
|
||||
G4double lowlimit=250*eV;
|
||||
G4Gamma ::SetEnergyRange(lowlimit,100*GeV);
|
||||
G4Electron::SetEnergyRange(lowlimit,100*GeV);
|
||||
G4Positron::SetEnergyRange(lowlimit,100*GeV);
|
||||
|
||||
// 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+");
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// 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: Em4PrimaryGeneratorAction.cc,v 1.1.4.1 1999/12/07 20:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em4PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4PrimaryGeneratorAction::Em4PrimaryGeneratorAction()
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
|
||||
G4ParticleDefinition* particle
|
||||
= G4ParticleTable::GetParticleTable()->FindParticle("gamma");
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
particleGun->SetParticleEnergy(9*MeV);
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4PrimaryGeneratorAction::~Em4PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
//this function is called at the begining of event
|
||||
//
|
||||
G4double theta = pi*G4UniformRand(), phi = twopi*G4UniformRand();
|
||||
G4double ux = sin(theta)*cos(phi),
|
||||
uy = sin(theta)*sin(phi),
|
||||
uz = cos(theta);
|
||||
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(ux,uy,uz));
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
// 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: Em4RunAction.cc,v 1.1.4.1 1999/12/07 20:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em4RunAction.hh"
|
||||
#include "Em4RunActionMessenger.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "CLHEP/Hist/HBookFile.h"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4RunAction::Em4RunAction()
|
||||
{
|
||||
bookHisto();
|
||||
|
||||
runMessenger = new Em4RunActionMessenger(this);
|
||||
saveFlag = "off";
|
||||
saveRndm = 1;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4RunAction::~Em4RunAction()
|
||||
{
|
||||
// Delete HBOOK stuff
|
||||
delete [] histo;
|
||||
delete hbookManager;
|
||||
|
||||
delete runMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4RunAction::bookHisto()
|
||||
{
|
||||
// init hbook
|
||||
hbookManager = new HBookFile("TestEm4.histo", 68);
|
||||
|
||||
// book histograms
|
||||
histo[0] = hbookManager->histogram("total energy deposit in C6F6 (MeV)"
|
||||
, 100,0.,10.);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << endl;
|
||||
|
||||
// save Rndm status
|
||||
if (saveRndm > 0)
|
||||
{ HepRandom::showEngineStatus();
|
||||
HepRandom::saveEngineStatus("beginOfRun.rndm");
|
||||
}
|
||||
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
|
||||
if(pVVisManager)
|
||||
{
|
||||
UI->ApplyCommand("/vis/clear/view");
|
||||
UI->ApplyCommand("/vis/draw/current");
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
if (G4VVisManager::GetConcreteInstance())
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
|
||||
|
||||
// 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: Em4RunActionMessenger.cc,v 1.1.4.1 1999/12/07 20:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em4RunActionMessenger.hh"
|
||||
#include "Em4RunAction.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4RunActionMessenger::Em4RunActionMessenger(Em4RunAction* run)
|
||||
:Em4Run(run)
|
||||
{
|
||||
SaveCmd = new G4UIcmdWithAString("/run/save",this);
|
||||
SaveCmd->SetGuidance("Save run statistic");
|
||||
SaveCmd->SetGuidance(" Choice : on(default),off");
|
||||
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....
|
||||
|
||||
Em4RunActionMessenger::~Em4RunActionMessenger()
|
||||
{
|
||||
delete SaveCmd;
|
||||
delete RndmSaveCmd; delete RndmReadCmd; delete RndmDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if (command == SaveCmd) Em4Run->SetSaveFlag(newValue);
|
||||
|
||||
if (command == RndmSaveCmd)
|
||||
Em4Run->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,41 @@
|
||||
// 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: Em4SteppingAction.cc,v 1.1.4.1 1999/12/07 20:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "Em4SteppingAction.hh"
|
||||
#include "Em4EventAction.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4SteppingAction::Em4SteppingAction(Em4EventAction* EvAct)
|
||||
:eventAction(EvAct),myVerbose(NULL)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
Em4SteppingAction::~Em4SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
G4double EdepStep = aStep->GetTotalEnergyDeposit();
|
||||
if (EdepStep > 0.) eventAction->addEdep(EdepStep);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
// 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: Em4SteppingVerbose.cc,v 1.1.4.1 1999/12/07 20:47:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// Em4SteppingVerbose.cc
|
||||
//
|
||||
// Description:
|
||||
// Implementation of the Em4SteppingVerbose class
|
||||
// Contact:
|
||||
// Questions and comments to this code should be sent to
|
||||
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
|
||||
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
#include "Em4SteppingVerbose.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
////////////////////////////////////////////////
|
||||
Em4SteppingVerbose::Em4SteppingVerbose()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
Em4SteppingVerbose::~Em4SteppingVerbose()
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
void Em4SteppingVerbose::StepInfo()
|
||||
/////////////////////////////////////////
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
if( verboseLevel >= 4 ) VerboseTrack();
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << endl;
|
||||
G4cout << setw( 5) << "#Step#" << " "
|
||||
<< setw( 6) << "X" << " "
|
||||
<< setw( 6) << "Y" << " "
|
||||
<< setw( 6) << "Z" << " "
|
||||
<< setw( 9) << "KineE" << " "
|
||||
<< setw( 9) << "dEStep" << " "
|
||||
<< setw(10) << "StepLeng"
|
||||
<< setw(10) << "TrakLeng"
|
||||
<< setw(10) << "NextVolu"
|
||||
<< setw(10) << "Process" << endl;
|
||||
}
|
||||
|
||||
G4cout << setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
// if( fStepStatus != fWorldBoundary){
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
G4cout << setw(10) << fTrack->GetNextVolume()->GetName();
|
||||
} else {
|
||||
G4cout << setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
G4cout << setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
} else {
|
||||
G4cout << "User Limit";
|
||||
}
|
||||
|
||||
G4cout << endl;
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << " :----- List of 2ndaries - "
|
||||
<< "#SpawnInStep=" << setw(3) << tN2ndariesTot
|
||||
<< "(Rest=" << setw(2) << fN2ndariesAtRestDoIt
|
||||
<< ",Along=" << setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << setw(3) << (*fSecondary).entries()
|
||||
<< " ---------------"
|
||||
<< endl;
|
||||
|
||||
for(G4int lp1=(*fSecondary).entries()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).entries(); lp1++){
|
||||
G4cout << " : "
|
||||
<< setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << endl;
|
||||
}
|
||||
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////
|
||||
void Em4SteppingVerbose::TrackingStarted()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
CopyState();
|
||||
G4int prec = G4cout.precision(3);
|
||||
if( verboseLevel > 0 ){
|
||||
|
||||
G4cout << setw( 5) << "Step#" << " "
|
||||
<< setw( 6) << "X" << " "
|
||||
<< setw( 6) << "Y" << " "
|
||||
<< setw( 6) << "Z" << " "
|
||||
<< setw( 9) << "KineE" << " "
|
||||
<< setw( 9) << "dEStep" << " "
|
||||
<< setw(10) << "StepLeng"
|
||||
<< setw(10) << "TrakLeng"
|
||||
<< setw(10) << "NextVolu"
|
||||
<< setw(10) << "Process" << endl;
|
||||
|
||||
G4cout << setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << setw(10) << fTrack->GetNextVolume()->GetName() << " ";
|
||||
} else {
|
||||
G4cout << setw(10) << "OutOfWorld" << " ";
|
||||
}
|
||||
G4cout << setw(10) << "initStep" << endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
@@ -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: Em4VisManager.cc,v 1.1.4.1 1999/12/07 20:47:07 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 "Em4VisManager.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....
|
||||
|
||||
Em4VisManager::Em4VisManager () {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void Em4VisManager::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