Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -16,6 +16,9 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
November 15th, 2019 Gabriele Cosmo (procbiasing-V10-05-01)
|
||||
- Fixed cases of implicit type conversions from size_t to G4int.
|
||||
|
||||
March 11th, 2019 Gabriele Cosmo (procbiasing-V10-05-00)
|
||||
- Fixed typos in printouts and comments.
|
||||
|
||||
|
||||
@@ -16,6 +16,21 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
|
||||
November 15th, 2019 M. Verderi
|
||||
- Introduce leading particle biasing proc-biasgen-V10-05-00
|
||||
This is made implementing the new biasing operation:
|
||||
include/G4BOptnLeadingParticle.hh
|
||||
src/G4BOptnLeadingParticle.cc
|
||||
- G4BOptnChangeCrossSection:
|
||||
add argument to:
|
||||
void SetBiasedCrossSection(G4double xst);
|
||||
as option to update the interaction length when
|
||||
setting a new cross-section value:
|
||||
void SetBiasedCrossSection(G4double xst, bool updateInteractionLength = false);
|
||||
default value makes the change backward compatible.
|
||||
|
||||
|
||||
November 24th, 2017 M. Verderi
|
||||
- Fix G4BiasingProcessInterface for wrong setting of first/last
|
||||
GPIL/DoIt flags in case charged particles. As the msc became
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
// -- return concrete type of interaction law:
|
||||
G4InteractionLawPhysical* GetBiasedExponentialLaw() {return fBiasedExponentialLaw;}
|
||||
// -- set biased cross-section:
|
||||
void SetBiasedCrossSection(G4double xst);
|
||||
void SetBiasedCrossSection(G4double xst, bool updateInteractionLength = false);
|
||||
G4double GetBiasedCrossSection() const;
|
||||
// -- Sample underneath distribution:
|
||||
void Sample();
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
//
|
||||
// G4BOptnLeadingParticle
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingOperation that implements the so-called "Leading
|
||||
// particle biasing scheme". It is of interest in the shield problem
|
||||
// to estimate the flux leaking from the shield.
|
||||
// It works as follows:
|
||||
// - it is intented for hadronic inelastic interaction
|
||||
// - at each interaction, are kept:
|
||||
// - the most energetic particle (the leading particle)
|
||||
// - with unmodified weight
|
||||
// - randomly one particle of each species
|
||||
// - with this particle weight = n * primary_weight where
|
||||
// n is the number of particles of this species
|
||||
//---------------------------------------------------------------------
|
||||
// Initial version Nov. 2019 M. Verderi
|
||||
|
||||
|
||||
#ifndef G4BOptnLeadingParticle_hh
|
||||
#define G4BOptnLeadingParticle_hh 1
|
||||
|
||||
#include "G4VBiasingOperation.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
|
||||
class G4BOptnLeadingParticle : public G4VBiasingOperation {
|
||||
public:
|
||||
// -- Constructor :
|
||||
G4BOptnLeadingParticle(G4String name);
|
||||
// -- destructor:
|
||||
virtual ~G4BOptnLeadingParticle();
|
||||
|
||||
public:
|
||||
// -- Methods from G4VBiasingOperation interface:
|
||||
// ----------------------------------------------
|
||||
// -- Unused:
|
||||
virtual const G4VBiasingInteractionLaw* ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface*, G4ForceCondition& ) {return nullptr;}
|
||||
// -- Used:
|
||||
virtual G4VParticleChange* ApplyFinalStateBiasing( const G4BiasingProcessInterface*, // -- Method used for this biasing. The related biasing operator
|
||||
const G4Track*, // -- returns this biasing operation at the post step do it level
|
||||
const G4Step*, // -- when the wrapped process has won the interaction length race.
|
||||
G4bool& ); // -- The wrapped process final state is then trimmed.
|
||||
// -- Unused:
|
||||
virtual G4double DistanceToApplyOperation( const G4Track*,
|
||||
G4double,
|
||||
G4ForceCondition*) {return 0;}
|
||||
virtual G4VParticleChange* GenerateBiasingFinalState( const G4Track*,
|
||||
const G4Step* ) {return nullptr;}
|
||||
|
||||
public:
|
||||
// -- The possibility is given to further apply a Russian roulette on tracks that are accompagnying the leading particle
|
||||
// -- after the classical leading particle biasing algorithm has been applied.
|
||||
// -- This is of interest when applying the technique to e+ -> gamma gamma for example. Given one gamma is leading,
|
||||
// -- the second one is alone in its category, hence selected. With the Russian roulette it is then possible to keep
|
||||
// -- this one randomly. This is also of interest for pi0 decays, or for brem. e- -> e- gamma where the e- or gamma
|
||||
// -- are alone in their category.
|
||||
void SetFurtherKillingProbability( G4double p ) { fRussianRouletteKillingProbability = p; } // -- if p <= 0.0 the killing is ignored.
|
||||
G4double GetFurtherKillingProbability() const { return fRussianRouletteKillingProbability; }
|
||||
|
||||
private:
|
||||
// -- Particle change used to return the trimmed final state:
|
||||
G4ParticleChange fParticleChange;
|
||||
G4double fRussianRouletteKillingProbability;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -50,6 +50,7 @@ GEANT4_DEFINE_MODULE(NAME G4biasing_gen
|
||||
G4BOptnCloning.hh
|
||||
G4BOptnForceCommonTruncatedExp.hh
|
||||
G4BOptnForceFreeFlight.hh
|
||||
G4BOptnLeadingParticle.hh
|
||||
G4BOptrForceCollision.hh
|
||||
G4BOptrForceCollisionTrackData.hh
|
||||
G4ILawCommonTruncatedExp.hh
|
||||
@@ -67,6 +68,7 @@ GEANT4_DEFINE_MODULE(NAME G4biasing_gen
|
||||
G4BOptnCloning.cc
|
||||
G4BOptnForceCommonTruncatedExp.cc
|
||||
G4BOptnForceFreeFlight.cc
|
||||
G4BOptnLeadingParticle.cc
|
||||
G4BOptrForceCollision.cc
|
||||
G4BOptrForceCollisionTrackData.cc
|
||||
G4ILawCommonTruncatedExp.cc
|
||||
|
||||
@@ -45,9 +45,10 @@ const G4VBiasingInteractionLaw* G4BOptnChangeCrossSection::ProvideOccurenceBiasi
|
||||
return fBiasedExponentialLaw;
|
||||
}
|
||||
|
||||
void G4BOptnChangeCrossSection::SetBiasedCrossSection(G4double xst)
|
||||
void G4BOptnChangeCrossSection::SetBiasedCrossSection( G4double xst, bool updateInteractionLength )
|
||||
{
|
||||
fBiasedExponentialLaw->SetPhysicalCrossSection( xst );
|
||||
if ( updateInteractionLength ) UpdateForStep( 0.0 );
|
||||
}
|
||||
|
||||
G4double G4BOptnChangeCrossSection::GetBiasedCrossSection() const
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "G4BOptnLeadingParticle.hh"
|
||||
#include "G4BiasingProcessInterface.hh"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
|
||||
G4BOptnLeadingParticle::G4BOptnLeadingParticle(G4String name)
|
||||
: G4VBiasingOperation ( name ),
|
||||
fRussianRouletteKillingProbability ( -1.0 )
|
||||
{
|
||||
}
|
||||
|
||||
G4BOptnLeadingParticle::~G4BOptnLeadingParticle()
|
||||
{
|
||||
}
|
||||
|
||||
G4VParticleChange* G4BOptnLeadingParticle::ApplyFinalStateBiasing( const G4BiasingProcessInterface* callingProcess,
|
||||
const G4Track* track,
|
||||
const G4Step* step,
|
||||
G4bool& )
|
||||
{
|
||||
// -- collect wrapped process particle change:
|
||||
auto wrappedProcessParticleChange = callingProcess->GetWrappedProcess()->PostStepDoIt(*track,*step);
|
||||
|
||||
// -- does nothing in case the primary stays alone or in weird situation where all are killed...
|
||||
if ( wrappedProcessParticleChange->GetNumberOfSecondaries() == 0 ) return wrappedProcessParticleChange;
|
||||
if ( wrappedProcessParticleChange->GetTrackStatus() == fKillTrackAndSecondaries ) return wrappedProcessParticleChange;
|
||||
// -- ... else, collect the secondaries in a same vector (the primary is pushed in this vector, if surviving, later see [**]):
|
||||
std::vector < G4Track* > secondariesAndPrimary;
|
||||
for ( auto i = 0 ; i < wrappedProcessParticleChange->GetNumberOfSecondaries() ; i++ ) secondariesAndPrimary.push_back( wrappedProcessParticleChange->GetSecondary( i ) );
|
||||
|
||||
|
||||
// -- If case the primary survives, need to collect its new state. In the general case of the base class G4VParticleChange
|
||||
// -- this is tricky, as this class does not hold the primary changes (and we have to build a fake step and fake track
|
||||
// -- caring about the touchables, etc.) So we limit here to the G4ParticleChange case, checking the reality of this
|
||||
// -- class with a dynamic cast. If we don't have such an actual G4DynamicParticle object, we give up the biasing and return
|
||||
// -- the untrimmed process final state.
|
||||
// -- Note that this case does not happen often, as the technique is intended for inelastic processes. For case where several
|
||||
// -- particles can be produced without killing the primary, we have for example the electron-/positron-nuclear
|
||||
G4ParticleChange* castParticleChange ( nullptr );
|
||||
G4Track* finalStatePrimary ( nullptr );
|
||||
if ( ( wrappedProcessParticleChange->GetTrackStatus() != fStopAndKill ) )
|
||||
{
|
||||
// fFakePrimaryTrack->CopyTrackInfo( *track );
|
||||
// fFakeStep ->InitializeStep( fFakePrimaryTrack );
|
||||
// wrappedProcessParticleChange->UpdateStepForPostStep( fFakeStep );
|
||||
// fFakeStep->UpdateTrack();
|
||||
castParticleChange = dynamic_cast< G4ParticleChange* >( wrappedProcessParticleChange );
|
||||
if ( castParticleChange == nullptr )
|
||||
{
|
||||
G4cout << " **** G4BOptnLeadingParticle::ApplyFinalStateBiasing(...) : can not bias for " << callingProcess->GetProcessName() << ", this is just a warning." << G4endl;
|
||||
return wrappedProcessParticleChange;
|
||||
}
|
||||
finalStatePrimary = new G4Track( *track );
|
||||
finalStatePrimary->SetKineticEnergy ( castParticleChange->GetEnergy() );
|
||||
finalStatePrimary->SetWeight ( castParticleChange->GetWeight() );
|
||||
finalStatePrimary->SetMomentumDirection( *(castParticleChange->GetMomentumDirection()) );
|
||||
// -- [**] push the primary as the last track in the vector of tracks:
|
||||
secondariesAndPrimary.push_back( finalStatePrimary );
|
||||
}
|
||||
|
||||
// -- Ensure the secondaries all have the primary weight:
|
||||
// ---- collect primary track weight, from updated by process if alive, or from original copy if died:
|
||||
G4double primaryWeight;
|
||||
if ( finalStatePrimary ) primaryWeight = finalStatePrimary->GetWeight();
|
||||
else primaryWeight = track ->GetWeight();
|
||||
// ---- now set this same weight to all secondaries:
|
||||
for ( auto i = 0 ; i < wrappedProcessParticleChange->GetNumberOfSecondaries() ; i++ ) secondariesAndPrimary[ i ]->SetWeight( primaryWeight );
|
||||
|
||||
|
||||
// -- finds the leading particle, initialize a map of surviving tracks, tag as surviving the leading track:
|
||||
size_t leadingIDX = 0;
|
||||
G4double leadingEnergy = -1;
|
||||
std::map< G4Track*, G4bool > survivingMap;
|
||||
for ( size_t idx = 0; idx < secondariesAndPrimary.size(); idx++ )
|
||||
{
|
||||
survivingMap[ secondariesAndPrimary[idx] ] = false;
|
||||
if ( secondariesAndPrimary[idx]->GetKineticEnergy() > leadingEnergy )
|
||||
{
|
||||
leadingEnergy = secondariesAndPrimary[idx]->GetKineticEnergy();
|
||||
leadingIDX = idx;
|
||||
}
|
||||
}
|
||||
survivingMap[ secondariesAndPrimary[leadingIDX] ] = true; // -- tag as surviving the leading particle
|
||||
|
||||
|
||||
// -- now make track vectors of given types ( choose type = abs(PDG) ), excluding the leading particle:
|
||||
std::map < G4int, std::vector< G4Track* > > typesAndTracks;
|
||||
for ( size_t idx = 0; idx < secondariesAndPrimary.size(); idx++ )
|
||||
{
|
||||
if ( idx == leadingIDX ) continue; // -- excludes the leading particle
|
||||
auto currentTrack = secondariesAndPrimary[idx];
|
||||
auto GROUP = std::abs( currentTrack->GetDefinition()->GetPDGEncoding() ); // -- merge particles and anti-particles in the same category -- §§ this might be proposed as an option in future
|
||||
if ( currentTrack->GetDefinition()->GetBaryonNumber() >= 2 ) GROUP = -1000; // -- merge all baryons above proton/neutron in one same group -- §§ might be proposed as an option too
|
||||
|
||||
if ( typesAndTracks.find( GROUP ) == typesAndTracks.end() )
|
||||
{
|
||||
std::vector< G4Track* > v;
|
||||
v.push_back( currentTrack );
|
||||
typesAndTracks[ GROUP ] = v;
|
||||
}
|
||||
else
|
||||
{
|
||||
typesAndTracks[ GROUP ].push_back( currentTrack );
|
||||
}
|
||||
}
|
||||
// -- and on these vectors, randomly select the surviving particles:
|
||||
// ---- randomly select one surviving track per species
|
||||
// ---- for this surviving track, further apply a Russian roulette
|
||||
G4int nSecondaries = 0; // -- the number of secondaries to be returned
|
||||
for ( auto typeAndTrack : typesAndTracks )
|
||||
{
|
||||
size_t nTracks = (typeAndTrack.second).size();
|
||||
G4Track* keptTrack;
|
||||
// -- select one track among ones in same species:
|
||||
if ( nTracks > 1 )
|
||||
{
|
||||
auto keptTrackIDX = G4RandFlat::shootInt( nTracks );
|
||||
keptTrack = (typeAndTrack.second)[keptTrackIDX];
|
||||
keptTrack->SetWeight( keptTrack->GetWeight() * nTracks );
|
||||
}
|
||||
else
|
||||
{
|
||||
keptTrack = (typeAndTrack.second)[0];
|
||||
}
|
||||
// -- further apply a Russian Roulette on it:
|
||||
G4bool keepTrack = false;
|
||||
if ( fRussianRouletteKillingProbability > 0.0 )
|
||||
{
|
||||
if ( G4UniformRand() > fRussianRouletteKillingProbability )
|
||||
{
|
||||
keptTrack->SetWeight( keptTrack->GetWeight() / (1. - fRussianRouletteKillingProbability) );
|
||||
keepTrack = true;
|
||||
}
|
||||
}
|
||||
else keepTrack = true;
|
||||
if ( keepTrack )
|
||||
{
|
||||
survivingMap[ keptTrack ] = true;
|
||||
if ( keptTrack != finalStatePrimary ) nSecondaries++;
|
||||
}
|
||||
}
|
||||
// -- and if the leading is not the primary, we have to count it in nSecondaries:
|
||||
if ( secondariesAndPrimary[leadingIDX] != finalStatePrimary ) nSecondaries++;
|
||||
|
||||
// -- verify if the primary is still alive or not after above selection:
|
||||
G4bool primarySurvived = false;
|
||||
if ( finalStatePrimary ) primarySurvived = survivingMap[ finalStatePrimary ];
|
||||
|
||||
|
||||
// -- fill the trimmed particle change:
|
||||
// ---- fill for the primary:
|
||||
fParticleChange.Initialize(*track);
|
||||
if ( primarySurvived )
|
||||
{
|
||||
fParticleChange.ProposeTrackStatus ( wrappedProcessParticleChange->GetTrackStatus() );
|
||||
fParticleChange.ProposeParentWeight ( finalStatePrimary->GetWeight() ); // -- take weight from copy of primary, this one being updated in the random selection loop above
|
||||
fParticleChange.ProposeEnergy ( finalStatePrimary->GetKineticEnergy() );
|
||||
fParticleChange.ProposeMomentumDirection ( finalStatePrimary->GetMomentumDirection() );
|
||||
}
|
||||
else
|
||||
{
|
||||
fParticleChange.ProposeTrackStatus ( fStopAndKill );
|
||||
fParticleChange.ProposeParentWeight( 0.0 );
|
||||
fParticleChange.ProposeEnergy ( 0.0 );
|
||||
}
|
||||
// -- fill for surviving secondaries:
|
||||
fParticleChange.SetSecondaryWeightByProcess(true);
|
||||
fParticleChange.SetNumberOfSecondaries(nSecondaries);
|
||||
// ---- note we loop up to on the number of secondaries, which excludes the primary, last in secondariesAndPrimary vector:
|
||||
////// G4cout << callingProcess->GetProcessName() << " :";
|
||||
for ( auto idx = 0 ; idx < wrappedProcessParticleChange->GetNumberOfSecondaries() ; idx++ )
|
||||
{
|
||||
G4Track* secondary = secondariesAndPrimary[idx];
|
||||
// ********************
|
||||
//// if ( !survivingMap[ secondary ] ) G4cout << " [";
|
||||
///// else G4cout << " ";
|
||||
///// G4cout << secondary->GetDefinition()->GetParticleName() << " " << secondary->GetKineticEnergy();
|
||||
///// if ( !survivingMap[ secondary ] ) G4cout << "]";
|
||||
//// if ( secondary == secondariesAndPrimary[leadingIDX] ) G4cout << " ***";
|
||||
// ******************
|
||||
if ( survivingMap[ secondary ] ) fParticleChange.AddSecondary( secondary );
|
||||
else delete secondary;
|
||||
}
|
||||
/// G4cout << G4endl;
|
||||
|
||||
// -- clean the wrapped process particle change:
|
||||
wrappedProcessParticleChange->Clear();
|
||||
|
||||
if ( finalStatePrimary ) delete finalStatePrimary;
|
||||
|
||||
// -- finally, returns the trimmed particle change:
|
||||
return &fParticleChange;
|
||||
|
||||
}
|
||||
@@ -36,7 +36,7 @@ G4bool G4BiasingHelper::ActivatePhysicsBiasing(G4ProcessManager* pmanager,
|
||||
G4VProcess* physicsProcess(0);
|
||||
|
||||
G4ProcessVector* vprocess = pmanager->GetProcessList();
|
||||
for (G4int ip = 0 ; ip < vprocess->size() ; ip++)
|
||||
for (std::size_t ip = 0 ; ip < vprocess->size() ; ++ip)
|
||||
{
|
||||
if ( (*vprocess)[ip]->GetProcessName() == physicsProcessToBias )
|
||||
{
|
||||
@@ -110,7 +110,7 @@ G4ParallelGeometriesLimiterProcess* G4BiasingHelper::AddLimiterProcess(G4Process
|
||||
|
||||
G4ProcessVector* processList = pmanager->GetProcessList();
|
||||
G4bool noInstance = true;
|
||||
for (G4int i = 0 ; i < processList->size() ; i++)
|
||||
for (std::size_t i = 0 ; i < processList->size() ; ++i)
|
||||
{
|
||||
G4VProcess* process = (*processList)[i];
|
||||
if ( dynamic_cast< G4ParallelGeometriesLimiterProcess* >( process ) )
|
||||
|
||||
@@ -918,14 +918,14 @@ G4bool G4BiasingProcessInterface::IsFirstPostStepGPILInterface(G4bool physOnly)
|
||||
G4bool isFirst = true;
|
||||
const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeGPIL);
|
||||
G4int thisIdx(-1);
|
||||
for (G4int i = 0; i < pv->size(); i++ ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
|
||||
for (std::size_t i = 0; i < pv->size(); ++i ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
|
||||
if ( thisIdx < 0 ) return false; // -- to ignore pure along processes
|
||||
for ( size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); i++ )
|
||||
for ( std::size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); ++i )
|
||||
{
|
||||
if ( (fSharedData->fBiasingProcessInterfaces)[i]->fIsPhysicsBasedBiasing || !physOnly )
|
||||
{
|
||||
G4int thatIdx(-1);
|
||||
for (G4int j = 0; j < pv->size(); j++ ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
|
||||
for (std::size_t j = 0; j < pv->size(); ++j ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
|
||||
if ( thatIdx >= 0 ) // -- to ignore pure along processes
|
||||
{
|
||||
if ( thisIdx > thatIdx )
|
||||
@@ -945,14 +945,14 @@ G4bool G4BiasingProcessInterface::IsLastPostStepGPILInterface(G4bool physOnly) c
|
||||
G4bool isLast = true;
|
||||
const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeGPIL);
|
||||
G4int thisIdx(-1);
|
||||
for (G4int i = 0; i < pv->size(); i++ ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
|
||||
for (std::size_t i = 0; i < pv->size(); ++i ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
|
||||
if ( thisIdx < 0 ) return false; // -- to ignore pure along processes
|
||||
for ( size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); i++ )
|
||||
for ( std::size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); ++i )
|
||||
{
|
||||
if ( (fSharedData->fBiasingProcessInterfaces)[i]->fIsPhysicsBasedBiasing || !physOnly )
|
||||
{
|
||||
G4int thatIdx(-1);
|
||||
for (G4int j = 0; j < pv->size(); j++ ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
|
||||
for (std::size_t j = 0; j < pv->size(); ++j ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
|
||||
if ( thatIdx >= 0 ) // -- to ignore pure along processes
|
||||
{
|
||||
if ( thisIdx < thatIdx )
|
||||
@@ -972,14 +972,14 @@ G4bool G4BiasingProcessInterface::IsFirstPostStepDoItInterface(G4bool physOnly)
|
||||
G4bool isFirst = true;
|
||||
const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeDoIt);
|
||||
G4int thisIdx(-1);
|
||||
for (G4int i = 0; i < pv->size(); i++ ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
|
||||
for (std::size_t i = 0; i < pv->size(); ++i ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
|
||||
if ( thisIdx < 0 ) return false; // -- to ignore pure along processes
|
||||
for ( size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); i++ )
|
||||
for ( std::size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); ++i )
|
||||
{
|
||||
if ( (fSharedData->fBiasingProcessInterfaces)[i]->fIsPhysicsBasedBiasing || !physOnly )
|
||||
{
|
||||
G4int thatIdx(-1);
|
||||
for (G4int j = 0; j < pv->size(); j++ ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
|
||||
for (std::size_t j = 0; j < pv->size(); ++j ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
|
||||
if ( thatIdx >= 0 ) // -- to ignore pure along processes
|
||||
{
|
||||
if ( thisIdx > thatIdx )
|
||||
@@ -999,14 +999,14 @@ G4bool G4BiasingProcessInterface::IsLastPostStepDoItInterface(G4bool physOnly) c
|
||||
G4bool isLast = true;
|
||||
const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeDoIt);
|
||||
G4int thisIdx(-1);
|
||||
for (G4int i = 0; i < pv->size(); i++ ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
|
||||
for (std::size_t i = 0; i < pv->size(); ++i ) if ( (*pv)(i) == this ) { thisIdx = i; break; }
|
||||
if ( thisIdx < 0 ) return false; // -- to ignore pure along processes
|
||||
for ( size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); i++ )
|
||||
for ( std::size_t i = 0; i < (fSharedData->fBiasingProcessInterfaces).size(); ++i )
|
||||
{
|
||||
if ( (fSharedData->fBiasingProcessInterfaces)[i]->fIsPhysicsBasedBiasing || !physOnly )
|
||||
{
|
||||
G4int thatIdx(-1);
|
||||
for (G4int j = 0; j < pv->size(); j++ ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
|
||||
for (std::size_t j = 0; j < pv->size(); ++j ) if ( (*pv)(j) == (fSharedData->fBiasingProcessInterfaces)[i] ) { thatIdx = j; break; }
|
||||
if ( thatIdx >= 0 ) // -- to ignore pure along processes
|
||||
{
|
||||
if ( thisIdx < thatIdx )
|
||||
@@ -1084,9 +1084,9 @@ void G4BiasingProcessInterface::ReorderBiasingVectorAsGPIL()
|
||||
( fSharedData -> fPublicNonPhysicsBiasingProcessInterfaces ) . clear();
|
||||
|
||||
const G4ProcessVector* pv = fProcessManager->GetPostStepProcessVector(typeGPIL);
|
||||
for (G4int i = 0; i < pv->size(); i++ )
|
||||
for (std::size_t i = 0; i < pv->size(); ++i )
|
||||
{
|
||||
for ( size_t j = 0; j < tmpProcess.size(); j++ )
|
||||
for ( std::size_t j = 0; j < tmpProcess.size(); ++j )
|
||||
{
|
||||
if ( (*pv)(i) == tmpProcess[j] )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user