Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AllITManager.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4AllITManager.cc 71827 2013-06-25 15:58:24Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
auto_ptr<G4AllITManager> G4AllITManager::fInstance(0);
|
||||
G4ThreadLocal G4AllITManager* G4AllITManager::fpInstance = 0;
|
||||
|
||||
G4AllITManager::G4AllITManager()
|
||||
{
|
||||
@@ -45,14 +45,14 @@ G4AllITManager::G4AllITManager()
|
||||
}
|
||||
|
||||
G4AllITManager* G4AllITManager::Instance()
|
||||
{
|
||||
if(fInstance.get() == 0) fInstance = auto_ptr<G4AllITManager>(new G4AllITManager());
|
||||
return fInstance.get() ;
|
||||
{
|
||||
if (!fpInstance) fpInstance = new G4AllITManager();
|
||||
return fpInstance ;
|
||||
}
|
||||
|
||||
void G4AllITManager::DeleteInstance()
|
||||
{
|
||||
fInstance.reset();
|
||||
if(fpInstance) delete fpInstance;
|
||||
}
|
||||
|
||||
G4AllITManager::~G4AllITManager()
|
||||
@@ -67,7 +67,7 @@ G4AllITManager::~G4AllITManager()
|
||||
it++;
|
||||
fITSubManager.erase(it_tmp);
|
||||
}
|
||||
fInstance.release();
|
||||
fpInstance = 0;
|
||||
}
|
||||
|
||||
void G4AllITManager::UpdatePositionMap()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4IT.cc 65022 2012-11-12 16:43:12Z gcosmo $
|
||||
// $Id: G4IT.cc 71125 2013-06-11 15:39:09Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
G4Allocator<G4IT> aITAllocator;
|
||||
G4ThreadLocal G4Allocator<G4IT> *aITAllocator = 0;
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
///
|
||||
// Static functions
|
||||
@@ -52,7 +52,7 @@ G4IT* GetIT(const G4Track* track)
|
||||
|
||||
G4IT* GetIT(const G4Track& track)
|
||||
{
|
||||
return (dynamic_cast<G4IT*>(track.GetUserInformation()));
|
||||
return (dynamic_cast<G4IT*>(track.GetUserInformation()));
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
///
|
||||
@@ -64,6 +64,7 @@ G4IT::G4IT() : G4VUserTrackInformation("G4IT"),
|
||||
fTrackingInformation()
|
||||
// fpTrackingInformation(new G4TrackingInformation())
|
||||
{
|
||||
if (!aITAllocator) aITAllocator = new G4Allocator<G4IT>;
|
||||
fpITBox=0;
|
||||
fpKDNode = 0 ;
|
||||
fpTrackNode = 0;
|
||||
@@ -113,6 +114,7 @@ G4IT::G4IT(G4Track * aTrack) : G4VUserTrackInformation("G4IT"),
|
||||
fTrackingInformation()
|
||||
// fpTrackingInformation(new G4TrackingInformation())
|
||||
{
|
||||
if (!aITAllocator) aITAllocator = new G4Allocator<G4IT>;
|
||||
fpITBox = 0;
|
||||
fpTrack = aTrack;
|
||||
fpKDNode = 0 ;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITModelProcessor.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4ITModelProcessor.cc 71125 2013-06-11 15:39:09Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -37,11 +37,12 @@
|
||||
#include "G4VITTimeStepper.hh"
|
||||
#include "G4VITReactionProcess.hh"
|
||||
|
||||
std::map<const G4Track*, G4bool> G4ITModelProcessor::fHasReacted ;
|
||||
G4ThreadLocal std::map<const G4Track*, G4bool> *G4ITModelProcessor::fHasReacted = 0;
|
||||
|
||||
G4ITModelProcessor::G4ITModelProcessor()
|
||||
{
|
||||
//ctor
|
||||
if (!fHasReacted) fHasReacted = new std::map<const G4Track*, G4bool>;
|
||||
fpTrack = 0;
|
||||
fpModelHandler = 0;
|
||||
fpModel = 0;
|
||||
@@ -210,8 +211,8 @@ void G4ITModelProcessor::FindReaction(std::map<G4Track*, G4TrackVectorHandle>* t
|
||||
|
||||
if(trackA == 0) continue;
|
||||
|
||||
std::map<const G4Track*, G4bool>::iterator it_hasReacted = fHasReacted.find(trackA);
|
||||
if(it_hasReacted != fHasReacted.end()) continue;
|
||||
std::map<const G4Track*, G4bool>::iterator it_hasReacted = fHasReacted->find(trackA);
|
||||
if(it_hasReacted != fHasReacted->end()) continue;
|
||||
if(trackA->GetTrackStatus() == fStopAndKill) continue;
|
||||
|
||||
G4IT* ITA = GetIT(trackA);
|
||||
@@ -232,8 +233,8 @@ void G4ITModelProcessor::FindReaction(std::map<G4Track*, G4TrackVectorHandle>* t
|
||||
trackB = *trackB_i;
|
||||
|
||||
if(trackB == 0) continue;
|
||||
it_hasReacted = fHasReacted.find(trackB);
|
||||
if(it_hasReacted != fHasReacted.end()) continue;
|
||||
it_hasReacted = fHasReacted->find(trackB);
|
||||
if(it_hasReacted != fHasReacted->end()) continue;
|
||||
if(trackB->GetTrackStatus() == fStopAndKill) continue;
|
||||
|
||||
// DEBUG
|
||||
@@ -272,8 +273,8 @@ void G4ITModelProcessor::FindReaction(std::map<G4Track*, G4TrackVectorHandle>* t
|
||||
|
||||
if(changes)
|
||||
{
|
||||
fHasReacted[trackA] = true;
|
||||
fHasReacted[trackB] = true;
|
||||
(*fHasReacted)[trackA] = true;
|
||||
(*fHasReacted)[trackB] = true;
|
||||
changes -> GetTrackA();
|
||||
changes -> GetTrackB();
|
||||
|
||||
@@ -287,5 +288,5 @@ void G4ITModelProcessor::FindReaction(std::map<G4Track*, G4TrackVectorHandle>* t
|
||||
}
|
||||
}
|
||||
|
||||
fHasReacted.clear();
|
||||
fHasReacted->clear();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITNavigator.cc 64376 2012-10-31 16:39:40Z gcosmo $
|
||||
// $Id: G4ITNavigator.cc 66872 2013-01-15 01:25:57Z japost $
|
||||
//
|
||||
// class G4ITNavigator Implementation
|
||||
//
|
||||
@@ -732,7 +732,7 @@ G4double G4ITNavigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
|
||||
G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
|
||||
|
||||
static G4int sNavCScalls=0;
|
||||
static G4ThreadLocal G4int sNavCScalls=0;
|
||||
sNavCScalls++;
|
||||
|
||||
fLastTriedStepComputation= true;
|
||||
@@ -1684,7 +1684,7 @@ void G4ITNavigator::ComputeStepLog(const G4ThreeVector& pGlobalpoint,
|
||||
<< fAccuracyForException/mm << " mm.";
|
||||
|
||||
suggestion << " ";
|
||||
static G4int warnNow = 0;
|
||||
static G4ThreadLocal G4int warnNow = 0;
|
||||
if( ((++warnNow % 100) == 1) )
|
||||
{
|
||||
message << G4endl
|
||||
|
||||
@@ -658,7 +658,6 @@ void G4ITNavigator::CheckNavigatorState() const
|
||||
|
||||
G4Exception("G4ITNavigator::CheckNavigatorStateIsValid",
|
||||
"NavigatorStateNotValid",FatalException,exceptionDescription);
|
||||
exit(-1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -684,7 +683,6 @@ void G4ITNavigator::NewNavigatorState()
|
||||
|
||||
G4Exception("G4ITNavigator::NewNavigatorState",
|
||||
"NoWorldVolume",FatalException,exceptionDescription);
|
||||
exit(-1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -704,7 +702,6 @@ G4VPhysicalVolume* G4ITNavigator::NewNavigatorStateAndLocate(const G4ThreeVector
|
||||
|
||||
G4Exception("G4ITNavigator::NewNavigatorStateAndLocate",
|
||||
"NoWorldVolume",FatalException,exceptionDescription);
|
||||
exit(-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITStepProcessor.cc 65022 2012-11-12 16:43:12Z gcosmo $
|
||||
// $Id: G4ITStepProcessor.cc 74551 2013-10-14 12:59:14Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -56,7 +56,7 @@
|
||||
using namespace std;
|
||||
|
||||
static const size_t SizeOfSelectedDoItVector=100;
|
||||
static const size_t& gMaxNProcesses(G4VITProcess::GetMaxProcessIndex());
|
||||
//static const size_t& gMaxNProcesses(G4VITProcess::GetMaxProcessIndex());
|
||||
|
||||
//____________________________________________________________________________________
|
||||
|
||||
@@ -76,8 +76,10 @@ G4ITStepProcessor::G4ITStepProcessor()
|
||||
|
||||
G4ITStepProcessor::G4ITStepProcessorState::G4ITStepProcessorState() :
|
||||
G4ITStepProcessorState_Lock(),
|
||||
fSelectedAtRestDoItVector (gMaxNProcesses,0),
|
||||
fSelectedPostStepDoItVector (gMaxNProcesses,0)
|
||||
// fSelectedAtRestDoItVector (gMaxNProcesses,0),
|
||||
// fSelectedPostStepDoItVector (gMaxNProcesses,0)
|
||||
fSelectedAtRestDoItVector (G4VITProcess::GetMaxProcessIndex(),0),
|
||||
fSelectedPostStepDoItVector (G4VITProcess::GetMaxProcessIndex(),0)
|
||||
{
|
||||
fPhysicalStep = -1.;
|
||||
fPreviousStepSize = -1.;
|
||||
@@ -94,8 +96,10 @@ G4ITStepProcessor::G4ITStepProcessorState::G4ITStepProcessorState() :
|
||||
// should not be used
|
||||
G4ITStepProcessor::G4ITStepProcessorState::G4ITStepProcessorState(const G4ITStepProcessorState& ) :
|
||||
G4ITStepProcessorState_Lock(),
|
||||
fSelectedAtRestDoItVector (gMaxNProcesses,0),
|
||||
fSelectedPostStepDoItVector (gMaxNProcesses,0)
|
||||
// fSelectedAtRestDoItVector (gMaxNProcesses,0),
|
||||
// fSelectedPostStepDoItVector (gMaxNProcesses,0)
|
||||
fSelectedAtRestDoItVector (G4VITProcess::GetMaxProcessIndex(),0),
|
||||
fSelectedPostStepDoItVector (G4VITProcess::GetMaxProcessIndex(),0)
|
||||
{
|
||||
fPhysicalStep = -1.;
|
||||
fPreviousStepSize = -1.;
|
||||
@@ -115,9 +119,11 @@ G4ITStepProcessor::G4ITStepProcessorState& G4ITStepProcessor::G4ITStepProcessor
|
||||
if(this == &rhs) return *this;
|
||||
|
||||
fSelectedAtRestDoItVector.clear();
|
||||
fSelectedAtRestDoItVector.resize(gMaxNProcesses,0);
|
||||
// fSelectedAtRestDoItVector.resize(gMaxNProcesses,0);
|
||||
fSelectedAtRestDoItVector.resize(G4VITProcess::GetMaxProcessIndex(),0);
|
||||
fSelectedPostStepDoItVector.clear();
|
||||
fSelectedPostStepDoItVector.resize(gMaxNProcesses,0);
|
||||
// fSelectedPostStepDoItVector.resize(gMaxNProcesses,0);
|
||||
fSelectedPostStepDoItVector.resize(G4VITProcess::GetMaxProcessIndex(),0);
|
||||
|
||||
fPhysicalStep = -1.;
|
||||
fPreviousStepSize = -1.;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITStepProcessor2.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4ITStepProcessor2.cc 77292 2013-11-22 10:58:39Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#include "G4ITStepProcessor.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4VITProcess.hh"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITTrackHolder.cc 64374 2012-10-31 16:37:23Z gcosmo $
|
||||
// $Id: G4ITTrackHolder.cc 66881 2013-01-16 02:55:54Z adotti $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -37,8 +37,9 @@
|
||||
|
||||
#include "G4ITTrackHolder.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Types.hh"
|
||||
|
||||
G4ITTrackHolder* G4ITTrackHolder::fInstance(0);
|
||||
G4ThreadLocal G4ITTrackHolder* G4ITTrackHolder::fInstance(0);
|
||||
|
||||
G4ITTrackHolder::G4ITTrackHolder()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITTransportation.cc 64374 2012-10-31 16:37:23Z gcosmo $
|
||||
// $Id: G4ITTransportation.cc 71125 2013-06-11 15:39:09Z gcosmo $
|
||||
//
|
||||
/// \brief This class is a slightly modified version of G4Transportation
|
||||
/// initially written by John Apostolakis and colleagues
|
||||
@@ -172,8 +172,9 @@ G4ITTransportation::G4ITTransportationState::G4ITTransportationState() : G4Proce
|
||||
fEndGlobalTimeComputed = false;
|
||||
fCandidateEndGlobalTime = -1;
|
||||
fParticleIsLooping = false;
|
||||
static G4TouchableHandle nullTouchableHandle; // Points to (G4VTouchable*) 0
|
||||
fCurrentTouchableHandle = nullTouchableHandle;
|
||||
static G4ThreadLocal G4TouchableHandle *nullTouchableHandle = 0;
|
||||
if (!nullTouchableHandle) nullTouchableHandle = new G4TouchableHandle; // Points to (G4VTouchable*) 0
|
||||
fCurrentTouchableHandle = *nullTouchableHandle;
|
||||
fGeometryLimitedStep = false;
|
||||
fPreviousSftOrigin = G4ThreeVector(0,0,0);
|
||||
fPreviousSafety = 0.0;
|
||||
@@ -613,10 +614,12 @@ G4VParticleChange* G4ITTransportation::AlongStepDoIt( const G4Track& track,
|
||||
|
||||
// G4cout << "G4ITTransportation::AlongStepDoIt" << G4endl;
|
||||
// set pdefOpticalPhoton
|
||||
static G4ParticleDefinition* pdefOpticalPhoton =
|
||||
G4ParticleTable::GetParticleTable()->FindParticle("opticalphoton");
|
||||
//Andrea Dotti: the following statement should be in a single line:
|
||||
// G4-MT transformation tools get confused if statement spans two lines
|
||||
// If needed contact: adotti@slac.stanford.edu
|
||||
static G4ThreadLocal G4ParticleDefinition* pdefOpticalPhoton = 0 ; if (!pdefOpticalPhoton) pdefOpticalPhoton= G4ParticleTable::GetParticleTable()->FindParticle("opticalphoton");
|
||||
|
||||
static G4int noCalls=0;
|
||||
static G4ThreadLocal G4int noCalls=0;
|
||||
noCalls++;
|
||||
|
||||
fParticleChange.Initialize(track) ;
|
||||
@@ -964,7 +967,7 @@ G4ITTransportation::StartTracking(G4Track* track)
|
||||
}
|
||||
|
||||
// Make sure to clear the chord finders of all fields (ie managers)
|
||||
static G4FieldManagerStore* fieldMgrStore= G4FieldManagerStore::GetInstance();
|
||||
static G4ThreadLocal G4FieldManagerStore* fieldMgrStore = 0 ; if (!fieldMgrStore) fieldMgrStore= G4FieldManagerStore::GetInstance();
|
||||
fieldMgrStore->ClearAllChordFindersState();
|
||||
|
||||
// Update the current touchable handle (from the track's)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITTransportationManager.cc 64374 2012-10-31 16:37:23Z gcosmo $
|
||||
// $Id: G4ITTransportationManager.cc 66872 2013-01-15 01:25:57Z japost $
|
||||
//
|
||||
/// \brief {Duplicated version of G4TransportationManager.
|
||||
/// This class just contains the pointer to the navigator object of the
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4ITNavigator.hh"
|
||||
|
||||
G4ITTransportationManager* G4ITTransportationManager::fpInstance (0);
|
||||
G4ThreadLocal G4ITTransportationManager* G4ITTransportationManager::fpInstance (0);
|
||||
|
||||
G4ITTransportationManager::G4ITTransportationManager()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITType.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4ITType.cc 74551 2013-10-14 12:59:14Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -34,8 +34,13 @@
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4ITType.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
G4ITTypeManager* G4ITTypeManager::fgInstance = 0;
|
||||
/*G4ThreadLocal*/ G4ITTypeManager* G4ITTypeManager::fgInstance = 0;
|
||||
G4ThreadLocal G4ITTypeManager* G4ITTypeManager::fgInstance_local = 0;
|
||||
|
||||
G4Mutex deleteMutex=G4MUTEX_INITIALIZER;
|
||||
G4Mutex ressourceMutex=G4MUTEX_INITIALIZER;
|
||||
|
||||
// static method
|
||||
size_t G4ITType::size()
|
||||
@@ -61,7 +66,26 @@ G4ITTypeManager* G4ITTypeManager::Instance()
|
||||
|
||||
void G4ITTypeManager::DeleteInstance()
|
||||
{
|
||||
delete fgInstance ;
|
||||
G4AutoLock lock(&deleteMutex);
|
||||
if(fgInstance)
|
||||
{
|
||||
delete fgInstance ;
|
||||
fgInstance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void G4ITTypeManager::ReserveRessource()
|
||||
{
|
||||
G4AutoLock lock(&ressourceMutex);
|
||||
fRessource++;
|
||||
}
|
||||
|
||||
void G4ITTypeManager::ReleaseRessource()
|
||||
{
|
||||
G4AutoLock lock(&ressourceMutex);
|
||||
fRessource--;
|
||||
|
||||
if(fRessource <= 0) DeleteInstance();
|
||||
}
|
||||
|
||||
G4ITTypeManager::G4ITTypeManager()
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "G4KDMap.hh"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//typedef std::_Deque_iterator<G4KDNode*,G4KDNode*&,G4KDNode**> _deq_iterator ;
|
||||
typedef std::deque<G4KDNode*>::iterator _deq_iterator ;
|
||||
|
||||
__1DSortOut::__1DSortOut(int dimension) : fSortOutNDim(dimension)
|
||||
{}
|
||||
|
||||
int __1DSortOut::GetDimension()
|
||||
{
|
||||
return fSortOutNDim.fDimension;
|
||||
}
|
||||
|
||||
G4KDNode* __1DSortOut::GetMidle(int& main_middle)
|
||||
{
|
||||
int contSize = fContainer.size();
|
||||
main_middle = (int) ceil(contSize/2.); // ceil = round up
|
||||
return fContainer[main_middle];
|
||||
}
|
||||
|
||||
_deq_iterator __1DSortOut::Insert(G4KDNode* pos)
|
||||
{
|
||||
return fContainer.insert(fContainer.end(),pos);
|
||||
}
|
||||
|
||||
G4KDNode* __1DSortOut::PopOutMiddle()
|
||||
{
|
||||
int middle;
|
||||
G4KDNode* pos = GetMidle(middle);
|
||||
_deq_iterator deq_pos = fContainer.begin()+middle;
|
||||
fContainer.erase(deq_pos);
|
||||
return pos;
|
||||
}
|
||||
|
||||
void __1DSortOut::Sort()
|
||||
{
|
||||
sort(fContainer.begin(),fContainer.end(),fSortOutNDim);
|
||||
}
|
||||
|
||||
void __1DSortOut::Erase(_deq_iterator& deq_pos)
|
||||
{
|
||||
fContainer.erase(deq_pos);
|
||||
}
|
||||
|
||||
void G4KDMap::Insert(G4KDNode* pos)
|
||||
{
|
||||
vector<_deq_iterator>& vit = fMap[pos];
|
||||
|
||||
size_t maxSize = fSortOut.size();
|
||||
|
||||
cout << maxSize << endl;
|
||||
cout << fSortOut.capacity() << endl;
|
||||
|
||||
vit.reserve(maxSize);
|
||||
|
||||
for (size_t i = 0; i < fSortOut.size(); ++i)
|
||||
{
|
||||
vit[i]=fSortOut[i]->Insert(pos);
|
||||
}
|
||||
|
||||
fIsSorted = false;
|
||||
}
|
||||
|
||||
G4KDNode* G4KDMap::PopOutMiddle(int dimension)
|
||||
{
|
||||
if(fIsSorted == false) Sort();
|
||||
G4KDNode* output_node = fSortOut[dimension]->PopOutMiddle();
|
||||
|
||||
std::map<G4KDNode*, std::vector<_deq_iterator> >::iterator fMap_it
|
||||
= fMap.find(output_node);
|
||||
|
||||
std::vector<_deq_iterator>& vit = fMap_it->second;
|
||||
|
||||
for(int i = 0 ; i < (int) fSortOut.size() ; i++)
|
||||
{
|
||||
if(i != dimension) fSortOut[i]->Erase(vit[i]);
|
||||
}
|
||||
|
||||
fMap.erase(fMap_it);
|
||||
|
||||
return output_node;
|
||||
}
|
||||
|
||||
void G4KDMap::Sort()
|
||||
{
|
||||
for (size_t i = 0; i < fSortOut.size(); ++i)
|
||||
{
|
||||
fSortOut[i]->Sort();
|
||||
}
|
||||
|
||||
fIsSorted = true;
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4KDTree.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4KDTree.cc 70171 2013-05-24 13:34:18Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -71,6 +71,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
#include "G4KDTree.hh"
|
||||
#include "G4KDMap.hh"
|
||||
#include "G4KDNode.hh"
|
||||
#include "G4KDTreeResult.hh"
|
||||
#include <list>
|
||||
@@ -90,7 +91,7 @@ public:
|
||||
size_t size = fDim * sizeof(double);
|
||||
memcpy(fMin, min, size);
|
||||
memcpy(fMax, max, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
~HyperRect()
|
||||
@@ -166,7 +167,7 @@ private:
|
||||
|
||||
//______________________________________________________________________
|
||||
// KDTree methods
|
||||
G4KDTree::G4KDTree (int k)
|
||||
G4KDTree::G4KDTree (int k) : fKDMap(new G4KDMap(k))
|
||||
{
|
||||
fDim = k;
|
||||
fRoot = 0;
|
||||
@@ -185,6 +186,8 @@ G4KDTree::~G4KDTree ()
|
||||
delete fRect;
|
||||
fRect = 0;
|
||||
}
|
||||
|
||||
if(fKDMap) delete fKDMap;
|
||||
}
|
||||
|
||||
void G4KDTree::Clear()
|
||||
@@ -218,6 +221,45 @@ void G4KDTree::__Clear_Rec(G4KDNode *node)
|
||||
delete node;
|
||||
}
|
||||
|
||||
G4KDNode* G4KDTree::InsertMap(const double& x, const double& y, const double& z, void *data)
|
||||
{
|
||||
double buf[3];
|
||||
buf[0] = x;
|
||||
buf[1] = y;
|
||||
buf[2] = z;
|
||||
return InsertMap(buf, data);
|
||||
}
|
||||
|
||||
G4KDNode* G4KDTree::InsertMap(const double *pos, void *data)
|
||||
{
|
||||
G4KDNode* node = new G4KDNode(this,pos,data,0,-2) ;
|
||||
// -2 = valeur intentionnellement absurde
|
||||
fKDMap->Insert(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
void G4KDTree::Build()
|
||||
{
|
||||
int Nnodes = fKDMap->GetSize();
|
||||
|
||||
G4KDNode* root = fKDMap->PopOutMiddle(0);
|
||||
|
||||
fRoot = root;
|
||||
fRect = new HyperRect(fDim,fRoot->GetPosition(),fRoot->GetPosition());
|
||||
|
||||
Nnodes--;
|
||||
|
||||
for(int n = 0 ; n < Nnodes ; n = n+fDim)
|
||||
{
|
||||
for(int dim = 0 ; dim < fDim ; dim ++)
|
||||
{
|
||||
G4KDNode* node = fKDMap->PopOutMiddle(dim);
|
||||
fRoot->Insert(node);
|
||||
fRect->Extend(node->GetPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
G4KDNode* G4KDTree::Insert(const double *pos, void *data)
|
||||
{
|
||||
G4KDNode* node = 0 ;
|
||||
@@ -259,7 +301,7 @@ G4KDNode* G4KDTree::Insert(const double& x, const double& y, const double& z, vo
|
||||
|
||||
//__________________________________________________________________
|
||||
int G4KDTree::__NearestInRange(G4KDNode *node, const double *pos, const double& range_sq,
|
||||
const double& range, G4KDTreeResult& list, int ordered, G4KDNode *source_node)
|
||||
const double& range, G4KDTreeResult& list, int ordered, G4KDNode *source_node)
|
||||
{
|
||||
if(!node) return 0;
|
||||
|
||||
@@ -306,7 +348,7 @@ int G4KDTree::__NearestInRange(G4KDNode *node, const double *pos, const double&
|
||||
|
||||
//__________________________________________________________________
|
||||
void G4KDTree::__NearestToPosition(G4KDNode *node, const double *pos, G4KDNode *&result,
|
||||
double *result_dist_sq, HyperRect* rect)
|
||||
double *result_dist_sq, HyperRect* rect)
|
||||
{
|
||||
int dir = node->GetAxis();
|
||||
int i;
|
||||
@@ -385,7 +427,7 @@ void G4KDTree::__NearestToPosition(G4KDNode *node, const double *pos, G4KDNode *
|
||||
|
||||
G4KDTreeResultHandle G4KDTree::Nearest(const double *pos)
|
||||
{
|
||||
// G4cout << "Nearest(pos)" << G4endl ;
|
||||
// G4cout << "Nearest(pos)" << G4endl ;
|
||||
|
||||
if (!fRect) return 0;
|
||||
|
||||
@@ -418,8 +460,8 @@ G4KDTreeResultHandle G4KDTree::Nearest(const double *pos)
|
||||
|
||||
//__________________________________________________________________
|
||||
void G4KDTree::__NearestToNode(G4KDNode *source_node, G4KDNode *node,
|
||||
const double *pos, std::vector<G4KDNode*>& result, double *result_dist_sq,
|
||||
HyperRect* rect, int& nbresult)
|
||||
const double *pos, std::vector<G4KDNode*>& result, double *result_dist_sq,
|
||||
HyperRect* rect, int& nbresult)
|
||||
{
|
||||
int dir = node->GetAxis();
|
||||
double dummy, dist_sq;
|
||||
@@ -507,7 +549,7 @@ void G4KDTree::__NearestToNode(G4KDNode *source_node, G4KDNode *node,
|
||||
|
||||
G4KDTreeResultHandle G4KDTree::Nearest(G4KDNode* node)
|
||||
{
|
||||
// G4cout << "Nearest(node)" << G4endl ;
|
||||
// G4cout << "Nearest(node)" << G4endl ;
|
||||
if (!fRect)
|
||||
{
|
||||
G4cout << "Tree empty" << G4endl ;
|
||||
@@ -576,9 +618,9 @@ G4KDTreeResultHandle G4KDTree::NearestInRange(const double *pos, const double& r
|
||||
}
|
||||
|
||||
G4KDTreeResultHandle G4KDTree::NearestInRange(const double& x,
|
||||
const double& y,
|
||||
const double& z,
|
||||
const double& range)
|
||||
const double& y,
|
||||
const double& z,
|
||||
const double& range)
|
||||
{
|
||||
double buf[3];
|
||||
buf[0] = x;
|
||||
|
||||
+6
-6
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4UserReactionAction.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4UserTimeStepAction.cc 74551 2013-10-14 12:59:14Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara@cenbg.in2p3.fr)
|
||||
//
|
||||
@@ -33,17 +33,17 @@
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4UserReactionAction.hh"
|
||||
#include "G4UserTimeStepAction.hh"
|
||||
|
||||
G4UserReactionAction::G4UserReactionAction()
|
||||
G4UserTimeStepAction::G4UserTimeStepAction()
|
||||
{;}
|
||||
|
||||
G4UserReactionAction::~G4UserReactionAction()
|
||||
G4UserTimeStepAction::~G4UserTimeStepAction()
|
||||
{;}
|
||||
|
||||
G4UserReactionAction::G4UserReactionAction(const G4UserReactionAction& /*other*/){;}
|
||||
G4UserTimeStepAction::G4UserTimeStepAction(const G4UserTimeStepAction& /*other*/){;}
|
||||
|
||||
G4UserReactionAction& G4UserReactionAction::operator=(const G4UserReactionAction& rhs)
|
||||
G4UserTimeStepAction& G4UserTimeStepAction::operator=(const G4UserTimeStepAction& rhs)
|
||||
{
|
||||
if (this == &rhs) return *this;
|
||||
return *this;
|
||||
@@ -23,20 +23,22 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VITProcess.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4VITProcess.cc 74551 2013-10-14 12:59:14Z gcosmo $
|
||||
//
|
||||
#include "G4VITProcess.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4IT.hh"
|
||||
|
||||
size_t G4VITProcess::fNbProcess = 0;
|
||||
/*G4ThreadLocal*/ size_t *G4VITProcess::fNbProcess = 0;
|
||||
|
||||
G4VITProcess::G4VITProcess(const G4String& name, G4ProcessType type) :
|
||||
G4VProcess( name, type ),
|
||||
fpState (0),
|
||||
fProcessID(fNbProcess)
|
||||
fpState (0)//,
|
||||
//fProcessID(fNbProcess)
|
||||
{
|
||||
fNbProcess++;
|
||||
if (!fNbProcess) fNbProcess = new size_t (0);
|
||||
fProcessID = *fNbProcess;
|
||||
(*fNbProcess)++;
|
||||
SetInstantiateProcessState(true);
|
||||
currentInteractionLength = 0;
|
||||
theInteractionTimeLeft = 0;
|
||||
@@ -93,26 +95,3 @@ void G4VITProcess::StartTracking(G4Track* track)
|
||||
fpState = 0;
|
||||
}
|
||||
|
||||
void G4VITProcess::SubtractNumberOfInteractionLengthLeft(
|
||||
G4double previousStepSize )
|
||||
{
|
||||
if (fpState->currentInteractionLength>0.0) {
|
||||
fpState->theNumberOfInteractionLengthLeft -= previousStepSize/(fpState->currentInteractionLength);
|
||||
if(fpState->theNumberOfInteractionLengthLeft<0.) {
|
||||
fpState->theNumberOfInteractionLengthLeft=perMillion;
|
||||
}
|
||||
|
||||
} else {
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0) {
|
||||
G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()";
|
||||
G4cerr << " [" << theProcessName << "]" <<G4endl;
|
||||
G4cerr << " currentInteractionLength = " << *currentInteractionLength/cm << " [cm]";
|
||||
G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]";
|
||||
G4cerr << G4endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft()",
|
||||
"Negative currentInteractionLength",EventMustBeAborted,theProcessName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VITTimeStepper.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4VITTimeStepper.cc 66872 2013-01-15 01:25:57Z japost $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -35,8 +35,8 @@
|
||||
|
||||
#include "G4VITTimeStepper.hh"
|
||||
|
||||
G4double G4VITTimeStepper::fCurrentGlobalTime = -1;
|
||||
G4double G4VITTimeStepper::fUserMinTimeStep = -1;
|
||||
G4ThreadLocal G4double G4VITTimeStepper::fCurrentGlobalTime = -1;
|
||||
G4ThreadLocal G4double G4VITTimeStepper::fUserMinTimeStep = -1;
|
||||
|
||||
G4VITTimeStepper::G4VITTimeStepper()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* G4VTrackState.cc
|
||||
*
|
||||
* Created on: 8 avr. 2013
|
||||
* Author: kara
|
||||
*/
|
||||
|
||||
#include "G4VTrackState.hh"
|
||||
|
||||
int G4VTrackStateID::fgLastID = 0;
|
||||
|
||||
template <class T> CLHEP::shared_ptr<G4TrackStateID<T> > G4TrackStateID<T>::fgTrackStateID (0);
|
||||
Reference in New Issue
Block a user