Import Geant4 11.4.0 source tree
This commit is contained in:
@@ -6,6 +6,14 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2025-10-30 I. Hrivnacova (digits_hits-V11-03-00)
|
||||
- G4VPrimitiveScorer : Implemented mechanism to weight score
|
||||
- The weighting is activated with 'scoreWeighted' option (default is off)
|
||||
- The applied weighting function is defined via std::function
|
||||
which can be set via new setter method
|
||||
- The weighting function is taken into account only in the G4PSCellFlux scorer type
|
||||
Based on initial implementation by A. Morsch, CERN
|
||||
|
||||
## 2024-05-07 Gabriele Cosmo (digits_hits-V11-02-00)
|
||||
- Fixed compilation error in G4THitsMap on macOS/clang with C++23 Standard
|
||||
enabled.
|
||||
|
||||
@@ -42,10 +42,16 @@
|
||||
#include "G4VSDFilter.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <functional>
|
||||
|
||||
class G4Step;
|
||||
class G4HCofThisEvent;
|
||||
class G4TouchableHistory;
|
||||
|
||||
// Define the signature for the weighting calculation
|
||||
// It should take: (const G4Step*) and return G4double
|
||||
using G4ScoreWeightCalculator = std::function<G4double(const G4Step*)>;
|
||||
|
||||
class G4VPrimitiveScorer
|
||||
{
|
||||
friend class G4MultiFunctionalDetector;
|
||||
@@ -71,12 +77,22 @@ class G4VPrimitiveScorer
|
||||
const G4String& GetUnit() const { return unitName; }
|
||||
G4double GetUnitValue() const { return unitValue; }
|
||||
|
||||
inline void ScoreWeighted(G4bool flg = false) { scoreWeighted = flg; }
|
||||
// Use specific weight for scoring
|
||||
|
||||
inline G4bool IsScoreWeighted() const { return scoreWeighted; }
|
||||
// Get option for specific weight for scoring
|
||||
|
||||
// Set/Get methods
|
||||
inline void SetMultiFunctionalDetector(G4MultiFunctionalDetector* d) { detector = d; }
|
||||
inline G4MultiFunctionalDetector* GetMultiFunctionalDetector() const { return detector; }
|
||||
inline const G4String& GetName() const { return primitiveName; }
|
||||
inline void SetFilter(G4VSDFilter* f) { filter = f; }
|
||||
inline G4VSDFilter* GetFilter() const { return filter; }
|
||||
inline void SetScoreWeightCalculator(G4ScoreWeightCalculator calculator) {
|
||||
fScoreWeightCalculator = calculator;
|
||||
}
|
||||
|
||||
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
|
||||
inline G4int GetVerboseLevel() const { return verboseLevel; }
|
||||
|
||||
@@ -114,6 +130,10 @@ class G4VPrimitiveScorer
|
||||
G4String unitName{"NoUnit"};
|
||||
G4double unitValue{1.0};
|
||||
G4int fNi{0}, fNj{0}, fNk{0}; // used for 3D scorers
|
||||
G4bool scoreWeighted{false};
|
||||
G4ScoreWeightCalculator fScoreWeightCalculator = [](const G4Step*) -> G4double {
|
||||
return 1.0;
|
||||
};
|
||||
|
||||
private:
|
||||
inline G4bool HitPrimitive(G4Step* aStep, G4TouchableHistory* ROhis)
|
||||
|
||||
@@ -78,8 +78,10 @@ G4bool G4PSCellFlux::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
G4int idx = ((G4TouchableHistory*) (aStep->GetPreStepPoint()->GetTouchable()))
|
||||
->GetReplicaNumber(indexDepth);
|
||||
G4double cubicVolume = ComputeVolume(aStep, idx);
|
||||
|
||||
G4double CellFlux = stepLength / cubicVolume;
|
||||
if (scoreWeighted) {
|
||||
CellFlux *= fScoreWeightCalculator(aStep);
|
||||
}
|
||||
if(weighted)
|
||||
CellFlux *= aStep->GetPreStepPoint()->GetWeight();
|
||||
G4int index = GetIndex(aStep);
|
||||
|
||||
@@ -178,6 +178,8 @@ class G4VScoringMesh
|
||||
inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
|
||||
// get the primitive scorer map
|
||||
inline MeshScoreMap GetScoreMap() const { return fMap; }
|
||||
// get the associated detector
|
||||
inline const G4MultiFunctionalDetector* GetMFD() const { return fMFD; }
|
||||
// get whether this mesh setup has been ready
|
||||
inline G4bool ReadyForQuantity() const { return (sizeIsSet && nMeshIsSet); }
|
||||
|
||||
|
||||
@@ -173,6 +173,9 @@ void G4ScoreQuantityMessenger::QuantityCommands()
|
||||
param = new G4UIparameter("unit", 's', true);
|
||||
param->SetDefaultValue("percm2");
|
||||
qCellFluxCmd->SetParameter(param);
|
||||
param = new G4UIparameter("scoreweighted", 'b', true);
|
||||
param->SetDefaultValue("false");
|
||||
qCellFluxCmd->SetParameter(param);
|
||||
//
|
||||
qPassCellFluxCmd = new G4UIcommand("/score/quantity/passageCellFlux", this);
|
||||
qPassCellFluxCmd->SetGuidance("Passage cell flux scorer");
|
||||
@@ -633,6 +636,7 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand* command,
|
||||
ps = new G4PSCellFlux(token[0]);
|
||||
}
|
||||
ps->SetUnit(token[1]);
|
||||
ps->ScoreWeighted(StoB(token[2]));
|
||||
mesh->SetPrimitiveScorer(ps);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user