Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -24,311 +24,320 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "G4EnergySplitter.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4RegularNavigationHelper.hh"
|
||||
#include "G4EnergyLossForExtrapolator.hh"
|
||||
|
||||
#include "G4EmCalculator.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4EnergyLossForExtrapolator.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4RegularNavigationHelper.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VSolid.hh"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// (Description)
|
||||
//
|
||||
// Created:
|
||||
//
|
||||
// Created:
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
G4EnergySplitter::G4EnergySplitter()
|
||||
{
|
||||
theElossExt = new G4EnergyLossForExtrapolator(0);
|
||||
thePhantomParam = 0;
|
||||
theNIterations = 2;
|
||||
theElossExt = new G4EnergyLossForExtrapolator(0);
|
||||
thePhantomParam = nullptr;
|
||||
theNIterations = 2;
|
||||
}
|
||||
|
||||
G4EnergySplitter::~G4EnergySplitter()
|
||||
{
|
||||
delete theElossExt;
|
||||
delete theElossExt;
|
||||
}
|
||||
|
||||
G4int G4EnergySplitter::SplitEnergyInVolumes(const G4Step* aStep )
|
||||
G4int G4EnergySplitter::SplitEnergyInVolumes(const G4Step* aStep)
|
||||
{
|
||||
theEnergies.clear();
|
||||
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
G4bool verbose = 1;
|
||||
if( verbose ) G4cout << "G4EnergySplitter::SplitEnergyInVolumes totalEdepo " << aStep->GetTotalEnergyDeposit()
|
||||
<< " Nsteps " << G4RegularNavigationHelper::Instance()->GetStepLengths().size() << G4endl;
|
||||
#endif
|
||||
if( G4RegularNavigationHelper::Instance()->GetStepLengths().size() == 0 ||
|
||||
aStep->GetTrack()->GetDefinition()->GetPDGCharge() == 0) { // we are only counting dose deposit
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes totalEdepo " << aStep->GetTotalEnergyDeposit()
|
||||
<< " Nsteps " << G4RegularNavigationHelper::Instance()->GetStepLengths().size()
|
||||
<< G4endl;
|
||||
#endif
|
||||
if (G4RegularNavigationHelper::Instance()->GetStepLengths().empty()
|
||||
|| aStep->GetTrack()->GetDefinition()->GetPDGCharge() == 0)
|
||||
{ // we are only counting dose deposit
|
||||
return (G4int)theEnergies.size();
|
||||
}
|
||||
if( G4RegularNavigationHelper::Instance()->GetStepLengths().size() == 1 ) {
|
||||
if (G4RegularNavigationHelper::Instance()->GetStepLengths().size() == 1) {
|
||||
theEnergies.push_back(edep);
|
||||
return (G4int)theEnergies.size();
|
||||
}
|
||||
|
||||
if( !thePhantomParam ) GetPhantomParam(TRUE);
|
||||
|
||||
if( aStep == 0 ) return FALSE; // it is 0 when called by GmScoringMgr after last event
|
||||
|
||||
//----- Distribute energy deposited in voxels
|
||||
std::vector< std::pair<G4int,G4double> > rnsl = G4RegularNavigationHelper::Instance()->GetStepLengths();
|
||||
if (thePhantomParam == nullptr) GetPhantomParam(true);
|
||||
|
||||
if (aStep == nullptr) return false; // it is 0 when called by GmScoringMgr after last event
|
||||
|
||||
//----- Distribute energy deposited in voxels
|
||||
std::vector<std::pair<G4int, G4double>> rnsl =
|
||||
G4RegularNavigationHelper::Instance()->GetStepLengths();
|
||||
|
||||
const G4ParticleDefinition* part = aStep->GetTrack()->GetDefinition();
|
||||
G4double kinEnergyPreOrig = aStep->GetPreStepPoint()->GetKineticEnergy();
|
||||
G4double kinEnergyPre = kinEnergyPreOrig;
|
||||
|
||||
|
||||
G4double stepLength = aStep->GetStepLength();
|
||||
G4double slSum = 0.;
|
||||
unsigned int ii;
|
||||
for( ii = 0; ii < rnsl.size(); ++ii ){
|
||||
for (ii = 0; ii < rnsl.size(); ++ii) {
|
||||
G4double sl = rnsl[ii].second;
|
||||
slSum += sl;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter1 step length geom " << sl << G4endl;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter1 step length geom "
|
||||
<< sl << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if( verbose )
|
||||
G4cout << "G4EnergySplitter RN: step length geom TOTAL " << slSum
|
||||
<< " true TOTAL " << stepLength
|
||||
<< " ratio " << stepLength/slSum
|
||||
<< " Energy " << aStep->GetPreStepPoint()->GetKineticEnergy()
|
||||
<< " Material " << aStep->GetPreStepPoint()->GetMaterial()->GetName()
|
||||
<< " Number of geom steps " << rnsl.size() << G4endl;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter RN: step length geom TOTAL " << slSum << " true TOTAL "
|
||||
<< stepLength << " ratio " << stepLength / slSum << " Energy "
|
||||
<< aStep->GetPreStepPoint()->GetKineticEnergy() << " Material "
|
||||
<< aStep->GetPreStepPoint()->GetMaterial()->GetName() << " Number of geom steps "
|
||||
<< rnsl.size() << G4endl;
|
||||
#endif
|
||||
//----- No iterations to correct elost and msc => distribute energy deposited according to geometrical step length in each voxel
|
||||
if( theNIterations == 0 ) {
|
||||
for( ii = 0; ii < rnsl.size(); ++ii ){
|
||||
//----- No iterations to correct elost and msc => distribute energy deposited according to
|
||||
// geometrical step length in each voxel
|
||||
if (theNIterations == 0) {
|
||||
for (ii = 0; ii < rnsl.size(); ++ii) {
|
||||
G4double sl = rnsl[ii].second;
|
||||
G4double edepStep = edep * sl/slSum; //divide edep along steps, proportional to step length
|
||||
G4double edepStep = edep * sl / slSum; // divide edep along steps, proportional to step
|
||||
// length
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii
|
||||
<< " edep " << edepStep << G4endl;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " edep " << edepStep << G4endl;
|
||||
#endif
|
||||
|
||||
|
||||
theEnergies.push_back(edepStep);
|
||||
|
||||
}
|
||||
} else { // 1 or more iterations demanded
|
||||
|
||||
}
|
||||
else { // 1 or more iterations demanded
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
// print corrected energy at iteration 0
|
||||
if(verbose) {
|
||||
// print corrected energy at iteration 0
|
||||
if (verbose) {
|
||||
G4double slSum = 0.;
|
||||
for( ii = 0; ii < rnsl.size(); ++ii ){
|
||||
G4double sl = rnsl[ii].second;
|
||||
slSum += sl;
|
||||
for (ii = 0; ii < rnsl.size(); ++ii) {
|
||||
G4double sl = rnsl[ii].second;
|
||||
slSum += sl;
|
||||
}
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes "<< ii
|
||||
<< " RN: iter0 corrected energy lost " << edep*rnsl[ii].second/slSum
|
||||
<< G4endl;
|
||||
for (ii = 0; ii < rnsl.size(); ii++) {
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes " << ii
|
||||
<< " RN: iter0 corrected energy lost " << edep * rnsl[ii].second / slSum << G4endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
G4double slRatio = stepLength/slSum;
|
||||
G4double slRatio = stepLength / slSum;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes RN: iter 0, step ratio " << slRatio << G4endl;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes RN: iter 0, step ratio " << slRatio
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
|
||||
//--- energy at each interaction
|
||||
G4EmCalculator emcalc;
|
||||
G4double totalELost = 0.;
|
||||
std::vector<G4double> stepLengths;
|
||||
for( G4int iiter = 1; iiter <= theNIterations; ++iiter ) {
|
||||
//--- iter1: distribute true step length in each voxel: geom SL in each voxel is multiplied by a constant so that the sum gives the total true step length
|
||||
if( iiter == 1 ) {
|
||||
for( ii = 0; ii < rnsl.size(); ++ii ){
|
||||
G4double sl = rnsl[ii].second;
|
||||
stepLengths.push_back( sl * slRatio );
|
||||
for (G4int iiter = 1; iiter <= theNIterations; ++iiter) {
|
||||
//--- iter1: distribute true step length in each voxel: geom SL in each voxel is multiplied by
|
||||
// a constant so that the sum gives the total true step length
|
||||
if (iiter == 1) {
|
||||
for (ii = 0; ii < rnsl.size(); ++ii) {
|
||||
G4double sl = rnsl[ii].second;
|
||||
stepLengths.push_back(sl * slRatio);
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter" << iiter << " corrected step length " << sl*slRatio << G4endl;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter" << iiter
|
||||
<< " corrected step length " << sl * slRatio << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
for( ii = 0; ii < rnsl.size(); ++ii ){
|
||||
const G4Material* mate = thePhantomParam->GetMaterial( rnsl[ii].first );
|
||||
G4double dEdx = 0.;
|
||||
if( kinEnergyPre > 0. ) { //t check this
|
||||
dEdx = emcalc.GetDEDX(kinEnergyPre, part, mate);
|
||||
}
|
||||
G4double elost = stepLengths[ii] * dEdx;
|
||||
|
||||
}
|
||||
|
||||
for (ii = 0; ii < rnsl.size(); ++ii) {
|
||||
const G4Material* mate = thePhantomParam->GetMaterial(rnsl[ii].first);
|
||||
G4double dEdx = 0.;
|
||||
if (kinEnergyPre > 0.) { // t check this
|
||||
dEdx = emcalc.GetDEDX(kinEnergyPre, part, mate);
|
||||
}
|
||||
G4double elost = stepLengths[ii] * dEdx;
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter1 energy lost " << elost
|
||||
<< " energy at interaction " << kinEnergyPre
|
||||
<< " = stepLength " << stepLengths[ii]
|
||||
<< " * dEdx " << dEdx << G4endl;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter1 energy lost "
|
||||
<< elost << " energy at interaction " << kinEnergyPre << " = stepLength "
|
||||
<< stepLengths[ii] << " * dEdx " << dEdx << G4endl;
|
||||
#endif
|
||||
kinEnergyPre -= elost;
|
||||
theEnergies.push_back( elost );
|
||||
totalELost += elost;
|
||||
}
|
||||
|
||||
} else{
|
||||
//------ 2nd and other iterations
|
||||
//----- Get step lengths corrected by changing geom2true correction
|
||||
//-- Get ratios for each energy
|
||||
slSum = 0.;
|
||||
kinEnergyPre = kinEnergyPreOrig;
|
||||
for( ii = 0; ii < rnsl.size(); ++ii ){
|
||||
const G4Material* mate = thePhantomParam->GetMaterial( rnsl[ii].first );
|
||||
stepLengths[ii] = theElossExt->TrueStepLength( kinEnergyPre, rnsl[ii].second , mate, part );
|
||||
kinEnergyPre -= theEnergies[ii];
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii
|
||||
<< " RN: iter" << iiter << " step length geom " << stepLengths[ii]
|
||||
<< " geom2true " << rnsl[ii].second / stepLengths[ii] << G4endl;
|
||||
#endif
|
||||
|
||||
slSum += stepLengths[ii];
|
||||
}
|
||||
|
||||
//Correct step lengths so that they sum the total step length
|
||||
G4double slratio = aStep->GetStepLength()/slSum;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter" << iiter << " step ratio " << slRatio << G4endl;
|
||||
#endif
|
||||
for( ii = 0; ii < rnsl.size(); ++ii ){
|
||||
stepLengths[ii] *= slratio;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter" << iiter << " corrected step length " << stepLengths[ii] << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//---- Recalculate energy lost with this new step lengths
|
||||
kinEnergyPre = aStep->GetPreStepPoint()->GetKineticEnergy();
|
||||
totalELost = 0.;
|
||||
for( ii = 0; ii < rnsl.size(); ++ii ){
|
||||
const G4Material* mate = thePhantomParam->GetMaterial( rnsl[ii].first );
|
||||
G4double dEdx = 0.;
|
||||
if( kinEnergyPre > 0. ) {
|
||||
dEdx = emcalc.GetDEDX(kinEnergyPre, part, mate);
|
||||
}
|
||||
G4double elost = stepLengths[ii] * dEdx;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter" << iiter << " energy lost " << elost
|
||||
<< " energy at interaction " << kinEnergyPre
|
||||
<< " = stepLength " << stepLengths[ii]
|
||||
<< " * dEdx " << dEdx << G4endl;
|
||||
#endif
|
||||
kinEnergyPre -= elost;
|
||||
theEnergies[ii] = elost;
|
||||
totalELost += elost;
|
||||
}
|
||||
|
||||
kinEnergyPre -= elost;
|
||||
theEnergies.push_back(elost);
|
||||
totalELost += elost;
|
||||
}
|
||||
}
|
||||
|
||||
//correct energies so that they reproduce the real step energy lost
|
||||
G4double enerRatio = (edep/totalELost);
|
||||
|
||||
else {
|
||||
//------ 2nd and other iterations
|
||||
//----- Get step lengths corrected by changing geom2true correction
|
||||
//-- Get ratios for each energy
|
||||
slSum = 0.;
|
||||
kinEnergyPre = kinEnergyPreOrig;
|
||||
for (ii = 0; ii < rnsl.size(); ++ii) {
|
||||
const G4Material* mate = thePhantomParam->GetMaterial(rnsl[ii].first);
|
||||
stepLengths[ii] = theElossExt->TrueStepLength(kinEnergyPre, rnsl[ii].second, mate, part);
|
||||
kinEnergyPre -= theEnergies[ii];
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter" << iiter << " energy ratio " << enerRatio << G4endl;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter" << iiter
|
||||
<< " step length geom " << stepLengths[ii] << " geom2true "
|
||||
<< rnsl[ii].second / stepLengths[ii] << G4endl;
|
||||
#endif
|
||||
|
||||
|
||||
slSum += stepLengths[ii];
|
||||
}
|
||||
|
||||
// Correct step lengths so that they sum the total step length
|
||||
G4double slratio = aStep->GetStepLength() / slSum;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
G4double elostTot = 0.;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter" << iiter
|
||||
<< " step ratio " << slRatio << G4endl;
|
||||
#endif
|
||||
for( ii = 0; ii < theEnergies.size(); ++ii ){
|
||||
theEnergies[ii] *= enerRatio;
|
||||
for (ii = 0; ii < rnsl.size(); ++ii) {
|
||||
stepLengths[ii] *= slratio;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
elostTot += theEnergies[ii];
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes "<< ii << " RN: iter" << iiter << " corrected energy lost " << theEnergies[ii]
|
||||
<< " orig elost " << theEnergies[ii]/enerRatio
|
||||
<< " energy before interaction " << kinEnergyPreOrig-elostTot+theEnergies[ii]
|
||||
<< " energy after interaction " << kinEnergyPreOrig-elostTot
|
||||
<< G4endl;
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter" << iiter
|
||||
<< " corrected step length " << stepLengths[ii] << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//---- Recalculate energy lost with this new step lengths
|
||||
kinEnergyPre = aStep->GetPreStepPoint()->GetKineticEnergy();
|
||||
totalELost = 0.;
|
||||
for (ii = 0; ii < rnsl.size(); ++ii) {
|
||||
const G4Material* mate = thePhantomParam->GetMaterial(rnsl[ii].first);
|
||||
G4double dEdx = 0.;
|
||||
if (kinEnergyPre > 0.) {
|
||||
dEdx = emcalc.GetDEDX(kinEnergyPre, part, mate);
|
||||
}
|
||||
G4double elost = stepLengths[ii] * dEdx;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter" << iiter
|
||||
<< " energy lost " << elost << " energy at interaction " << kinEnergyPre
|
||||
<< " = stepLength " << stepLengths[ii] << " * dEdx " << dEdx << G4endl;
|
||||
#endif
|
||||
kinEnergyPre -= elost;
|
||||
theEnergies[ii] = elost;
|
||||
totalELost += elost;
|
||||
}
|
||||
}
|
||||
|
||||
// correct energies so that they reproduce the real step energy lost
|
||||
G4double enerRatio = (edep / totalELost);
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter" << iiter
|
||||
<< " energy ratio " << enerRatio << G4endl;
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
G4double elostTot = 0.;
|
||||
#endif
|
||||
for (ii = 0; ii < theEnergies.size(); ++ii) {
|
||||
theEnergies[ii] *= enerRatio;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
elostTot += theEnergies[ii];
|
||||
if (verbose)
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes " << ii << " RN: iter" << iiter
|
||||
<< " corrected energy lost " << theEnergies[ii] << " orig elost "
|
||||
<< theEnergies[ii] / enerRatio << " energy before interaction "
|
||||
<< kinEnergyPreOrig - elostTot + theEnergies[ii] << " energy after interaction "
|
||||
<< kinEnergyPreOrig - elostTot << G4endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return (G4int)theEnergies.size();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void G4EnergySplitter::GetPhantomParam(G4bool mustExist)
|
||||
{
|
||||
G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance();
|
||||
for( auto cite = pvs->cbegin(); cite != pvs->cend(); ++cite ) {
|
||||
// G4cout << " PV " << (*cite)->GetName() << " " << (*cite)->GetTranslation() << G4endl;
|
||||
if( IsPhantomVolume( *cite ) ) {
|
||||
const G4PVParameterised* pvparam = static_cast<const G4PVParameterised*>(*cite);
|
||||
for (const auto pv : *pvs) {
|
||||
if (IsPhantomVolume(pv)) {
|
||||
const auto pvparam = static_cast<const G4PVParameterised*>(pv);
|
||||
G4VPVParameterisation* param = pvparam->GetParameterisation();
|
||||
// if( static_cast<const G4PhantomParameterisation*>(param) ){
|
||||
// if( static_cast<const G4PhantomParameterisation*>(param) ){
|
||||
// G4cout << "G4PhantomParameterisation volume found " << (*cite)->GetName() << G4endl;
|
||||
thePhantomParam = static_cast<G4PhantomParameterisation*>(param);
|
||||
}
|
||||
}
|
||||
|
||||
if( !thePhantomParam && mustExist )
|
||||
G4Exception("G4EnergySplitter::GetPhantomParam",
|
||||
"PhantomParamError", FatalException,
|
||||
|
||||
if ((thePhantomParam == nullptr) && mustExist)
|
||||
G4Exception("G4EnergySplitter::GetPhantomParam", "PhantomParamError", FatalException,
|
||||
"No G4PhantomParameterisation found !");
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
G4bool G4EnergySplitter::IsPhantomVolume( G4VPhysicalVolume* pv )
|
||||
G4bool G4EnergySplitter::IsPhantomVolume(G4VPhysicalVolume* pv)
|
||||
{
|
||||
EAxis axis;
|
||||
G4int nReplicas;
|
||||
G4double width,offset;
|
||||
G4double width, offset;
|
||||
G4bool consuming;
|
||||
pv->GetReplicationData(axis,nReplicas,width,offset,consuming);
|
||||
pv->GetReplicationData(axis, nReplicas, width, offset, consuming);
|
||||
EVolume type = (consuming) ? kReplica : kParameterised;
|
||||
if( type == kParameterised && pv->GetRegularStructureId() == 1 ) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
return type == kParameterised && pv->GetRegularStructureId() == 1;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void G4EnergySplitter::GetLastVoxelID( G4int& voxelID)
|
||||
{
|
||||
void G4EnergySplitter::GetLastVoxelID(G4int& voxelID)
|
||||
{
|
||||
voxelID = (*(G4RegularNavigationHelper::Instance()->GetStepLengths().cbegin())).first;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void G4EnergySplitter::GetFirstVoxelID( G4int& voxelID)
|
||||
void G4EnergySplitter::GetFirstVoxelID(G4int& voxelID)
|
||||
{
|
||||
voxelID = (*(G4RegularNavigationHelper::Instance()->GetStepLengths().crbegin())).first;
|
||||
voxelID = (*(G4RegularNavigationHelper::Instance()->GetStepLengths().crbegin())).first;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void G4EnergySplitter::GetVoxelID( G4int stepNo, G4int& voxelID )
|
||||
void G4EnergySplitter::GetVoxelID(G4int stepNo, G4int& voxelID)
|
||||
{
|
||||
if( stepNo < 0 || stepNo >= G4int(G4RegularNavigationHelper::Instance()->GetStepLengths().size()) ) {
|
||||
G4Exception("G4EnergySplitter::GetVoxelID",
|
||||
"Invalid stepNo, smaller than 0 or bigger or equal to number of voxels traversed",
|
||||
FatalErrorInArgument,
|
||||
G4String("stepNo = " + G4UIcommand::ConvertToString(stepNo) + ", number of voxels = " + G4UIcommand::ConvertToString(G4int(G4RegularNavigationHelper::Instance()->GetStepLengths().size())) ).c_str());
|
||||
if (stepNo < 0 || stepNo >= G4int(G4RegularNavigationHelper::Instance()->GetStepLengths().size()))
|
||||
{
|
||||
G4Exception("G4EnergySplitter::GetVoxelID",
|
||||
"Invalid stepNo, smaller than 0 or bigger or equal to number of voxels traversed",
|
||||
FatalErrorInArgument,
|
||||
G4String("stepNo = " + G4UIcommand::ConvertToString(stepNo)
|
||||
+ ", number of voxels = "
|
||||
+ G4UIcommand::ConvertToString(
|
||||
G4int(G4RegularNavigationHelper::Instance()->GetStepLengths().size())))
|
||||
.c_str());
|
||||
}
|
||||
std::vector< std::pair<G4int,G4double> >::const_iterator ite = G4RegularNavigationHelper::Instance()->GetStepLengths().cbegin();
|
||||
advance( ite, stepNo );
|
||||
auto ite = G4RegularNavigationHelper::Instance()->GetStepLengths().cbegin();
|
||||
advance(ite, stepNo);
|
||||
voxelID = (*ite).first;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void G4EnergySplitter::GetStepLength( G4int stepNo, G4double& stepLength )
|
||||
void G4EnergySplitter::GetStepLength(G4int stepNo, G4double& stepLength)
|
||||
{
|
||||
std::vector< std::pair<G4int,G4double> >::const_iterator ite = G4RegularNavigationHelper::Instance()->GetStepLengths().cbegin();
|
||||
advance( ite, stepNo );
|
||||
auto ite = G4RegularNavigationHelper::Instance()->GetStepLengths().cbegin();
|
||||
advance(ite, stepNo);
|
||||
stepLength = (*ite).second;
|
||||
}
|
||||
|
||||
@@ -27,44 +27,45 @@
|
||||
//
|
||||
//
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4ParallelWorldProcess.hh"
|
||||
#include "G4ParallelWorldProcessStore.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4PathFinder.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
|
||||
#include "G4FieldTrackUpdator.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4ParallelWorldProcessStore.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4PathFinder.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4TransportationProcessType.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4TransportationProcessType.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4ThreadLocal G4Step* G4ParallelWorldProcess::fpHyperStep = nullptr;
|
||||
G4ThreadLocal G4int G4ParallelWorldProcess::nParallelWorlds = 0;
|
||||
G4ThreadLocal G4int G4ParallelWorldProcess::fNavIDHyp = 0;
|
||||
|
||||
G4ThreadLocal G4Step* G4ParallelWorldProcess::fpHyperStep = 0;
|
||||
G4ThreadLocal G4int G4ParallelWorldProcess::nParallelWorlds = 0;
|
||||
G4ThreadLocal G4int G4ParallelWorldProcess::fNavIDHyp = 0;
|
||||
const G4Step* G4ParallelWorldProcess::GetHyperStep()
|
||||
{ return fpHyperStep; }
|
||||
G4int G4ParallelWorldProcess::GetHypNavigatorID()
|
||||
{ return fNavIDHyp; }
|
||||
{
|
||||
return fpHyperStep;
|
||||
}
|
||||
|
||||
G4ParallelWorldProcess::
|
||||
G4ParallelWorldProcess(const G4String& processName,G4ProcessType theType)
|
||||
:G4VProcess(processName,theType),fGhostWorld(nullptr),fGhostNavigator(nullptr),
|
||||
fNavigatorID(-1),fFieldTrack('0'),fGhostSafety(0.),fOnBoundary(false),
|
||||
layeredMaterialFlag(false)
|
||||
G4int G4ParallelWorldProcess::GetHypNavigatorID()
|
||||
{
|
||||
return fNavIDHyp;
|
||||
}
|
||||
|
||||
G4ParallelWorldProcess::G4ParallelWorldProcess(const G4String& processName, G4ProcessType theType)
|
||||
: G4VProcess(processName, theType), fFieldTrack('0')
|
||||
{
|
||||
SetProcessSubType(PARALLEL_WORLD_PROCESS);
|
||||
if(!fpHyperStep) fpHyperStep = new G4Step();
|
||||
if (fpHyperStep == nullptr) fpHyperStep = new G4Step();
|
||||
iParallelWorld = ++nParallelWorlds;
|
||||
|
||||
pParticleChange = &aDummyParticleChange;
|
||||
@@ -78,10 +79,9 @@ G4ParallelWorldProcess(const G4String& processName,G4ProcessType theType)
|
||||
fPathFinder = G4PathFinder::GetInstance();
|
||||
|
||||
fGhostWorldName = "** NotDefined **";
|
||||
G4ParallelWorldProcessStore::GetInstance()->SetParallelWorld(this,processName);
|
||||
G4ParallelWorldProcessStore::GetInstance()->SetParallelWorld(this, processName);
|
||||
|
||||
if (verboseLevel>0)
|
||||
{
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -90,15 +90,13 @@ G4ParallelWorldProcess::~G4ParallelWorldProcess()
|
||||
{
|
||||
delete fGhostStep;
|
||||
nParallelWorlds--;
|
||||
if(nParallelWorlds==0)
|
||||
{
|
||||
if (nParallelWorlds == 0) {
|
||||
delete fpHyperStep;
|
||||
fpHyperStep = 0;
|
||||
fpHyperStep = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void G4ParallelWorldProcess::
|
||||
SetParallelWorld(G4String parallelWorldName)
|
||||
void G4ParallelWorldProcess::SetParallelWorld(G4String parallelWorldName)
|
||||
{
|
||||
fGhostWorldName = parallelWorldName;
|
||||
fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
|
||||
@@ -106,8 +104,7 @@ SetParallelWorld(G4String parallelWorldName)
|
||||
fGhostNavigator->SetPushVerbosity(false);
|
||||
}
|
||||
|
||||
void G4ParallelWorldProcess::
|
||||
SetParallelWorld(G4VPhysicalVolume* parallelWorld)
|
||||
void G4ParallelWorldProcess::SetParallelWorld(G4VPhysicalVolume* parallelWorld)
|
||||
{
|
||||
fGhostWorldName = parallelWorld->GetName();
|
||||
fGhostWorld = parallelWorld;
|
||||
@@ -117,15 +114,15 @@ SetParallelWorld(G4VPhysicalVolume* parallelWorld)
|
||||
|
||||
void G4ParallelWorldProcess::StartTracking(G4Track* trk)
|
||||
{
|
||||
if(fGhostNavigator)
|
||||
{ fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
|
||||
else
|
||||
{
|
||||
G4Exception("G4ParallelWorldProcess::StartTracking",
|
||||
"ProcParaWorld000",FatalException,
|
||||
"G4ParallelWorldProcess is used for tracking without having a parallel world assigned");
|
||||
if (fGhostNavigator != nullptr) {
|
||||
fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator);
|
||||
}
|
||||
fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
|
||||
else {
|
||||
G4Exception(
|
||||
"G4ParallelWorldProcess::StartTracking", "ProcParaWorld000", FatalException,
|
||||
"G4ParallelWorldProcess is used for tracking without having a parallel world assigned");
|
||||
}
|
||||
fPathFinder->PrepareNewTrack(trk->GetPosition(), trk->GetMomentumDirection());
|
||||
|
||||
fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
|
||||
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
|
||||
@@ -137,20 +134,11 @@ void G4ParallelWorldProcess::StartTracking(G4Track* trk)
|
||||
fGhostPreStepPoint->SetStepStatus(fUndefined);
|
||||
fGhostPostStepPoint->SetStepStatus(fUndefined);
|
||||
|
||||
// G4VPhysicalVolume* thePhys = fNewGhostTouchable->GetVolume();
|
||||
// if(thePhys)
|
||||
// {
|
||||
// G4Material* ghostMaterial = thePhys->GetLogicalVolume()->GetMaterial();
|
||||
// if(ghostMaterial)
|
||||
// { G4cout << " --- Material : " << ghostMaterial->GetName() << G4endl; }
|
||||
// }
|
||||
|
||||
*(fpHyperStep->GetPostStepPoint()) = *(trk->GetStep()->GetPostStepPoint());
|
||||
if(layeredMaterialFlag)
|
||||
{
|
||||
if (layeredMaterialFlag) {
|
||||
G4StepPoint* realWorldPostStepPoint = trk->GetStep()->GetPostStepPoint();
|
||||
SwitchMaterial(realWorldPostStepPoint);
|
||||
G4StepPoint *realWorldPreStepPoint = trk->GetStep()->GetPreStepPoint();
|
||||
G4StepPoint* realWorldPreStepPoint = trk->GetStep()->GetPreStepPoint();
|
||||
SwitchMaterial(realWorldPreStepPoint);
|
||||
G4double velocity = trk->CalculateVelocity();
|
||||
realWorldPostStepPoint->SetVelocity(velocity);
|
||||
@@ -160,48 +148,44 @@ void G4ParallelWorldProcess::StartTracking(G4Track* trk)
|
||||
*(fpHyperStep->GetPreStepPoint()) = *(fpHyperStep->GetPostStepPoint());
|
||||
}
|
||||
|
||||
G4double
|
||||
G4ParallelWorldProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/,
|
||||
G4ForceCondition* condition)
|
||||
G4double G4ParallelWorldProcess::AtRestGetPhysicalInteractionLength(const G4Track& /*track*/,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// At Rest must be registered ONLY for the particle which has other At Rest
|
||||
// process(es).
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// At Rest must be registered ONLY for the particle which has other At Rest
|
||||
// process(es).
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*condition = Forced;
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
G4VParticleChange* G4ParallelWorldProcess::AtRestDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// At Rest must be registered ONLY for the particle which has other At Rest
|
||||
// process(es).
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
G4VParticleChange* G4ParallelWorldProcess::AtRestDoIt(const G4Track& track, const G4Step& step)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// At Rest must be registered ONLY for the particle which has other At Rest
|
||||
// process(es).
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
|
||||
G4VSensitiveDetector* aSD = 0;
|
||||
if(fOldGhostTouchable->GetVolume())
|
||||
{ aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector(); }
|
||||
G4VSensitiveDetector* aSD = nullptr;
|
||||
if (fOldGhostTouchable->GetVolume() != nullptr) {
|
||||
aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector();
|
||||
}
|
||||
fOnBoundary = false;
|
||||
if(aSD)
|
||||
{
|
||||
if (aSD != nullptr) {
|
||||
CopyStep(step);
|
||||
fGhostPreStepPoint->SetSensitiveDetector(aSD);
|
||||
|
||||
fNewGhostTouchable = fOldGhostTouchable;
|
||||
|
||||
|
||||
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
|
||||
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
|
||||
if(fNewGhostTouchable->GetVolume())
|
||||
{
|
||||
if (fNewGhostTouchable->GetVolume() != nullptr) {
|
||||
fGhostPostStepPoint->SetSensitiveDetector(
|
||||
fNewGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
|
||||
}
|
||||
else
|
||||
{ fGhostPostStepPoint->SetSensitiveDetector(0); }
|
||||
else {
|
||||
fGhostPostStepPoint->SetSensitiveDetector(nullptr);
|
||||
}
|
||||
|
||||
aSD->Hit(fGhostStep);
|
||||
}
|
||||
@@ -210,144 +194,136 @@ G4VParticleChange* G4ParallelWorldProcess::AtRestDoIt(
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
G4double
|
||||
G4ParallelWorldProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/,
|
||||
G4double /*previousStepSize*/,
|
||||
G4ForceCondition* condition)
|
||||
G4double G4ParallelWorldProcess::PostStepGetPhysicalInteractionLength(const G4Track& /*track*/,
|
||||
G4double /*previousStepSize*/,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = StronglyForced;
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
G4VParticleChange* G4ParallelWorldProcess::PostStepDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
G4VParticleChange* G4ParallelWorldProcess::PostStepDoIt(const G4Track& track, const G4Step& step)
|
||||
{
|
||||
fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
|
||||
G4VSensitiveDetector* aSD = 0;
|
||||
if(fOldGhostTouchable->GetVolume())
|
||||
{ aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector(); }
|
||||
G4VSensitiveDetector* aSD = nullptr;
|
||||
if (fOldGhostTouchable->GetVolume() != nullptr) {
|
||||
aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector();
|
||||
}
|
||||
CopyStep(step);
|
||||
fGhostPreStepPoint->SetSensitiveDetector(aSD);
|
||||
|
||||
if(fOnBoundary)
|
||||
{
|
||||
if (fOnBoundary) {
|
||||
fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
fNewGhostTouchable = fOldGhostTouchable;
|
||||
}
|
||||
|
||||
|
||||
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
|
||||
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
|
||||
|
||||
if(fNewGhostTouchable->GetVolume())
|
||||
{
|
||||
if (fNewGhostTouchable->GetVolume() != nullptr) {
|
||||
fGhostPostStepPoint->SetSensitiveDetector(
|
||||
fNewGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
|
||||
}
|
||||
else
|
||||
{ fGhostPostStepPoint->SetSensitiveDetector(0); }
|
||||
else {
|
||||
fGhostPostStepPoint->SetSensitiveDetector(nullptr);
|
||||
}
|
||||
|
||||
G4VSensitiveDetector* sd = fGhostPreStepPoint->GetSensitiveDetector();
|
||||
if(sd)
|
||||
{
|
||||
if (sd != nullptr) {
|
||||
sd->Hit(fGhostStep);
|
||||
}
|
||||
|
||||
pParticleChange->Initialize(track);
|
||||
if(layeredMaterialFlag)
|
||||
{
|
||||
G4StepPoint* realWorldPostStepPoint =
|
||||
((G4Step*)(track.GetStep()))->GetPostStepPoint();
|
||||
pParticleChange->Initialize(track);
|
||||
if (layeredMaterialFlag) {
|
||||
G4StepPoint* realWorldPostStepPoint = ((G4Step*)(track.GetStep()))->GetPostStepPoint();
|
||||
SwitchMaterial(realWorldPostStepPoint);
|
||||
}
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
G4double G4ParallelWorldProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
|
||||
G4double& proposedSafety, G4GPILSelection* selection)
|
||||
G4double G4ParallelWorldProcess::AlongStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& proposedSafety,
|
||||
G4GPILSelection* selection)
|
||||
{
|
||||
static G4ThreadLocal G4FieldTrack *endTrack_G4MT_TLS_ = 0 ; if (!endTrack_G4MT_TLS_) endTrack_G4MT_TLS_ = new G4FieldTrack ('0') ; G4FieldTrack &endTrack = *endTrack_G4MT_TLS_;
|
||||
//static ELimited eLimited;
|
||||
static G4ThreadLocal G4FieldTrack* endTrack_G4MT_TLS_ = nullptr;
|
||||
if (endTrack_G4MT_TLS_ == nullptr) endTrack_G4MT_TLS_ = new G4FieldTrack('0');
|
||||
G4FieldTrack& endTrack = *endTrack_G4MT_TLS_;
|
||||
// static ELimited eLimited;
|
||||
ELimited eLimited;
|
||||
ELimited eLim = kUndefLimited;
|
||||
|
||||
|
||||
*selection = NotCandidateForSelection;
|
||||
G4double returnedStep = DBL_MAX;
|
||||
|
||||
if (previousStepSize > 0.)
|
||||
{ fGhostSafety -= previousStepSize; }
|
||||
if (previousStepSize > 0.) {
|
||||
fGhostSafety -= previousStepSize;
|
||||
}
|
||||
if (fGhostSafety < 0.) fGhostSafety = 0.0;
|
||||
|
||||
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
|
||||
{
|
||||
|
||||
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.) {
|
||||
// I have no chance to limit
|
||||
returnedStep = currentMinimumStep;
|
||||
fOnBoundary = false;
|
||||
proposedSafety = fGhostSafety - currentMinimumStep;
|
||||
eLim = kDoNot;
|
||||
}
|
||||
else
|
||||
{
|
||||
G4FieldTrackUpdator::Update(&fFieldTrack,&track);
|
||||
else {
|
||||
G4FieldTrackUpdator::Update(&fFieldTrack, &track);
|
||||
|
||||
#ifdef G4DEBUG_PARALLEL_WORLD_PROCESS
|
||||
if( verboseLevel > 0 ){
|
||||
int localVerb = verboseLevel-1;
|
||||
#ifdef G4DEBUG_PARALLEL_WORLD_PROCESS
|
||||
if (verboseLevel > 0) {
|
||||
int localVerb = verboseLevel - 1;
|
||||
|
||||
if( localVerb == 1 ) {
|
||||
G4cout << " Pll Wrl proc::AlongStepGPIL " << this->GetProcessName() << G4endl;
|
||||
}else if( localVerb > 1 ) {
|
||||
G4cout << "----------------------------------------------" << G4endl;
|
||||
G4cout << " ParallelWorldProcess: field Track set to : " << G4endl;
|
||||
G4cout << "----------------------------------------------" << G4endl;
|
||||
G4cout << fFieldTrack << G4endl;
|
||||
G4cout << "----------------------------------------------" << G4endl;
|
||||
}
|
||||
if (localVerb == 1) {
|
||||
G4cout << " Pll Wrl proc::AlongStepGPIL " << this->GetProcessName() << G4endl;
|
||||
}
|
||||
else if (localVerb > 1) {
|
||||
G4cout << "----------------------------------------------" << G4endl;
|
||||
G4cout << " ParallelWorldProcess: field Track set to : " << G4endl;
|
||||
G4cout << "----------------------------------------------" << G4endl;
|
||||
G4cout << fFieldTrack << G4endl;
|
||||
G4cout << "----------------------------------------------" << G4endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
returnedStep
|
||||
= fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
|
||||
track.GetCurrentStepNumber(),fGhostSafety,eLimited,
|
||||
endTrack,track.GetVolume());
|
||||
if(eLimited == kDoNot)
|
||||
{
|
||||
|
||||
returnedStep = fPathFinder->ComputeStep(fFieldTrack, currentMinimumStep, fNavigatorID,
|
||||
track.GetCurrentStepNumber(), fGhostSafety, eLimited,
|
||||
endTrack, track.GetVolume());
|
||||
if (eLimited == kDoNot) {
|
||||
fOnBoundary = false;
|
||||
fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
|
||||
fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
fOnBoundary = true;
|
||||
// fGhostSafetyEnd = 0.0; // At end-point of expected step only
|
||||
}
|
||||
proposedSafety = fGhostSafety;
|
||||
if(eLimited == kUnique || eLimited == kSharedOther) {
|
||||
*selection = CandidateForSelection;
|
||||
if (eLimited == kUnique || eLimited == kSharedOther) {
|
||||
*selection = CandidateForSelection;
|
||||
}
|
||||
else if (eLimited == kSharedTransport) {
|
||||
returnedStep *= (1.0 + 1.0e-9);
|
||||
else if (eLimited == kSharedTransport) {
|
||||
returnedStep *= (1.0 + 1.0e-9);
|
||||
}
|
||||
eLim = eLimited;
|
||||
}
|
||||
|
||||
if(iParallelWorld==nParallelWorlds) fNavIDHyp = 0;
|
||||
if(eLim == kUnique || eLim == kSharedOther) fNavIDHyp = fNavigatorID;
|
||||
if (iParallelWorld == nParallelWorlds) fNavIDHyp = 0;
|
||||
if (eLim == kUnique || eLim == kSharedOther) fNavIDHyp = fNavigatorID;
|
||||
return returnedStep;
|
||||
}
|
||||
|
||||
G4VParticleChange* G4ParallelWorldProcess::AlongStepDoIt(
|
||||
const G4Track& track, const G4Step& )
|
||||
G4VParticleChange* G4ParallelWorldProcess::AlongStepDoIt(const G4Track& track, const G4Step&)
|
||||
{
|
||||
pParticleChange->Initialize(track);
|
||||
return pParticleChange;
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
void G4ParallelWorldProcess::CopyStep(const G4Step & step)
|
||||
void G4ParallelWorldProcess::CopyStep(const G4Step& step)
|
||||
{
|
||||
G4StepStatus prevStat = fGhostPostStepPoint->GetStepStatus();
|
||||
|
||||
@@ -362,13 +338,14 @@ void G4ParallelWorldProcess::CopyStep(const G4Step & step)
|
||||
*fGhostPostStepPoint = *(step.GetPostStepPoint());
|
||||
|
||||
fGhostPreStepPoint->SetStepStatus(prevStat);
|
||||
if(fOnBoundary)
|
||||
{ fGhostPostStepPoint->SetStepStatus(fGeomBoundary); }
|
||||
else if(fGhostPostStepPoint->GetStepStatus()==fGeomBoundary)
|
||||
{ fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc); }
|
||||
if (fOnBoundary) {
|
||||
fGhostPostStepPoint->SetStepStatus(fGeomBoundary);
|
||||
}
|
||||
else if (fGhostPostStepPoint->GetStepStatus() == fGeomBoundary) {
|
||||
fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc);
|
||||
}
|
||||
|
||||
if(iParallelWorld==1)
|
||||
{
|
||||
if (iParallelWorld == 1) {
|
||||
G4StepStatus prevStatHyp = fpHyperStep->GetPostStepPoint()->GetStepStatus();
|
||||
|
||||
fpHyperStep->SetTrack(step.GetTrack());
|
||||
@@ -379,49 +356,42 @@ void G4ParallelWorldProcess::CopyStep(const G4Step & step)
|
||||
|
||||
*(fpHyperStep->GetPreStepPoint()) = *(fpHyperStep->GetPostStepPoint());
|
||||
*(fpHyperStep->GetPostStepPoint()) = *(step.GetPostStepPoint());
|
||||
|
||||
|
||||
fpHyperStep->GetPreStepPoint()->SetStepStatus(prevStatHyp);
|
||||
}
|
||||
|
||||
if(fOnBoundary)
|
||||
{ fpHyperStep->GetPostStepPoint()->SetStepStatus(fGeomBoundary); }
|
||||
if (fOnBoundary) {
|
||||
fpHyperStep->GetPostStepPoint()->SetStepStatus(fGeomBoundary);
|
||||
}
|
||||
}
|
||||
|
||||
void G4ParallelWorldProcess::SwitchMaterial(G4StepPoint* realWorldStepPoint)
|
||||
{
|
||||
if(realWorldStepPoint->GetStepStatus()==fWorldBoundary) return;
|
||||
if (realWorldStepPoint->GetStepStatus() == fWorldBoundary) return;
|
||||
G4VPhysicalVolume* thePhys = fNewGhostTouchable->GetVolume();
|
||||
if(thePhys)
|
||||
{
|
||||
if (thePhys != nullptr) {
|
||||
G4Material* ghostMaterial = thePhys->GetLogicalVolume()->GetMaterial();
|
||||
if(ghostMaterial)
|
||||
{
|
||||
if (ghostMaterial != nullptr) {
|
||||
G4Region* ghostRegion = thePhys->GetLogicalVolume()->GetRegion();
|
||||
G4ProductionCuts* prodCuts =
|
||||
realWorldStepPoint->GetMaterialCutsCouple()->GetProductionCuts();
|
||||
if(ghostRegion)
|
||||
{
|
||||
G4ProductionCuts* prodCuts = realWorldStepPoint->GetMaterialCutsCouple()->GetProductionCuts();
|
||||
if (ghostRegion != nullptr) {
|
||||
G4ProductionCuts* ghostProdCuts = ghostRegion->GetProductionCuts();
|
||||
if(ghostProdCuts) prodCuts = ghostProdCuts;
|
||||
if (ghostProdCuts != nullptr) prodCuts = ghostProdCuts;
|
||||
}
|
||||
const G4MaterialCutsCouple* ghostMCCouple =
|
||||
G4ProductionCutsTable::GetProductionCutsTable()
|
||||
->GetMaterialCutsCouple(ghostMaterial,prodCuts);
|
||||
if(ghostMCCouple)
|
||||
{
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->GetMaterialCutsCouple(ghostMaterial,
|
||||
prodCuts);
|
||||
if (ghostMCCouple != nullptr) {
|
||||
realWorldStepPoint->SetMaterial(ghostMaterial);
|
||||
realWorldStepPoint->SetMaterialCutsCouple(ghostMCCouple);
|
||||
*(fpHyperStep->GetPostStepPoint()) = *(fGhostPostStepPoint);
|
||||
fpHyperStep->GetPostStepPoint()->SetMaterial(ghostMaterial);
|
||||
fpHyperStep->GetPostStepPoint()->SetMaterialCutsCouple(ghostMCCouple);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << "!!! MaterialCutsCouple is not found for "
|
||||
<< ghostMaterial->GetName() << "." << G4endl
|
||||
<< " Material in real world ("
|
||||
<< realWorldStepPoint->GetMaterial()->GetName()
|
||||
<< ") is used." << G4endl;
|
||||
else {
|
||||
G4cout << "!!! MaterialCutsCouple is not found for " << ghostMaterial->GetName() << "."
|
||||
<< G4endl << " Material in real world ("
|
||||
<< realWorldStepPoint->GetMaterial()->GetName() << ") is used." << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,19 +400,16 @@ void G4ParallelWorldProcess::SwitchMaterial(G4StepPoint* realWorldStepPoint)
|
||||
G4bool G4ParallelWorldProcess::IsAtRestRequired(G4ParticleDefinition* partDef)
|
||||
{
|
||||
G4int pdgCode = partDef->GetPDGEncoding();
|
||||
if(pdgCode==0)
|
||||
{
|
||||
if (pdgCode == 0) {
|
||||
G4String partName = partDef->GetParticleName();
|
||||
if(partName=="geantino") return false;
|
||||
if(partName=="chargedgeantino") return false;
|
||||
if (partName == "geantino") return false;
|
||||
if (partName == "chargedgeantino") return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pdgCode==11 || pdgCode==2212) return false; // electrons and proton
|
||||
else {
|
||||
if (pdgCode == 11 || pdgCode == 2212) return false; // electrons and proton
|
||||
pdgCode = std::abs(pdgCode);
|
||||
if(pdgCode==22) return false; // gamma and optical photons
|
||||
if(pdgCode==12 || pdgCode==14 || pdgCode==16) return false; // all neutronos
|
||||
if (pdgCode == 22) return false; // gamma and optical photons
|
||||
if (pdgCode == 12 || pdgCode == 14 || pdgCode == 16) return false; // all neutronos
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,14 +28,16 @@
|
||||
//
|
||||
|
||||
#include "G4ParallelWorldProcessStore.hh"
|
||||
|
||||
#include "G4ParallelWorldProcess.hh"
|
||||
|
||||
G4ThreadLocal G4ParallelWorldProcessStore* G4ParallelWorldProcessStore::fInstance=0;
|
||||
G4ThreadLocal G4ParallelWorldProcessStore* G4ParallelWorldProcessStore::fInstance = nullptr;
|
||||
|
||||
G4ParallelWorldProcessStore* G4ParallelWorldProcessStore::GetInstance()
|
||||
{
|
||||
if(!fInstance)
|
||||
{ fInstance = new G4ParallelWorldProcessStore(); }
|
||||
if (fInstance == nullptr) {
|
||||
fInstance = new G4ParallelWorldProcessStore();
|
||||
}
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
@@ -44,35 +46,30 @@ G4ParallelWorldProcessStore* G4ParallelWorldProcessStore::GetInstanceIfExist()
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
G4ParallelWorldProcessStore::G4ParallelWorldProcessStore()
|
||||
{;}
|
||||
G4ParallelWorldProcessStore::G4ParallelWorldProcessStore() = default;
|
||||
|
||||
G4ParallelWorldProcessStore::~G4ParallelWorldProcessStore()
|
||||
{
|
||||
Clear();
|
||||
fInstance = 0;
|
||||
Clear();
|
||||
fInstance = nullptr;
|
||||
}
|
||||
|
||||
void G4ParallelWorldProcessStore::SetParallelWorld(G4ParallelWorldProcess* proc,
|
||||
G4String parallelWorldName)
|
||||
G4String parallelWorldName)
|
||||
{
|
||||
std::map<G4ParallelWorldProcess*,G4String>::iterator itr;
|
||||
for(itr=fInstance->begin();itr!=fInstance->end();itr++)
|
||||
for (const auto& [process, name] : *fInstance)
|
||||
{
|
||||
if(itr->first==proc)
|
||||
{
|
||||
if(itr->second==parallelWorldName)
|
||||
{ // already registered
|
||||
return;
|
||||
}
|
||||
else
|
||||
{ // insonsistent !
|
||||
G4ExceptionDescription ED;
|
||||
ED << "G4ParallelWorldProcess (" << proc << ") has the world volume ("
|
||||
<< itr->second << "). It is inconsistent with (" << parallelWorldName << ").";
|
||||
G4Exception("G4ParallelWorldProcessStore::SetParallelWorld","ProcScore0101",
|
||||
FatalException,ED);
|
||||
if(process == proc) {
|
||||
if(name == parallelWorldName) {
|
||||
return; // already registered
|
||||
}
|
||||
|
||||
// inconsistent !
|
||||
G4ExceptionDescription ED;
|
||||
ED << "G4ParallelWorldProcess (" << proc << ") has the world volume (" << name
|
||||
<< "). It is inconsistent with (" << parallelWorldName << ").";
|
||||
G4Exception("G4ParallelWorldProcessStore::SetParallelWorld", "ProcScore0101", FatalException,
|
||||
ED);
|
||||
}
|
||||
}
|
||||
(*fInstance)[proc] = parallelWorldName;
|
||||
@@ -80,19 +77,22 @@ void G4ParallelWorldProcessStore::SetParallelWorld(G4ParallelWorldProcess* proc,
|
||||
|
||||
void G4ParallelWorldProcessStore::UpdateWorlds()
|
||||
{
|
||||
std::map<G4ParallelWorldProcess*,G4String>::iterator itr;
|
||||
for(itr=fInstance->begin();itr!=fInstance->end();itr++)
|
||||
{ (itr->first)->SetParallelWorld(itr->second); }
|
||||
for(auto& [process, name] : *fInstance)
|
||||
{
|
||||
process->SetParallelWorld(name);
|
||||
}
|
||||
}
|
||||
|
||||
G4ParallelWorldProcess* G4ParallelWorldProcessStore::GetProcess(G4String parallelWorldName)
|
||||
{
|
||||
std::map<G4ParallelWorldProcess*,G4String>::iterator itr;
|
||||
for(itr=fInstance->begin();itr!=fInstance->end();itr++)
|
||||
{ if(itr->second==parallelWorldName) return itr->first; }
|
||||
return 0;
|
||||
for(const auto& [proc, name] : *fInstance)
|
||||
{
|
||||
if (name == parallelWorldName) return proc;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void G4ParallelWorldProcessStore::Clear()
|
||||
{ fInstance->clear(); }
|
||||
|
||||
{
|
||||
fInstance->clear();
|
||||
}
|
||||
|
||||
@@ -29,29 +29,27 @@
|
||||
|
||||
#include "G4ParallelWorldScoringProcess.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4PathFinder.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4FieldTrackUpdator.hh"
|
||||
#include "G4Navigator.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
#include "G4PathFinder.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//--------------------------------
|
||||
// Constructor with name and type:
|
||||
//--------------------------------
|
||||
G4ParallelWorldScoringProcess::
|
||||
G4ParallelWorldScoringProcess(const G4String& processName,G4ProcessType theType)
|
||||
:G4VProcess(processName,theType), fGhostNavigator(0), fNavigatorID(-1), fFieldTrack('0')
|
||||
G4ParallelWorldScoringProcess::G4ParallelWorldScoringProcess(const G4String& processName,
|
||||
G4ProcessType theType)
|
||||
: G4VProcess(processName, theType), fFieldTrack('0')
|
||||
{
|
||||
pParticleChange = &aDummyParticleChange;
|
||||
|
||||
@@ -62,12 +60,11 @@ G4ParallelWorldScoringProcess(const G4String& processName,G4ProcessType theType)
|
||||
fTransportationManager = G4TransportationManager::GetTransportationManager();
|
||||
fPathFinder = G4PathFinder::GetInstance();
|
||||
|
||||
fGhostWorld = 0;
|
||||
fGhostWorld = nullptr;
|
||||
fGhostSafety = 0.;
|
||||
fOnBoundary = false;
|
||||
|
||||
if (verboseLevel>0)
|
||||
{
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -82,54 +79,48 @@ G4ParallelWorldScoringProcess::~G4ParallelWorldScoringProcess()
|
||||
|
||||
//------------------------------------------------------
|
||||
//
|
||||
// SetParallelWorld
|
||||
// SetParallelWorld
|
||||
//
|
||||
//------------------------------------------------------
|
||||
void G4ParallelWorldScoringProcess::
|
||||
SetParallelWorld(G4String parallelWorldName)
|
||||
void G4ParallelWorldScoringProcess::SetParallelWorld(G4String parallelWorldName)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Get pointers of the parallel world and its navigator
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Get pointers of the parallel world and its navigator
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
fGhostWorldName = parallelWorldName;
|
||||
fGhostWorld = fTransportationManager->GetParallelWorld(fGhostWorldName);
|
||||
fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
}
|
||||
|
||||
void G4ParallelWorldScoringProcess::
|
||||
SetParallelWorld(G4VPhysicalVolume* parallelWorld)
|
||||
void G4ParallelWorldScoringProcess::SetParallelWorld(G4VPhysicalVolume* parallelWorld)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Get pointer of navigator
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Get pointer of navigator
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
fGhostWorldName = parallelWorld->GetName();
|
||||
fGhostWorld = parallelWorld;
|
||||
fGhostNavigator = fTransportationManager->GetNavigator(fGhostWorld);
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
}
|
||||
|
||||
G4bool G4ParallelWorldScoringProcess::
|
||||
IsAtRestRequired(G4ParticleDefinition* partDef)
|
||||
G4bool G4ParallelWorldScoringProcess::IsAtRestRequired(G4ParticleDefinition* partDef)
|
||||
{
|
||||
G4int pdgCode = partDef->GetPDGEncoding();
|
||||
if(pdgCode==0)
|
||||
{
|
||||
if (pdgCode == 0) {
|
||||
G4String partName = partDef->GetParticleName();
|
||||
if(partName=="geantino") return false;
|
||||
if(partName=="chargedgeantino") return false;
|
||||
if (partName == "geantino") return false;
|
||||
if (partName == "chargedgeantino") return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pdgCode==11 || pdgCode==2212) return false; // electrons and proton
|
||||
else {
|
||||
if (pdgCode == 11 || pdgCode == 2212) return false; // electrons and proton
|
||||
pdgCode = std::abs(pdgCode);
|
||||
if(pdgCode==22) return false; // gamma and optical photons
|
||||
if(pdgCode==12 || pdgCode==14 || pdgCode==16) return false; // all neutronos
|
||||
if (pdgCode == 22) return false; // gamma and optical photons
|
||||
if (pdgCode == 12 || pdgCode == 14 || pdgCode == 16) return false; // all neutronos
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------
|
||||
//
|
||||
// StartTracking
|
||||
@@ -137,36 +128,26 @@ IsAtRestRequired(G4ParticleDefinition* partDef)
|
||||
//------------------------------------------------------
|
||||
void G4ParallelWorldScoringProcess::StartTracking(G4Track* trk)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Activate navigator and get the navigator ID
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// G4cout << " G4ParallelWorldScoringProcess::StartTracking" << G4endl;
|
||||
if(fGhostNavigator)
|
||||
{ fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator); }
|
||||
else
|
||||
{
|
||||
G4Exception("G4ParallelWorldScoringProcess::StartTracking",
|
||||
"ProcParaWorld000",FatalException,
|
||||
"G4ParallelWorldScoringProcess is used for tracking without having a parallel world assigned");
|
||||
// Activate navigator and get the navigator ID
|
||||
if (fGhostNavigator != nullptr) {
|
||||
fNavigatorID = fTransportationManager->ActivateNavigator(fGhostNavigator);
|
||||
}
|
||||
else {
|
||||
G4Exception("G4ParallelWorldScoringProcess::StartTracking", "ProcParaWorld000", FatalException,
|
||||
"G4ParallelWorldScoringProcess is used for tracking without having a parallel "
|
||||
"world assigned");
|
||||
}
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
// G4cout << "G4ParallelWorldScoringProcess::StartTracking <<<<<<<<<<<<<<<<<< " << G4endl;
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Let PathFinder initialize
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
fPathFinder->PrepareNewTrack(trk->GetPosition(),trk->GetMomentumDirection());
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Let PathFinder initialize
|
||||
fPathFinder->PrepareNewTrack(trk->GetPosition(), trk->GetMomentumDirection());
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Setup initial touchables for the first step
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Setup initial touchables for the first step
|
||||
fOldGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
|
||||
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
|
||||
fNewGhostTouchable = fOldGhostTouchable;
|
||||
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
|
||||
|
||||
// Initialize
|
||||
// Initialize
|
||||
fGhostSafety = -1.;
|
||||
fOnBoundary = false;
|
||||
fGhostPreStepPoint->SetStepStatus(fUndefined);
|
||||
@@ -178,10 +159,9 @@ void G4ParallelWorldScoringProcess::StartTracking(G4Track* trk)
|
||||
// AtRestGetPhysicalInteractionLength()
|
||||
//
|
||||
//----------------------------------------------------------
|
||||
G4double
|
||||
G4ParallelWorldScoringProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/,
|
||||
G4ForceCondition* condition)
|
||||
G4double
|
||||
G4ParallelWorldScoringProcess::AtRestGetPhysicalInteractionLength(const G4Track& /*track*/,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = Forced;
|
||||
return DBL_MAX;
|
||||
@@ -192,35 +172,34 @@ G4ParallelWorldScoringProcess::AtRestGetPhysicalInteractionLength(
|
||||
// AtRestDoIt()
|
||||
//
|
||||
//------------------------------------
|
||||
G4VParticleChange* G4ParallelWorldScoringProcess::AtRestDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
G4VParticleChange* G4ParallelWorldScoringProcess::AtRestDoIt(const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
|
||||
G4VSensitiveDetector* aSD = 0;
|
||||
if(fOldGhostTouchable->GetVolume())
|
||||
{ aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector(); }
|
||||
G4VSensitiveDetector* aSD = nullptr;
|
||||
if (fOldGhostTouchable->GetVolume() != nullptr) {
|
||||
aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector();
|
||||
}
|
||||
fOnBoundary = false;
|
||||
CopyStep(step);
|
||||
fGhostPreStepPoint->SetSensitiveDetector(aSD);
|
||||
|
||||
fNewGhostTouchable = fOldGhostTouchable;
|
||||
|
||||
|
||||
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
|
||||
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
|
||||
if(fNewGhostTouchable->GetVolume())
|
||||
{
|
||||
if (fNewGhostTouchable->GetVolume() != nullptr) {
|
||||
fGhostPostStepPoint->SetSensitiveDetector(
|
||||
fNewGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
|
||||
}
|
||||
else
|
||||
{ fGhostPostStepPoint->SetSensitiveDetector(0); }
|
||||
else {
|
||||
fGhostPostStepPoint->SetSensitiveDetector(nullptr);
|
||||
}
|
||||
|
||||
if (verboseLevel>1) Verbose(step);
|
||||
if (verboseLevel > 1) Verbose(step);
|
||||
|
||||
G4VSensitiveDetector* sd = fGhostPreStepPoint->GetSensitiveDetector();
|
||||
if(sd)
|
||||
{
|
||||
if (sd != nullptr) {
|
||||
sd->Hit(fGhostStep);
|
||||
}
|
||||
|
||||
@@ -233,11 +212,8 @@ G4VParticleChange* G4ParallelWorldScoringProcess::AtRestDoIt(
|
||||
// PostStepGetPhysicalInteractionLength()
|
||||
//
|
||||
//----------------------------------------------------------
|
||||
G4double
|
||||
G4ParallelWorldScoringProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/,
|
||||
G4double /*previousStepSize*/,
|
||||
G4ForceCondition* condition)
|
||||
G4double G4ParallelWorldScoringProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/, G4double /*previousStepSize*/, G4ForceCondition* condition)
|
||||
{
|
||||
// I must be invoked anyway to score the hit.
|
||||
*condition = StronglyForced;
|
||||
@@ -249,130 +225,102 @@ G4ParallelWorldScoringProcess::PostStepGetPhysicalInteractionLength(
|
||||
// PostStepDoIt()
|
||||
//
|
||||
//------------------------------------
|
||||
G4VParticleChange* G4ParallelWorldScoringProcess::PostStepDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
G4VParticleChange* G4ParallelWorldScoringProcess::PostStepDoIt(const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
fOldGhostTouchable = fGhostPostStepPoint->GetTouchableHandle();
|
||||
G4VSensitiveDetector* aSD = 0;
|
||||
if(fOldGhostTouchable->GetVolume())
|
||||
{ aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector(); }
|
||||
G4VSensitiveDetector* aSD = nullptr;
|
||||
if (fOldGhostTouchable->GetVolume() != nullptr) {
|
||||
aSD = fOldGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector();
|
||||
}
|
||||
CopyStep(step);
|
||||
fGhostPreStepPoint->SetSensitiveDetector(aSD);
|
||||
|
||||
// fPathFinder->Locate( track.GetPosition(),
|
||||
// track.GetMomentumDirection(),
|
||||
// true);
|
||||
|
||||
// fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
|
||||
// step.GetPostStepPoint()->GetMomentumDirection());
|
||||
|
||||
if(fOnBoundary)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Locate the point and get new touchable
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
//?? fPathFinder->Locate(step.GetPostStepPoint()->GetPosition(),
|
||||
//?? step.GetPostStepPoint()->GetMomentumDirection());
|
||||
if (fOnBoundary) {
|
||||
// Locate the point and get new touchable
|
||||
fNewGhostTouchable = fPathFinder->CreateTouchableHandle(fNavigatorID);
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do I need this ??????????????????????????????????????????????????????????
|
||||
// fGhostNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
|
||||
// ?????????????????????????????????????????????????????????????????????????
|
||||
|
||||
// fPathFinder->ReLocate(track.GetPosition());
|
||||
|
||||
else {
|
||||
// reuse the touchable
|
||||
fNewGhostTouchable = fOldGhostTouchable;
|
||||
}
|
||||
|
||||
|
||||
fGhostPreStepPoint->SetTouchableHandle(fOldGhostTouchable);
|
||||
fGhostPostStepPoint->SetTouchableHandle(fNewGhostTouchable);
|
||||
|
||||
if(fNewGhostTouchable->GetVolume())
|
||||
{
|
||||
if (fNewGhostTouchable->GetVolume() != nullptr) {
|
||||
fGhostPostStepPoint->SetSensitiveDetector(
|
||||
fNewGhostTouchable->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
|
||||
}
|
||||
else
|
||||
{ fGhostPostStepPoint->SetSensitiveDetector(0); }
|
||||
else {
|
||||
fGhostPostStepPoint->SetSensitiveDetector(nullptr);
|
||||
}
|
||||
|
||||
if (verboseLevel>1) Verbose(step);
|
||||
if (verboseLevel > 1) Verbose(step);
|
||||
|
||||
G4VSensitiveDetector* sd = fGhostPreStepPoint->GetSensitiveDetector();
|
||||
if(sd)
|
||||
{
|
||||
if (sd != nullptr) {
|
||||
sd->Hit(fGhostStep);
|
||||
}
|
||||
|
||||
pParticleChange->Initialize(track); // Does not change the track properties
|
||||
pParticleChange->Initialize(track); // Does not change the track properties
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------
|
||||
//
|
||||
// AlongStepGetPhysicalInteractionLength
|
||||
//
|
||||
//---------------------------------------
|
||||
G4double G4ParallelWorldScoringProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
|
||||
G4double& proposedSafety, G4GPILSelection* selection)
|
||||
const G4Track& track, G4double previousStepSize, G4double currentMinimumStep,
|
||||
G4double& proposedSafety, G4GPILSelection* selection)
|
||||
{
|
||||
static G4ThreadLocal G4FieldTrack *endTrack_G4MT_TLS_ = 0 ; if (!endTrack_G4MT_TLS_) endTrack_G4MT_TLS_ = new G4FieldTrack ('0') ; G4FieldTrack &endTrack = *endTrack_G4MT_TLS_;
|
||||
static G4ThreadLocal ELimited *eLimited_G4MT_TLS_ = 0 ; if (!eLimited_G4MT_TLS_) eLimited_G4MT_TLS_ = new ELimited ; ELimited &eLimited = *eLimited_G4MT_TLS_;
|
||||
|
||||
static G4ThreadLocal G4FieldTrack* endTrack_G4MT_TLS_ = nullptr;
|
||||
if (endTrack_G4MT_TLS_ == nullptr) endTrack_G4MT_TLS_ = new G4FieldTrack('0');
|
||||
G4FieldTrack& endTrack = *endTrack_G4MT_TLS_;
|
||||
static G4ThreadLocal ELimited* eLimited_G4MT_TLS_ = nullptr;
|
||||
if (eLimited_G4MT_TLS_ == nullptr) eLimited_G4MT_TLS_ = new ELimited;
|
||||
ELimited& eLimited = *eLimited_G4MT_TLS_;
|
||||
|
||||
*selection = NotCandidateForSelection;
|
||||
G4double returnedStep = DBL_MAX;
|
||||
|
||||
if (previousStepSize > 0.)
|
||||
{ fGhostSafety -= previousStepSize; }
|
||||
// else
|
||||
// { fGhostSafety = -1.; }
|
||||
if (previousStepSize > 0.) {
|
||||
fGhostSafety -= previousStepSize;
|
||||
}
|
||||
if (fGhostSafety < 0.) fGhostSafety = 0.0;
|
||||
|
||||
// ------------------------------------------
|
||||
|
||||
// Determination of the proposed STEP LENGTH:
|
||||
// ------------------------------------------
|
||||
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.)
|
||||
{
|
||||
if (currentMinimumStep <= fGhostSafety && currentMinimumStep > 0.) {
|
||||
// I have no chance to limit
|
||||
returnedStep = currentMinimumStep;
|
||||
fOnBoundary = false;
|
||||
proposedSafety = fGhostSafety - currentMinimumStep;
|
||||
}
|
||||
else // (currentMinimumStep > fGhostSafety: I may limit the Step)
|
||||
else // (currentMinimumStep > fGhostSafety: I may limit the Step)
|
||||
{
|
||||
G4FieldTrackUpdator::Update(&fFieldTrack,&track);
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// ComputeStep
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
returnedStep
|
||||
= fPathFinder->ComputeStep(fFieldTrack,currentMinimumStep,fNavigatorID,
|
||||
track.GetCurrentStepNumber(),fGhostSafety,eLimited,
|
||||
endTrack,track.GetVolume());
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
if(eLimited == kDoNot)
|
||||
{
|
||||
G4FieldTrackUpdator::Update(&fFieldTrack, &track);
|
||||
// ComputeStep
|
||||
returnedStep = fPathFinder->ComputeStep(fFieldTrack, currentMinimumStep, fNavigatorID,
|
||||
track.GetCurrentStepNumber(), fGhostSafety, eLimited,
|
||||
endTrack, track.GetVolume());
|
||||
if (eLimited == kDoNot) {
|
||||
// Track is not on the boundary
|
||||
fOnBoundary = false;
|
||||
fGhostSafety = fGhostNavigator->ComputeSafety(endTrack.GetPosition());
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Track is on the boundary
|
||||
fOnBoundary = true;
|
||||
// fEndGhostSafety = 0.0; // Will apply at the end of the step ...
|
||||
}
|
||||
proposedSafety = fGhostSafety;
|
||||
if(eLimited == kUnique || eLimited == kSharedOther) {
|
||||
*selection = CandidateForSelection;
|
||||
}else if (eLimited == kSharedTransport) {
|
||||
returnedStep *= (1.0 + 1.0e-9);
|
||||
// Expand to disable its selection in Step Manager comparison
|
||||
if (eLimited == kUnique || eLimited == kSharedOther) {
|
||||
*selection = CandidateForSelection;
|
||||
}
|
||||
else if (eLimited == kSharedTransport) {
|
||||
returnedStep *= (1.0 + 1.0e-9);
|
||||
// Expand to disable its selection in Step Manager comparison
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,17 +332,15 @@ G4double G4ParallelWorldScoringProcess::AlongStepGetPhysicalInteractionLength(
|
||||
return returnedStep;
|
||||
}
|
||||
|
||||
G4VParticleChange* G4ParallelWorldScoringProcess::AlongStepDoIt(
|
||||
const G4Track& track, const G4Step& )
|
||||
G4VParticleChange* G4ParallelWorldScoringProcess::AlongStepDoIt(const G4Track& track, const G4Step&)
|
||||
{
|
||||
// Dummy ParticleChange ie: does nothing
|
||||
// Expecting G4Transportation to move the track
|
||||
pParticleChange->Initialize(track);
|
||||
return pParticleChange;
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
|
||||
void G4ParallelWorldScoringProcess::CopyStep(const G4Step & step)
|
||||
void G4ParallelWorldScoringProcess::CopyStep(const G4Step& step)
|
||||
{
|
||||
G4StepStatus prevStat = fGhostPostStepPoint->GetStepStatus();
|
||||
|
||||
@@ -407,75 +353,77 @@ void G4ParallelWorldScoringProcess::CopyStep(const G4Step & step)
|
||||
*fGhostPreStepPoint = *(step.GetPreStepPoint());
|
||||
*fGhostPostStepPoint = *(step.GetPostStepPoint());
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Set StepStatus for ghost world
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Set StepStatus for ghost world
|
||||
fGhostPreStepPoint->SetStepStatus(prevStat);
|
||||
if(fOnBoundary)
|
||||
{ fGhostPostStepPoint->SetStepStatus(fGeomBoundary); }
|
||||
else if(fGhostPostStepPoint->GetStepStatus()==fGeomBoundary)
|
||||
{ fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc); }
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
if (fOnBoundary) {
|
||||
fGhostPostStepPoint->SetStepStatus(fGeomBoundary);
|
||||
}
|
||||
else if (fGhostPostStepPoint->GetStepStatus() == fGeomBoundary) {
|
||||
fGhostPostStepPoint->SetStepStatus(fPostStepDoItProc);
|
||||
}
|
||||
}
|
||||
|
||||
void G4ParallelWorldScoringProcess::Verbose(const G4Step& step) const
|
||||
{
|
||||
G4cout << "In mass geometry ------------------------------------------------" << G4endl;
|
||||
G4cout << " StepLength : " << step.GetStepLength()/mm << " TotalEnergyDeposit : "
|
||||
<< step.GetTotalEnergyDeposit()/MeV << G4endl;
|
||||
G4cout << " PreStepPoint : "
|
||||
<< step.GetPreStepPoint()->GetPhysicalVolume()->GetName() << " - ";
|
||||
if(step.GetPreStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << step.GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
G4cout << " StepLength : " << step.GetStepLength() / mm
|
||||
<< " TotalEnergyDeposit : " << step.GetTotalEnergyDeposit() / MeV << G4endl;
|
||||
G4cout << " PreStepPoint : " << step.GetPreStepPoint()->GetPhysicalVolume()->GetName() << " - ";
|
||||
if (step.GetPreStepPoint()->GetProcessDefinedStep() != nullptr) {
|
||||
G4cout << step.GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
|
||||
}
|
||||
else {
|
||||
G4cout << "NoProcessAssigned";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << step.GetPreStepPoint()->GetPosition() << G4endl;
|
||||
G4cout << " PostStepPoint : ";
|
||||
if(step.GetPostStepPoint()->GetPhysicalVolume())
|
||||
{ G4cout << step.GetPostStepPoint()->GetPhysicalVolume()->GetName(); }
|
||||
else
|
||||
{ G4cout << "OutOfWorld"; }
|
||||
if (step.GetPostStepPoint()->GetPhysicalVolume() != nullptr) {
|
||||
G4cout << step.GetPostStepPoint()->GetPhysicalVolume()->GetName();
|
||||
}
|
||||
else {
|
||||
G4cout << "OutOfWorld";
|
||||
}
|
||||
G4cout << " - ";
|
||||
if(step.GetPostStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << step.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
if (step.GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
|
||||
G4cout << step.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
|
||||
}
|
||||
else {
|
||||
G4cout << "NoProcessAssigned";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << step.GetPostStepPoint()->GetPosition() << G4endl;
|
||||
|
||||
G4cout << "In ghost geometry ------------------------------------------------" << G4endl;
|
||||
G4cout << " StepLength : " << fGhostStep->GetStepLength()/mm
|
||||
<< " TotalEnergyDeposit : "
|
||||
<< fGhostStep->GetTotalEnergyDeposit()/MeV << G4endl;
|
||||
G4cout << " PreStepPoint : "
|
||||
<< fGhostStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() << " ["
|
||||
<< fGhostStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber()
|
||||
<< " ]" << " - ";
|
||||
if(fGhostStep->GetPreStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << fGhostStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
G4cout << " StepLength : " << fGhostStep->GetStepLength() / mm
|
||||
<< " TotalEnergyDeposit : " << fGhostStep->GetTotalEnergyDeposit() / MeV << G4endl;
|
||||
G4cout << " PreStepPoint : " << fGhostStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()
|
||||
<< " [" << fGhostStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber() << " ]"
|
||||
<< " - ";
|
||||
if (fGhostStep->GetPreStepPoint()->GetProcessDefinedStep() != nullptr) {
|
||||
G4cout << fGhostStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
|
||||
}
|
||||
else {
|
||||
G4cout << "NoProcessAssigned";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << fGhostStep->GetPreStepPoint()->GetPosition() << G4endl;
|
||||
G4cout << " PostStepPoint : ";
|
||||
if(fGhostStep->GetPostStepPoint()->GetPhysicalVolume())
|
||||
{
|
||||
if (fGhostStep->GetPostStepPoint()->GetPhysicalVolume() != nullptr) {
|
||||
G4cout << fGhostStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() << " ["
|
||||
<< fGhostStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber()
|
||||
<< " ]";
|
||||
<< fGhostStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber() << " ]";
|
||||
}
|
||||
else {
|
||||
G4cout << "OutOfWorld";
|
||||
}
|
||||
else
|
||||
{ G4cout << "OutOfWorld"; }
|
||||
G4cout << " - ";
|
||||
if(fGhostStep->GetPostStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << fGhostStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
if (fGhostStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
|
||||
G4cout << fGhostStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
|
||||
}
|
||||
else {
|
||||
G4cout << "NoProcessAssigned";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << fGhostStep->GetPostStepPoint()->GetPosition() << " == "
|
||||
<< fGhostStep->GetTrack()->GetMomentumDirection()
|
||||
<< G4endl;
|
||||
|
||||
G4cout << " " << fGhostStep->GetPostStepPoint()->GetPosition()
|
||||
<< " == " << fGhostStep->GetTrack()->GetMomentumDirection() << G4endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,42 +28,36 @@
|
||||
|
||||
#include "G4ScoreSplittingProcess.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4RegularNavigationHelper.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
#include "G4EnergySplitter.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4RegularNavigationHelper.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//--------------------------------
|
||||
// Constructor with name and type:
|
||||
//--------------------------------
|
||||
G4ScoreSplittingProcess::
|
||||
G4ScoreSplittingProcess(const G4String& processName,G4ProcessType theType)
|
||||
:G4VProcess(processName,theType),
|
||||
fOldTouchableH(), fNewTouchableH(), fInitialTouchableH(), fFinalTouchableH()
|
||||
G4ScoreSplittingProcess::G4ScoreSplittingProcess(const G4String& processName, G4ProcessType theType)
|
||||
: G4VProcess(processName, theType)
|
||||
{
|
||||
pParticleChange = &xParticleChange;
|
||||
|
||||
fSplitStep = new G4Step();
|
||||
fSplitPreStepPoint = fSplitStep->GetPreStepPoint();
|
||||
fSplitPreStepPoint = fSplitStep->GetPreStepPoint();
|
||||
fSplitPostStepPoint = fSplitStep->GetPostStepPoint();
|
||||
|
||||
if (verboseLevel>0)
|
||||
{
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
fpEnergySplitter = new G4EnergySplitter();
|
||||
fpEnergySplitter = new G4EnergySplitter();
|
||||
}
|
||||
|
||||
// -----------
|
||||
@@ -72,7 +66,7 @@ G4ScoreSplittingProcess(const G4String& processName,G4ProcessType theType)
|
||||
G4ScoreSplittingProcess::~G4ScoreSplittingProcess()
|
||||
{
|
||||
delete fSplitStep;
|
||||
delete fpEnergySplitter;
|
||||
delete fpEnergySplitter;
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
@@ -82,43 +76,37 @@ G4ScoreSplittingProcess::~G4ScoreSplittingProcess()
|
||||
//------------------------------------------------------
|
||||
void G4ScoreSplittingProcess::StartTracking(G4Track* trk)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Setup initial touchables for the first step
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
const G4Step* pStep= trk->GetStep();
|
||||
// Setup initial touchables for the first step
|
||||
const G4Step* pStep = trk->GetStep();
|
||||
|
||||
fOldTouchableH = trk->GetTouchableHandle();
|
||||
*fSplitPreStepPoint = *(pStep->GetPreStepPoint()); // Best to copy, so as to initialise
|
||||
*fSplitPreStepPoint = *(pStep->GetPreStepPoint()); // Best to copy, so as to initialise
|
||||
fSplitPreStepPoint->SetTouchableHandle(fOldTouchableH);
|
||||
fNewTouchableH = fOldTouchableH;
|
||||
*fSplitPostStepPoint= *(pStep->GetPostStepPoint()); // Best to copy, so as to initialise
|
||||
*fSplitPostStepPoint = *(pStep->GetPostStepPoint()); // Best to copy, so as to initialise
|
||||
fSplitPostStepPoint->SetTouchableHandle(fNewTouchableH);
|
||||
|
||||
/// Initialize
|
||||
fSplitPreStepPoint ->SetStepStatus(fUndefined);
|
||||
/// Initialize
|
||||
fSplitPreStepPoint->SetStepStatus(fUndefined);
|
||||
fSplitPostStepPoint->SetStepStatus(fUndefined);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//
|
||||
// PostStepGetPhysicalInteractionLength()
|
||||
//
|
||||
//----------------------------------------------------------
|
||||
G4double
|
||||
G4ScoreSplittingProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/,
|
||||
G4double /*previousStepSize*/,
|
||||
G4ForceCondition* condition)
|
||||
G4double G4ScoreSplittingProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/, G4double /*previousStepSize*/, G4ForceCondition* condition)
|
||||
{
|
||||
// This process must be invoked anyway to score the hit
|
||||
// - to do the scoring if the current volume is a regular structure, or
|
||||
// - else to toggle the flag so that the SteppingManager does the scoring.
|
||||
*condition = StronglyForced;
|
||||
|
||||
// Future optimisation: check whether in regular structure.
|
||||
// Future optimisation: check whether in regular structure.
|
||||
// If it is in regular structure, be StronglyForced
|
||||
// If not in regular structure,
|
||||
// If not in regular structure,
|
||||
// ask to be called only if SteppingControl is AvoidHitInvocation
|
||||
// in order to reset it to NormalCondition
|
||||
|
||||
@@ -130,139 +118,137 @@ G4ScoreSplittingProcess::PostStepGetPhysicalInteractionLength(
|
||||
// PostStepDoIt()
|
||||
//
|
||||
//------------------------------------
|
||||
G4VParticleChange* G4ScoreSplittingProcess::PostStepDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
G4VPhysicalVolume* pCurrentVolume= track.GetVolume();
|
||||
G4LogicalVolume* pLogicalVolume= pCurrentVolume->GetLogicalVolume();
|
||||
G4VParticleChange* G4ScoreSplittingProcess::PostStepDoIt(const G4Track& track, const G4Step& step)
|
||||
{
|
||||
G4VPhysicalVolume* pCurrentVolume = track.GetVolume();
|
||||
G4LogicalVolume* pLogicalVolume = pCurrentVolume->GetLogicalVolume();
|
||||
G4VSensitiveDetector* ptrSD = pLogicalVolume->GetSensitiveDetector();
|
||||
|
||||
pParticleChange->Initialize(track);
|
||||
if( ( ! pCurrentVolume->IsRegularStructure() ) || ( !ptrSD )
|
||||
|| G4RegularNavigationHelper::Instance()->GetStepLengths().size() <= 1) {
|
||||
// Set the flag to make sure that Stepping Manager does the scoring
|
||||
pParticleChange->ProposeSteppingControl( NormalCondition );
|
||||
} else {
|
||||
G4ThreeVector preStepPosition, postStepPosition, direction, finalPostStepPosition;
|
||||
pParticleChange->ProposeSteppingControl( AvoidHitInvocation );
|
||||
|
||||
G4double totalEnergyDeposit= step.GetTotalEnergyDeposit();
|
||||
G4StepStatus fullStepStatus= step.GetPostStepPoint()->GetStepStatus();
|
||||
pParticleChange->Initialize(track);
|
||||
if ((!pCurrentVolume->IsRegularStructure()) || (ptrSD == nullptr)
|
||||
|| G4RegularNavigationHelper::Instance()->GetStepLengths().size() <= 1)
|
||||
{
|
||||
// Set the flag to make sure that Stepping Manager does the scoring
|
||||
pParticleChange->ProposeSteppingControl(NormalCondition);
|
||||
}
|
||||
else {
|
||||
G4ThreeVector preStepPosition, postStepPosition, direction, finalPostStepPosition;
|
||||
pParticleChange->ProposeSteppingControl(AvoidHitInvocation);
|
||||
|
||||
CopyStepStart(step);
|
||||
fSplitPreStepPoint->SetSensitiveDetector(ptrSD);
|
||||
fOldTouchableH = fInitialTouchableH;
|
||||
fNewTouchableH= fOldTouchableH;
|
||||
*fSplitPostStepPoint= *(step.GetPreStepPoint());
|
||||
|
||||
// Split the energy
|
||||
// ----------------
|
||||
G4int numberVoxelsInStep= fpEnergySplitter->SplitEnergyInVolumes( &step );
|
||||
G4double totalEnergyDeposit = step.GetTotalEnergyDeposit();
|
||||
G4StepStatus fullStepStatus = step.GetPostStepPoint()->GetStepStatus();
|
||||
|
||||
preStepPosition= step.GetPreStepPoint()->GetPosition();
|
||||
finalPostStepPosition= step.GetPostStepPoint()->GetPosition();
|
||||
direction= (finalPostStepPosition - preStepPosition).unit();
|
||||
CopyStepStart(step);
|
||||
fSplitPreStepPoint->SetSensitiveDetector(ptrSD);
|
||||
fOldTouchableH = fInitialTouchableH;
|
||||
fNewTouchableH = fOldTouchableH;
|
||||
*fSplitPostStepPoint = *(step.GetPreStepPoint());
|
||||
|
||||
fFinalTouchableH= track.GetNextTouchableHandle();
|
||||
// Split the energy
|
||||
// ----------------
|
||||
G4int numberVoxelsInStep = fpEnergySplitter->SplitEnergyInVolumes(&step);
|
||||
|
||||
postStepPosition= preStepPosition;
|
||||
// Loop over the sub-parts of this step
|
||||
G4int iStep;
|
||||
for ( iStep=0; iStep < numberVoxelsInStep; iStep++ ){
|
||||
G4int idVoxel= -1; // Voxel ID
|
||||
G4double stepLength=0.0, energyLoss= 0.0;
|
||||
preStepPosition = step.GetPreStepPoint()->GetPosition();
|
||||
finalPostStepPosition = step.GetPostStepPoint()->GetPosition();
|
||||
direction = (finalPostStepPosition - preStepPosition).unit();
|
||||
|
||||
*fSplitPreStepPoint = *fSplitPostStepPoint;
|
||||
fOldTouchableH = fNewTouchableH;
|
||||
fFinalTouchableH = track.GetNextTouchableHandle();
|
||||
|
||||
preStepPosition= postStepPosition;
|
||||
fSplitPreStepPoint->SetPosition( preStepPosition );
|
||||
fSplitPreStepPoint->SetTouchableHandle(fOldTouchableH);
|
||||
|
||||
fpEnergySplitter->GetLengthAndEnergyDeposited( iStep, idVoxel, stepLength, energyLoss);
|
||||
postStepPosition = preStepPosition;
|
||||
// Loop over the sub-parts of this step
|
||||
G4int iStep;
|
||||
for (iStep = 0; iStep < numberVoxelsInStep; iStep++) {
|
||||
G4int idVoxel = -1; // Voxel ID
|
||||
G4double stepLength = 0.0, energyLoss = 0.0;
|
||||
|
||||
// Correct the material, so that the track->GetMaterial gives correct answer
|
||||
pLogicalVolume->SetMaterial( fpEnergySplitter->GetVoxelMaterial( iStep) ); // idVoxel) );
|
||||
*fSplitPreStepPoint = *fSplitPostStepPoint;
|
||||
fOldTouchableH = fNewTouchableH;
|
||||
|
||||
postStepPosition= preStepPosition + stepLength * direction;
|
||||
fSplitPostStepPoint->SetPosition(postStepPosition);
|
||||
preStepPosition = postStepPosition;
|
||||
fSplitPreStepPoint->SetPosition(preStepPosition);
|
||||
fSplitPreStepPoint->SetTouchableHandle(fOldTouchableH);
|
||||
|
||||
// Load the Step with the new values
|
||||
fSplitStep->SetStepLength(stepLength);
|
||||
fSplitStep->SetTotalEnergyDeposit(energyLoss);
|
||||
if( iStep < numberVoxelsInStep -1 ){
|
||||
fSplitStep->GetPostStepPoint()->SetStepStatus( fGeomBoundary );
|
||||
G4int nextVoxelId= -1;
|
||||
fpEnergySplitter->GetVoxelID( iStep+1, nextVoxelId );
|
||||
fpEnergySplitter->GetLengthAndEnergyDeposited(iStep, idVoxel, stepLength, energyLoss);
|
||||
|
||||
// Create new "next" touchable for each section ??
|
||||
G4VTouchable* fNewTouchablePtr=
|
||||
CreateTouchableForSubStep( nextVoxelId, postStepPosition );
|
||||
fNewTouchableH= G4TouchableHandle(fNewTouchablePtr);
|
||||
fSplitPostStepPoint->SetTouchableHandle( fNewTouchableH );
|
||||
} else {
|
||||
fSplitStep->GetPostStepPoint()->SetStepStatus( fullStepStatus );
|
||||
fSplitPostStepPoint->SetTouchableHandle( fFinalTouchableH );
|
||||
}
|
||||
// Correct the material, so that the track->GetMaterial gives correct answer
|
||||
pLogicalVolume->SetMaterial(fpEnergySplitter->GetVoxelMaterial(iStep)); // idVoxel) );
|
||||
|
||||
postStepPosition = preStepPosition + stepLength * direction;
|
||||
fSplitPostStepPoint->SetPosition(postStepPosition);
|
||||
|
||||
// As first approximation, split the NIEL in the same fractions as the energy deposit
|
||||
G4double eLossFraction;
|
||||
eLossFraction= (totalEnergyDeposit>0.0) ? energyLoss / totalEnergyDeposit : 1.0 ;
|
||||
fSplitStep->SetNonIonizingEnergyDeposit(step.GetNonIonizingEnergyDeposit()*eLossFraction);
|
||||
|
||||
fSplitPostStepPoint->SetSensitiveDetector( ptrSD );
|
||||
// Load the Step with the new values
|
||||
fSplitStep->SetStepLength(stepLength);
|
||||
fSplitStep->SetTotalEnergyDeposit(energyLoss);
|
||||
if (iStep < numberVoxelsInStep - 1) {
|
||||
fSplitStep->GetPostStepPoint()->SetStepStatus(fGeomBoundary);
|
||||
G4int nextVoxelId = -1;
|
||||
fpEnergySplitter->GetVoxelID(iStep + 1, nextVoxelId);
|
||||
|
||||
// Call the Sensitive Detector
|
||||
ptrSD->Hit(fSplitStep);
|
||||
// Create new "next" touchable for each section ??
|
||||
G4VTouchable* fNewTouchablePtr = CreateTouchableForSubStep(nextVoxelId, postStepPosition);
|
||||
fNewTouchableH = G4TouchableHandle(fNewTouchablePtr);
|
||||
fSplitPostStepPoint->SetTouchableHandle(fNewTouchableH);
|
||||
}
|
||||
else {
|
||||
fSplitStep->GetPostStepPoint()->SetStepStatus(fullStepStatus);
|
||||
fSplitPostStepPoint->SetTouchableHandle(fFinalTouchableH);
|
||||
}
|
||||
|
||||
if (verboseLevel>1) Verbose(step);
|
||||
}
|
||||
// As first approximation, split the NIEL in the same fractions as the energy deposit
|
||||
G4double eLossFraction;
|
||||
eLossFraction = (totalEnergyDeposit > 0.0) ? energyLoss / totalEnergyDeposit : 1.0;
|
||||
fSplitStep->SetNonIonizingEnergyDeposit(step.GetNonIonizingEnergyDeposit() * eLossFraction);
|
||||
|
||||
fSplitPostStepPoint->SetSensitiveDetector(ptrSD);
|
||||
|
||||
// Call the Sensitive Detector
|
||||
ptrSD->Hit(fSplitStep);
|
||||
|
||||
if (verboseLevel > 1) Verbose(step);
|
||||
}
|
||||
}
|
||||
|
||||
// This must change the Stepping Control
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
G4TouchableHistory*
|
||||
G4ScoreSplittingProcess::CreateTouchableForSubStep( G4int newVoxelNum, G4ThreeVector )
|
||||
G4TouchableHistory* G4ScoreSplittingProcess::CreateTouchableForSubStep(G4int newVoxelNum,
|
||||
G4ThreeVector)
|
||||
{
|
||||
// G4cout << " Creating touchable handle for voxel-no " << newVoxelNum << G4endl;
|
||||
auto oldTouchableHistory = dynamic_cast<G4TouchableHistory*>(fOldTouchableH());
|
||||
G4TouchableHistory* ptrTouchableHistory =
|
||||
G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->CreateTouchableHistory(oldTouchableHistory->GetHistory());
|
||||
|
||||
G4TouchableHistory* oldTouchableHistory= dynamic_cast<G4TouchableHistory*>(fOldTouchableH());
|
||||
G4TouchableHistory* ptrTouchableHistory= G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking()->CreateTouchableHistory(oldTouchableHistory->GetHistory());
|
||||
|
||||
// Change the history
|
||||
G4NavigationHistory* ptrNavHistory= const_cast<G4NavigationHistory*>(ptrTouchableHistory->GetHistory());
|
||||
G4VPhysicalVolume* curPhysicalVol= ptrNavHistory->GetTopVolume();
|
||||
auto ptrNavHistory = const_cast<G4NavigationHistory*>(ptrTouchableHistory->GetHistory());
|
||||
G4VPhysicalVolume* curPhysicalVol = ptrNavHistory->GetTopVolume();
|
||||
|
||||
EVolume curVolumeType= ptrNavHistory->GetTopVolumeType();
|
||||
if( curVolumeType == kParameterised )
|
||||
{
|
||||
ptrNavHistory->BackLevel();
|
||||
EVolume curVolumeType = ptrNavHistory->GetTopVolumeType();
|
||||
if (curVolumeType == kParameterised) {
|
||||
ptrNavHistory->BackLevel();
|
||||
// G4VPVParameterised parameterisedPV= pNewMother
|
||||
G4VPVParameterisation* curParamstn= curPhysicalVol->GetParameterisation();
|
||||
G4VPVParameterisation* curParamstn = curPhysicalVol->GetParameterisation();
|
||||
|
||||
// From G4ParameterisedNavigation::IdentifyAndPlaceSolid() inline method
|
||||
G4VSolid* sampleSolid = curParamstn->ComputeSolid(newVoxelNum, curPhysicalVol);
|
||||
sampleSolid->ComputeDimensions(curParamstn, newVoxelNum, curPhysicalVol);
|
||||
curParamstn->ComputeTransformation(newVoxelNum, curPhysicalVol);
|
||||
|
||||
ptrNavHistory->NewLevel( curPhysicalVol, kParameterised, newVoxelNum );
|
||||
ptrNavHistory->NewLevel(curPhysicalVol, kParameterised, newVoxelNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << " Current volume type is not Parameterised. " << G4endl;
|
||||
G4Exception("G4ScoreSplittingProcess::CreateTouchableForSubStep",
|
||||
"ErrorRegularParamaterisation", JustWarning,
|
||||
"Score Splitting Process is used for Regular Structure - but did not find one here.");
|
||||
else {
|
||||
G4cout << " Current volume type is not Parameterised. " << G4endl;
|
||||
G4Exception(
|
||||
"G4ScoreSplittingProcess::CreateTouchableForSubStep", "ErrorRegularParamaterisation",
|
||||
JustWarning,
|
||||
"Score Splitting Process is used for Regular Structure - but did not find one here.");
|
||||
}
|
||||
return ptrTouchableHistory;
|
||||
return ptrTouchableHistory;
|
||||
}
|
||||
|
||||
void G4ScoreSplittingProcess::CopyStepStart(const G4Step & step)
|
||||
void G4ScoreSplittingProcess::CopyStepStart(const G4Step& step)
|
||||
{
|
||||
fSplitStep->SetTrack(step.GetTrack());
|
||||
fSplitStep->SetStepLength(step.GetStepLength());
|
||||
@@ -270,98 +256,98 @@ void G4ScoreSplittingProcess::CopyStepStart(const G4Step & step)
|
||||
fSplitStep->SetNonIonizingEnergyDeposit(step.GetNonIonizingEnergyDeposit());
|
||||
fSplitStep->SetControlFlag(step.GetControlFlag());
|
||||
|
||||
*fSplitPreStepPoint = *(step.GetPreStepPoint());
|
||||
*fSplitPreStepPoint = *(step.GetPreStepPoint());
|
||||
|
||||
fInitialTouchableH= (step.GetPreStepPoint()) ->GetTouchableHandle();
|
||||
fFinalTouchableH = (step.GetPostStepPoint())->GetTouchableHandle();
|
||||
fInitialTouchableH = (step.GetPreStepPoint())->GetTouchableHandle();
|
||||
fFinalTouchableH = (step.GetPostStepPoint())->GetTouchableHandle();
|
||||
}
|
||||
|
||||
void G4ScoreSplittingProcess::Verbose(const G4Step& step) const
|
||||
{
|
||||
G4cout << "In mass geometry ------------------------------------------------" << G4endl;
|
||||
G4cout << " StepLength : " << step.GetStepLength()/mm << " TotalEnergyDeposit : "
|
||||
<< step.GetTotalEnergyDeposit()/MeV << G4endl;
|
||||
G4cout << " PreStepPoint : "
|
||||
<< step.GetPreStepPoint()->GetPhysicalVolume()->GetName() << " - ";
|
||||
if(step.GetPreStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << step.GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
G4cout << " StepLength : " << step.GetStepLength() / mm
|
||||
<< " TotalEnergyDeposit : " << step.GetTotalEnergyDeposit() / MeV << G4endl;
|
||||
G4cout << " PreStepPoint : " << step.GetPreStepPoint()->GetPhysicalVolume()->GetName() << " - ";
|
||||
if (step.GetPreStepPoint()->GetProcessDefinedStep() != nullptr) {
|
||||
G4cout << step.GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
|
||||
}
|
||||
else {
|
||||
G4cout << "NoProcessAssigned";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << step.GetPreStepPoint()->GetPosition() << G4endl;
|
||||
G4cout << " PostStepPoint : ";
|
||||
if(step.GetPostStepPoint()->GetPhysicalVolume())
|
||||
{ G4cout << step.GetPostStepPoint()->GetPhysicalVolume()->GetName(); }
|
||||
else
|
||||
{ G4cout << "OutOfWorld"; }
|
||||
if (step.GetPostStepPoint()->GetPhysicalVolume() != nullptr) {
|
||||
G4cout << step.GetPostStepPoint()->GetPhysicalVolume()->GetName();
|
||||
}
|
||||
else {
|
||||
G4cout << "OutOfWorld";
|
||||
}
|
||||
G4cout << " - ";
|
||||
if(step.GetPostStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << step.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
if (step.GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
|
||||
G4cout << step.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
|
||||
}
|
||||
else {
|
||||
G4cout << "NoProcessAssigned";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << step.GetPostStepPoint()->GetPosition() << G4endl;
|
||||
|
||||
G4cout << "In ghost geometry ------------------------------------------------" << G4endl;
|
||||
G4cout << " StepLength : " << fSplitStep->GetStepLength()/mm
|
||||
<< " TotalEnergyDeposit : "
|
||||
<< fSplitStep->GetTotalEnergyDeposit()/MeV << G4endl;
|
||||
G4cout << " PreStepPoint : "
|
||||
<< fSplitStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() << " ["
|
||||
<< fSplitStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber()
|
||||
<< " ]" << " - ";
|
||||
if(fSplitStep->GetPreStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << fSplitStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
G4cout << " StepLength : " << fSplitStep->GetStepLength() / mm
|
||||
<< " TotalEnergyDeposit : " << fSplitStep->GetTotalEnergyDeposit() / MeV << G4endl;
|
||||
G4cout << " PreStepPoint : " << fSplitStep->GetPreStepPoint()->GetPhysicalVolume()->GetName()
|
||||
<< " [" << fSplitStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber() << " ]"
|
||||
<< " - ";
|
||||
if (fSplitStep->GetPreStepPoint()->GetProcessDefinedStep() != nullptr) {
|
||||
G4cout << fSplitStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName();
|
||||
}
|
||||
else {
|
||||
G4cout << "NoProcessAssigned";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << fSplitStep->GetPreStepPoint()->GetPosition() << G4endl;
|
||||
G4cout << " PostStepPoint : ";
|
||||
if(fSplitStep->GetPostStepPoint()->GetPhysicalVolume())
|
||||
{
|
||||
if (fSplitStep->GetPostStepPoint()->GetPhysicalVolume() != nullptr) {
|
||||
G4cout << fSplitStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() << " ["
|
||||
<< fSplitStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber()
|
||||
<< " ]";
|
||||
<< fSplitStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber() << " ]";
|
||||
}
|
||||
else {
|
||||
G4cout << "OutOfWorld";
|
||||
}
|
||||
else
|
||||
{ G4cout << "OutOfWorld"; }
|
||||
G4cout << " - ";
|
||||
if(fSplitStep->GetPostStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << fSplitStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
if (fSplitStep->GetPostStepPoint()->GetProcessDefinedStep() != nullptr) {
|
||||
G4cout << fSplitStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
|
||||
}
|
||||
else {
|
||||
G4cout << "NoProcessAssigned";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << fSplitStep->GetPostStepPoint()->GetPosition() << " == "
|
||||
<< fSplitStep->GetTrack()->GetMomentumDirection()
|
||||
<< G4endl;
|
||||
|
||||
G4cout << " " << fSplitStep->GetPostStepPoint()->GetPosition()
|
||||
<< " == " << fSplitStep->GetTrack()->GetMomentumDirection() << G4endl;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//
|
||||
// AtRestGetPhysicalInteractionLength()
|
||||
//
|
||||
//----------------------------------------------------------
|
||||
G4double
|
||||
G4ScoreSplittingProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/,
|
||||
G4ForceCondition* condition)
|
||||
G4double G4ScoreSplittingProcess::AtRestGetPhysicalInteractionLength(const G4Track& /*track*/,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = NotForced; // Was Forced
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------
|
||||
// AlongStepGetPhysicalInteractionLength
|
||||
//---------------------------------------
|
||||
G4double G4ScoreSplittingProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& , // track,
|
||||
G4double , // previousStepSize,
|
||||
G4double , // currentMinimumStep,
|
||||
G4double& , // proposedSafety,
|
||||
G4GPILSelection* selection)
|
||||
G4double
|
||||
G4ScoreSplittingProcess::AlongStepGetPhysicalInteractionLength(const G4Track&, // track,
|
||||
G4double, // previousStepSize,
|
||||
G4double, // currentMinimumStep,
|
||||
G4double&, // proposedSafety,
|
||||
G4GPILSelection* selection)
|
||||
{
|
||||
*selection = NotCandidateForSelection;
|
||||
return DBL_MAX;
|
||||
@@ -371,8 +357,7 @@ G4double G4ScoreSplittingProcess::AlongStepGetPhysicalInteractionLength(
|
||||
// AlongStepDoIt()
|
||||
//------------------------------------
|
||||
|
||||
G4VParticleChange* G4ScoreSplittingProcess::AlongStepDoIt(
|
||||
const G4Track& track, const G4Step& )
|
||||
G4VParticleChange* G4ScoreSplittingProcess::AlongStepDoIt(const G4Track& track, const G4Step&)
|
||||
{
|
||||
// Dummy ParticleChange ie: does nothing
|
||||
// Expecting G4Transportation to move the track
|
||||
@@ -383,10 +368,8 @@ G4VParticleChange* G4ScoreSplittingProcess::AlongStepDoIt(
|
||||
//------------------------------------
|
||||
// AtRestDoIt()
|
||||
//------------------------------------
|
||||
G4VParticleChange* G4ScoreSplittingProcess::AtRestDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step&)
|
||||
{
|
||||
G4VParticleChange* G4ScoreSplittingProcess::AtRestDoIt(const G4Track& track, const G4Step&)
|
||||
{
|
||||
pParticleChange->Initialize(track);
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user