23#include "G4MultiFunctionalDetector.hh"
24#include "G4ScoringManager.hh"
25#include "G4VPrimitiveScorer.hh"
26#include "G4VScoringMesh.hh"
28#include <TVirtualMC.h>
40 "Cannot create two instances of singleton.");
80 auto g4ScoringManager = G4ScoringManager::GetScoringManagerIfExist();
81 if (g4ScoringManager ==
nullptr )
return;
86 Double_t ekin = step->GetTrack()->GetKineticEnergy();
87 Int_t pdg = step->GetTrack()->GetParticleDefinition()->GetPDGEncoding();
88 return calculator(pdg, ekin);
92 auto nofMesh = g4ScoringManager->GetNumberOfMesh();
93 if (nofMesh < 1)
return;
95 std::size_t counter = 0;
96 for (std::size_t i = 0; i < nofMesh; ++i) {
97 auto mesh = g4ScoringManager->GetMesh((G4int)i);
98 const auto mfd = mesh->GetMFD();
99 G4int nps = mfd->GetNumberOfPrimitives();
100 for (G4int i = 0; i < nps; ++i) {
101 auto scorer = mfd->GetPrimitive(i);
103 if (scorer->IsScoreWeighted()) {
105 scorer->SetScoreWeightCalculator(g4Swc);
112 G4cout <<
"### User score weight calculator set to " << counter <<
" scorers."
178 const TString& volName, TVirtualMCSensitiveDetector* sd)
187 const TString& volName)
const
191 return fSDServices->GetUserSD(volName.Data(),
false);
Definition of the TG4GeometryServices class.
Definition of the TG4Globals class and basic container types.
Definition of the TG4MediumMap class.
Definition of the TG4Medium class.
Definition of the TG4SDConstruction class.
Definition of the TG4SDManager class.
Definition of the TG4SDServices class.
std::function< Double_t(Int_t pdg, Double_t ekin)> TG4ScoreWeightCalculator
static void Exception(const TString &className, const TString &methodName, const TString &text)
Sensitive detector construction.
Geant4 implementation of the TVirtualMC interface methods for access to Geant4 geometry related with ...
TG4ScoreWeightCalculator fScoreWeightCalculator
score weight calculator
Int_t NofVolDaughters(const char *volName) const
const char * VolDaughterName(const char *volName, Int_t i) const
TVirtualMCSensitiveDetector * GetSensitiveDetector(const TString &volName) const
void SetSensitiveDetector(const TString &volName, TVirtualMCSensitiveDetector *sd)
void SetExclusiveSDScoring(Bool_t exclusiveSDScoring)
G4String fNameBuffer
buffer for volume name
Int_t VolDaughterCopyNo(const char *volName, Int_t i) const
TG4SDServices * fSDServices
services related with sensitive detectors
const char * VolName(Int_t id) const
void LateInitialize(TG4ScoreWeightCalculator swc)
Int_t VolId(const Text_t *volName) const
static TG4SDManager * fgInstance
this instance
Int_t VolId2Mate(Int_t volumeId) const
TG4SDConstruction * fSDConstruction
sensitive detectors construction
Sensitive detectors services.