Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: DetectorConstruction.cc,v 1.4 2003/11/25 15:19:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: DetectorConstruction.cc,v 1.5 2004/05/27 13:43:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
/////////////////////////////////////////////////////////////////////////
@@ -79,6 +79,8 @@ DetectorConstruction::DetectorConstruction()
padLength = 0.1*mm;
padWidth = 0.02*mm;
absLength = 2.*mm;
vertexRegion = 0;
muonRegion = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -221,7 +223,11 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
// G4RegionStore::GetInstance()->Clean();
if(vertexRegion) delete vertexRegion;
if(muonRegion) delete muonRegion;
vertexRegion = new G4Region("VertexDetector");
muonRegion = new G4Region("MuonDetector");
if(vertexLength < padLength*5.0) vertexLength = padLength*5.0;
G4double gap = 0.01*mm;
@@ -359,15 +365,12 @@ G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
// Define region for the vertex detector
G4Region* regionV = new G4Region("VertexDetector");
regionV->AddRootLogicalVolume(logicVV);
regionV->AddRootLogicalVolume(logicA3);
vertexRegion->AddRootLogicalVolume(logicVV);
vertexRegion->AddRootLogicalVolume(logicA3);
// Define region for the muon detector
G4Region* regionM = new G4Region("MuonDetector");
regionM->AddRootLogicalVolume(logicYV);
muonRegion->AddRootLogicalVolume(logicYV);
// color regions
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: DetectorMessenger.cc,v 1.1 2003/07/14 17:10:16 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: DetectorMessenger.cc,v 1.2 2004/05/27 13:43:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
/////////////////////////////////////////////////////////////////////////
@@ -47,6 +47,7 @@
#include "G4UIcmdWith3Vector.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "HistoManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -109,6 +110,28 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
UpdateCmd->SetGuidance("if you changed geometrical value(s)");
UpdateCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
accCmd1 = new G4UIcmdWith3Vector("/testem/det/acceptance1",this);
accCmd1->SetGuidance("set Edep and RMS");
accCmd1->SetGuidance("acceptance values for central cell");
accCmd1->SetParameterName("edep","rms","limit",true);
accCmd1->SetRange("edep>0 && edep<1 && rms>0");
accCmd1->AvailableForStates(G4State_PreInit,G4State_Idle);
accCmd2 = new G4UIcmdWith3Vector("/testem/det/acceptance9",this);
accCmd2->SetGuidance("set Edep and RMS");
accCmd2->SetGuidance("acceptance values for 3x3 matrix");
accCmd2->SetParameterName("edep","rms","limit",true);
accCmd2->SetRange("edep>0 && edep<1 && rms>0");
accCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
accCmd3 = new G4UIcmdWith3Vector("/testem/det/acceptance25",this);
accCmd3->SetGuidance("set Edep and RMS");
accCmd3->SetGuidance("acceptance values for 5x5 matrix");
accCmd3->SetParameterName("edep","rms","limit",true);
accCmd3->SetRange("edep>0 && edep<1 && rms>0");
accCmd3->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -125,6 +148,9 @@ DetectorMessenger::~DetectorMessenger()
delete l6Cmd;
delete UpdateCmd;
delete testemDir;
delete accCmd1;
delete accCmd2;
delete accCmd3;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -157,6 +183,18 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
if( command == UpdateCmd )
{ Detector->UpdateGeometry();}
HistoManager* histo = HistoManager::GetPointer();
if( command == accCmd1 )
{ histo->SetEdepAndRMS(0,accCmd1->GetNew3VectorValue(newValue));}
if( command == accCmd2 )
{ histo->SetEdepAndRMS(1,accCmd2->GetNew3VectorValue(newValue));}
if( command == accCmd3 )
{ histo->SetEdepAndRMS(2,accCmd3->GetNew3VectorValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: EmAcceptance.cc,v 1.1 2004/05/27 13:43:57 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "EmAcceptance.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EmAcceptance::EmAcceptance()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EmAcceptance::~EmAcceptance()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EmAcceptance::BeginOfAcceptance(const G4String& title, G4int stat)
{
G4cout << G4endl;
G4cout << "<<<<<ACCEPTANCE>>>>> " << stat << " events for " << title << G4endl;
isAccepted = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EmAcceptance::EndOfAcceptance()
{
G4String resume = "IS ACCEPTED";
if(!isAccepted) resume = "IS NOT ACCEPTED";
G4cout << "<<<<<END>>>>> " << resume << G4endl;
G4cout << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void EmAcceptance::EmAcceptanceGauss(const G4String& title, G4int stat,
G4double avr, G4double avr0,
G4double rms, G4double limit)
{
G4double x = sqrt((G4double)stat);
G4double dde = avr - avr0;
G4double de = dde*x/rms;
G4cout << title << ": " << avr << " del"<< title << "= " << dde << " nrms= " << de << G4endl;
if(de > limit) isAccepted = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -36,12 +36,12 @@
#include "Histo.hh"
#ifdef G4ANALYSIS_USE
#include <memory> // for the auto_ptr(T>
#include "AIDA/AIDA.h"
#include "HistoMessenger.hh"
#endif
//#include <iomanip>
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -84,14 +84,16 @@ void Histo::book()
G4cout << "### Histo books " << nHisto << " histograms " << G4endl;
// Creating the analysis factory
std::auto_ptr< AIDA::IAnalysisFactory > af( AIDA_createAnalysisFactory() );
// Creating the tree factory
std::auto_ptr< AIDA::ITreeFactory > tf( af->createTreeFactory() );
// Creating a tree mapped to a new hbook file.
//tree = tf->create(histName,histType,false,false);
tree = tf->create(histName,histType,false,false,"uncompress");
G4cout << "Tree store : " << tree->storeName() << G4endl;
tree = tf->create(histName,histType,false,true,"uncompress");
if(tree)
G4cout << "Tree store : " << tree->storeName() << G4endl;
else
G4cout << "ERROR: Tree store " << histName << " is not created!" << G4endl;
// Creating a histogram factory, whose histograms will be handled by the tree
std::auto_ptr< AIDA::IHistogramFactory > hf(af->createHistogramFactory( *tree ));
@@ -100,7 +102,7 @@ void Histo::book()
for(G4int i=0; i<nHisto; i++) {
if(active[i]) {
histo[i] = hf->createHistogram1D(ids[i], tittles[i], bins[i], xmin[i], xmax[i]);
histo[i] = hf->createHistogram1D(ids[i], titles[i], bins[i], xmin[i], xmax[i]);
}
}
// Creating a tuple factory, whose tuples will be handled by the tree
@@ -143,7 +145,7 @@ void Histo::add1D(const G4String& id, const G4String& name, G4int nb,
xmax.push_back(x2);
unit.push_back(u);
ids.push_back(id);
tittles.push_back(name);
titles.push_back(name);
histo.push_back(0);
}
@@ -232,3 +234,17 @@ void Histo::addRow()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::setFileName(const G4String& nam)
{
histName = nam;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void Histo::setFileType(const G4String& nam)
{
histType = nam;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -35,6 +35,8 @@
#include "HistoManager.hh"
#include "G4UnitsTable.hh"
#include "Histo.hh"
#include "EmAcceptance.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -55,15 +57,19 @@ HistoManager* HistoManager::GetPointer()
HistoManager::HistoManager()
{
verbose = 1;
nEvt1 = -1;
nEvt2 = -1;
nEvt1 = -1;
nEvt2 = -1;
nmax = 3;
histo = new Histo();
bookHisto();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
HistoManager::~HistoManager()
{}
{
delete histo;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -79,38 +85,46 @@ void HistoManager::bookHisto()
nTuple = false;
nHisto = 10;
histo.add1D("10",
for(G4int i=0; i<nmax; i++) {
edep.push_back(0.0);
erms.push_back(0.0);
edeptrue.push_back(1.0);
rmstrue.push_back(1.0);
limittrue.push_back(DBL_MAX);
}
histo->add1D("10",
"Energy deposit (MeV) in central crystal",nBinsED,0.0,beamEnergy,MeV);
histo.add1D("11",
histo->add1D("11",
"Energy deposit (MeV) in 3x3",nBinsED,0.0,beamEnergy,MeV);
histo.add1D("12",
histo->add1D("12",
"Energy deposit (MeV) in 5x5",nBinsED,0.0,beamEnergy,MeV);
histo.add1D("13",
histo->add1D("13",
"Energy (MeV) of delta-electrons",nBinsE,0.0,maxEnergy,MeV);
histo.add1D("14",
histo->add1D("14",
"Energy (MeV) of gammas",nBinsE,0.0,maxEnergy,MeV);
histo.add1D("15",
histo->add1D("15",
"Energy (MeV) in abs1",nBinsEA,0.0,maxEnergyAbs,MeV);
histo.add1D("16",
histo->add1D("16",
"Energy (MeV) in abs2",nBinsEA,0.0,maxEnergyAbs,MeV);
histo.add1D("17",
histo->add1D("17",
"Energy (MeV) in abs3",nBinsEA,0.0,maxEnergyAbs,MeV);
histo.add1D("18",
histo->add1D("18",
"Energy (MeV) in abs4",nBinsEA,0.0,maxEnergyAbs,MeV);
histo.add1D("19",
histo->add1D("19",
"Number of vertex hits",20,-0.5,19.5,1.0);
if(nTuple) {
histo.addTuple( "100", "Dose deposite","float r, z, e" );
histo->addTuple( "100", "Dose deposite","float r, z, e" );
}
}
@@ -123,7 +137,7 @@ void HistoManager::BeginOfRun()
n_posit= 0;
n_gam = 0;
n_step = 0;
histo.book();
histo->book();
if(verbose > 0) {
G4cout << "HistoManager: Histograms are booked and run has been started"
@@ -137,30 +151,62 @@ void HistoManager::EndOfRun()
{
G4cout << "HistoManager: End of run actions are started" << G4endl;
G4String nam[3] = {"1x1", "3x3", "5x5"};
// average
G4cout<<"========================================================"<<G4endl;
G4double x = (G4double)n_evt;
if(n_evt > 0) x = 1.0/x;
G4int j;
for(j=0; j<nmax; j++) {
edep[j] *= x/beamEnergy;
G4double y = erms[j]*x/(beamEnergy*beamEnergy) - edep[j]*edep[j];
if(y < 0.0) y = 0.0;
erms[j] = sqrt(y);
}
G4double xe = x*(G4double)n_elec;
G4double xg = x*(G4double)n_gam;
G4double xp = x*(G4double)n_posit;
G4double xs = x*(G4double)n_step;
G4cout << "Number of events " << n_evt <<G4endl;
G4cout << std::setprecision(4) << "Average number of e- " << xe << G4endl;
G4cout << std::setprecision(4) << "Average number of gamma " << xg << G4endl;
G4cout << std::setprecision(4) << "Average number of e+ " << xp << G4endl;
G4cout << std::setprecision(4) << "Average number of steps " << xs << G4endl;
G4cout << "Number of events " << n_evt <<G4endl;
G4cout << std::setprecision(4) << "Average number of e- " << xe << G4endl;
G4cout << std::setprecision(4) << "Average number of gamma " << xg << G4endl;
G4cout << std::setprecision(4) << "Average number of e+ " << xp << G4endl;
G4cout << std::setprecision(4) << "Average number of steps " << xs << G4endl;
for(j=0; j<3; j++) {
G4cout << std::setprecision(4) << "Edep " << nam[j] << " = " << edep[j]
<< " +- " << erms[j]*sqrt(x) << G4endl;
}
G4cout<<"========================================================"<<G4endl;
G4cout<<G4endl;
// normalise histograms
for(G4int i=0; i<nHisto; i++) {
histo.scale(i,x);
histo->scale(i,x);
}
histo.save();
histo->save();
// Acceptance
EmAcceptance acc;
G4bool isStarted = false;
for (j=0; j<nmax; j++) {
G4double ltrue = limittrue[j];
if (ltrue < DBL_MAX) {
if (!isStarted) {
acc.BeginOfAcceptance("Crystal Calorimeter",n_evt);
isStarted = true;
}
G4double etrue = edeptrue[j];
G4double rtrue = rmstrue[j];
acc.EmAcceptanceGauss("Edep"+nam[j],n_evt,edep[j],etrue,rtrue,ltrue);
acc.EmAcceptanceGauss("Erms"+nam[j],n_evt,erms[j],rtrue,rtrue,2.0*ltrue);
}
}
if(isStarted) acc.EndOfAcceptance();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -190,17 +236,24 @@ void HistoManager::EndOfEvent()
e25 += E[i];
if( ( 6<=i && 8>=i) || (11<=i && 13>=i) || (16<=i && 18>=i)) e9 += E[i];
}
histo.fill(0,E[12],1.0);
histo.fill(1,e9,1.0);
histo.fill(2,e25,1.0);
histo.fill(5,Eabs1,1.0);
histo.fill(6,Eabs2,1.0);
histo.fill(7,Eabs3,1.0);
histo.fill(8,Eabs4,1.0);
histo->fill(0,E[12],1.0);
histo->fill(1,e9,1.0);
histo->fill(2,e25,1.0);
histo->fill(5,Eabs1,1.0);
histo->fill(6,Eabs2,1.0);
histo->fill(7,Eabs3,1.0);
histo->fill(8,Eabs4,1.0);
float nn = (double)(Nvertex.size());
histo.fill(9,nn,1.0);
histo->fill(9,nn,1.0);
if(nTuple) histo.addRow();
edep[0] += E[12];
erms[0] += E[12]*E[12];
edep[1] += e9;
erms[1] += e9*e9;
edep[2] += e25;
erms[2] += e25*e25;
if(nTuple) histo->addRow();
}
@@ -219,13 +272,13 @@ void HistoManager::ScoreNewTrack(const G4Track* aTrack)
if(0 == pid) {
histo.fillTuple("TKIN", kinE/MeV);
histo->fillTuple("TKIN", kinE/MeV);
G4double mass = 0.0;
if(particle) {
mass = particle->GetPDGMass();
histo.fillTuple("MASS", mass/MeV);
histo.fillTuple("CHAR",(particle->GetPDGCharge())/eplus);
histo->fillTuple("MASS", mass/MeV);
histo->fillTuple("CHAR",(particle->GetPDGCharge())/eplus);
G4double beta = 1.;
if(mass > 0.) {
G4double gamma = kinE/mass + 1.;
@@ -268,9 +321,9 @@ void HistoManager::ScoreNewTrack(const G4Track* aTrack)
void HistoManager::AddEnergy(G4double edep, G4int volIndex, G4int copyNo)
{
if(1 < verbose) {
G4cout << "HistoManager::AddEnergy: e(keV)= " << edep/keV
G4cout << "HistoManager::AddEnergy: e(keV)= " << edep/keV
<< "; volIdx= " << volIndex
<< "; copyNo= " << copyNo
<< "; copyNo= " << copyNo
<< G4endl;
}
if(0 == volIndex) {
@@ -308,7 +361,7 @@ void HistoManager::AddDeltaElectron(const G4DynamicParticle* elec)
{
G4double e = elec->GetKineticEnergy()/MeV;
if(e > 0.0) n_elec++;
histo.fill(3,e,1.0);
histo->fill(3,e,1.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -317,7 +370,18 @@ void HistoManager::AddPhoton(const G4DynamicParticle* ph)
{
G4double e = ph->GetKineticEnergy()/MeV;
if(e > 0.0) n_gam++;
histo.fill(4,e,1.0);
histo->fill(4,e,1.0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void HistoManager::SetEdepAndRMS(G4int i, G4ThreeVector val)
{
if(i<nmax && i>=0) {
if(val[0] > 0.0) edeptrue[i] = val[0];
if(val[1] > 0.0) rmstrue[i] = val[1];
if(val[2] > 0.0) limittrue[i] = val[2];
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: HistoMessenger.cc,v 1.1 2003/10/31 12:09:37 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: HistoMessenger.cc,v 1.2 2004/05/27 13:43:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -48,7 +48,7 @@ HistoMessenger::HistoMessenger(Histo* manager)
fileCmd = new G4UIcmdWithAString("/testem/histo/fileType",this);
fileCmd->SetGuidance("set type (hbook, XML) for the histograms file");
histoCmd = new G4UIcommand("/testem/histo/setHisto",this);
histoCmd->SetGuidance("Set bining of the histo number ih :");
histoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
@@ -61,20 +61,21 @@ HistoMessenger::HistoMessenger(Histo* manager)
G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
nbBins->SetGuidance("number of bins");
nbBins->SetParameterRange("nbBins>0");
histoCmd->SetParameter(nbBins);
//
histoCmd->SetParameter(nbBins);
//
G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
valMin->SetGuidance("valMin, expressed in unit");
histoCmd->SetParameter(valMin);
//
histoCmd->SetParameter(valMin);
//
G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
valMax->SetGuidance("valMax, expressed in unit");
histoCmd->SetParameter(valMax);
//
//
G4UIparameter* unit = new G4UIparameter("unit",'s',true);
unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
unit->SetDefaultValue("none");
histoCmd->SetParameter(unit);
histoCmd->SetParameter(unit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -84,7 +85,7 @@ HistoMessenger::~HistoMessenger()
delete fileCmd;
delete histoCmd;
delete factoryCmd;
delete histoDir;
delete histoDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -106,7 +107,7 @@ void HistoMessenger::SetNewValue(G4UIcommand* command,G4String newValues)
G4double vUnit = 1. ;
if (unit != "none") vUnit = G4UIcommand::ValueOf(unit);
histo->setHisto1D(ih,nbBins,vmin,vmax,vUnit);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: PrimaryGeneratorAction.cc,v 1.1 2003/07/14 17:10:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: PrimaryGeneratorAction.cc,v 1.2 2004/05/27 13:43:18 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
/////////////////////////////////////////////////////////////////////////
@@ -46,6 +46,7 @@
#include "G4Event.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "HistoManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -74,7 +75,9 @@ PrimaryGeneratorAction::~PrimaryGeneratorAction()
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4double zVertex = - (detector->GetWorldSizeZ());
particleGun->SetParticlePosition(G4ThreeVector(0.,0.,zVertex));
particleGun->SetParticlePosition(G4ThreeVector(0.,0.,zVertex));
if(anEvent->GetEventID() == 1)
(HistoManager::GetPointer())->SetBeamEnergy(particleGun->GetParticleEnergy());
particleGun->GeneratePrimaryVertex(anEvent);
}