Import Geant4 10.2.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4IT.cc 87061 2014-11-24 11:43:34Z gcosmo $
|
||||
// $Id: G4IT.cc 94218 2015-11-09 08:24:48Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -38,14 +38,14 @@
|
||||
#include "G4ITBox.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4TrackList.hh"
|
||||
#include "G4TrackingInformation.hh"
|
||||
|
||||
using namespace std;
|
||||
|
||||
G4ThreadLocal G4Allocator<G4IT> *aITAllocator = 0;
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
///
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Static functions
|
||||
///
|
||||
//
|
||||
G4IT* GetIT(const G4Track* track)
|
||||
{
|
||||
return (dynamic_cast<G4IT*>(track->GetUserInformation()));
|
||||
@@ -55,19 +55,18 @@ G4IT* GetIT(const G4Track& track)
|
||||
{
|
||||
return (dynamic_cast<G4IT*>(track.GetUserInformation()));
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
///
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Constructors / Destructors
|
||||
///
|
||||
//
|
||||
G4IT::G4IT() :
|
||||
G4VUserTrackInformation("G4IT"),
|
||||
fpTrack(0),
|
||||
fpPreviousIT(0),
|
||||
fpNextIT(0),
|
||||
fTrackingInformation()
|
||||
// fpTrackingInformation(new G4TrackingInformation())
|
||||
fpTrackingInformation(new G4TrackingInformation())
|
||||
{
|
||||
if (!aITAllocator) aITAllocator = new G4Allocator<G4IT>;
|
||||
fpITBox = 0;
|
||||
fpKDNode = 0;
|
||||
fpTrackNode = 0;
|
||||
@@ -81,8 +80,7 @@ G4IT::G4IT(const G4IT& /*right*/) :
|
||||
fpTrack(0),
|
||||
fpPreviousIT(0),
|
||||
fpNextIT(0),
|
||||
fTrackingInformation()
|
||||
// fpTrackingInformation(new G4TrackingInformation())
|
||||
fpTrackingInformation(new G4TrackingInformation())
|
||||
{
|
||||
fpITBox = 0;
|
||||
fpKDNode = 0;
|
||||
@@ -96,9 +94,12 @@ G4IT& G4IT::operator=(const G4IT& right)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "The assignment operator of G4IT should not be used, this feature is not supported."
|
||||
<< "The assignment operator of G4IT should not be used, "
|
||||
"this feature is not supported."
|
||||
<< "If really needed, please contact the developers.";
|
||||
G4Exception("G4IT::operator=(const G4IT& right)", "G4IT001", FatalException,
|
||||
G4Exception("G4IT::operator=(const G4IT& right)",
|
||||
"G4IT001",
|
||||
FatalException,
|
||||
exceptionDescription);
|
||||
|
||||
if (this == &right) return *this;
|
||||
@@ -110,7 +111,7 @@ G4IT& G4IT::operator=(const G4IT& right)
|
||||
fpKDNode = 0;
|
||||
fParentID_A = 0;
|
||||
fParentID_B = 0;
|
||||
// fpTrackingInformation = 0;
|
||||
fpTrackingInformation = 0;
|
||||
fpTrackNode = 0;
|
||||
|
||||
return *this;
|
||||
@@ -120,10 +121,8 @@ G4IT::G4IT(G4Track * aTrack) :
|
||||
G4VUserTrackInformation("G4IT"),
|
||||
fpPreviousIT(0),
|
||||
fpNextIT(0),
|
||||
fTrackingInformation()
|
||||
// fpTrackingInformation(new G4TrackingInformation())
|
||||
fpTrackingInformation(new G4TrackingInformation())
|
||||
{
|
||||
if (!aITAllocator) aITAllocator = new G4Allocator<G4IT>;
|
||||
fpITBox = 0;
|
||||
fpTrack = aTrack;
|
||||
fpKDNode = 0;
|
||||
@@ -157,27 +156,21 @@ G4IT::~G4IT()
|
||||
{
|
||||
TakeOutBox();
|
||||
|
||||
// if(fpTrackingInformation)
|
||||
// {
|
||||
// delete fpTrackingInformation;
|
||||
// fpTrackingInformation = 0;
|
||||
// }
|
||||
if(fpTrackingInformation)
|
||||
{
|
||||
delete fpTrackingInformation;
|
||||
fpTrackingInformation = 0;
|
||||
}
|
||||
|
||||
// Note :
|
||||
// G4ITTrackingManager will delete fTrackNode.
|
||||
// fKDNode will be deleted when the KDTree is rebuilt
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
///
|
||||
// Methods
|
||||
///
|
||||
void G4IT::RecordCurrentPositionNTime()
|
||||
{
|
||||
if (fpTrack)
|
||||
{
|
||||
fTrackingInformation.RecordCurrentPositionNTime(fpTrack);
|
||||
}
|
||||
}
|
||||
|
||||
G4bool G4IT::operator<(const G4IT& right) const
|
||||
{
|
||||
@@ -206,13 +199,41 @@ G4bool G4IT::operator!=(const G4IT& right) const
|
||||
return !(this->operator==(right));
|
||||
}
|
||||
|
||||
|
||||
|
||||
double G4IT::operator[](int i) const
|
||||
{
|
||||
return fpTrack->GetPosition()[i];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const G4ThreeVector& G4IT::GetPosition() const
|
||||
{
|
||||
if (fpTrack) return GetTrack()->GetPosition();
|
||||
return *(new G4ThreeVector());
|
||||
}
|
||||
|
||||
const double& G4IT::operator[](int i) const
|
||||
void G4IT::RecordCurrentPositionNTime()
|
||||
{
|
||||
return const_cast<G4ThreeVector&>(GetTrack()->GetPosition())[i];
|
||||
if (fpTrack)
|
||||
{
|
||||
fpTrackingInformation->RecordCurrentPositionNTime(fpTrack);
|
||||
}
|
||||
}
|
||||
|
||||
G4double G4IT::GetPreStepGlobalTime() const
|
||||
{
|
||||
return fpTrackingInformation->GetPreStepGlobalTime();
|
||||
}
|
||||
|
||||
G4double G4IT::GetPreStepLocalTime() const
|
||||
{
|
||||
return fpTrackingInformation->GetPreStepLocalTime();
|
||||
}
|
||||
|
||||
const G4ThreeVector& G4IT::GetPreStepPosition() const
|
||||
{
|
||||
return fpTrackingInformation->GetPreStepPosition();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* G4ITLeadingTracks.cc
|
||||
*
|
||||
* Created on: Jun 26, 2015
|
||||
* Author: mkaramit
|
||||
*/
|
||||
|
||||
#include <G4ITLeadingTracks.hh>
|
||||
#include "G4TrackingInformation.hh"
|
||||
#include <G4IT.hh>
|
||||
|
||||
G4ITLeadingTracks::G4ITLeadingTracks()
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
|
||||
}
|
||||
|
||||
G4ITLeadingTracks::~G4ITLeadingTracks()
|
||||
{
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
|
||||
void G4ITLeadingTracks::Reset()
|
||||
{
|
||||
if (fLeadingTracks.empty() == false)
|
||||
{
|
||||
std::vector<G4Track*>::iterator fLeadingTracks_i = fLeadingTracks.begin();
|
||||
|
||||
while (fLeadingTracks_i != fLeadingTracks.end())
|
||||
{
|
||||
G4Track* track = *fLeadingTracks_i;
|
||||
if (track)
|
||||
{
|
||||
G4IT* ITrack = GetIT(track);
|
||||
if (ITrack)
|
||||
{
|
||||
ITrack->GetTrackingInfo()->SetLeadingStep(false);
|
||||
}
|
||||
}
|
||||
|
||||
++fLeadingTracks_i;
|
||||
continue;
|
||||
}
|
||||
|
||||
fLeadingTracks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void G4ITLeadingTracks::Push(G4Track* track)
|
||||
{
|
||||
fLeadingTracks.push_back(track);
|
||||
}
|
||||
|
||||
void G4ITLeadingTracks::PrepareLeadingTracks()
|
||||
{
|
||||
for(size_t i = 0 ; i < fLeadingTracks.size() ; ++i)
|
||||
{
|
||||
G4Track* track = fLeadingTracks[i];
|
||||
G4IT* ITrack = GetIT(track);
|
||||
ITrack->GetTrackingInfo()->SetLeadingStep(true);
|
||||
// ITrack->GetTrackingInfo()->SetLeadingStep(false);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITModelProcessor.cc 87375 2014-12-02 08:17:28Z gcosmo $
|
||||
// $Id: G4ITModelProcessor.cc 94010 2015-11-05 10:08:33Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -37,6 +37,14 @@
|
||||
#include "G4VITTimeStepComputer.hh"
|
||||
#include "G4VITReactionProcess.hh"
|
||||
//#include "G4ITTimeStepper.hh"
|
||||
#include "G4ITReaction.hh"
|
||||
#include "G4ITTrackHolder.hh"
|
||||
#include "G4ITTrackingManager.hh"
|
||||
#include "G4UserTimeStepAction.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//#define DEBUG_MEM
|
||||
|
||||
@@ -45,31 +53,32 @@
|
||||
using namespace G4MemStat;
|
||||
#endif
|
||||
|
||||
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;
|
||||
fInitialized = false;
|
||||
fpModelManager = 0;
|
||||
fCurrentModel.assign(G4ITType::size(), std::vector<G4VITStepModel*>());
|
||||
|
||||
for (int i = 0; i < (int) G4ITType::size(); i++)
|
||||
for(int i = 0; i < (int) G4ITType::size(); i++)
|
||||
{
|
||||
fCurrentModel[i].assign(G4ITType::size(), 0);
|
||||
}
|
||||
fUserMinTimeStep = -1.;
|
||||
fTSTimeStep = DBL_MAX;
|
||||
fpTrackingManager = 0;
|
||||
fReactionSet = 0;
|
||||
fpTrackContainer = 0;
|
||||
fpModelHandler = 0;
|
||||
fComputeTimeStep = false;
|
||||
fComputeReaction = false;
|
||||
}
|
||||
|
||||
G4ITModelProcessor::~G4ITModelProcessor()
|
||||
{
|
||||
//dtor
|
||||
// if(fpModelHandler) delete fpModelHandler; deleted by G4Scheduler
|
||||
// if(fpModelHandler) delete fpModelHandler; deleted by G4Scheduler
|
||||
fCurrentModel.clear();
|
||||
fReactionInfo.clear();
|
||||
}
|
||||
@@ -84,12 +93,23 @@ G4ITModelProcessor::G4ITModelProcessor(const G4ITModelProcessor& /*other*/)
|
||||
fInitialized = false;
|
||||
fpModelManager = 0;
|
||||
fUserMinTimeStep = -1.;
|
||||
fTSTimeStep = DBL_MAX;
|
||||
fpTrackingManager = 0;
|
||||
fReactionSet = 0;
|
||||
fpTrackContainer = 0;
|
||||
fComputeTimeStep = false;
|
||||
fComputeReaction = false;
|
||||
}
|
||||
|
||||
void G4ITModelProcessor::RegisterModel(double time, G4VITStepModel* model)
|
||||
{
|
||||
fpModelHandler->RegisterModel(model, time);
|
||||
}
|
||||
|
||||
// Should not be used
|
||||
G4ITModelProcessor& G4ITModelProcessor::operator=(const G4ITModelProcessor& rhs)
|
||||
{
|
||||
if (this == &rhs) return *this; // handle self assignment
|
||||
if(this == &rhs) return *this; // handle self assignment
|
||||
//assignment operator
|
||||
return *this;
|
||||
}
|
||||
@@ -97,32 +117,227 @@ G4ITModelProcessor& G4ITModelProcessor::operator=(const G4ITModelProcessor& rhs)
|
||||
void G4ITModelProcessor::Initialize()
|
||||
{
|
||||
fpModelHandler->Initialize();
|
||||
fReactionSet = G4ITReactionSet::Instance();
|
||||
fpTrackContainer = G4ITTrackHolder::Instance();
|
||||
fInitialized = true;
|
||||
fComputeTimeStep = false;
|
||||
fComputeReaction = false;
|
||||
if(fpModelHandler->GetTimeStepComputerFlag()) fComputeTimeStep = true;
|
||||
if(fpModelHandler->GetReactionProcessFlag()) fComputeReaction = true;
|
||||
}
|
||||
|
||||
//_________________________________________________________________________
|
||||
|
||||
G4double G4ITModelProcessor::CalculateMinTimeStep(G4double currentGlobalTime,
|
||||
G4double definedMinTimeStep)
|
||||
{
|
||||
|
||||
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
|
||||
MemStat mem_first, mem_second, mem_diff;
|
||||
#endif
|
||||
|
||||
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
|
||||
mem_first = MemoryUsage();
|
||||
#endif
|
||||
|
||||
fTSTimeStep = DBL_MAX;
|
||||
|
||||
InitializeStepper(currentGlobalTime, definedMinTimeStep);
|
||||
// TODO
|
||||
// fpMasterModelProcessor -> InitializeStepper(fGlobalTime, fDefinedMinTimeStep) ;
|
||||
|
||||
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
|
||||
mem_second = MemoryUsage();
|
||||
mem_diff = mem_second-mem_first;
|
||||
G4cout << "\t || MEM || G4Scheduler::CalculateMinTimeStep || After "
|
||||
"computing fpModelProcessor -> InitializeStepper, diff is : "
|
||||
<< mem_diff
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
// G4TrackList::iterator fpMainList_i = fpMainList->begin();
|
||||
|
||||
G4TrackManyList* mainList = fpTrackContainer->GetMainList();
|
||||
G4TrackManyList::iterator it = mainList->begin();
|
||||
G4TrackManyList::iterator end = mainList->end();
|
||||
|
||||
for (; it != end; ++it)
|
||||
{
|
||||
G4Track * track = *it;
|
||||
|
||||
if (track == 0)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription << "No track found.";
|
||||
G4Exception("G4Scheduler::CalculateMinStep", "ITScheduler006",
|
||||
FatalErrorInArgument, exceptionDescription);
|
||||
return 0; // makes coverity happy
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
G4cout << "*_* " << GetIT(track)->GetName()
|
||||
<< " ID: " << track->GetTrackID()
|
||||
<< " at time : " << track->GetGlobalTime()
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
G4TrackStatus trackStatus = track->GetTrackStatus();
|
||||
if (trackStatus == fStopAndKill || trackStatus == fStopButAlive)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// This Extract... was thought for MT mode at the track level
|
||||
//ExtractTimeStepperData(fpModelProcessor) ;
|
||||
|
||||
CalculateTimeStep(track, definedMinTimeStep);
|
||||
|
||||
// if MT mode at track level, this command should be displaced
|
||||
ExtractTimeStepperData();
|
||||
}
|
||||
|
||||
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
|
||||
mem_second = MemoryUsage();
|
||||
mem_diff = mem_second-mem_first;
|
||||
G4cout << "\t || MEM || G4Scheduler::CalculateMinTimeStep || "
|
||||
"After looping on tracks, diff is : " << mem_diff << G4endl;
|
||||
#endif
|
||||
return fTSTimeStep;
|
||||
}
|
||||
|
||||
//_________________________________________________________________________
|
||||
|
||||
void G4ITModelProcessor::ExtractTimeStepperData()
|
||||
{
|
||||
if(fpTrack == 0)
|
||||
{
|
||||
CleanProcessor();
|
||||
return;
|
||||
}
|
||||
|
||||
const std::vector<std::vector<G4VITStepModel*> >* model = GetCurrentModel();
|
||||
|
||||
for(unsigned i = 0; i < model->size(); ++i)
|
||||
{
|
||||
for(unsigned j = 0; j < (*model)[i].size(); ++j)
|
||||
{
|
||||
G4VITStepModel* mod = (*model)[i][j];
|
||||
|
||||
if(mod == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
G4VITTimeStepComputer* stepper(mod->GetTimeStepper());
|
||||
|
||||
G4double sampledMinTimeStep(stepper->GetSampledMinTimeStep());
|
||||
G4TrackVectorHandle reactants(stepper->GetReactants());
|
||||
|
||||
if(sampledMinTimeStep < fTSTimeStep)
|
||||
{
|
||||
/*
|
||||
// DEBUG SPECIAL CASE
|
||||
if(!reactants)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription ;
|
||||
CalculateMinTimeStep(); // => at least N (N = nb of tracks) loops exceptionDescription << "No reactants were found by the time stepper.";
|
||||
G4Exception("G4Scheduler::ExtractTimeStepperData","ITScheduler007",
|
||||
FatalErrorInArgument,exceptionDescription);
|
||||
continue ;
|
||||
}
|
||||
*/
|
||||
|
||||
fTSTimeStep = sampledMinTimeStep;
|
||||
//fReactingTracks.clear();
|
||||
|
||||
fReactionSet->CleanAllReaction();
|
||||
if(bool(reactants))
|
||||
{
|
||||
// G4cout << "*** (1) G4Scheduler::ExtractTimeStepperData insert
|
||||
// reactants for " << GetIT(track)->GetName() << G4endl;
|
||||
// G4cout << "bool(reactants) = " << bool(reactants) << G4endl;
|
||||
// G4cout << reactants->size() << G4endl;
|
||||
// G4cout << GetIT(reactants->operator[](0))->GetName() << G4endl;
|
||||
|
||||
// fReactingTracks.insert(make_pair(track, reactants));
|
||||
fReactionSet->AddReactions(fTSTimeStep,
|
||||
const_cast<G4Track*>(fpTrack),
|
||||
reactants);
|
||||
stepper->ResetReactants();
|
||||
}
|
||||
}
|
||||
else if(fTSTimeStep == sampledMinTimeStep)
|
||||
{
|
||||
/*
|
||||
// DEBUG SPECIAL CASE
|
||||
if(!reactants)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription ;
|
||||
exceptionDescription << "No reactants were found by the time stepper.";
|
||||
G4Exception("G4Scheduler::ExtractTimeStepperData","ITScheduler008",
|
||||
FatalErrorInArgument,exceptionDescription);
|
||||
continue ;
|
||||
}
|
||||
*/
|
||||
if(bool(reactants))
|
||||
{
|
||||
// G4cout << "*** (2) G4Scheduler::ExtractTimeStepperData insert
|
||||
// reactants for " << GetIT(track)->GetName() << G4endl;
|
||||
// G4cout << "bool(reactants) = " << bool(reactants) << G4endl;
|
||||
// G4cout << "trackA : " << GetIT(track)->GetName()
|
||||
// << " ("<< track->GetTrackID() << ")" << G4endl;
|
||||
// G4cout << reactants->size() << G4endl;
|
||||
// G4cout << GetIT(reactants->operator[](0))->GetName() << G4endl;
|
||||
|
||||
// fReactingTracks.insert(make_pair(track, reactants));
|
||||
|
||||
fReactionSet->AddReactions(fTSTimeStep,
|
||||
const_cast<G4Track*>(fpTrack),
|
||||
reactants);
|
||||
stepper->ResetReactants();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bool(reactants))
|
||||
{
|
||||
stepper->ResetReactants();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CleanProcessor();
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
void G4ITModelProcessor::InitializeStepper(const G4double& currentGlobalTime,
|
||||
const G4double& userMinTime)
|
||||
|
||||
void G4ITModelProcessor::InitializeStepper(G4double currentGlobalTime,
|
||||
G4double userMinTime)
|
||||
{
|
||||
// G4cout << "G4ITModelProcessor::InitializeStepper" << G4endl;
|
||||
if (fpModelHandler == 0)
|
||||
if(fpModelHandler == 0)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "No G4ITModelHandler was passed to the modelProcessor.";
|
||||
G4Exception("G4ITModelProcessor::InitializeStepper", "ITModelProcessor002",
|
||||
FatalErrorInArgument, exceptionDescription);
|
||||
G4Exception("G4ITModelProcessor::InitializeStepper",
|
||||
"ITModelProcessor002",
|
||||
FatalErrorInArgument,
|
||||
exceptionDescription);
|
||||
}
|
||||
const std::vector<std::vector<G4ITModelManager*> >* modelManager =
|
||||
fpModelHandler->GetAllModelManager();
|
||||
|
||||
if (modelManager == 0)
|
||||
if(modelManager == 0)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "No G4ITModelManager was register to G4ITModelHandler.";
|
||||
G4Exception("G4ITModelProcessor::InitializeStepper", "ITModelProcessor003",
|
||||
FatalErrorInArgument, exceptionDescription);
|
||||
G4Exception("G4ITModelProcessor::InitializeStepper",
|
||||
"ITModelProcessor003",
|
||||
FatalErrorInArgument,
|
||||
exceptionDescription);
|
||||
}
|
||||
|
||||
int nbModels1 = modelManager->size();
|
||||
@@ -136,15 +351,15 @@ void G4ITModelProcessor::InitializeStepper(const G4double& currentGlobalTime,
|
||||
G4VITStepModel* model = 0;
|
||||
G4ITModelManager* modman = 0;
|
||||
|
||||
for (int i = 0; i < nbModels1; i++)
|
||||
for(int i = 0; i < nbModels1; i++)
|
||||
{
|
||||
nbModels2 = (*modelManager)[i].size();
|
||||
|
||||
for (int j = 0; j <= i; j++)
|
||||
for(int j = 0; j <= i; j++)
|
||||
{
|
||||
modman = (*modelManager)[i][j];
|
||||
|
||||
if (modman == 0) continue;
|
||||
if(modman == 0) continue;
|
||||
|
||||
model = modman->GetModel(currentGlobalTime);
|
||||
G4VITTimeStepComputer* stepper = model->GetTimeStepper();
|
||||
@@ -157,7 +372,7 @@ void G4ITModelProcessor::InitializeStepper(const G4double& currentGlobalTime,
|
||||
mem_first = MemoryUsage();
|
||||
#endif
|
||||
|
||||
// stepper->PrepareForAllProcessors() ;
|
||||
// stepper->PrepareForAllProcessors() ;
|
||||
stepper->Prepare();
|
||||
|
||||
#if defined (DEBUG_MEM)
|
||||
@@ -169,7 +384,7 @@ void G4ITModelProcessor::InitializeStepper(const G4double& currentGlobalTime,
|
||||
}
|
||||
}
|
||||
|
||||
if (nbModels1 == 1 && nbModels2 == 1)
|
||||
if(nbModels1 == 1 && nbModels2 == 1)
|
||||
{
|
||||
fpModelManager = modman;
|
||||
fpModel = model;
|
||||
@@ -184,12 +399,14 @@ void G4ITModelProcessor::CalculateTimeStep(const G4Track* track,
|
||||
{
|
||||
// G4cout << "G4ITModelProcessor::CalculateStep" << G4endl;
|
||||
CleanProcessor();
|
||||
if (track == 0)
|
||||
if(track == 0)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription << "No track was passed to the method (track == 0).";
|
||||
G4Exception("G4ITModelProcessor::CalculateStep", "ITModelProcessor004",
|
||||
FatalErrorInArgument, exceptionDescription);
|
||||
G4Exception("G4ITModelProcessor::CalculateStep",
|
||||
"ITModelProcessor004",
|
||||
FatalErrorInArgument,
|
||||
exceptionDescription);
|
||||
}
|
||||
SetTrack(track);
|
||||
fUserMinTimeStep = userMinTimeStep;
|
||||
@@ -200,7 +417,7 @@ void G4ITModelProcessor::CalculateTimeStep(const G4Track* track,
|
||||
//______________________________________________________________________________
|
||||
void G4ITModelProcessor::DoCalculateStep()
|
||||
{
|
||||
if (fpModel) // ie only one model has been declared and will be used
|
||||
if(fpModel) // ie only one model has been declared and will be used
|
||||
{
|
||||
fpModel->GetTimeStepper()->CalculateStep(*fpTrack, fUserMinTimeStep);
|
||||
}
|
||||
@@ -209,115 +426,300 @@ void G4ITModelProcessor::DoCalculateStep()
|
||||
std::vector<G4VITStepModel*>& model = fCurrentModel[GetIT(fpTrack)
|
||||
->GetITType()];
|
||||
|
||||
for (int i = 0; i < (int) model.size(); i++)
|
||||
for(int i = 0; i < (int) model.size(); i++)
|
||||
{
|
||||
if (model[i] == 0) continue;
|
||||
if(model[i] == 0) continue;
|
||||
model[i]->GetTimeStepper()->CalculateStep(*fpTrack, fUserMinTimeStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//_________________________________________________________________________
|
||||
|
||||
void G4ITModelProcessor::ComputeTrackReaction(G4ITStepStatus fITStepStatus,
|
||||
G4double fGlobalTime,
|
||||
G4double currentTimeStep,
|
||||
G4double previousTimeStep,
|
||||
G4bool reachedUserTimeLimit,
|
||||
G4double fTimeTolerance,
|
||||
G4UserTimeStepAction* fpUserTimeStepAction,
|
||||
G4int
|
||||
#ifdef G4VERBOSE
|
||||
fVerbose
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// if (fReactingTracks.empty())
|
||||
if(fReactionSet->Empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(fITStepStatus == eCollisionBetweenTracks)
|
||||
// if(fInteractionStep == false)
|
||||
{
|
||||
// TODO
|
||||
FindReaction(fReactionSet,
|
||||
currentTimeStep,
|
||||
previousTimeStep,
|
||||
reachedUserTimeLimit);
|
||||
// TODO
|
||||
// A ne faire uniquement si le temps choisis est celui calculé par le time stepper
|
||||
// Sinon utiliser quelque chose comme : fModelProcessor->FindReaction(&fMainList);
|
||||
|
||||
std::vector<G4ITReactionChange*> * reactionInfo_v = GetReactionInfo();
|
||||
std::vector<G4ITReactionChange*>::iterator reactionInfo_i = reactionInfo_v
|
||||
->begin();
|
||||
|
||||
for(; reactionInfo_i != reactionInfo_v->end(); ++reactionInfo_i)
|
||||
{
|
||||
G4ITReactionChange* changes = (*reactionInfo_i);
|
||||
G4Track* trackA = const_cast<G4Track*>(changes->GetTrackA());
|
||||
G4Track* trackB = const_cast<G4Track*>(changes->GetTrackB());
|
||||
|
||||
if(trackA == 0 || trackB == 0 || trackA->GetTrackStatus() == fStopAndKill
|
||||
|| trackB->GetTrackStatus() == fStopAndKill) continue;
|
||||
|
||||
G4int nbSecondaries = changes->GetNumberOfSecondaries();
|
||||
const vector<G4Track*>* productsVector = changes->GetfSecondary();
|
||||
|
||||
if(fpUserTimeStepAction)
|
||||
{
|
||||
fpUserTimeStepAction->UserReactionAction(*trackA,
|
||||
*trackB,
|
||||
productsVector);
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if(fVerbose)
|
||||
{
|
||||
G4cout << "At time : " << setw(7) << G4BestUnit(fGlobalTime, "Time")
|
||||
<< " Reaction : " << GetIT(trackA)->GetName() << " ("
|
||||
<< trackA->GetTrackID() << ") + " << GetIT(trackB)->GetName() << " ("
|
||||
<< trackB->GetTrackID() << ") -> ";
|
||||
}
|
||||
#endif
|
||||
|
||||
if(nbSecondaries > 0)
|
||||
{
|
||||
for(int i = 0; i < nbSecondaries; ++i)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if(fVerbose && i != 0) G4cout << " + ";
|
||||
#endif
|
||||
|
||||
G4Track* secondary = (*productsVector)[i]; //changes->GetSecondary(i);
|
||||
fpTrackContainer->_PushTrack(secondary);
|
||||
GetIT(secondary)->SetParentID(trackA->GetTrackID(),
|
||||
trackB->GetTrackID());
|
||||
|
||||
if(secondary->GetGlobalTime() - fGlobalTime > fTimeTolerance)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription << "The time of the secondary should not be bigger than the"
|
||||
" current global time."
|
||||
<< " This may cause synchronization problem. If the process you"
|
||||
" are using required "
|
||||
<< "such feature please contact the developpers." << G4endl<< "The global time in the step manager : "
|
||||
<< G4BestUnit(fGlobalTime,"Time")
|
||||
<< G4endl
|
||||
<< "The global time of the track : "
|
||||
<< G4BestUnit(secondary->GetGlobalTime(),"Time")
|
||||
<< G4endl;
|
||||
|
||||
G4Exception("G4Scheduler::ComputeInteractionBetweenTracks",
|
||||
"ITScheduler010",
|
||||
FatalErrorInArgument,
|
||||
exceptionDescription);
|
||||
}
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if(fVerbose)
|
||||
G4cout << GetIT(secondary)->GetName() << " ("
|
||||
<< secondary->GetTrackID() << ")";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if(fVerbose) G4cout << "No product";
|
||||
#endif
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if(fVerbose) G4cout << G4endl;
|
||||
#endif
|
||||
if(trackA->GetTrackID() == 0 || trackB->GetTrackID() == 0)
|
||||
{
|
||||
G4Track* track = 0;
|
||||
if(trackA->GetTrackID() == 0) track = trackA;
|
||||
else track = trackB;
|
||||
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "The problem was found for the reaction between tracks :"
|
||||
<< trackA->GetParticleDefinition()->GetParticleName() << " ("
|
||||
<< trackA->GetTrackID() << ") & "
|
||||
<< trackB->GetParticleDefinition()->GetParticleName() << " ("
|
||||
<< trackB->GetTrackID() << "). \n";
|
||||
|
||||
if(track->GetStep() == 0)
|
||||
{
|
||||
exceptionDescription << "Also no step was found"
|
||||
<< " ie track->GetStep() == 0 \n";
|
||||
}
|
||||
|
||||
exceptionDescription << "Parent ID of trackA : "
|
||||
<< trackA->GetParentID() << "\n";
|
||||
exceptionDescription << "Parent ID of trackB : "
|
||||
<< trackB->GetParentID() << "\n";
|
||||
|
||||
exceptionDescription
|
||||
<< "The ID of one of the reaction track was not setup.";
|
||||
G4Exception("G4Scheduler::ComputeInteractionBetweenTracks",
|
||||
"ITScheduler011",
|
||||
FatalErrorInArgument,
|
||||
exceptionDescription);
|
||||
}
|
||||
|
||||
if(changes->WereParentsKilled())
|
||||
{
|
||||
// DEBUG
|
||||
// G4cout << "Erasing tracks : "
|
||||
// << "trackA at time : " << G4BestUnit(trackA->GetGlobalTime() , "Time")
|
||||
// << "\t trackB at time : "<< G4BestUnit(trackB->GetGlobalTime(), "Time")
|
||||
// << "\t GlobalTime : " << G4BestUnit(fGlobalTime, "Time")
|
||||
// << G4endl;
|
||||
|
||||
trackA->SetTrackStatus(fStopAndKill);
|
||||
trackB->SetTrackStatus(fStopAndKill);
|
||||
|
||||
// G4TrackList::Pop(trackA);
|
||||
// G4TrackList::Pop(trackB);
|
||||
fpTrackingManager->EndTracking(trackA);
|
||||
fpTrackingManager->EndTracking(trackB);
|
||||
}
|
||||
|
||||
delete changes;
|
||||
}
|
||||
|
||||
reactionInfo_v->clear(); // never null because point to a non-pointer member of ModelProcessor
|
||||
}
|
||||
// DEBUG
|
||||
//else
|
||||
//{
|
||||
// G4cout << "fInteractionStep == true" << G4endl ;
|
||||
//}
|
||||
|
||||
// fReactingTracks.clear();
|
||||
fReactionSet->CleanAllReaction();
|
||||
|
||||
fpTrackContainer->MergeSecondariesWithMainList();
|
||||
fpTrackContainer->KillTracks();
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
void G4ITModelProcessor::FindReaction(std::map<G4Track*, G4TrackVectorHandle>* tracks,
|
||||
void G4ITModelProcessor::FindReaction(G4ITReactionSet* reactionSet,
|
||||
const double currentStepTime,
|
||||
const double previousStepTime,
|
||||
const bool reachedUserStepTimeLimit)
|
||||
{
|
||||
// DEBUG
|
||||
// G4cout << "G4ITReactionManager::FindReaction" << G4endl;
|
||||
if (tracks == 0) return;
|
||||
//if (tracks == 0) return;
|
||||
if(reactionSet == 0) return;
|
||||
if(fpModelHandler->GetAllModelManager()->empty()) return;
|
||||
|
||||
if (fpModelHandler->GetAllModelManager()->empty()) return;
|
||||
G4ITReactionPerTrackMap& reactionPerTrackMap = reactionSet->GetReactionMap();
|
||||
|
||||
std::map<G4Track*, G4TrackVectorHandle>::iterator tracks_i = tracks->begin();
|
||||
std::map<G4Track*, G4ITReactionPerTrackPtr, compTrackPerID>::iterator tracks_i =
|
||||
reactionPerTrackMap.begin();
|
||||
|
||||
// G4cout << "G4ITModelProcessor::FindReaction at step :" << G4ITTimeStepper::Instance()->GetNbSteps() << G4endl;
|
||||
//std::map<G4Track*, G4TrackVectorHandle, compTrackPerID>::iterator tracks_i = tracks->begin();
|
||||
|
||||
for (tracks_i = tracks->begin(); tracks_i != tracks->end(); tracks_i++)
|
||||
// G4cout << "G4ITModelProcessor::FindReaction at step :" << G4ITTimeStepper::Instance()->GetNbSteps() << G4endl;
|
||||
|
||||
// for (tracks_i = tracks->begin(); tracks_i != tracks->end(); tracks_i++)
|
||||
for(tracks_i = reactionPerTrackMap.begin();
|
||||
tracks_i != reactionPerTrackMap.end();
|
||||
tracks_i = reactionPerTrackMap.begin())
|
||||
{
|
||||
/// Get track A
|
||||
//G4cout << "here" << G4endl;
|
||||
G4Track* trackA = tracks_i->first;
|
||||
if(trackA->GetTrackStatus() == fStopAndKill)
|
||||
{
|
||||
//G4cout << "continue 1" << G4endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (trackA == 0) continue;
|
||||
|
||||
// G4cout << "trackA is " << GetIT(trackA)->GetName() << G4endl;
|
||||
|
||||
std::map<const G4Track*, G4bool>::iterator it_hasReacted =
|
||||
fHasReacted->find(trackA);
|
||||
if (it_hasReacted != fHasReacted->end()) continue;
|
||||
if (trackA->GetTrackStatus() == fStopAndKill) continue;
|
||||
G4ITReactionPerTrackPtr reactionPerTrack = tracks_i->second;
|
||||
G4ITReactionList& reactionList = reactionPerTrack->GetReactionList();
|
||||
|
||||
G4IT* ITA = GetIT(trackA);
|
||||
G4ITType ITypeA = ITA->GetITType();
|
||||
|
||||
const std::vector<G4VITStepModel*> model = fCurrentModel[ITypeA];
|
||||
|
||||
G4TrackVectorHandle& trackB_vector = tracks_i->second;
|
||||
std::vector<G4Track*>::iterator trackB_i = trackB_vector->begin();
|
||||
|
||||
G4Track* trackB = 0;
|
||||
G4ITType ITypeB(-1);
|
||||
G4VITReactionProcess* process = 0;
|
||||
G4ITReactionChange* changes = 0;
|
||||
|
||||
for (; trackB_i != trackB_vector->end(); trackB_i++)
|
||||
assert(reactionList.begin() != reactionList.end());
|
||||
|
||||
for(G4ITReactionList::iterator it = reactionList.begin();
|
||||
it != reactionList.end(); it = reactionList.begin())
|
||||
{
|
||||
trackB = *trackB_i;
|
||||
G4ITReactionPtr reaction(*it);
|
||||
trackB = reaction->GetReactant(trackA);
|
||||
if(trackB->GetTrackStatus() == fStopAndKill)
|
||||
{
|
||||
//G4cout << "continue 2" << G4endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (trackB == 0) continue;
|
||||
it_hasReacted = fHasReacted->find(trackB);
|
||||
if (it_hasReacted != fHasReacted->end()) continue;
|
||||
if (trackB->GetTrackStatus() == fStopAndKill) continue;
|
||||
|
||||
// DEBUG
|
||||
// G4cout << "Couple : " << trackA->GetParticleDefinition->GetParticleName() << " ("
|
||||
// << trackA->GetTrackID() << ") "
|
||||
// << trackB->GetParticleDefinition->GetParticleName() << " ("
|
||||
// << trackB->GetTrackID() << ")"
|
||||
// << G4endl;
|
||||
|
||||
if (trackB == trackA)
|
||||
if(trackB == trackA)
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "The IT reaction process sent back a reaction between trackA and trackB. ";
|
||||
exceptionDescription << "The problem is trackA == trackB";
|
||||
G4Exception("G4ITModelProcessor::FindReaction", "ITModelProcessor005",
|
||||
FatalErrorInArgument, exceptionDescription);
|
||||
G4Exception("G4ITModelProcessor::FindReaction",
|
||||
"ITModelProcessor005",
|
||||
FatalErrorInArgument,
|
||||
exceptionDescription);
|
||||
}
|
||||
|
||||
G4IT* ITB = GetIT(trackB);
|
||||
G4ITType ITypeBtmp = ITB->GetITType();
|
||||
|
||||
if (ITypeB != ITypeBtmp)
|
||||
if(ITypeB != ITypeBtmp)
|
||||
{
|
||||
ITypeB = ITypeBtmp;
|
||||
|
||||
if (model[ITypeB]) process = model[ITypeB]->GetReactionProcess();
|
||||
if(model[ITypeB]) process = model[ITypeB]->GetReactionProcess();
|
||||
}
|
||||
|
||||
if (process && process->TestReactibility(*trackA, *trackB,
|
||||
currentStepTime,
|
||||
previousStepTime,
|
||||
reachedUserStepTimeLimit))
|
||||
reactionSet->SelectThisReaction(reaction);
|
||||
|
||||
if(process && process->TestReactibility(*trackA,
|
||||
*trackB,
|
||||
currentStepTime,
|
||||
previousStepTime,
|
||||
reachedUserStepTimeLimit))
|
||||
{
|
||||
changes = process->MakeReaction(*trackA, *trackB);
|
||||
}
|
||||
|
||||
if (changes)
|
||||
if(changes)
|
||||
{
|
||||
(*fHasReacted)[trackA] = true;
|
||||
(*fHasReacted)[trackB] = true;
|
||||
changes->GetTrackA();
|
||||
changes->GetTrackB();
|
||||
|
||||
fReactionInfo.push_back(changes);
|
||||
|
||||
// G4cout << "pushing reaction for trackA (" << trackA->GetTrackID() << ") and trackB ("
|
||||
// << trackB->GetTrackID() << ")" << G4endl;
|
||||
//
|
||||
// G4cout << "nb of secondaries : " << changes->GetNumberOfSecondaries() << G4endl;
|
||||
// G4cout << "with track 0 = " << changes->GetSecondary(0) << G4endl;
|
||||
// G4cout << "pushing reaction for trackA (" << trackA->GetTrackID() << ") and trackB ("
|
||||
// << trackB->GetTrackID() << ")" << G4endl;
|
||||
//
|
||||
// G4cout << "nb of secondaries : " << changes->GetNumberOfSecondaries() << G4endl;
|
||||
// G4cout << "with track 0 = " << changes->GetSecondary(0) << G4endl;
|
||||
|
||||
process->ResetChanges();
|
||||
changes = 0;
|
||||
@@ -327,5 +729,5 @@ void G4ITModelProcessor::FindReaction(std::map<G4Track*, G4TrackVectorHandle>* t
|
||||
}
|
||||
}
|
||||
|
||||
fHasReacted->clear();
|
||||
//assert(G4ITReaction::gAll->empty() == true);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
|
||||
//#define G4DEBUG_NAVIGATION 1
|
||||
#include "G4VoxelSafety.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4VoxelLimits.hh"
|
||||
|
||||
#define fHistory fpNavigatorState->fHistory
|
||||
#define fLastTriedStepComputation fpNavigatorState->fLastTriedStepComputation
|
||||
@@ -80,6 +82,17 @@
|
||||
#define fPreviousSftOrigin fpNavigatorState->fPreviousSftOrigin
|
||||
#define fPreviousSafety fpNavigatorState->fPreviousSafety
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace BoundingBox
|
||||
{
|
||||
enum Boundary
|
||||
{
|
||||
kMin,
|
||||
kMax
|
||||
};
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// Constructor
|
||||
// ********************************************************************
|
||||
@@ -90,8 +103,8 @@ G4ITNavigator2::G4ITNavigator2()
|
||||
fWarnPush(true)
|
||||
{
|
||||
fActive= false;
|
||||
fActionThreshold_NoZeroSteps = 10;
|
||||
fAbandonThreshold_NoZeroSteps = 25;
|
||||
fActionThreshold_NoZeroSteps = 1000;
|
||||
fAbandonThreshold_NoZeroSteps = 2500;
|
||||
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
|
||||
fregularNav.SetNormalNavigation( &fnormalNav );
|
||||
|
||||
@@ -1341,9 +1354,9 @@ G4double G4ITNavigator2::ComputeStep( const G4ThreeVector &pGlobalpoint,
|
||||
// ********************************************************************
|
||||
//
|
||||
G4double G4ITNavigator2::CheckNextStep( const G4ThreeVector& pGlobalpoint,
|
||||
const G4ThreeVector& pDirection,
|
||||
const G4double pCurrentProposedStepLength,
|
||||
G4double& pNewSafety)
|
||||
const G4ThreeVector& pDirection,
|
||||
const G4double pCurrentProposedStepLength,
|
||||
G4double& pNewSafety)
|
||||
{
|
||||
CheckNavigatorStateIsValid();
|
||||
G4double step;
|
||||
@@ -1351,7 +1364,8 @@ G4double G4ITNavigator2::CheckNextStep( const G4ThreeVector& pGlobalpoint,
|
||||
// Save the state, for this parasitic call
|
||||
//
|
||||
//SetSavedState();
|
||||
G4SaveNavigatorState savedState(fpNavigatorState);
|
||||
// G4SaveNavigatorState savedState(fpNavigatorState);
|
||||
G4NavigatorState savedState(*fpNavigatorState);
|
||||
|
||||
step = ComputeStep ( pGlobalpoint,
|
||||
pDirection,
|
||||
@@ -2450,3 +2464,58 @@ std::ostream& operator << (std::ostream &os,const G4ITNavigator2 &n)
|
||||
os.precision(oldcoutPrec);
|
||||
return os;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
EInside
|
||||
G4ITNavigator2::InsideCurrentVolume(const G4ThreeVector& globalPoint) const
|
||||
{
|
||||
const G4AffineTransform& transform = GetGlobalToLocalTransform();
|
||||
G4ThreeVector localPoint(transform.TransformPoint(globalPoint));
|
||||
|
||||
G4VSolid* solid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
|
||||
|
||||
return solid->Inside(localPoint);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void G4ITNavigator2::GetRandomInCurrentVolume(G4ThreeVector& _rndmPoint) const
|
||||
{
|
||||
const G4AffineTransform& local2Global = GetLocalToGlobalTransform();
|
||||
G4VSolid* solid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
|
||||
|
||||
G4VoxelLimits voxelLimits; // Defaults to "infinite" limits.
|
||||
G4double vmin, vmax;
|
||||
G4AffineTransform dummy;
|
||||
std::vector<std::vector<double> > fExtend;
|
||||
|
||||
solid->CalculateExtent(kXAxis,voxelLimits,dummy,vmin,vmax);
|
||||
fExtend[kXAxis][BoundingBox::kMin] = vmin;
|
||||
fExtend[kXAxis][BoundingBox::kMax] = vmax;
|
||||
|
||||
solid->CalculateExtent(kYAxis,voxelLimits,dummy,vmin,vmax);
|
||||
fExtend[kYAxis][BoundingBox::kMin] = vmin;
|
||||
fExtend[kYAxis][BoundingBox::kMax] = vmax;
|
||||
|
||||
solid->CalculateExtent(kZAxis,voxelLimits,dummy,vmin,vmax);
|
||||
fExtend[kZAxis][BoundingBox::kMin] = vmin;
|
||||
fExtend[kZAxis][BoundingBox::kMax] = vmax;
|
||||
|
||||
G4ThreeVector rndmPos;
|
||||
|
||||
while(1)
|
||||
{
|
||||
for(size_t i = 0 ; i < 3 ; ++i)
|
||||
{
|
||||
double min = fExtend[i][BoundingBox::kMin];
|
||||
double max = fExtend[i][BoundingBox::kMax];
|
||||
rndmPos[i] = G4UniformRand()*(max-min)+min;
|
||||
}
|
||||
|
||||
if(solid->Inside(rndmPos) == kInside) break;
|
||||
}
|
||||
|
||||
_rndmPoint = local2Global.TransformPoint(rndmPos);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* G4ITReactionInfo.cc
|
||||
*
|
||||
* Created on: 1 févr. 2015
|
||||
* Author: matkara
|
||||
*/
|
||||
|
||||
#include <G4ITReaction.hh>
|
||||
#include "globals.hh"
|
||||
|
||||
//G4ThreadLocal std::set<G4ITReaction*>* G4ITReaction::gAll(0);
|
||||
|
||||
G4ThreadLocal G4ITReactionSet* G4ITReactionSet::fpInstance(0);
|
||||
|
||||
bool compReactionPerTime::operator()(G4ITReactionPtr rhs,
|
||||
G4ITReactionPtr lhs) const
|
||||
{
|
||||
double time1 = rhs->GetTime();
|
||||
double time2 = lhs->GetTime();
|
||||
if (time1 == time2)
|
||||
{
|
||||
return rhs->GetHash() < lhs->GetHash();
|
||||
}
|
||||
return rhs->GetTime() < lhs->GetTime();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void hash_combine(std::size_t& seed,
|
||||
const T& v)
|
||||
{
|
||||
// std::hash<T> hasher;
|
||||
seed ^= /*std::hash<T>(v)*/ v + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
|
||||
std::size_t G4ITReaction::GetHash() const
|
||||
{
|
||||
std::size_t hash = 0;
|
||||
hash_combine(hash, fReactants.first->GetTrackID());
|
||||
hash_combine(hash, fReactants.first->GetTrackID());
|
||||
return hash;
|
||||
}
|
||||
|
||||
G4ITReaction::G4ITReaction(double time, G4Track* trackA, G4Track* trackB) :
|
||||
G4enable_shared_from_this<G4ITReaction>(),
|
||||
fTime(time),
|
||||
fReactants(trackA,trackB)
|
||||
{
|
||||
//if(gAll == 0) gAll = new std::set<G4ITReaction*>();
|
||||
//gAll->insert(this);
|
||||
|
||||
fReactionPerTimeIt = 0;
|
||||
}
|
||||
|
||||
G4ITReaction::~G4ITReaction()
|
||||
{
|
||||
//gAll->erase(this);
|
||||
if(fReactionPerTimeIt) delete fReactionPerTimeIt;
|
||||
}
|
||||
|
||||
void G4ITReaction::RemoveMe()
|
||||
{
|
||||
G4ITReactionPtr backMeUp = this->shared_from_this();
|
||||
for(G4ReactionPerTrackIt::iterator it = fReactionPerTrack.begin() ;
|
||||
it != fReactionPerTrack.end() ; ++it)
|
||||
{
|
||||
// G4cout << it->first.get() << G4endl;
|
||||
// assert(it->first.get() != 0);
|
||||
it->first->RemoveThisReaction(it->second);
|
||||
}
|
||||
fReactionPerTrack.clear();
|
||||
|
||||
if(fReactionPerTimeIt)
|
||||
{
|
||||
G4ITReactionSet::Instance()->GetReactionsPerTime().erase(*fReactionPerTimeIt);
|
||||
delete fReactionPerTimeIt;
|
||||
fReactionPerTimeIt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool G4ITReactionPerTrack::RemoveThisReaction(G4ITReactionList::iterator it)
|
||||
{
|
||||
// G4cout << "G4ITReactionPerTrack::RemoveReaction" << G4endl;
|
||||
fReactions.erase(it);
|
||||
if(fReactions.empty())
|
||||
{
|
||||
// G4cout << "G4ITReactionPerTrack is empty" << G4endl;
|
||||
G4ITReactionSet::Instance()->RemoveReactionPerTrack(this->shared_from_this());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -46,6 +46,12 @@ PriorityList::PriorityList() :
|
||||
{
|
||||
}
|
||||
|
||||
PriorityList::PriorityList(G4TrackManyList& allMainList):
|
||||
G4TrackList::Watcher(), fpMainList(0), fpWaitingList(0)
|
||||
{
|
||||
NewMainList(allMainList);
|
||||
}
|
||||
|
||||
PriorityList::PriorityList(const PriorityList& right) :
|
||||
G4TrackList::Watcher(),
|
||||
fpMainList(right.fpMainList),
|
||||
@@ -71,13 +77,13 @@ void PriorityList::NotifyDeletingList(G4TrackList* __list)
|
||||
{
|
||||
if (__list == fpMainList)
|
||||
{
|
||||
// StopWatching(fpMainList);
|
||||
fpMainList = 0;
|
||||
StopWatching(fpMainList);
|
||||
}
|
||||
else if (__list == fpWaitingList)
|
||||
{
|
||||
// StopWatching(fpWaitingList);
|
||||
fpWaitingList = 0;
|
||||
StopWatching(fpWaitingList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +198,7 @@ G4ITTrackHolder* G4ITTrackHolder::Instance()
|
||||
if (fgInstance == 0)
|
||||
{
|
||||
fgInstance = new G4ITTrackHolder();
|
||||
if(G4Threading::IsWorkerThread() == false ||
|
||||
if(G4Threading::IsMasterThread() ||
|
||||
G4Threading::IsMultithreadedApplication() == false
|
||||
)
|
||||
{
|
||||
@@ -379,15 +385,15 @@ void G4ITTrackHolder::AddTrackID(G4Track* track)
|
||||
|
||||
void G4ITTrackHolder::Push(G4Track* track)
|
||||
{
|
||||
if (G4VScheduler::Instance()->IsRunning())
|
||||
{
|
||||
G4ExceptionDescription exceptionDescription;
|
||||
exceptionDescription
|
||||
<< "G4ITTrackHolder::PushTrack : You are trying to push tracks while the "
|
||||
"ITStepManager is running";
|
||||
G4Exception("G4ITTrackHolder::PushTrack", "ITStepManager012",
|
||||
FatalErrorInArgument, exceptionDescription);
|
||||
}
|
||||
// if (G4VScheduler::Instance()->IsRunning())
|
||||
// {
|
||||
// G4ExceptionDescription exceptionDescription;
|
||||
// exceptionDescription
|
||||
// << "G4ITTrackHolder::PushTrack : You are trying to push tracks while the "
|
||||
// "ITStepManager is running";
|
||||
// G4Exception("G4ITTrackHolder::PushTrack", "ITStepManager012",
|
||||
// FatalErrorInArgument, exceptionDescription);
|
||||
// }
|
||||
_PushTrack(track);
|
||||
|
||||
// G4MIConstituent::NotifyEntityAdded(track);
|
||||
@@ -402,7 +408,7 @@ void G4ITTrackHolder::PushTo(G4Track* track, PriorityList::Type type)
|
||||
|
||||
if (it == fLists.end())
|
||||
{
|
||||
priorityList = new PriorityList();
|
||||
priorityList = new PriorityList(fAllMainList);
|
||||
fLists[moleculeID] = priorityList;
|
||||
}
|
||||
else
|
||||
@@ -462,7 +468,7 @@ void G4ITTrackHolder::_PushTrack(G4Track* track)
|
||||
double currentGlobalTime = G4Scheduler::Instance()->GetGlobalTime();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (fVerbose > 5)
|
||||
if (fVerbose)
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "\t"<< ">> Pushing a track --> ";
|
||||
@@ -508,10 +514,37 @@ void G4ITTrackHolder::_PushTrack(G4Track* track)
|
||||
{
|
||||
if (globalTime == currentGlobalTime)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (fVerbose)
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "\t"<< ">> Pushing to *main* list --> ";
|
||||
G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
|
||||
<< " -- ";
|
||||
G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
|
||||
<< "\t";
|
||||
G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
PushTo(track, PriorityList::MainList);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if(currentGlobalTime > 1*CLHEP::picosecond) abort();
|
||||
#ifdef G4VERBOSE
|
||||
if (fVerbose)
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "\t"<< ">> Pushing to *delayed* list --> ";
|
||||
G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
|
||||
<< " -- ";
|
||||
G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
|
||||
<< "\t";
|
||||
G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
PushDelayed(track);
|
||||
}
|
||||
}
|
||||
@@ -548,6 +581,19 @@ void G4ITTrackHolder::_PushTrack(G4Track* track)
|
||||
{
|
||||
// G4cout << "Is pushing " << GetIT(track)->GetName() << G4endl;
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if (fVerbose)
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "\t"<< ">> Pushing to *secondary* list --> ";
|
||||
G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
|
||||
<< " -- ";
|
||||
G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
|
||||
<< "\t";
|
||||
G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
|
||||
<< G4endl;
|
||||
}
|
||||
#endif
|
||||
PushTo(track, PriorityList::SecondariesList);
|
||||
}
|
||||
else // globalTime < fGlobalTime already taken into account above
|
||||
@@ -575,7 +621,7 @@ void G4ITTrackHolder::_PushTrack(G4Track* track)
|
||||
void G4ITTrackHolder::PushDelayed(G4Track* track)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if (fVerbose > 5)
|
||||
if (fVerbose)
|
||||
{
|
||||
G4cout << "\t" << ">> Pushing a delayed track" << G4endl;
|
||||
}
|
||||
@@ -651,14 +697,14 @@ void G4ITTrackHolder::KillTracks()
|
||||
{
|
||||
if (fToBeKilledList.size() == 0) return;
|
||||
#ifdef G4VERBOSE
|
||||
if (fVerbose > 5)
|
||||
if (fVerbose > 1)
|
||||
{
|
||||
G4cout << "*** G4ITTrackHolder::KillTracks , step #"
|
||||
// << G4MIWorldEngine::Instance()->GetScheduler()->GetNbSteps()
|
||||
<< G4VScheduler::Instance()->GetNbSteps() << " ***" << G4endl;
|
||||
<< G4VScheduler::Instance()->GetNbSteps()
|
||||
<< " ***" << G4endl;
|
||||
G4cout << "Nb of tracks to kill "<< fToBeKilledList.size() << G4endl;
|
||||
G4cout << setw(25) << left << "#Name"
|
||||
<< setw(25) << "track ID"<< G4endl;
|
||||
<< setw(25) << "track ID"<< G4endl;
|
||||
|
||||
G4TrackList::iterator it = fToBeKilledList.begin();
|
||||
for(; it != fToBeKilledList.end();)
|
||||
@@ -747,6 +793,16 @@ bool G4ITTrackHolder::AddWatcher(Key id,
|
||||
return true;
|
||||
}
|
||||
|
||||
void G4ITTrackHolder::AddWatcherForMainList(G4TrackList::Watcher* watcher)
|
||||
{
|
||||
fAllMainList.AddGlobalWatcher(watcher);
|
||||
}
|
||||
|
||||
void G4ITTrackHolder::AddWatcherForKillList(G4TrackList::Watcher* watcher)
|
||||
{
|
||||
watcher->Watch(&fToBeKilledList);
|
||||
}
|
||||
|
||||
void G4ITTrackHolder::PushToMaster(G4Track* track)
|
||||
{
|
||||
G4ITTrackHolder* trackHolder = MasterInstance();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITTrackingInteractivity.cc 85244 2014-10-27 08:24:13Z gcosmo $
|
||||
// $Id: G4ITTrackingInteractivity.cc 91584 2015-07-27 13:01:48Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -35,6 +35,7 @@
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include <G4ITSteppingVerbose.hh>
|
||||
#include "G4ITTrackingInteractivity.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4String.hh"
|
||||
@@ -60,3 +61,35 @@ void G4ITTrackingInteractivity::TrackBanner(G4Track* track, const G4String& mess
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4ITTrackingInteractivity::G4ITTrackingInteractivity(G4VITSteppingVerbose* verbose)
|
||||
{
|
||||
fVerboseLevel = 0;
|
||||
if(verbose)
|
||||
{
|
||||
fpVerbose = verbose;
|
||||
}
|
||||
else
|
||||
{
|
||||
fpVerbose = new G4ITSteppingVerbose();
|
||||
}
|
||||
}
|
||||
|
||||
void G4ITTrackingInteractivity::SetSteppingVerboseLevel(G4int level)
|
||||
{
|
||||
fpVerbose->SetVerbose(level);
|
||||
}
|
||||
|
||||
//void G4ITTrackingInteractivity::StartTracking(G4Track* track)
|
||||
//{
|
||||
// fpVerbose->TrackingStarted(track);
|
||||
//}
|
||||
//
|
||||
//void G4ITTrackingInteractivity::EndTracking(G4Track* track)
|
||||
//{
|
||||
// fpVerbose->TrackingEnded(track);
|
||||
//}
|
||||
|
||||
G4int G4ITTrackingInteractivity::GetSteppingVerboseLevel() const
|
||||
{
|
||||
return fpVerbose->GetVerbose();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITTrackingManager.cc 85244 2014-10-27 08:24:13Z gcosmo $
|
||||
// $Id: G4ITTrackingManager.cc 91584 2015-07-27 13:01:48Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "G4IT.hh"
|
||||
#include "G4TrackingInformation.hh"
|
||||
#include "G4ITTrackingInteractivity.hh"
|
||||
#include "G4VITSteppingVerbose.hh"
|
||||
#include "G4ITTrackHolder.hh"
|
||||
|
||||
G4ITTrackingManager::G4ITTrackingManager()
|
||||
{
|
||||
@@ -57,7 +59,13 @@ G4ITTrackingManager::~G4ITTrackingManager()
|
||||
//___________________________________________________
|
||||
void G4ITTrackingManager::StartTracking(G4Track* track)
|
||||
{
|
||||
if (fpTrackingInteractivity) fpTrackingInteractivity->StartTracking(track);
|
||||
if (fpTrackingInteractivity)
|
||||
{
|
||||
fpTrackingInteractivity->StartTracking(track);
|
||||
#ifdef G4VERBOSE
|
||||
fpTrackingInteractivity->GetSteppingVerbose()->TrackingStarted(track);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Inform beginning of tracking to physics processes
|
||||
track->GetDefinition()->GetProcessManager()->StartTracking(track);
|
||||
@@ -81,5 +89,24 @@ void G4ITTrackingManager::SetInteractivity(G4ITTrackingInteractivity* iteractivi
|
||||
//___________________________________________________
|
||||
void G4ITTrackingManager::EndTracking(G4Track* track)
|
||||
{
|
||||
if (fpTrackingInteractivity) fpTrackingInteractivity->EndTracking(track);
|
||||
if (fpTrackingInteractivity)
|
||||
{
|
||||
fpTrackingInteractivity->EndTracking(track);
|
||||
#ifdef G4VERBOSE
|
||||
fpTrackingInteractivity->GetSteppingVerbose()->TrackingEnded(track);
|
||||
#endif
|
||||
}
|
||||
G4TrackList::Pop(track);
|
||||
G4ITTrackHolder::Instance()->PushToKill(track);
|
||||
}
|
||||
|
||||
void G4ITTrackingManager::EndTrackingWOKill(G4Track* track)
|
||||
{
|
||||
if (fpTrackingInteractivity)
|
||||
{
|
||||
fpTrackingInteractivity->EndTracking(track);
|
||||
#ifdef G4VERBOSE
|
||||
fpTrackingInteractivity->GetSteppingVerbose()->TrackingEnded(track);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ITTransportation.cc 87375 2014-12-02 08:17:28Z gcosmo $
|
||||
// $Id: G4ITTransportation.cc 94289 2015-11-11 08:33:40Z gcosmo $
|
||||
//
|
||||
/// \brief This class is a slightly modified version of G4Transportation
|
||||
/// initially written by John Apostolakis and colleagues
|
||||
@@ -56,6 +56,8 @@
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4ITTransportation.hh"
|
||||
#include "G4IT.hh"
|
||||
#include "G4TrackingInformation.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4ITTransportationManager.hh"
|
||||
@@ -73,8 +75,12 @@
|
||||
|
||||
class G4VSensitiveDetector;
|
||||
|
||||
#ifndef PrepareState
|
||||
#define PrepareState() G4ITTransportationState* __state = this->GetState<G4ITTransportationState>();
|
||||
#endif
|
||||
|
||||
#ifndef State
|
||||
#define State(theXInfo) (GetState<G4ITTransportationState>()->theXInfo)
|
||||
#define State(theXInfo) (__state->theXInfo)
|
||||
#endif
|
||||
|
||||
//#define DEBUG_MEM
|
||||
@@ -167,9 +173,9 @@ G4ITTransportation::G4ITTransportation(const G4ITTransportation& right) :
|
||||
fInstantiateProcessState = right.fInstantiateProcessState;
|
||||
}
|
||||
|
||||
G4ITTransportation& G4ITTransportation::operator=(const G4ITTransportation& right)
|
||||
G4ITTransportation& G4ITTransportation::operator=(const G4ITTransportation& /*right*/)
|
||||
{
|
||||
if (this == &right) return *this;
|
||||
// if (this == &right) return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -250,6 +256,7 @@ AlongStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double& currentSafety,
|
||||
G4GPILSelection* selection)
|
||||
{
|
||||
PrepareState()
|
||||
G4double geometryStepLength(-1.0), newSafety(-1.0);
|
||||
|
||||
State(fParticleIsLooping) = false;
|
||||
@@ -643,6 +650,7 @@ void G4ITTransportation::ComputeStep(const G4Track& track,
|
||||
const double timeStep,
|
||||
double& oPhysicalStep)
|
||||
{
|
||||
PrepareState()
|
||||
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
|
||||
G4ThreeVector startMomentumDir = pParticle->GetMomentumDirection();
|
||||
G4ThreeVector startPosition = track.GetPosition();
|
||||
@@ -690,6 +698,8 @@ G4VParticleChange* G4ITTransportation::AlongStepDoIt(const G4Track& track,
|
||||
mem_first = MemoryUsage();
|
||||
#endif
|
||||
|
||||
PrepareState()
|
||||
|
||||
// G4cout << "G4ITTransportation::AlongStepDoIt" << G4endl;
|
||||
// set pdefOpticalPhoton
|
||||
// Andrea Dotti: the following statement should be in a single line:
|
||||
@@ -862,6 +872,8 @@ G4VParticleChange* G4ITTransportation::PostStepDoIt(const G4Track& track,
|
||||
const G4Step&)
|
||||
{
|
||||
// G4cout << "G4ITTransportation::PostStepDoIt" << G4endl;
|
||||
|
||||
PrepareState()
|
||||
G4TouchableHandle retCurrentTouchable; // The one to return
|
||||
G4bool isLastStep = false;
|
||||
|
||||
@@ -1073,9 +1085,11 @@ void G4ITTransportation::StartTracking(G4Track* track)
|
||||
|
||||
// Update the current touchable handle (from the track's)
|
||||
//
|
||||
PrepareState()
|
||||
State(fCurrentTouchableHandle) = track->GetTouchableHandle();
|
||||
|
||||
G4VITProcess::StartTracking(track);
|
||||
}
|
||||
|
||||
#undef State
|
||||
#undef PrepareState
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4KDTreeResult.cc 80151 2014-04-03 09:42:22Z gcosmo $
|
||||
// $Id: G4KDTreeResult.cc 91584 2015-07-27 13:01:48Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -65,6 +65,8 @@ private:
|
||||
ResNode& operator=(const ResNode& rhs)
|
||||
{
|
||||
if(this == &rhs) return *this;
|
||||
fNode = rhs.fNode;
|
||||
fDistanceSqr= rhs.fDistanceSqr;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
@@ -85,9 +87,9 @@ G4KDTreeResult::~G4KDTreeResult()
|
||||
std::list<ResNode>::erase(begin(),end());
|
||||
}
|
||||
|
||||
void G4KDTreeResult::Insert(double pos, G4KDNode_Base* node)
|
||||
void G4KDTreeResult::Insert(double dis_sq, G4KDNode_Base* node)
|
||||
{
|
||||
std::list<ResNode>::push_back(ResNode(pos,node));
|
||||
std::list<ResNode>::push_back(ResNode(dis_sq,node));
|
||||
}
|
||||
|
||||
void G4KDTreeResult::Clear()
|
||||
|
||||
@@ -48,52 +48,53 @@
|
||||
namespace G4MemStat
|
||||
{
|
||||
|
||||
using std::ios_base;
|
||||
using std::ifstream;
|
||||
using std::string;
|
||||
using std::ios_base;
|
||||
using std::ifstream;
|
||||
using std::string;
|
||||
|
||||
MemStat MemoryUsage()
|
||||
{
|
||||
MemStat output;
|
||||
MemStat MemoryUsage()
|
||||
{
|
||||
MemStat output;
|
||||
|
||||
#if ( defined(__MACH__) && defined(__clang__) && defined(__x86_64__) ) || \
|
||||
( defined(__MACH__) && defined(__GNUC__) && __GNUC__>=4 && __GNUC_MINOR__>=7 ) || \
|
||||
defined(__linux__) || defined(_AIX)
|
||||
|
||||
// 'file' stat seems to give the most reliable results
|
||||
//
|
||||
ifstream stat_stream("/proc/self/stat",ios_base::in);
|
||||
// 'file' stat seems to give the most reliable results
|
||||
//
|
||||
ifstream stat_stream("/proc/self/stat", ios_base::in);
|
||||
|
||||
// dummy vars for leading entries in stat that we don't care about
|
||||
//
|
||||
string pid, comm, state, ppid, pgrp, session, tty_nr;
|
||||
string tpgid, flags, minflt, cminflt, majflt, cmajflt;
|
||||
string utime, stime, cutime, cstime, priority, nice;
|
||||
string O, itrealvalue, starttime;
|
||||
// dummy vars for leading entries in stat that we don't care about
|
||||
//
|
||||
string pid, comm, state, ppid, pgrp, session, tty_nr;
|
||||
string tpgid, flags, minflt, cminflt, majflt, cmajflt;
|
||||
string utime, stime, cutime, cstime, priority, nice;
|
||||
string O, itrealvalue, starttime;
|
||||
|
||||
// the two fields we want
|
||||
//
|
||||
unsigned long vsize;
|
||||
long rss;
|
||||
// the two fields we want
|
||||
//
|
||||
unsigned long vsize;
|
||||
long rss;
|
||||
|
||||
stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr
|
||||
>> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt
|
||||
>> utime >> stime >> cutime >> cstime >> priority >> nice
|
||||
>> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest
|
||||
stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr
|
||||
>> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt >> utime
|
||||
>> stime >> cutime >> cstime >> priority >> nice >> O >> itrealvalue
|
||||
>> starttime >> vsize >> rss; // don't care about the rest
|
||||
|
||||
stat_stream.close();
|
||||
stat_stream.close();
|
||||
|
||||
long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
|
||||
output.vmz = vsize / 1024.0;
|
||||
output.mem = rss * page_size_kb;
|
||||
long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
|
||||
output.vmz = vsize / 1024.0;
|
||||
output.mem = rss * page_size_kb;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream &os, const MemStat& memStat)
|
||||
{
|
||||
return os << "( vmz: "<< memStat.vmz << ", " << "mem: " << memStat.mem << ")" ;
|
||||
}
|
||||
std::ostream & operator<<(std::ostream &os, const MemStat& memStat)
|
||||
{
|
||||
return os << "( vmz: " << memStat.vmz << ", " << "mem: " << memStat.mem
|
||||
<< ")";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4TrackList.cc 87454 2014-12-04 14:54:12Z gcosmo $
|
||||
// $Id: G4TrackList.cc 93616 2015-10-27 08:59:17Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -180,7 +180,7 @@ G4FastList<G4Track>* G4FastList<G4Track>::GetList(G4Track* __track)
|
||||
G4FastListNode<G4Track>* __trackListNode = __IT->GetListNode();
|
||||
|
||||
if(__trackListNode == 0) return 0;
|
||||
if(__trackListNode->fListRef == 0) return 0;
|
||||
if(__trackListNode->fListRef == nullptr) return 0;
|
||||
|
||||
return __trackListNode->fListRef->fpList;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4TrackingInformation.cc 80151 2014-04-03 09:42:22Z gcosmo $
|
||||
// $Id: G4TrackingInformation.cc 88348 2015-02-16 08:43:34Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -104,7 +104,7 @@ G4TrackingInformation& G4TrackingInformation::operator=(const G4TrackingInformat
|
||||
// return fProcessState[index];
|
||||
//}
|
||||
|
||||
G4::shared_ptr<G4ProcessState_Lock> G4TrackingInformation::GetProcessState(size_t index)
|
||||
G4shared_ptr<G4ProcessState_Lock> G4TrackingInformation::GetProcessState(size_t index)
|
||||
{
|
||||
if(index> G4VITProcess::GetMaxProcessIndex())
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4UserTimeStepAction.cc 85244 2014-10-27 08:24:13Z gcosmo $
|
||||
// $Id: G4UserTimeStepAction.cc 94289 2015-11-11 08:33:40Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara@cenbg.in2p3.fr)
|
||||
//
|
||||
@@ -44,9 +44,9 @@ G4UserTimeStepAction::~G4UserTimeStepAction()
|
||||
|
||||
G4UserTimeStepAction::G4UserTimeStepAction(const G4UserTimeStepAction& /*other*/){;}
|
||||
|
||||
G4UserTimeStepAction& G4UserTimeStepAction::operator=(const G4UserTimeStepAction& rhs)
|
||||
G4UserTimeStepAction& G4UserTimeStepAction::operator=(const G4UserTimeStepAction& /*rhs*/)
|
||||
{
|
||||
if (this == &rhs) return *this;
|
||||
// if (this == &rhs) return *this;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VITDiscreteProcess.cc 71231 2013-06-12 13:06:28Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// History: first implementation, based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// --------------------------------------------------------------
|
||||
// New Physics scheme 8 Jan. 1997 H.Kurahige
|
||||
// ------------------------------------------------------------
|
||||
|
||||
#include "G4VITDiscreteProcess.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
G4VITDiscreteProcess::G4VITDiscreteProcess() :
|
||||
G4VITProcess("No Name Discrete Process")
|
||||
{
|
||||
G4Exception("G4VDiscreteProcess::G4VDiscreteProcess()",
|
||||
"ProcMan102",
|
||||
JustWarning,
|
||||
"Default constructor is called");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4VITDiscreteProcess::G4VITDiscreteProcess(const G4String& aName,
|
||||
G4ProcessType aType) :
|
||||
G4VITProcess(aName, aType)
|
||||
{
|
||||
enableAtRestDoIt = false;
|
||||
enableAlongStepDoIt = false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4VITDiscreteProcess::~G4VITDiscreteProcess()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4VITDiscreteProcess::G4VITDiscreteProcess(G4VITDiscreteProcess& right) :
|
||||
G4VITProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4double
|
||||
G4VITDiscreteProcess::
|
||||
PostStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
if((previousStepSize < 0.0)
|
||||
|| (fpState->theNumberOfInteractionLengthLeft <= 0.0))
|
||||
{
|
||||
// beginning of tracking (or just after DoIt of this process)
|
||||
ResetNumberOfInteractionLengthLeft();
|
||||
} else if(previousStepSize > 0.0)
|
||||
{
|
||||
// subtract NumberOfInteractionLengthLeft
|
||||
SubtractNumberOfInteractionLengthLeft(previousStepSize);
|
||||
} else
|
||||
{
|
||||
// zero step
|
||||
// DO NOTHING
|
||||
}
|
||||
|
||||
// condition is set to "Not Forced"
|
||||
*condition = NotForced;
|
||||
|
||||
// get mean free path
|
||||
fpState->currentInteractionLength = GetMeanFreePath(track,
|
||||
previousStepSize,
|
||||
condition);
|
||||
|
||||
G4double value;
|
||||
if(fpState->currentInteractionLength < DBL_MAX)
|
||||
{
|
||||
value = fpState->theNumberOfInteractionLengthLeft
|
||||
* fpState->currentInteractionLength;
|
||||
} else
|
||||
{
|
||||
value = DBL_MAX;
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if(verboseLevel > 1)
|
||||
{
|
||||
G4cout << "G4VDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
||||
G4cout << "[ " << GetProcessName() << "]" << G4endl;
|
||||
track.GetDynamicParticle()->DumpInfo();
|
||||
G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl;
|
||||
G4cout << "InteractionLength= " << value / cm << "[cm] " << G4endl;
|
||||
}
|
||||
#endif
|
||||
return value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
G4VParticleChange* G4VITDiscreteProcess::PostStepDoIt(const G4Track&,
|
||||
const G4Step&)
|
||||
{
|
||||
// clear NumberOfInteractionLengthLeft
|
||||
ClearNumberOfInteractionLengthLeft();
|
||||
|
||||
return pParticleChange;
|
||||
}
|
||||
@@ -23,35 +23,36 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VITProcess.cc 80151 2014-04-03 09:42:22Z gcosmo $
|
||||
// $Id: G4VITProcess.cc 94218 2015-11-09 08:24:48Z gcosmo $
|
||||
//
|
||||
#include "G4VITProcess.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4IT.hh"
|
||||
#include "G4TrackingInformation.hh"
|
||||
|
||||
/*G4ThreadLocal*/ size_t *G4VITProcess::fNbProcess = 0;
|
||||
/*G4ThreadLocal*/size_t *G4VITProcess::fNbProcess = 0;
|
||||
|
||||
G4VITProcess::G4VITProcess(const G4String& name, G4ProcessType type) :
|
||||
G4VProcess( name, type )
|
||||
G4VProcess(name, type)
|
||||
// fpState (0)//,
|
||||
//fProcessID(fNbProcess)
|
||||
{
|
||||
fpState.reset();
|
||||
if (!fNbProcess) fNbProcess = new size_t (0);
|
||||
fProcessID = *fNbProcess;
|
||||
(*fNbProcess)++;
|
||||
SetInstantiateProcessState(true);
|
||||
currentInteractionLength = 0;
|
||||
theInteractionTimeLeft = 0;
|
||||
theNumberOfInteractionLengthLeft = 0;
|
||||
fProposesTimeStep = false;
|
||||
fpState.reset();
|
||||
if(!fNbProcess) fNbProcess = new size_t(0);
|
||||
fProcessID = *fNbProcess;
|
||||
(*fNbProcess)++;
|
||||
SetInstantiateProcessState(true);
|
||||
currentInteractionLength = 0;
|
||||
theInteractionTimeLeft = 0;
|
||||
theNumberOfInteractionLengthLeft = 0;
|
||||
fProposesTimeStep = false;
|
||||
}
|
||||
|
||||
G4VITProcess::G4ProcessState::G4ProcessState()
|
||||
{
|
||||
theNumberOfInteractionLengthLeft = -1.0 ;
|
||||
theInteractionTimeLeft = -1.0 ;
|
||||
currentInteractionLength = -1.0 ;
|
||||
theNumberOfInteractionLengthLeft = -1.0;
|
||||
theInteractionTimeLeft = -1.0;
|
||||
currentInteractionLength = -1.0;
|
||||
}
|
||||
|
||||
G4VITProcess::G4ProcessState::~G4ProcessState()
|
||||
@@ -59,42 +60,43 @@ G4VITProcess::G4ProcessState::~G4ProcessState()
|
||||
|
||||
G4VITProcess::~G4VITProcess()
|
||||
{
|
||||
//dtor
|
||||
// As the owner, G4IT should delete fProcessState
|
||||
//dtor
|
||||
// As the owner, G4IT should delete fProcessState
|
||||
}
|
||||
|
||||
G4VITProcess::G4VITProcess(const G4VITProcess& other) : G4VProcess(other), fProcessID(other.fProcessID)
|
||||
G4VITProcess::G4VITProcess(const G4VITProcess& other) :
|
||||
G4VProcess(other), fProcessID(other.fProcessID)
|
||||
{
|
||||
//copy ctor
|
||||
//fpState = 0 ;
|
||||
currentInteractionLength = 0;
|
||||
theInteractionTimeLeft = 0;
|
||||
theNumberOfInteractionLengthLeft = 0;
|
||||
fInstantiateProcessState = other.fInstantiateProcessState;
|
||||
fProposesTimeStep = other.fProposesTimeStep;
|
||||
//copy ctor
|
||||
//fpState = 0 ;
|
||||
currentInteractionLength = 0;
|
||||
theInteractionTimeLeft = 0;
|
||||
theNumberOfInteractionLengthLeft = 0;
|
||||
fInstantiateProcessState = other.fInstantiateProcessState;
|
||||
fProposesTimeStep = other.fProposesTimeStep;
|
||||
}
|
||||
|
||||
G4VITProcess& G4VITProcess::operator=(const G4VITProcess& rhs)
|
||||
{
|
||||
if (this == &rhs) return *this; // handle self assignment
|
||||
//assignment operator
|
||||
return *this;
|
||||
if (this == &rhs) return *this; // handle self assignment
|
||||
//assignment operator
|
||||
return *this;
|
||||
}
|
||||
|
||||
void G4VITProcess::StartTracking(G4Track* track)
|
||||
{
|
||||
G4TrackingInformation* trackingInfo = GetIT(track)->GetTrackingInfo();
|
||||
if(InstantiateProcessState())
|
||||
{
|
||||
// fpState = new G4ProcessState();
|
||||
fpState.reset(new G4ProcessState());
|
||||
}
|
||||
G4TrackingInformation* trackingInfo = GetIT(track)->GetTrackingInfo();
|
||||
if(InstantiateProcessState())
|
||||
{
|
||||
// fpState = new G4ProcessState();
|
||||
fpState.reset(new G4ProcessState());
|
||||
}
|
||||
|
||||
theNumberOfInteractionLengthLeft = &(fpState->theNumberOfInteractionLengthLeft );
|
||||
theInteractionTimeLeft = &(fpState->theInteractionTimeLeft );
|
||||
currentInteractionLength = &(fpState->currentInteractionLength );
|
||||
trackingInfo->RecordProcessState(fpState,fProcessID);
|
||||
// fpState = 0;
|
||||
fpState.reset();
|
||||
theNumberOfInteractionLengthLeft = &(fpState->theNumberOfInteractionLengthLeft );
|
||||
theInteractionTimeLeft = &(fpState->theInteractionTimeLeft );
|
||||
currentInteractionLength = &(fpState->currentInteractionLength );
|
||||
trackingInfo->RecordProcessState(fpState,fProcessID);
|
||||
// fpState = 0;
|
||||
fpState.reset();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VITRestDiscreteProcess.cc 64057 2012-10-30 15:04:49Z gcosmo $
|
||||
// $Id: G4VITRestDiscreteProcess.cc 93883 2015-11-03 08:25:04Z gcosmo $
|
||||
//
|
||||
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
|
||||
//
|
||||
@@ -52,7 +52,7 @@ G4VITRestDiscreteProcess::~G4VITRestDiscreteProcess()
|
||||
{
|
||||
}
|
||||
|
||||
G4VITRestDiscreteProcess::G4VITRestDiscreteProcess(G4VITRestDiscreteProcess& right)
|
||||
G4VITRestDiscreteProcess::G4VITRestDiscreteProcess(const G4VITRestDiscreteProcess& right)
|
||||
: G4VITProcess(right)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/*
|
||||
* G4VITSteppingVerbose.cc
|
||||
*
|
||||
* Created on: Jun 22, 2015
|
||||
* Author: mkaramit
|
||||
*/
|
||||
|
||||
#include <G4VITSteppingVerbose.hh>
|
||||
#include <G4UIcmdWithAnInteger.hh>
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
G4VITSteppingVerbose::G4VITSteppingVerbose()
|
||||
{
|
||||
fpStepProcessor = 0;
|
||||
fpState = 0;
|
||||
fpProcessGeneralInfo = 0;
|
||||
|
||||
PhysicalStep = -1;
|
||||
fStepStatus = fUndefined;
|
||||
|
||||
fParticleChange = 0;
|
||||
fTrack = 0;
|
||||
fSecondary = 0;
|
||||
fStep = 0;
|
||||
fPreStepPoint = 0;
|
||||
fPostStepPoint = 0;
|
||||
|
||||
fCurrentVolume = 0;
|
||||
// fSensitive = fpStepProcessor->GetfSensitive();
|
||||
fCurrentProcess = 0;
|
||||
|
||||
fAtRestDoItVector = 0;
|
||||
fAlongStepDoItVector = 0;
|
||||
fPostStepDoItVector = 0;
|
||||
|
||||
fAtRestGetPhysIntVector = 0;
|
||||
fAlongStepGetPhysIntVector = 0;
|
||||
fPostStepGetPhysIntVector = 0;
|
||||
|
||||
MAXofAtRestLoops = 0;
|
||||
MAXofAlongStepLoops = 0;
|
||||
MAXofPostStepLoops = 0;
|
||||
|
||||
fAtRestDoItProcTriggered = 0;
|
||||
fPostStepDoItProcTriggered = 0;
|
||||
|
||||
fN2ndariesAtRestDoIt = 0;
|
||||
fN2ndariesAlongStepDoIt = 0;
|
||||
fN2ndariesPostStepDoIt = 0;
|
||||
|
||||
// fNavigator = fpStepProcessor->GetfNavigator();
|
||||
|
||||
fVerboseLevel = 0;
|
||||
fpVerboseUI = new G4UIcmdWithAnInteger("/chem/tracking/verbose", this);
|
||||
|
||||
fSelectedAtRestDoItVector = 0;
|
||||
fSelectedPostStepDoItVector = 0;
|
||||
|
||||
fPreviousStepSize = 0.;
|
||||
|
||||
fTouchableHandle = 0;
|
||||
|
||||
// StepControlFlag = fpStepProcessor->GetStepControlFlag();
|
||||
|
||||
physIntLength = 0;
|
||||
fCondition = InActivated;
|
||||
fGPILSelection = NotCandidateForSelection;
|
||||
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
G4VITSteppingVerbose::~G4VITSteppingVerbose()
|
||||
{
|
||||
if(fpVerboseUI) delete fpVerboseUI;
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
void G4VITSteppingVerbose::CopyState()
|
||||
{
|
||||
|
||||
if(fpState) *fpState = *(fpStepProcessor->GetProcessorState());
|
||||
else
|
||||
{
|
||||
fpState = new G4ITStepProcessorState(*fpStepProcessor->GetProcessorState());
|
||||
}
|
||||
|
||||
fpProcessGeneralInfo = fpStepProcessor->GetCurrentProcessInfo();
|
||||
|
||||
PhysicalStep = fpStepProcessor->GetPhysIntLength();
|
||||
fStepStatus = fpState->fStepStatus;
|
||||
|
||||
fParticleChange = fpStepProcessor->GetParticleChange();
|
||||
fTrack = fpStepProcessor->GetTrack();
|
||||
fSecondary = fpStepProcessor->GetSecondaries();
|
||||
fStep = fpStepProcessor->GetStep();
|
||||
fPreStepPoint = fStep->GetPreStepPoint();
|
||||
fPostStepPoint = fStep->GetPostStepPoint();
|
||||
|
||||
fCurrentVolume = fpStepProcessor->GetCurrentVolume();
|
||||
// fSensitive = fpStepProcessor->GetfSensitive();
|
||||
fCurrentProcess = fpStepProcessor->GetCurrentProcess();
|
||||
|
||||
fAtRestDoItVector = fpProcessGeneralInfo->fpAtRestDoItVector;
|
||||
fAlongStepDoItVector = fpProcessGeneralInfo->fpAlongStepDoItVector;
|
||||
fPostStepDoItVector = fpProcessGeneralInfo->fpPostStepDoItVector;
|
||||
|
||||
fAtRestGetPhysIntVector = fpProcessGeneralInfo->fpAtRestGetPhysIntVector;
|
||||
fAlongStepGetPhysIntVector =
|
||||
fpProcessGeneralInfo->fpAlongStepGetPhysIntVector;
|
||||
fPostStepGetPhysIntVector = fpProcessGeneralInfo->fpPostStepGetPhysIntVector;
|
||||
|
||||
MAXofAtRestLoops = fpProcessGeneralInfo->MAXofAtRestLoops;
|
||||
MAXofAlongStepLoops = fpProcessGeneralInfo->MAXofAlongStepLoops;
|
||||
MAXofPostStepLoops = fpProcessGeneralInfo->MAXofPostStepLoops;
|
||||
|
||||
fAtRestDoItProcTriggered = fpStepProcessor->GetAtRestDoItProcTriggered();
|
||||
fPostStepDoItProcTriggered = fpStepProcessor->GetPostStepDoItProcTriggered();
|
||||
|
||||
fN2ndariesAtRestDoIt = fpStepProcessor->GetN2ndariesAtRestDoIt();
|
||||
fN2ndariesAlongStepDoIt = fpStepProcessor->GetN2ndariesAlongStepDoIt();
|
||||
fN2ndariesPostStepDoIt = fpStepProcessor->GetN2ndariesPostStepDoIt();
|
||||
|
||||
// fNavigator = fpStepProcessor->GetfNavigator();
|
||||
|
||||
fSelectedAtRestDoItVector = &(fpState->fSelectedAtRestDoItVector);
|
||||
fSelectedPostStepDoItVector = &(fpState->fSelectedPostStepDoItVector);
|
||||
|
||||
fPreviousStepSize = fpState->fPreviousStepSize;
|
||||
|
||||
fTouchableHandle = fpState->fTouchableHandle;
|
||||
|
||||
// StepControlFlag = fpStepProcessor->GetStepControlFlag();
|
||||
|
||||
physIntLength = fpStepProcessor->GetPhysIntLength();
|
||||
fCondition = fpStepProcessor->GetCondition();
|
||||
fGPILSelection = fpStepProcessor->GetGPILSelection();
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
void G4VITSteppingVerbose::SetNewValue(G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if(command == fpVerboseUI)
|
||||
{
|
||||
fVerboseLevel = fpVerboseUI->GetNewIntValue(newValue);
|
||||
}
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
G4String G4VITSteppingVerbose::GetCurrentValue(G4UIcommand* command)
|
||||
{
|
||||
return command->ConvertToString(fVerboseLevel);
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
void G4VITSteppingVerbose::TrackingStarted(G4Track*
|
||||
#ifdef G4VERBOSE
|
||||
track
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if(fVerboseLevel > 0)
|
||||
{
|
||||
TrackBanner(track, "G4ITTrackingManager::StartTracking : ");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
void G4VITSteppingVerbose::TrackingEnded(G4Track*
|
||||
#ifdef G4VERBOSE
|
||||
track
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if(fVerboseLevel > 0)
|
||||
{
|
||||
TrackBanner(track, "G4ITTrackingManager::EndTracking : ");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//______________________________________________________________________________
|
||||
|
||||
void G4VITSteppingVerbose::TrackBanner(G4Track* track, const G4String& message)
|
||||
{
|
||||
G4cout << G4endl;
|
||||
G4cout << "*******************************************************"
|
||||
<< "**************************************************"
|
||||
<< G4endl;
|
||||
if(message != "")
|
||||
{
|
||||
G4cout << message;
|
||||
}
|
||||
G4cout << " * G4Track Information: "
|
||||
<< " Particle : " << track->GetDefinition()->GetParticleName()
|
||||
<< ","
|
||||
<< " Track ID : " << track->GetTrackID()
|
||||
<< ","
|
||||
<< " Parent ID : " << track->GetParentID()
|
||||
<< G4endl;
|
||||
G4cout << "*******************************************************"
|
||||
<< "**************************************************"
|
||||
<< G4endl;
|
||||
G4cout << G4endl;
|
||||
}
|
||||
Reference in New Issue
Block a user