Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VPrimitiveScorer Class Referenceabstract

#include <G4VPrimitiveScorer.hh>

Inheritance diagram for G4VPrimitiveScorer:

Public Member Functions

 G4VPrimitiveScorer (const G4String &name, G4int depth=0)
virtual ~G4VPrimitiveScorer ()=default
G4int GetCollectionID (G4int)
virtual void Initialize (G4HCofThisEvent *)
virtual void EndOfEvent (G4HCofThisEvent *)
virtual void clear ()
virtual void DrawAll ()
virtual void PrintAll ()
void SetUnit (const G4String &unit)
const G4StringGetUnit () const
G4double GetUnitValue () const
void ScoreWeighted (G4bool flg=false)
G4bool IsScoreWeighted () const
void SetMultiFunctionalDetector (G4MultiFunctionalDetector *d)
G4MultiFunctionalDetectorGetMultiFunctionalDetector () const
const G4StringGetName () const
void SetFilter (G4VSDFilter *f)
G4VSDFilterGetFilter () const
void SetScoreWeightCalculator (G4ScoreWeightCalculator calculator)
void SetVerboseLevel (G4int vl)
G4int GetVerboseLevel () const
void SetNijk (G4int i, G4int j, G4int k)

Protected Member Functions

G4VSolidComputeSolid (G4Step *aStep, G4int replicaIdx)
G4VSolidComputeCurrentSolid (G4Step *aStep)
virtual G4bool ProcessHits (G4Step *, G4TouchableHistory *)=0
virtual G4int GetIndex (G4Step *)
void CheckAndSetUnit (const G4String &unit, const G4String &category)

Protected Attributes

G4String primitiveName
G4MultiFunctionalDetectordetector {nullptr}
G4VSDFilterfilter {nullptr}
G4int verboseLevel {0}
G4int indexDepth
G4String unitName {"NoUnit"}
G4double unitValue {1.0}
G4int fNi {0}
G4int fNj {0}
G4int fNk {0}
G4bool scoreWeighted {false}
G4ScoreWeightCalculator fScoreWeightCalculator

Friends

class G4MultiFunctionalDetector

Detailed Description

Definition at line 55 of file G4VPrimitiveScorer.hh.

Constructor & Destructor Documentation

◆ G4VPrimitiveScorer()

◆ ~G4VPrimitiveScorer()

virtual G4VPrimitiveScorer::~G4VPrimitiveScorer ( )
virtualdefault

Member Function Documentation

◆ CheckAndSetUnit()

void G4VPrimitiveScorer::CheckAndSetUnit ( const G4String & unit,
const G4String & category )
protected

Definition at line 67 of file G4VPrimitiveScorer.cc.

68{
69 if (G4UnitDefinition::GetCategory(unit) == category) {
70 unitName = unit;
72 }
73 else {
74 G4String msg = "Invalid unit [" + unit + "] (Current unit is [" + GetUnit() +
75 "] ) requested for " + GetName();
76 G4Exception("G4VPrimitiveScorer::CheckAndSetUnit", "Det0151", JustWarning, msg);
77 }
78}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)
const G4String & GetName() const
const G4String & GetUnit() const

Referenced by G4PSCellCharge::SetUnit(), G4PSCellFlux::SetUnit(), G4PSCylinderSurfaceCurrent::SetUnit(), G4PSCylinderSurfaceFlux::SetUnit(), G4PSDoseDeposit::SetUnit(), G4PSEnergyDeposit::SetUnit(), G4PSFlatSurfaceCurrent::SetUnit(), G4PSFlatSurfaceFlux::SetUnit(), G4PSMinKinEAtGeneration::SetUnit(), G4PSPassageCellFlux::SetUnit(), G4PSPassageTrackLength::SetUnit(), G4PSSphereSurfaceCurrent::SetUnit(), G4PSSphereSurfaceFlux::SetUnit(), and G4PSTrackLength::SetUnit().

◆ clear()

◆ ComputeCurrentSolid()

G4VSolid * G4VPrimitiveScorer::ComputeCurrentSolid ( G4Step * aStep)
protected

Definition at line 105 of file G4VPrimitiveScorer.cc.

106{
107 G4StepPoint* preStep = aStep->GetPreStepPoint();
108 // The only difference: did not know the replica number
109 G4int replicaIdx =
110 (static_cast<const G4TouchableHistory*>(preStep->GetTouchable()))->GetReplicaNumber(indexDepth);
111
112 return ComputeSolid(aStep, replicaIdx);
113}
int G4int
Definition G4Types.hh:85
const G4VTouchable * GetTouchable() const
G4StepPoint * GetPreStepPoint() const
G4VSolid * ComputeSolid(G4Step *aStep, G4int replicaIdx)

Referenced by G4PSCylinderSurfaceCurrent::ProcessHits(), G4PSCylinderSurfaceFlux::ProcessHits(), and G4PSSphereSurfaceCurrent::ProcessHits().

◆ ComputeSolid()

G4VSolid * G4VPrimitiveScorer::ComputeSolid ( G4Step * aStep,
G4int replicaIdx )
protected

Definition at line 80 of file G4VPrimitiveScorer.cc.

81{
82 G4VSolid* solid = nullptr;
83 G4StepPoint* preStep = aStep->GetPreStepPoint();
84
85 auto physVol = preStep->GetPhysicalVolume();
86 G4VPVParameterisation* physParam = physVol->GetParameterisation();
87
88 if (physParam != nullptr) { // for parameterized volume
89 if (replicaIdx < 0) {
91 desc << "Incorrect replica number --- GetReplicaNumber : " << replicaIdx << G4endl;
92 G4Exception("G4VPrimitiveScorer::ComputeSolid", "DetPS0001", JustWarning, desc);
93 // replicaIdx= 0; // You must ensure that it's in range !!!
94 }
95 solid = physParam->ComputeSolid(replicaIdx, physVol);
96 solid->ComputeDimensions(physParam, replicaIdx, physVol);
97 }
98 else { // for ordinary volume
99 solid = physVol->GetLogicalVolume()->GetSolid();
100 }
101
102 return solid;
103}
std::ostringstream G4ExceptionDescription
#define G4endl
Definition G4ios.hh:67
G4VPhysicalVolume * GetPhysicalVolume() const
virtual G4VSolid * ComputeSolid(const G4int no, G4VPhysicalVolume *pv)
virtual G4VPVParameterisation * GetParameterisation() const =0
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition G4VSolid.cc:136

Referenced by ComputeCurrentSolid(), G4PSCellFlux::ComputeVolume(), G4PSDoseDeposit::ComputeVolume(), and G4PSPassageCellFlux::ComputeVolume().

◆ DrawAll()

void G4VPrimitiveScorer::DrawAll ( )
virtual

Definition at line 56 of file G4VPrimitiveScorer.cc.

56{}

◆ EndOfEvent()

void G4VPrimitiveScorer::EndOfEvent ( G4HCofThisEvent * )
virtual

Reimplemented in G4PSPopulation.

Definition at line 52 of file G4VPrimitiveScorer.cc.

52{}

◆ GetCollectionID()

◆ GetFilter()

G4VSDFilter * G4VPrimitiveScorer::GetFilter ( ) const
inline

Definition at line 91 of file G4VPrimitiveScorer.hh.

91{ return filter; }

Referenced by G4VScoringMesh::List().

◆ GetIndex()

G4int G4VPrimitiveScorer::GetIndex ( G4Step * aStep)
protectedvirtual

Reimplemented in G4PSCellCharge3D, G4PSCellFlux3D, G4PSCylinderSurfaceCurrent3D, G4PSCylinderSurfaceFlux3D, G4PSDoseDeposit3D, G4PSEnergyDeposit3D, G4PSFlatSurfaceCurrent3D, G4PSFlatSurfaceFlux3D, G4PSMinKinEAtGeneration3D, G4PSNofCollision3D, G4PSNofSecondary3D, G4PSNofStep3D, G4PSPassageCellCurrent3D, G4PSPassageCellFlux3D, G4PSPassageTrackLength3D, G4PSPopulation3D, G4PSSphereSurfaceCurrent3D, G4PSSphereSurfaceFlux3D, G4PSStepChecker3D, G4PSTermination3D, G4PSTrackCounter3D, G4PSTrackLength3D, and G4PSVolumeFlux3D.

Definition at line 60 of file G4VPrimitiveScorer.cc.

61{
62 G4StepPoint* preStep = aStep->GetPreStepPoint();
63 auto th = (G4TouchableHistory*)(preStep->GetTouchable());
64 return th->GetReplicaNumber(indexDepth);
65}

Referenced by G4PSCellCharge::ProcessHits(), G4PSCellFlux::ProcessHits(), G4PSCylinderSurfaceCurrent::ProcessHits(), G4PSCylinderSurfaceFlux::ProcessHits(), G4PSDoseDeposit::ProcessHits(), G4PSEnergyDeposit::ProcessHits(), G4PSFlatSurfaceCurrent::ProcessHits(), G4PSFlatSurfaceFlux::ProcessHits(), G4PSMinKinEAtGeneration::ProcessHits(), G4PSNofCollision::ProcessHits(), G4PSNofSecondary::ProcessHits(), G4PSNofStep::ProcessHits(), G4PSPassageCellCurrent::ProcessHits(), G4PSPassageCellFlux::ProcessHits(), G4PSPassageTrackLength::ProcessHits(), G4PSPopulation::ProcessHits(), G4PSSphereSurfaceCurrent::ProcessHits(), G4PSSphereSurfaceFlux::ProcessHits(), G4PSStepChecker::ProcessHits(), G4PSTermination::ProcessHits(), G4PSTrackCounter::ProcessHits(), G4PSTrackLength::ProcessHits(), and G4PSVolumeFlux::ProcessHits().

◆ GetMultiFunctionalDetector()

◆ GetName()

const G4String & G4VPrimitiveScorer::GetName ( ) const
inline

Definition at line 89 of file G4VPrimitiveScorer.hh.

89{ return primitiveName; }

Referenced by CheckAndSetUnit(), G4VScoringMesh::GetPrimitiveScorer(), G4PSCellCharge::Initialize(), G4PSCellFlux::Initialize(), G4PSCylinderSurfaceCurrent::Initialize(), G4PSCylinderSurfaceFlux::Initialize(), G4PSDoseDeposit::Initialize(), G4PSEnergyDeposit::Initialize(), G4PSFlatSurfaceCurrent::Initialize(), G4PSFlatSurfaceFlux::Initialize(), G4PSMinKinEAtGeneration::Initialize(), G4PSNofCollision::Initialize(), G4PSNofSecondary::Initialize(), G4PSNofStep::Initialize(), G4PSPassageCellCurrent::Initialize(), G4PSPassageCellFlux::Initialize(), G4PSPassageTrackLength::Initialize(), G4PSPopulation::Initialize(), G4PSSphereSurfaceCurrent::Initialize(), G4PSSphereSurfaceFlux::Initialize(), G4PSTermination::Initialize(), G4PSTrackCounter::Initialize(), G4PSTrackLength::Initialize(), G4PSVolumeFlux::Initialize(), G4VScoringMesh::List(), G4PSCellCharge::PrintAll(), G4PSCellFlux::PrintAll(), G4PSCylinderSurfaceCurrent::PrintAll(), G4PSCylinderSurfaceFlux::PrintAll(), G4PSDoseDeposit::PrintAll(), G4PSEnergyDeposit::PrintAll(), G4PSFlatSurfaceCurrent::PrintAll(), G4PSFlatSurfaceFlux::PrintAll(), G4PSMinKinEAtGeneration::PrintAll(), G4PSNofCollision::PrintAll(), G4PSNofSecondary::PrintAll(), G4PSNofStep::PrintAll(), G4PSPassageCellCurrent::PrintAll(), G4PSPassageCellFlux::PrintAll(), G4PSPassageTrackLength::PrintAll(), G4PSPopulation::PrintAll(), G4PSSphereSurfaceCurrent::PrintAll(), G4PSSphereSurfaceFlux::PrintAll(), G4PSTermination::PrintAll(), G4PSTrackCounter::PrintAll(), G4PSTrackLength::PrintAll(), G4PSVolumeFlux::PrintAll(), G4MultiFunctionalDetector::RegisterPrimitive(), G4MultiFunctionalDetector::RemovePrimitive(), G4VScoringMesh::SetPrimitiveScorer(), G4PSCylinderSurfaceCurrent::SetUnit(), G4PSCylinderSurfaceFlux::SetUnit(), G4PSFlatSurfaceCurrent::SetUnit(), G4PSFlatSurfaceFlux::SetUnit(), G4PSNofCollision::SetUnit(), G4PSNofSecondary::SetUnit(), G4PSNofStep::SetUnit(), G4PSPassageCellCurrent::SetUnit(), G4PSPopulation::SetUnit(), G4PSSphereSurfaceCurrent::SetUnit(), G4PSSphereSurfaceFlux::SetUnit(), G4PSTermination::SetUnit(), and G4PSTrackCounter::SetUnit().

◆ GetUnit()

◆ GetUnitValue()

◆ GetVerboseLevel()

G4int G4VPrimitiveScorer::GetVerboseLevel ( ) const
inline

Definition at line 97 of file G4VPrimitiveScorer.hh.

97{ return verboseLevel; }

◆ Initialize()

◆ IsScoreWeighted()

G4bool G4VPrimitiveScorer::IsScoreWeighted ( ) const
inline

Definition at line 83 of file G4VPrimitiveScorer.hh.

83{ return scoreWeighted; }

◆ PrintAll()

◆ ProcessHits()

◆ ScoreWeighted()

void G4VPrimitiveScorer::ScoreWeighted ( G4bool flg = false)
inline

Definition at line 80 of file G4VPrimitiveScorer.hh.

80{ scoreWeighted = flg; }

◆ SetFilter()

void G4VPrimitiveScorer::SetFilter ( G4VSDFilter * f)
inline

Definition at line 90 of file G4VPrimitiveScorer.hh.

90{ filter = f; }

◆ SetMultiFunctionalDetector()

void G4VPrimitiveScorer::SetMultiFunctionalDetector ( G4MultiFunctionalDetector * d)
inline

◆ SetNijk()

◆ SetScoreWeightCalculator()

void G4VPrimitiveScorer::SetScoreWeightCalculator ( G4ScoreWeightCalculator calculator)
inline

Definition at line 92 of file G4VPrimitiveScorer.hh.

92 {
93 fScoreWeightCalculator = calculator;
94 }
G4ScoreWeightCalculator fScoreWeightCalculator

◆ SetUnit()

void G4VPrimitiveScorer::SetUnit ( const G4String & unit)
inline

Definition at line 76 of file G4VPrimitiveScorer.hh.

76{ unitName = unit; }

◆ SetVerboseLevel()

void G4VPrimitiveScorer::SetVerboseLevel ( G4int vl)
inline

Definition at line 96 of file G4VPrimitiveScorer.hh.

96{ verboseLevel = vl; }

◆ G4MultiFunctionalDetector

Member Data Documentation

◆ detector

◆ filter

G4VSDFilter* G4VPrimitiveScorer::filter {nullptr}
protected

Definition at line 127 of file G4VPrimitiveScorer.hh.

127{nullptr};

Referenced by GetFilter(), and SetFilter().

◆ fNi

G4int G4VPrimitiveScorer::fNi {0}
protected

Definition at line 132 of file G4VPrimitiveScorer.hh.

132{0}, fNj{0}, fNk{0}; // used for 3D scorers

Referenced by G4PSStepChecker3D::GetIndex(), and SetNijk().

◆ fNj

◆ fNk

◆ fScoreWeightCalculator

G4ScoreWeightCalculator G4VPrimitiveScorer::fScoreWeightCalculator
protected
Initial value:
= [](const G4Step*) -> G4double {
return 1.0;
}
double G4double
Definition G4Types.hh:83

Definition at line 134 of file G4VPrimitiveScorer.hh.

134 {
135 return 1.0;
136 };

Referenced by G4PSCellFlux::ProcessHits(), and SetScoreWeightCalculator().

◆ indexDepth

◆ primitiveName

G4String G4VPrimitiveScorer::primitiveName
protected

Definition at line 125 of file G4VPrimitiveScorer.hh.

Referenced by G4VPrimitiveScorer(), GetCollectionID(), and GetName().

◆ scoreWeighted

G4bool G4VPrimitiveScorer::scoreWeighted {false}
protected

Definition at line 133 of file G4VPrimitiveScorer.hh.

133{false};

Referenced by IsScoreWeighted(), G4PSCellFlux::ProcessHits(), and ScoreWeighted().

◆ unitName

◆ unitValue

◆ verboseLevel


The documentation for this class was generated from the following files: