Import Geant4 10.3.0.beta source tree
This commit is contained in:
+18
-16
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Event.cc 84194 2014-10-10 14:29:58Z gcosmo $
|
||||
// $Id: G4Event.cc 94950 2016-01-07 11:53:14Z gcosmo $
|
||||
//
|
||||
|
||||
// G4Event
|
||||
@@ -37,41 +37,43 @@
|
||||
#include "G4VDigiCollection.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4ThreadLocal G4Allocator<G4Event> *anEventAllocator = 0;
|
||||
G4ThreadLocal G4Allocator<G4Event> *anEventAllocator = nullptr;
|
||||
|
||||
G4Event::G4Event()
|
||||
:eventID(0),
|
||||
thePrimaryVertex(0),numberOfPrimaryVertex(0),
|
||||
HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
|
||||
randomNumberStatus(0),validRandomNumberStatus(false),
|
||||
randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
|
||||
thePrimaryVertex(nullptr),numberOfPrimaryVertex(0),
|
||||
HC(nullptr),DC(nullptr),trajectoryContainer(nullptr),
|
||||
eventAborted(false),userInfo(nullptr),
|
||||
randomNumberStatus(nullptr),validRandomNumberStatus(false),
|
||||
randomNumberStatusForProcessing(nullptr),validRandomNumberStatusForProcessing(false),
|
||||
keepTheEvent(false),grips(0)
|
||||
{
|
||||
}
|
||||
|
||||
G4Event::G4Event(G4int evID)
|
||||
:eventID(evID),
|
||||
thePrimaryVertex(0),numberOfPrimaryVertex(0),
|
||||
HC(0),DC(0),trajectoryContainer(0),eventAborted(false),userInfo(0),
|
||||
randomNumberStatus(0),validRandomNumberStatus(false),
|
||||
randomNumberStatusForProcessing(0),validRandomNumberStatusForProcessing(false),
|
||||
thePrimaryVertex(nullptr),numberOfPrimaryVertex(0),
|
||||
HC(nullptr),DC(nullptr),trajectoryContainer(nullptr),
|
||||
eventAborted(false),userInfo(nullptr),
|
||||
randomNumberStatus(nullptr),validRandomNumberStatus(false),
|
||||
randomNumberStatusForProcessing(nullptr),validRandomNumberStatusForProcessing(false),
|
||||
keepTheEvent(false),grips(0)
|
||||
{
|
||||
}
|
||||
|
||||
G4Event::~G4Event()
|
||||
{
|
||||
if(thePrimaryVertex) delete thePrimaryVertex;
|
||||
if(HC) delete HC;
|
||||
if(DC) delete DC;
|
||||
delete thePrimaryVertex;
|
||||
delete HC;
|
||||
delete DC;
|
||||
if(trajectoryContainer)
|
||||
{
|
||||
trajectoryContainer->clearAndDestroy();
|
||||
delete trajectoryContainer;
|
||||
}
|
||||
if(userInfo) delete userInfo;
|
||||
if(validRandomNumberStatus) delete randomNumberStatus;
|
||||
if(validRandomNumberStatusForProcessing) delete randomNumberStatusForProcessing;
|
||||
delete userInfo;
|
||||
delete randomNumberStatus;
|
||||
delete randomNumberStatusForProcessing;
|
||||
}
|
||||
|
||||
G4int G4Event::operator==(const G4Event &right) const
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4EventManager.cc 71031 2013-06-10 09:11:38Z gcosmo $
|
||||
// $Id: G4EventManager.cc 94950 2016-01-07 11:53:14Z gcosmo $
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -42,12 +42,12 @@
|
||||
#include "G4Navigator.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
G4ThreadLocal G4EventManager* G4EventManager::fpEventManager = 0;
|
||||
G4ThreadLocal G4EventManager* G4EventManager::fpEventManager = nullptr;
|
||||
G4EventManager* G4EventManager::GetEventManager()
|
||||
{ return fpEventManager; }
|
||||
|
||||
G4EventManager::G4EventManager()
|
||||
:currentEvent(0),trajectoryContainer(0),
|
||||
:currentEvent(nullptr),trajectoryContainer(nullptr),
|
||||
verboseLevel(0),tracking(false),abortRequested(false),
|
||||
storetRandomNumberStatusToG4Event(false)
|
||||
{
|
||||
@@ -65,17 +65,18 @@ G4EventManager::G4EventManager()
|
||||
sdManager = G4SDManager::GetSDMpointerIfExist();
|
||||
stateManager = G4StateManager::GetStateManager();
|
||||
fpEventManager = this;
|
||||
userEventAction = 0;
|
||||
userStackingAction = 0;
|
||||
userTrackingAction = 0;
|
||||
userSteppingAction = 0;
|
||||
userEventAction = nullptr;
|
||||
userStackingAction = nullptr;
|
||||
userTrackingAction = nullptr;
|
||||
userSteppingAction = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// private -> never called
|
||||
/* private -> never called
|
||||
G4EventManager::G4EventManager(const G4EventManager&) {;}
|
||||
G4EventManager& G4EventManager::operator=(const G4EventManager&)
|
||||
{ return *this; }
|
||||
*/
|
||||
|
||||
G4EventManager::~G4EventManager()
|
||||
{
|
||||
@@ -83,7 +84,7 @@ G4EventManager::~G4EventManager()
|
||||
delete transformer;
|
||||
delete trackManager;
|
||||
delete theMessenger;
|
||||
if(userEventAction) delete userEventAction;
|
||||
delete userEventAction;
|
||||
fpEventManager = 0;
|
||||
}
|
||||
|
||||
@@ -94,8 +95,6 @@ G4int G4EventManager::operator==(const G4EventManager &right) const { }
|
||||
G4int G4EventManager::operator!=(const G4EventManager &right) const { }
|
||||
*/
|
||||
|
||||
|
||||
|
||||
void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
{
|
||||
abortRequested = false;
|
||||
@@ -117,15 +116,15 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
currentEvent->SetRandomNumberStatusForProcessing(randomNumberStatusToG4Event);
|
||||
}
|
||||
|
||||
// Reseting Navigator has been moved to G4Eventmanager, so that resetting
|
||||
// Reseting Navigator has been moved to G4EventManager, so that resetting
|
||||
// is now done for every event.
|
||||
G4ThreeVector center(0,0,0);
|
||||
G4Navigator* navigator =
|
||||
G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
|
||||
navigator->LocateGlobalPointAndSetup(center,0,false);
|
||||
|
||||
G4Track * track;
|
||||
G4TrackStatus istop;
|
||||
G4Track * track = nullptr;
|
||||
G4TrackStatus istop = fAlive;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if ( verboseLevel > 0 )
|
||||
@@ -139,7 +138,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
trackContainer->PrepareNewEvent();
|
||||
|
||||
#ifdef G4_STORE_TRAJECTORY
|
||||
trajectoryContainer = 0;
|
||||
trajectoryContainer = nullptr;
|
||||
#endif
|
||||
|
||||
sdManager = G4SDManager::GetSDMpointerIfExist();
|
||||
@@ -169,7 +168,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
#endif
|
||||
|
||||
G4VTrajectory* previousTrajectory;
|
||||
while( ( track = trackContainer->PopNextTrack(&previousTrajectory) ) != 0 )
|
||||
while( ( track = trackContainer->PopNextTrack(&previousTrajectory) ) != 0 ) // Loop checking 12.28.2015 M.Asai
|
||||
{
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
@@ -195,7 +194,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
}
|
||||
#endif
|
||||
|
||||
G4VTrajectory * aTrajectory = 0;
|
||||
G4VTrajectory * aTrajectory = nullptr;
|
||||
#ifdef G4_STORE_TRAJECTORY
|
||||
aTrajectory = trackManager->GimmeTrajectory();
|
||||
|
||||
@@ -263,22 +262,22 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
|
||||
if(userEventAction) userEventAction->EndOfEventAction(currentEvent);
|
||||
|
||||
stateManager->SetNewState(G4State_GeomClosed);
|
||||
currentEvent = 0;
|
||||
currentEvent = nullptr;
|
||||
abortRequested = false;
|
||||
}
|
||||
|
||||
void G4EventManager::StackTracks(G4TrackVector *trackVector,G4bool IDhasAlreadySet)
|
||||
{
|
||||
G4Track * newTrack;
|
||||
|
||||
if( trackVector )
|
||||
{
|
||||
|
||||
size_t n_passedTrack = trackVector->size();
|
||||
if( n_passedTrack == 0 ) return;
|
||||
for( size_t i = 0; i < n_passedTrack; i++ )
|
||||
//size_t n_passedTrack = trackVector->size();
|
||||
//if( n_passedTrack == 0 ) return;
|
||||
//for( size_t i = 0; i < n_passedTrack; i++ )
|
||||
//{
|
||||
// newTrack = (*trackVector)[ i ];
|
||||
if( trackVector->size() == 0 ) return;
|
||||
for( auto newTrack : *trackVector )
|
||||
{
|
||||
newTrack = (*trackVector)[ i ];
|
||||
trackIDCounter++;
|
||||
if(!IDhasAlreadySet)
|
||||
{
|
||||
|
||||
@@ -83,10 +83,10 @@ namespace {
|
||||
G4GeneralParticleSourceMessenger* theInstance = 0;
|
||||
}
|
||||
|
||||
G4GeneralParticleSourceMessenger* G4GeneralParticleSourceMessenger::GetInstance(G4GeneralParticleSource* ps)
|
||||
G4GeneralParticleSourceMessenger* G4GeneralParticleSourceMessenger::GetInstance(G4GeneralParticleSource* psc)
|
||||
{
|
||||
G4AutoLock l(&creationM);
|
||||
if ( theInstance == 0 ) theInstance = new G4GeneralParticleSourceMessenger(ps);
|
||||
if ( theInstance == 0 ) theInstance = new G4GeneralParticleSourceMessenger(psc);
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
@@ -1775,7 +1775,7 @@ void G4GeneralParticleSourceMessenger::IonCommand(G4String newValues)
|
||||
if (ion==0)
|
||||
{
|
||||
G4cout << "Ion with Z=" << fAtomicNumber;
|
||||
G4cout << " A=" << fAtomicMass << "is not be defined" << G4endl;
|
||||
G4cout << " A=" << fAtomicMass << " is not defined" << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1816,7 +1816,7 @@ void G4GeneralParticleSourceMessenger::IonLvlCommand(G4String newValues)
|
||||
ion = G4IonTable::GetIonTable()->GetIon(fAtomicNumberL, fAtomicMassL, fIonEnergyLevel);
|
||||
if (ion == 0) {
|
||||
G4cout << "Ion with Z=" << fAtomicNumberL;
|
||||
G4cout << " A=" << fAtomicMass << "is not be defined" << G4endl;
|
||||
G4cout << " A=" << fAtomicMassL << " is not defined" << G4endl;
|
||||
} else {
|
||||
fParticleGun->SetParticleDefinition(ion);
|
||||
fParticleGun->SetParticleCharge(fIonChargeL*eplus);
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4MultiEventAction.cc 90212 2016-01-27 18:33:12Z adotti $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4MultiEventAction.cc
|
||||
//
|
||||
// Created on: Jan 17, 2016
|
||||
// Author: adotti
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
|
||||
#include "G4MultiEventAction.hh"
|
||||
#include <algorithm>
|
||||
|
||||
void G4MultiEventAction::SetEventManager(G4EventManager* mgr)
|
||||
{
|
||||
std::for_each( begin() , end() ,
|
||||
[mgr](G4UserEventActionUPtr& e) { e->SetEventManager(mgr); }
|
||||
);
|
||||
}
|
||||
|
||||
void G4MultiEventAction::BeginOfEventAction(const G4Event* evt)
|
||||
{
|
||||
std::for_each( begin() , end() ,
|
||||
[evt](G4UserEventActionUPtr& e) { e->BeginOfEventAction(evt); }
|
||||
);
|
||||
}
|
||||
|
||||
void G4MultiEventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
std::for_each( begin() , end() ,
|
||||
[evt](G4UserEventActionUPtr& e) { e->EndOfEventAction(evt); }
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleGun.cc 66892 2013-01-17 10:57:59Z gunter $
|
||||
// $Id: G4ParticleGun.cc 94950 2016-01-07 11:53:14Z gcosmo $
|
||||
//
|
||||
|
||||
// G4ParticleGun
|
||||
@@ -57,7 +57,7 @@ G4ParticleGun::G4ParticleGun
|
||||
void G4ParticleGun::SetInitialValues()
|
||||
{
|
||||
NumberOfParticlesToBeGenerated = 1;
|
||||
particle_definition = 0;
|
||||
particle_definition = nullptr;
|
||||
G4ThreeVector zero;
|
||||
particle_momentum_direction = (G4ParticleMomentum)zero;
|
||||
particle_energy = 0.0;
|
||||
@@ -74,29 +74,29 @@ G4ParticleGun::~G4ParticleGun()
|
||||
delete theMessenger;
|
||||
}
|
||||
|
||||
G4ParticleGun::G4ParticleGun(const G4ParticleGun& /*right*/)
|
||||
:G4VPrimaryGenerator()
|
||||
{ G4Exception(
|
||||
"G4ParticleGun::G4ParticleGun","Event0191",FatalException,
|
||||
"G4ParticleGun : Copy constructor should not be used."); }
|
||||
|
||||
const G4ParticleGun& G4ParticleGun::operator=(const G4ParticleGun& right)
|
||||
{ G4Exception(
|
||||
"G4ParticleGun::operator=","Event0192",FatalException,
|
||||
"G4ParticleGun : Equal operator should not be used.");
|
||||
return right; }
|
||||
|
||||
G4int G4ParticleGun::operator==(const G4ParticleGun& /*right*/) const
|
||||
{ G4Exception(
|
||||
"G4ParticleGun::operator==","Event0193",FatalException,
|
||||
"G4ParticleGun : == operator should not be used.");
|
||||
return true; }
|
||||
|
||||
G4int G4ParticleGun::operator!=(const G4ParticleGun& /*right*/) const
|
||||
{ G4Exception(
|
||||
"G4ParticleGun::operator!=","Event0193",FatalException,
|
||||
"G4ParticleGun : != operator should not be used.");
|
||||
return false; }
|
||||
//G4ParticleGun::G4ParticleGun(const G4ParticleGun& /*right*/)
|
||||
//:G4VPrimaryGenerator()
|
||||
//{ G4Exception(
|
||||
// "G4ParticleGun::G4ParticleGun","Event0191",FatalException,
|
||||
// "G4ParticleGun : Copy constructor should not be used."); }
|
||||
//
|
||||
//const G4ParticleGun& G4ParticleGun::operator=(const G4ParticleGun& right)
|
||||
//{ G4Exception(
|
||||
// "G4ParticleGun::operator=","Event0192",FatalException,
|
||||
// "G4ParticleGun : Equal operator should not be used.");
|
||||
// return right; }
|
||||
//
|
||||
//G4int G4ParticleGun::operator==(const G4ParticleGun& /*right*/) const
|
||||
//{ G4Exception(
|
||||
// "G4ParticleGun::operator==","Event0193",FatalException,
|
||||
// "G4ParticleGun : == operator should not be used.");
|
||||
// return true; }
|
||||
//
|
||||
//G4int G4ParticleGun::operator!=(const G4ParticleGun& /*right*/) const
|
||||
//{ G4Exception(
|
||||
// "G4ParticleGun::operator!=","Event0193",FatalException,
|
||||
// "G4ParticleGun : != operator should not be used.");
|
||||
// return false; }
|
||||
|
||||
void G4ParticleGun::SetParticleDefinition
|
||||
(G4ParticleDefinition * aParticleDefinition)
|
||||
@@ -161,7 +161,7 @@ void G4ParticleGun::SetParticleMomentum(G4double aMomentum)
|
||||
G4cout << " is now defined in terms Momentum: "
|
||||
<< aMomentum/GeV << "GeV/c" << G4endl;
|
||||
}
|
||||
if(particle_definition==0)
|
||||
if(!particle_definition)
|
||||
{
|
||||
G4cout <<"Particle Definition not defined yet for G4ParticleGun"<< G4endl;
|
||||
G4cout <<"Zero Mass is assumed"<<G4endl;
|
||||
@@ -191,7 +191,7 @@ void G4ParticleGun::SetParticleMomentum(G4ParticleMomentum aMomentum)
|
||||
G4cout << " is now defined in terms Momentum: "
|
||||
<< aMomentum.mag()/GeV << "GeV/c" << G4endl;
|
||||
}
|
||||
if(particle_definition==0)
|
||||
if(!particle_definition)
|
||||
{
|
||||
G4cout <<"Particle Definition not defined yet for G4ParticleGun"<< G4endl;
|
||||
G4cout <<"Zero Mass is assumed"<<G4endl;
|
||||
@@ -211,7 +211,15 @@ void G4ParticleGun::SetParticleMomentum(G4ParticleMomentum aMomentum)
|
||||
|
||||
void G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)
|
||||
{
|
||||
if(particle_definition==0) return;
|
||||
if(!particle_definition)
|
||||
{
|
||||
G4ExceptionDescription ED;
|
||||
ED << "Particle definition is not defined." << G4endl;
|
||||
ED << "G4ParticleGun::SetParticleDefinition() has to be invoked beforehand." << G4endl;
|
||||
G4Exception("G4ParticleGun::GeneratePrimaryVertex()","Event0109",
|
||||
FatalException, ED);
|
||||
return;
|
||||
}
|
||||
|
||||
// create a new vertex
|
||||
G4PrimaryVertex* vertex =
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PrimaryTransformer.cc 72252 2013-07-12 09:04:11Z gcosmo $
|
||||
// $Id: G4PrimaryTransformer.cc 94950 2016-01-07 11:53:14Z gcosmo $
|
||||
//
|
||||
|
||||
#include "G4PrimaryTransformer.hh"
|
||||
@@ -42,8 +42,8 @@
|
||||
|
||||
G4PrimaryTransformer::G4PrimaryTransformer()
|
||||
:verboseLevel(0),trackID(0),
|
||||
unknown(0),unknownParticleDefined(false),
|
||||
opticalphoton(0),opticalphotonDefined(false),
|
||||
unknown(nullptr),unknownParticleDefined(false),
|
||||
opticalphoton(nullptr),opticalphotonDefined(false),
|
||||
nWarn(0)
|
||||
{
|
||||
particleTable = G4ParticleTable::GetParticleTable();
|
||||
@@ -72,11 +72,12 @@ G4TrackVector* G4PrimaryTransformer::GimmePrimaries(G4Event* anEvent,G4int track
|
||||
trackID = trackIDCounter;
|
||||
|
||||
//TV.clearAndDestroy();
|
||||
for( size_t ii=0; ii<TV.size();ii++)
|
||||
{ delete TV[ii]; }
|
||||
for(auto tr : TV) delete tr;
|
||||
TV.clear();
|
||||
|
||||
//Loop over vertices
|
||||
G4PrimaryVertex* nextVertex = anEvent->GetPrimaryVertex();
|
||||
while(nextVertex)
|
||||
while(nextVertex) // Loop checking 12.28.2015 M.Asai
|
||||
{
|
||||
GenerateTracks(nextVertex);
|
||||
nextVertex = nextVertex->GetNext();
|
||||
@@ -105,7 +106,7 @@ void G4PrimaryTransformer::GenerateTracks(G4PrimaryVertex* primaryVertex)
|
||||
#endif
|
||||
|
||||
G4PrimaryParticle* primaryParticle = primaryVertex->GetPrimary();
|
||||
while( primaryParticle != 0 )
|
||||
while( primaryParticle != 0 ) // Loop checking 12.28.2015 M.Asai
|
||||
{
|
||||
GenerateSingleTrack( primaryParticle, X0, Y0, Z0, T0, WV );
|
||||
primaryParticle = primaryParticle->GetNext();
|
||||
@@ -128,7 +129,7 @@ void G4PrimaryTransformer::GenerateSingleTrack
|
||||
}
|
||||
#endif
|
||||
G4PrimaryParticle* daughter = primaryParticle->GetDaughter();
|
||||
while(daughter)
|
||||
while(daughter) // Loop checking 12.28.2015 M.Asai
|
||||
{
|
||||
GenerateSingleTrack(daughter,x0,y0,z0,t0,wv);
|
||||
daughter = daughter->GetNext();
|
||||
|
||||
Reference in New Issue
Block a user