Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: RE05PrimaryGeneratorAction.cc 83391 2014-08-21 14:35:11Z gcosmo $
// $Id: RE05PrimaryGeneratorAction.cc 98775 2016-08-09 14:30:39Z gcosmo $
//
/// \file RE05/src/RE05PrimaryGeneratorAction.cc
/// \brief Implementation of the RE05PrimaryGeneratorAction class
@@ -38,61 +38,66 @@
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
G4VPrimaryGenerator* RE05PrimaryGeneratorAction::HEPEvt = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05PrimaryGeneratorAction::RE05PrimaryGeneratorAction()
{
if(!HEPEvt)
{
const char* filename = "pythia_event.data";
HEPEvt = new G4HEPEvtInterface(filename,1);
}
G4int n_particle = 1;
G4ParticleGun* fParticleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="mu+");
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
fParticleGun->SetParticleEnergy(100.*GeV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
particleGun = fParticleGun;
messenger = new RE05PrimaryGeneratorMessenger(this);
useHEPEvt = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4AutoLock.hh"
namespace {
G4Mutex RE05PrimGenDestrMutex = G4MUTEX_INITIALIZER;
G4Mutex RE05PrimGenMutex = G4MUTEX_INITIALIZER;
}
G4VPrimaryGenerator* RE05PrimaryGeneratorAction::fHEPEvt = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05PrimaryGeneratorAction::RE05PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction(),
fParticleGun(0),
fMessenger(0),
fUseHEPEvt(false)
{
if(!fHEPEvt)
{
const char* filename = "pythia_event.data";
fHEPEvt = new G4HEPEvtInterface(filename,1);
}
G4int n_particle = 1;
G4ParticleGun* particleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="mu+");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
particleGun->SetParticleEnergy(100.*GeV);
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
fParticleGun = particleGun;
fMessenger = new RE05PrimaryGeneratorMessenger(this);
fUseHEPEvt = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05PrimaryGeneratorAction::~RE05PrimaryGeneratorAction()
{
G4AutoLock lock(&RE05PrimGenDestrMutex);
if(HEPEvt) { delete HEPEvt; HEPEvt=0; }
delete particleGun;
delete messenger;
if(fHEPEvt) { delete fHEPEvt; fHEPEvt=0; }
delete fParticleGun;
delete fMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
if(useHEPEvt)
if(fUseHEPEvt)
{
G4AutoLock lock(&RE05PrimGenMutex);
HEPEvt->GeneratePrimaryVertex(anEvent);
fHEPEvt->GeneratePrimaryVertex(anEvent);
}
else
{ particleGun->GeneratePrimaryVertex(anEvent); }
{ fParticleGun->GeneratePrimaryVertex(anEvent); }
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......