Import Geant4 11.3.0 source tree
This commit is contained in:
@@ -6,6 +6,16 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-11-01 Laurent Desorgher (emadjoint-V11-02-01)
|
||||
- Add attribute fLastFreeFlightTrackId in G4AdjointForcedInteractionForGamma
|
||||
in order to run adjoint simulation in MT mode
|
||||
- Add attribute fCurrentParticleDef in G4AdjointCSmanager in order
|
||||
to run adjoint simulation in MT mode
|
||||
|
||||
## 2024-10-10 Gabriele Cosmo (emadjoint-V11-02-00)
|
||||
- Fixed reported Coverity defects for use of const G4String& and std::move().
|
||||
- Minor code cleanup (use of default destructor, std::size_t, G4 types, ...).
|
||||
|
||||
## 2022-11-23 Gabriele Cosmo (emadjoint-V11-00-05)
|
||||
- Fixed more compilation warnings for implicit type conversions.
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@ class G4AdjointCSManager
|
||||
G4double fMassRatio = 1.; // ion
|
||||
G4double fLastCSCorrectionFactor = 1.;
|
||||
|
||||
G4ParticleDefinition* fCurrentParticleDef = nullptr;
|
||||
std::size_t fCurrentParticleIndex = 0;
|
||||
std::size_t fCurrentMatIndex = 0;
|
||||
|
||||
|
||||
@@ -55,45 +55,45 @@ class G4AdjointCSMatrix
|
||||
void Clear();
|
||||
|
||||
void AddData(G4double aPrimEnergy, G4double aCS,
|
||||
std::vector<double>* aLogSecondEnergyVector,
|
||||
std::vector<double>* aLogProbVector, size_t n_pro_decade = 0);
|
||||
std::vector<G4double>* aLogSecondEnergyVector,
|
||||
std::vector<G4double>* aLogProbVector, std::size_t n_pro_decade = 0);
|
||||
|
||||
G4bool GetData(unsigned int i, G4double& aPrimEnergy, G4double& aCS,
|
||||
G4double& log0, std::vector<double>*& aLogSecondEnergyVector,
|
||||
std::vector<double>*& aLogProbVector,
|
||||
std::vector<size_t>*& aLogProbVectorIndex);
|
||||
G4double& log0, std::vector<G4double>*& aLogSecondEnergyVector,
|
||||
std::vector<G4double>*& aLogProbVector,
|
||||
std::vector<std::size_t>*& aLogProbVectorIndex);
|
||||
|
||||
inline std::vector<double>* GetLogPrimEnergyVector()
|
||||
inline std::vector<G4double>* GetLogPrimEnergyVector()
|
||||
{
|
||||
return &fLogPrimEnergyVector;
|
||||
}
|
||||
|
||||
inline std::vector<double>* GetLogCrossSectionvector()
|
||||
inline std::vector<G4double>* GetLogCrossSectionvector()
|
||||
{
|
||||
return &fLogCrossSectionVector;
|
||||
}
|
||||
|
||||
inline G4bool IsScatProjToProj() { return fScatProjToProj; }
|
||||
|
||||
void Write(G4String file_name);
|
||||
void Write(const G4String& file_name);
|
||||
|
||||
void Read(G4String file_name);
|
||||
void Read(const G4String& file_name);
|
||||
|
||||
private:
|
||||
std::vector<double> fLogPrimEnergyVector;
|
||||
std::vector<G4double> fLogPrimEnergyVector;
|
||||
// Adjoint Cross sections as functions of primary energy
|
||||
std::vector<double> fLogCrossSectionVector;
|
||||
std::vector<G4double> fLogCrossSectionVector;
|
||||
|
||||
std::vector<std::vector<double>*> fLogSecondEnergyMatrix;
|
||||
std::vector<std::vector<double>*> fLogProbMatrix;
|
||||
std::vector<std::vector<G4double>*> fLogSecondEnergyMatrix;
|
||||
std::vector<std::vector<G4double>*> fLogProbMatrix;
|
||||
// Each column represents the integrated probability of
|
||||
// getting a secondary
|
||||
|
||||
// index of equidistant LogProb
|
||||
std::vector<std::vector<size_t>*> fLogProbMatrixIndex;
|
||||
std::vector<double> fLog0Vector;
|
||||
std::vector<std::vector<std::size_t>*> fLogProbMatrixIndex;
|
||||
std::vector<G4double> fLog0Vector;
|
||||
|
||||
size_t fNbPrimEnergy = 0;
|
||||
std::size_t fNbPrimEnergy = 0;
|
||||
|
||||
G4bool fScatProjToProj;
|
||||
};
|
||||
|
||||
+3
-1
@@ -47,7 +47,7 @@ class G4AdjointCSManager;
|
||||
class G4AdjointForcedInteractionForGamma : public G4VContinuousDiscreteProcess
|
||||
{
|
||||
public:
|
||||
explicit G4AdjointForcedInteractionForGamma(G4String process_name);
|
||||
explicit G4AdjointForcedInteractionForGamma(const G4String& process_name);
|
||||
|
||||
~G4AdjointForcedInteractionForGamma() override;
|
||||
|
||||
@@ -102,6 +102,8 @@ class G4AdjointForcedInteractionForGamma : public G4VContinuousDiscreteProcess
|
||||
G4double fTotNbAdjIntLength = 0.;
|
||||
|
||||
G4double fNbAdjIntLength = 0.;
|
||||
|
||||
G4int fLastFreeFlightTrackId = 1000;
|
||||
|
||||
G4bool fContinueGammaAsNewFreeFlight = false;
|
||||
G4bool fFreeFlightGamma = false;
|
||||
|
||||
@@ -58,21 +58,21 @@ class G4AdjointInterpolator
|
||||
G4double& y1, G4double& y2);
|
||||
|
||||
G4double Interpolation(G4double& x, G4double& x1, G4double& x2, G4double& y1,
|
||||
G4double& y2, G4String InterPolMethod = "Log");
|
||||
G4double& y2, const G4String& InterPolMethod = "Log");
|
||||
|
||||
size_t FindPosition(G4double& x, std::vector<G4double>& x_vec,
|
||||
size_t ind_min = 0, size_t ind_max = 0);
|
||||
std::size_t FindPosition(G4double& x, std::vector<G4double>& x_vec,
|
||||
std::size_t ind_min = 0, std::size_t ind_max = 0);
|
||||
|
||||
size_t FindPositionForLogVector(G4double& x, std::vector<G4double>& x_vec);
|
||||
std::size_t FindPositionForLogVector(G4double& x, std::vector<G4double>& x_vec);
|
||||
|
||||
// xvec should monotically increase
|
||||
G4double Interpolate(G4double& x, std::vector<G4double>& x_vec,
|
||||
std::vector<G4double>& y_vec,
|
||||
G4String InterPolMethod = "Log");
|
||||
const G4String& InterPolMethod = "Log");
|
||||
|
||||
G4double InterpolateWithIndexVector(
|
||||
G4double& x, std::vector<G4double>& x_vec, std::vector<G4double>& y_vec,
|
||||
std::vector<size_t>& index_vec, G4double x0,
|
||||
std::vector<std::size_t>& index_vec, G4double x0,
|
||||
G4double dx); // xvec should monotically increase
|
||||
|
||||
G4double InterpolateForLogVector(G4double& x, std::vector<G4double>& x_vec,
|
||||
|
||||
@@ -42,7 +42,7 @@ class G4AdjointPhotoElectricModel;
|
||||
class G4InversePEEffect : public G4VAdjointReverseReaction
|
||||
{
|
||||
public:
|
||||
explicit G4InversePEEffect(G4String process_name,
|
||||
explicit G4InversePEEffect(const G4String& process_name,
|
||||
G4AdjointPhotoElectricModel* aModel);
|
||||
~G4InversePEEffect() override;
|
||||
|
||||
|
||||
@@ -42,16 +42,15 @@ class G4AdjointIonIonisationModel;
|
||||
class G4IonInverseIonisation : public G4VAdjointReverseReaction
|
||||
{
|
||||
public:
|
||||
explicit G4IonInverseIonisation(G4bool whichScatCase, G4String process_name,
|
||||
explicit G4IonInverseIonisation(G4bool whichScatCase, const G4String& process_name,
|
||||
G4AdjointIonIonisationModel* aEmAdjointModel);
|
||||
~G4IonInverseIonisation() override;
|
||||
~G4IonInverseIonisation() override = default;
|
||||
|
||||
void ProcessDescription(std::ostream&) const override;
|
||||
void DumpInfo() const override { ProcessDescription(G4cout); };
|
||||
void DumpInfo() const override { ProcessDescription(G4cout); }
|
||||
|
||||
G4IonInverseIonisation(G4IonInverseIonisation&) = delete;
|
||||
G4IonInverseIonisation& operator=(const G4IonInverseIonisation& right) =
|
||||
delete;
|
||||
G4IonInverseIonisation& operator=(const G4IonInverseIonisation& right) = delete;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@ class G4VParticleChange;
|
||||
class G4VAdjointReverseReaction : public G4VDiscreteProcess
|
||||
{
|
||||
public:
|
||||
explicit G4VAdjointReverseReaction(G4String process_name,
|
||||
explicit G4VAdjointReverseReaction(const G4String& process_name,
|
||||
G4bool whichScatCase);
|
||||
|
||||
~G4VAdjointReverseReaction() override;
|
||||
|
||||
@@ -138,20 +138,20 @@ class G4VEmAdjointModel
|
||||
};
|
||||
|
||||
inline G4ParticleDefinition*
|
||||
GetAdjointEquivalentOfDirectPrimaryParticleDefinition()
|
||||
GetAdjointEquivalentOfDirectPrimaryParticleDefinition() const
|
||||
{
|
||||
return fAdjEquivDirectPrimPart;
|
||||
}
|
||||
|
||||
inline G4ParticleDefinition*
|
||||
GetAdjointEquivalentOfDirectSecondaryParticleDefinition()
|
||||
GetAdjointEquivalentOfDirectSecondaryParticleDefinition() const
|
||||
{
|
||||
return fAdjEquivDirectSecondPart;
|
||||
}
|
||||
|
||||
inline G4double GetHighEnergyLimit() { return fHighEnergyLimit; }
|
||||
inline G4double GetHighEnergyLimit() const { return fHighEnergyLimit; }
|
||||
|
||||
inline G4double GetLowEnergyLimit() { return fLowEnergyLimit; }
|
||||
inline G4double GetLowEnergyLimit() const { return fLowEnergyLimit; }
|
||||
|
||||
void SetHighEnergyLimit(G4double aVal);
|
||||
|
||||
@@ -173,7 +173,7 @@ class G4VEmAdjointModel
|
||||
fSecondPartSameType = aBool;
|
||||
}
|
||||
|
||||
inline G4bool GetSecondPartOfSameType() { return fSecondPartSameType; }
|
||||
inline G4bool GetSecondPartOfSameType() const { return fSecondPartSameType; }
|
||||
|
||||
inline void SetUseMatrix(G4bool aBool) { fUseMatrix = aBool; }
|
||||
|
||||
@@ -189,18 +189,18 @@ class G4VEmAdjointModel
|
||||
|
||||
inline void SetApplyCutInRange(G4bool aBool) { fApplyCutInRange = aBool; }
|
||||
|
||||
inline G4bool GetUseMatrix() { return fUseMatrix; }
|
||||
inline G4bool GetUseMatrix() const { return fUseMatrix; }
|
||||
|
||||
inline G4bool GetUseMatrixPerElement() { return fUseMatrixPerElement; }
|
||||
inline G4bool GetUseMatrixPerElement() const { return fUseMatrixPerElement; }
|
||||
|
||||
inline G4bool GetUseOnlyOneMatrixForAllElements()
|
||||
inline G4bool GetUseOnlyOneMatrixForAllElements() const
|
||||
{
|
||||
return fOneMatrixForAllElements;
|
||||
}
|
||||
|
||||
inline G4bool GetApplyCutInRange() { return fApplyCutInRange; }
|
||||
inline G4bool GetApplyCutInRange() const { return fApplyCutInRange; }
|
||||
|
||||
inline G4String GetName() { return fName; }
|
||||
inline const G4String& GetName() const { return fName; }
|
||||
|
||||
inline virtual void SetCSBiasingFactor(G4double aVal)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ class G4eAdjointMultipleScattering : public G4VMultipleScattering
|
||||
public:
|
||||
explicit G4eAdjointMultipleScattering(const G4String& processName = "msc");
|
||||
|
||||
~G4eAdjointMultipleScattering() override;
|
||||
~G4eAdjointMultipleScattering() override = default;
|
||||
|
||||
void StartTracking(G4Track*) override;
|
||||
|
||||
|
||||
@@ -42,16 +42,15 @@ class G4VEmAdjointModel;
|
||||
class G4eInverseBremsstrahlung : public G4VAdjointReverseReaction
|
||||
{
|
||||
public:
|
||||
explicit G4eInverseBremsstrahlung(G4bool whichScatCase, G4String process_name,
|
||||
explicit G4eInverseBremsstrahlung(G4bool whichScatCase, const G4String& process_name,
|
||||
G4VEmAdjointModel* aEmAdjointModel);
|
||||
~G4eInverseBremsstrahlung() override;
|
||||
~G4eInverseBremsstrahlung() override = default;
|
||||
|
||||
void ProcessDescription(std::ostream&) const override;
|
||||
void DumpInfo() const override { ProcessDescription(G4cout); };
|
||||
void DumpInfo() const override { ProcessDescription(G4cout); }
|
||||
|
||||
G4eInverseBremsstrahlung(G4eInverseBremsstrahlung&) = delete;
|
||||
G4eInverseBremsstrahlung& operator=(const G4eInverseBremsstrahlung& right) =
|
||||
delete;
|
||||
G4eInverseBremsstrahlung& operator=(const G4eInverseBremsstrahlung& right) = delete;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -42,12 +42,12 @@ class G4AdjointComptonModel;
|
||||
class G4eInverseCompton : public G4VAdjointReverseReaction
|
||||
{
|
||||
public:
|
||||
explicit G4eInverseCompton(G4bool whichScatCase, G4String process_name,
|
||||
explicit G4eInverseCompton(G4bool whichScatCase, const G4String& process_name,
|
||||
G4AdjointComptonModel* aEmAdjointModel);
|
||||
~G4eInverseCompton() override;
|
||||
~G4eInverseCompton() override = default;
|
||||
|
||||
void ProcessDescription(std::ostream&) const override;
|
||||
void DumpInfo() const override { ProcessDescription(G4cout); };
|
||||
void DumpInfo() const override { ProcessDescription(G4cout); }
|
||||
|
||||
G4eInverseCompton(G4eInverseCompton&) = delete;
|
||||
G4eInverseCompton& operator=(const G4eInverseCompton& right) = delete;
|
||||
|
||||
@@ -42,9 +42,9 @@ class G4VEmAdjointModel;
|
||||
class G4eInverseIonisation : public G4VAdjointReverseReaction
|
||||
{
|
||||
public:
|
||||
G4eInverseIonisation(G4bool whichScatCase, G4String process_name,
|
||||
G4eInverseIonisation(G4bool whichScatCase, const G4String& process_name,
|
||||
G4VEmAdjointModel* aEmAdjointModel);
|
||||
~G4eInverseIonisation();
|
||||
~G4eInverseIonisation() override = default;
|
||||
|
||||
void ProcessDescription(std::ostream&) const override;
|
||||
void DumpInfo() const override { ProcessDescription(G4cout); };
|
||||
|
||||
@@ -42,9 +42,9 @@ class G4AdjointhIonisationModel;
|
||||
class G4hInverseIonisation : public G4VAdjointReverseReaction
|
||||
{
|
||||
public:
|
||||
explicit G4hInverseIonisation(G4bool whichScatCase, G4String process_name,
|
||||
explicit G4hInverseIonisation(G4bool whichScatCase, const G4String& process_name,
|
||||
G4AdjointhIonisationModel* aEmAdjointModel);
|
||||
~G4hInverseIonisation() override;
|
||||
~G4hInverseIonisation() override = default;
|
||||
|
||||
G4hInverseIonisation(G4hInverseIonisation&) = delete;
|
||||
G4hInverseIonisation& operator=(const G4hInverseIonisation& right) = delete;
|
||||
|
||||
@@ -301,7 +301,7 @@ void G4AdjointCSManager::BuildCrossSectionMatrices()
|
||||
<< " does not use cross section matrices" << G4endl;
|
||||
std::vector<G4AdjointCSMatrix*> two_empty_matrices;
|
||||
fAdjointCSMatricesForProdToProj.push_back(two_empty_matrices);
|
||||
fAdjointCSMatricesForScatProjToProj.push_back(two_empty_matrices);
|
||||
fAdjointCSMatricesForScatProjToProj.push_back(std::move(two_empty_matrices));
|
||||
}
|
||||
}
|
||||
G4cout << " All adjoint cross section matrices are computed!"
|
||||
@@ -1066,11 +1066,10 @@ void G4AdjointCSManager::DefineCurrentMaterial(
|
||||
void G4AdjointCSManager::DefineCurrentParticle(
|
||||
const G4ParticleDefinition* aPartDef)
|
||||
{
|
||||
static G4ParticleDefinition* currentParticleDef = nullptr;
|
||||
|
||||
if(aPartDef != currentParticleDef)
|
||||
|
||||
if(aPartDef != fCurrentParticleDef)
|
||||
{
|
||||
currentParticleDef = const_cast<G4ParticleDefinition*>(aPartDef);
|
||||
fCurrentParticleDef = const_cast<G4ParticleDefinition*>(aPartDef);
|
||||
fMassRatio = 1.;
|
||||
if(aPartDef == fAdjIon)
|
||||
fMassRatio = proton_mass_c2 / aPartDef->GetPDGMass();
|
||||
|
||||
@@ -79,9 +79,9 @@ void G4AdjointCSMatrix::Clear()
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
void G4AdjointCSMatrix::AddData(G4double aLogPrimEnergy, G4double aLogCS,
|
||||
std::vector<double>* aLogSecondEnergyVector,
|
||||
std::vector<double>* aLogProbVector,
|
||||
size_t n_pro_decade)
|
||||
std::vector<G4double>* aLogSecondEnergyVector,
|
||||
std::vector<G4double>* aLogProbVector,
|
||||
std::size_t n_pro_decade)
|
||||
{
|
||||
G4AdjointInterpolator* theInterpolator = G4AdjointInterpolator::GetInstance();
|
||||
|
||||
@@ -91,14 +91,14 @@ void G4AdjointCSMatrix::AddData(G4double aLogPrimEnergy, G4double aLogCS,
|
||||
fLogSecondEnergyMatrix.push_back(aLogSecondEnergyVector);
|
||||
fLogProbMatrix.push_back(aLogProbVector);
|
||||
|
||||
std::vector<size_t>* aLogProbVectorIndex = nullptr;
|
||||
std::vector<std::size_t>* aLogProbVectorIndex = nullptr;
|
||||
|
||||
if(n_pro_decade > 0 && !aLogProbVector->empty())
|
||||
{
|
||||
aLogProbVectorIndex = new std::vector<size_t>();
|
||||
aLogProbVectorIndex = new std::vector<std::size_t>();
|
||||
G4double dlog = std::log(10.) / n_pro_decade;
|
||||
G4double log_val =
|
||||
int(std::min((*aLogProbVector)[0], aLogProbVector->back()) / dlog) * dlog;
|
||||
G4int(std::min((*aLogProbVector)[0], aLogProbVector->back()) / dlog) * dlog;
|
||||
fLog0Vector.push_back(log_val);
|
||||
|
||||
// Loop checking, 07-Aug-2015, Vladimir Ivanchenko
|
||||
@@ -121,9 +121,9 @@ void G4AdjointCSMatrix::AddData(G4double aLogPrimEnergy, G4double aLogCS,
|
||||
///////////////////////////////////////////////////////
|
||||
G4bool G4AdjointCSMatrix::GetData(unsigned int i, G4double& aLogPrimEnergy,
|
||||
G4double& aLogCS, G4double& log0,
|
||||
std::vector<double>*& aLogSecondEnergyVector,
|
||||
std::vector<double>*& aLogProbVector,
|
||||
std::vector<size_t>*& aLogProbVectorIndex)
|
||||
std::vector<G4double>*& aLogSecondEnergyVector,
|
||||
std::vector<G4double>*& aLogProbVector,
|
||||
std::vector<std::size_t>*& aLogProbVectorIndex)
|
||||
{
|
||||
if(i >= fNbPrimEnergy)
|
||||
return false;
|
||||
@@ -137,19 +137,19 @@ G4bool G4AdjointCSMatrix::GetData(unsigned int i, G4double& aLogPrimEnergy,
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
void G4AdjointCSMatrix::Write(G4String file_name)
|
||||
void G4AdjointCSMatrix::Write(const G4String& file_name)
|
||||
{
|
||||
std::fstream FileOutput(file_name, std::ios::out);
|
||||
FileOutput << std::setiosflags(std::ios::scientific);
|
||||
FileOutput << std::setprecision(6);
|
||||
FileOutput << fLogPrimEnergyVector.size() << G4endl;
|
||||
for(size_t i = 0; i < fLogPrimEnergyVector.size(); ++i)
|
||||
for(std::size_t i = 0; i < fLogPrimEnergyVector.size(); ++i)
|
||||
{
|
||||
FileOutput << std::exp(fLogPrimEnergyVector[i]) / MeV << '\t'
|
||||
<< std::exp(fLogCrossSectionVector[i]) << G4endl;
|
||||
size_t j1 = 0;
|
||||
std::size_t j1 = 0;
|
||||
FileOutput << fLogSecondEnergyMatrix[i]->size() << G4endl;
|
||||
for(size_t j = 0; j < fLogSecondEnergyMatrix[i]->size(); ++j)
|
||||
for(std::size_t j = 0; j < fLogSecondEnergyMatrix[i]->size(); ++j)
|
||||
{
|
||||
FileOutput << std::exp((*fLogSecondEnergyMatrix[i])[j]);
|
||||
++j1;
|
||||
@@ -165,7 +165,7 @@ void G4AdjointCSMatrix::Write(G4String file_name)
|
||||
FileOutput << G4endl;
|
||||
j1 = 0;
|
||||
FileOutput << fLogProbMatrix[i]->size() << G4endl;
|
||||
for(size_t j = 0; j < fLogProbMatrix[i]->size(); ++j)
|
||||
for(std::size_t j = 0; j < fLogProbMatrix[i]->size(); ++j)
|
||||
{
|
||||
FileOutput << std::exp((*fLogProbMatrix[i])[j]);
|
||||
++j1;
|
||||
@@ -183,17 +183,17 @@ void G4AdjointCSMatrix::Write(G4String file_name)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
void G4AdjointCSMatrix::Read(G4String file_name)
|
||||
void G4AdjointCSMatrix::Read(const G4String& file_name)
|
||||
{
|
||||
std::fstream FileOutput(file_name, std::ios::in);
|
||||
size_t n1, n2;
|
||||
std::size_t n1, n2;
|
||||
|
||||
fLogPrimEnergyVector.clear();
|
||||
fLogCrossSectionVector.clear();
|
||||
fLogSecondEnergyMatrix.clear();
|
||||
fLogProbMatrix.clear();
|
||||
FileOutput >> n1;
|
||||
for(size_t i = 0; i < n1; ++i)
|
||||
for(std::size_t i = 0; i < n1; ++i)
|
||||
{
|
||||
G4double E, CS;
|
||||
FileOutput >> E >> CS;
|
||||
@@ -203,14 +203,14 @@ void G4AdjointCSMatrix::Read(G4String file_name)
|
||||
fLogSecondEnergyMatrix.push_back(new std::vector<G4double>());
|
||||
fLogProbMatrix.push_back(new std::vector<G4double>());
|
||||
|
||||
for(size_t j = 0; j < n2; ++j)
|
||||
for(std::size_t j = 0; j < n2; ++j)
|
||||
{
|
||||
G4double E1;
|
||||
FileOutput >> E1;
|
||||
fLogSecondEnergyMatrix[i]->push_back(E1);
|
||||
}
|
||||
FileOutput >> n2;
|
||||
for(size_t j = 0; j < n2; ++j)
|
||||
for(std::size_t j = 0; j < n2; ++j)
|
||||
{
|
||||
G4double prob;
|
||||
FileOutput >> prob;
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "G4VEmAdjointModel.hh"
|
||||
|
||||
G4AdjointForcedInteractionForGamma::G4AdjointForcedInteractionForGamma(
|
||||
G4String process_name)
|
||||
const G4String& process_name)
|
||||
: G4VContinuousDiscreteProcess(process_name)
|
||||
, fAdjointComptonModel(nullptr)
|
||||
, fAdjointBremModel(nullptr)
|
||||
@@ -226,13 +226,12 @@ G4double
|
||||
G4AdjointForcedInteractionForGamma::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& track, G4double, G4ForceCondition* condition)
|
||||
{
|
||||
static G4int lastFreeFlightTrackId = 1000;
|
||||
G4int step_id = track.GetCurrentStepNumber();
|
||||
*condition = NotForced;
|
||||
fCopyGammaForForced = false;
|
||||
G4int track_id = track.GetTrackID();
|
||||
fFreeFlightGamma =
|
||||
(track_id != lastFreeFlightTrackId + 1 || fContinueGammaAsNewFreeFlight);
|
||||
(track_id != fLastFreeFlightTrackId + 1 || fContinueGammaAsNewFreeFlight);
|
||||
if(fFreeFlightGamma)
|
||||
{
|
||||
if(step_id == 1 || fContinueGammaAsNewFreeFlight)
|
||||
@@ -241,7 +240,7 @@ G4AdjointForcedInteractionForGamma::PostStepGetPhysicalInteractionLength(
|
||||
// A gamma with same conditions will be generate at next post_step do it
|
||||
// for the forced interaction
|
||||
fCopyGammaForForced = true;
|
||||
lastFreeFlightTrackId = track_id;
|
||||
fLastFreeFlightTrackId = track_id;
|
||||
fAccTrackLength = 0.;
|
||||
fTotNbAdjIntLength = 0.;
|
||||
fContinueGammaAsNewFreeFlight = false;
|
||||
|
||||
@@ -85,7 +85,7 @@ G4double G4AdjointInterpolator::ExponentialInterpolation(
|
||||
G4double G4AdjointInterpolator::Interpolation(G4double& x, G4double& x1,
|
||||
G4double& x2, G4double& y1,
|
||||
G4double& y2,
|
||||
G4String InterPolMethod)
|
||||
const G4String& InterPolMethod)
|
||||
{
|
||||
if(InterPolMethod == "Log")
|
||||
{
|
||||
@@ -111,15 +111,15 @@ G4double G4AdjointInterpolator::Interpolation(G4double& x, G4double& x1,
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// only valid if x_vec is monotically increasing
|
||||
size_t G4AdjointInterpolator::FindPosition(G4double& x,
|
||||
std::vector<G4double>& x_vec, size_t,
|
||||
size_t)
|
||||
std::size_t G4AdjointInterpolator::FindPosition(G4double& x,
|
||||
std::vector<G4double>& x_vec, std::size_t,
|
||||
std::size_t)
|
||||
{
|
||||
// most rapid method could be used probably
|
||||
|
||||
size_t ndim = x_vec.size();
|
||||
size_t ind1 = 0;
|
||||
size_t ind2 = ndim - 1;
|
||||
std::size_t ndim = x_vec.size();
|
||||
std::size_t ind1 = 0;
|
||||
std::size_t ind2 = ndim - 1;
|
||||
|
||||
if(ndim > 1)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ size_t G4AdjointInterpolator::FindPosition(G4double& x,
|
||||
{ // increasing
|
||||
do
|
||||
{
|
||||
size_t midBin = (ind1 + ind2) / 2;
|
||||
std::size_t midBin = (ind1 + ind2) / 2;
|
||||
if(x < x_vec[midBin])
|
||||
ind2 = midBin;
|
||||
else
|
||||
@@ -138,7 +138,7 @@ size_t G4AdjointInterpolator::FindPosition(G4double& x,
|
||||
{
|
||||
do
|
||||
{
|
||||
size_t midBin = (ind1 + ind2) / 2;
|
||||
std::size_t midBin = (ind1 + ind2) / 2;
|
||||
if(x < x_vec[midBin])
|
||||
ind1 = midBin;
|
||||
else
|
||||
@@ -152,7 +152,7 @@ size_t G4AdjointInterpolator::FindPosition(G4double& x,
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// only valid if x_vec is monotically increasing
|
||||
size_t G4AdjointInterpolator::FindPositionForLogVector(
|
||||
std::size_t G4AdjointInterpolator::FindPositionForLogVector(
|
||||
G4double& log_x, std::vector<G4double>& log_x_vec)
|
||||
{
|
||||
// most rapid method could be used probably
|
||||
@@ -163,9 +163,9 @@ size_t G4AdjointInterpolator::FindPositionForLogVector(
|
||||
G4double G4AdjointInterpolator::Interpolate(G4double& x,
|
||||
std::vector<G4double>& x_vec,
|
||||
std::vector<G4double>& y_vec,
|
||||
G4String InterPolMethod)
|
||||
const G4String& InterPolMethod)
|
||||
{
|
||||
size_t i = FindPosition(x, x_vec);
|
||||
std::size_t i = FindPosition(x, x_vec);
|
||||
return Interpolation(x, x_vec[i], x_vec[i + 1], y_vec[i], y_vec[i + 1],
|
||||
InterPolMethod);
|
||||
}
|
||||
@@ -173,19 +173,19 @@ G4double G4AdjointInterpolator::Interpolate(G4double& x,
|
||||
///////////////////////////////////////////////////////
|
||||
G4double G4AdjointInterpolator::InterpolateWithIndexVector(
|
||||
G4double& x, std::vector<G4double>& x_vec, std::vector<G4double>& y_vec,
|
||||
std::vector<size_t>& index_vec, G4double x0,
|
||||
std::vector<std::size_t>& index_vec, G4double x0,
|
||||
G4double dx) // only linear interpolation possible
|
||||
{
|
||||
size_t ind = 0;
|
||||
std::size_t ind = 0;
|
||||
if(x > x0)
|
||||
ind = int((x - x0) / dx);
|
||||
ind = G4int((x - x0) / dx);
|
||||
if(ind >= index_vec.size() - 1)
|
||||
ind = index_vec.size() - 2;
|
||||
size_t ind1 = index_vec[ind];
|
||||
size_t ind2 = index_vec[ind + 1];
|
||||
std::size_t ind1 = index_vec[ind];
|
||||
std::size_t ind2 = index_vec[ind + 1];
|
||||
if(ind1 > ind2)
|
||||
{
|
||||
size_t ind11 = ind1;
|
||||
std::size_t ind11 = ind1;
|
||||
ind1 = ind2;
|
||||
ind2 = ind11;
|
||||
}
|
||||
@@ -199,7 +199,7 @@ G4double G4AdjointInterpolator::InterpolateForLogVector(
|
||||
G4double& log_x, std::vector<G4double>& log_x_vec,
|
||||
std::vector<G4double>& log_y_vec)
|
||||
{
|
||||
size_t i = FindPositionForLogVector(log_x, log_x_vec);
|
||||
std::size_t i = FindPositionForLogVector(log_x, log_x_vec);
|
||||
|
||||
G4double log_y = LinearInterpolation(log_x, log_x_vec[i], log_x_vec[i + 1],
|
||||
log_y_vec[i], log_y_vec[i + 1]);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "G4VEmAdjointModel.hh"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4InversePEEffect::G4InversePEEffect(G4String process_name,
|
||||
G4InversePEEffect::G4InversePEEffect(const G4String& process_name,
|
||||
G4AdjointPhotoElectricModel* aModel)
|
||||
: G4VAdjointReverseReaction(process_name, false)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4IonInverseIonisation::G4IonInverseIonisation(
|
||||
G4bool whichScatCase, G4String process_name,
|
||||
G4bool whichScatCase, const G4String& process_name,
|
||||
G4AdjointIonIonisationModel* aEmAdjointModel)
|
||||
: G4VAdjointReverseReaction(process_name, whichScatCase)
|
||||
{
|
||||
@@ -46,9 +46,6 @@ G4IonInverseIonisation::G4IonInverseIonisation(
|
||||
fAdjointModel->SetSecondPartOfSameType(false);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4IonInverseIonisation::~G4IonInverseIonisation() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void G4IonInverseIonisation::ProcessDescription(std::ostream& out) const
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4VEmAdjointModel.hh"
|
||||
|
||||
G4VAdjointReverseReaction::G4VAdjointReverseReaction(G4String process_name,
|
||||
G4VAdjointReverseReaction::G4VAdjointReverseReaction(const G4String& process_name,
|
||||
G4bool whichScatCase)
|
||||
: G4VDiscreteProcess(process_name)
|
||||
{
|
||||
|
||||
@@ -47,9 +47,6 @@ G4eAdjointMultipleScattering::G4eAdjointMultipleScattering(
|
||||
: G4VMultipleScattering(processName)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4eAdjointMultipleScattering::~G4eAdjointMultipleScattering() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void G4eAdjointMultipleScattering::ProcessDescription(std::ostream& out) const
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4eInverseBremsstrahlung::G4eInverseBremsstrahlung(
|
||||
G4bool whichScatCase, G4String process_name,
|
||||
G4bool whichScatCase, const G4String& process_name,
|
||||
G4VEmAdjointModel* aBremAdjointModel)
|
||||
: G4VAdjointReverseReaction(process_name, whichScatCase)
|
||||
{
|
||||
@@ -37,9 +37,6 @@ G4eInverseBremsstrahlung::G4eInverseBremsstrahlung(
|
||||
fAdjointModel->SetSecondPartOfSameType(false);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4eInverseBremsstrahlung::~G4eInverseBremsstrahlung() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void G4eInverseBremsstrahlung::ProcessDescription(std::ostream& out) const
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4eInverseCompton::G4eInverseCompton(
|
||||
G4bool whichScatCase, G4String process_name,
|
||||
G4bool whichScatCase, const G4String& process_name,
|
||||
G4AdjointComptonModel* aComptonAdjointModel)
|
||||
: G4VAdjointReverseReaction(process_name, whichScatCase)
|
||||
{
|
||||
@@ -46,9 +46,6 @@ G4eInverseCompton::G4eInverseCompton(
|
||||
fAdjointModel->SetSecondPartOfSameType(false);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4eInverseCompton::~G4eInverseCompton() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void G4eInverseCompton::ProcessDescription(std::ostream& out) const
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4eInverseIonisation::G4eInverseIonisation(G4bool whichScatCase,
|
||||
G4String process_name,
|
||||
const G4String& process_name,
|
||||
G4VEmAdjointModel* aEmAdjointModel)
|
||||
: G4VAdjointReverseReaction(process_name, whichScatCase)
|
||||
{
|
||||
@@ -46,9 +46,6 @@ G4eInverseIonisation::G4eInverseIonisation(G4bool whichScatCase,
|
||||
fAdjointModel->SetSecondPartOfSameType(true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
G4eInverseIonisation::~G4eInverseIonisation() {}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void G4eInverseIonisation::ProcessDescription(std::ostream& out) const
|
||||
{
|
||||
|
||||
@@ -39,13 +39,10 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
G4hInverseIonisation::G4hInverseIonisation(
|
||||
G4bool whichScatCase, G4String process_name,
|
||||
G4bool whichScatCase, const G4String& process_name,
|
||||
G4AdjointhIonisationModel* aEmAdjointModel)
|
||||
: G4VAdjointReverseReaction(process_name, whichScatCase)
|
||||
{
|
||||
fAdjointModel = aEmAdjointModel;
|
||||
fAdjointModel->SetSecondPartOfSameType(false);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
G4hInverseIonisation::~G4hInverseIonisation() {}
|
||||
|
||||
Reference in New Issue
Block a user