Import Geant4 7.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 12:11:21 +02:00
parent 516dbf1a58
commit d93e1e39a9
5384 changed files with 125662 additions and 82444 deletions
@@ -29,8 +29,8 @@
//
// Code developed by: S.Guatelli, guatelli@ge.infn.it
//
// $Id: RemSimRunAction.cc,v 1.10 2004/11/23 11:43:21 guatelli Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: RemSimRunAction.cc,v 1.11 2005/05/19 13:30:59 guatelli Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
#include "RemSimRunAction.hh"
@@ -39,7 +39,6 @@
#ifdef G4ANALYSIS_USE
#include "RemSimAnalysisManager.hh"
#endif
#include "RemSimRunMessenger.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
#include "G4ios.hh"
@@ -49,18 +48,11 @@
RemSimRunAction::RemSimRunAction()
{
//Read the input file concerning the generation of primary particles
energies = new G4DataVector;
data = new G4DataVector;
messenger = new RemSimRunMessenger(this);
file = "";
}
RemSimRunAction::~RemSimRunAction()
{
delete messenger;
delete energies;
delete data;
}
void RemSimRunAction::BeginOfRunAction(const G4Run* aRun)
@@ -82,94 +74,3 @@ void RemSimRunAction::EndOfRunAction(const G4Run* aRun)
G4cout<< "Number of events:" << numberEvents << G4endl;
}
void RemSimRunAction::Read(G4String name)
{
file = name;
ReadData(MeV,name);
G4cout << name << " is the input file!" << G4endl;
}
void RemSimRunAction::ReadData(G4double unitE, G4String fileName)
{
char nameChar[100] = {""};
std::ostrstream ost(nameChar, 100, std::ios::out);
ost << fileName;
G4String name(nameChar);
std::ifstream file(fileName);
std::filebuf* lsdp = file.rdbuf();
if (! (lsdp->is_open()) )
{
G4String excep = "RemSimRunAction - data file: not found";
G4Exception(excep);
}
G4double a = 0;
G4int k = 1;
do
{
file >> a;
G4int nColumns = 2;
// The file is organized into two columns:
// 1st column is the energy
// 2nd column is the corresponding value
// The file terminates with the pattern: -1 -1
// -2 -2
if (a == -1 || a == -2)
{
}
else
{
if (k%nColumns != 0)
{
G4double e = a * unitE;
energies->push_back(e);
// G4cout<<e<<"energy";
k++;
}
else if (k%nColumns == 0)
{
G4double value = a;
data->push_back(value);
//G4cout<<" "<<a<<"flux"<<G4endl;
k = 1;
}
}
} while (a != -2); // end of file
file.close();
}
G4DataVector* RemSimRunAction::GetPrimaryParticleEnergy()
{
return energies;
}
G4DataVector* RemSimRunAction::GetPrimaryParticleEnergyDistribution()
{
return data;
}
G4double RemSimRunAction::GetPrimaryParticleEnergyDistributionSum()
{
G4double sum = 0;
size_t size = data -> size();
for (size_t i = 0; i < size; i++)
{
sum+=(*data)[i];
}
return sum;
}
G4bool RemSimRunAction::GetFile()
{
if (file == "") return false;
else return true;
}