File indexing completed on 2025-02-23 09:22:07
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef SCAVENGER_ScoreSpecies_h
0030 # define SCAVENGER_ScoreSpecies_h 1
0031
0032 # include "G4THitsMap.hh"
0033 # include "G4UIcmdWithADoubleAndUnit.hh"
0034 # include "G4UIcmdWithAString.hh"
0035 # include "G4UIcmdWithAnInteger.hh"
0036 # include "G4UImessenger.hh"
0037 # include "G4VPrimitiveScorer.hh"
0038
0039 # include <set>
0040
0041 class G4VAnalysisManager;
0042
0043 class G4MolecularConfiguration;
0044
0045
0046 namespace scavenger
0047 {
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057 class ScoreSpecies : public G4VPrimitiveScorer, public G4UImessenger
0058 {
0059 public:
0060 explicit ScoreSpecies(const G4String& name, const G4int& depth = 0);
0061
0062 ~ScoreSpecies() override = default;
0063
0064
0065
0066 inline void AddTimeToRecord(const G4double& time) { fTimeToRecord.insert(time); }
0067
0068
0069 inline void ClearTimeToRecord() { fTimeToRecord.clear(); }
0070
0071
0072 [[nodiscard]] inline G4int GetNumberOfRecordedEvents() const { return fNEvent; }
0073
0074 void Initialize(G4HCofThisEvent*) override;
0075
0076 void EndOfEvent(G4HCofThisEvent*) override;
0077
0078 void DrawAll() override {};
0079
0080 void PrintAll() override;
0081
0082
0083
0084 void AbsorbResultsFromWorkerScorer(G4VPrimitiveScorer*);
0085
0086 void OutputAndClear();
0087
0088 void SetNewValue(G4UIcommand*, G4String) override;
0089
0090
0091 void WriteWithAnalysisManager(G4VAnalysisManager*);
0092
0093 struct SpeciesInfo
0094 {
0095 SpeciesInfo() = default;
0096 SpeciesInfo(const SpeciesInfo& right) = default;
0097 SpeciesInfo& operator=(const SpeciesInfo& right) = default;
0098
0099 G4int fNumber = 0;
0100 G4double fG = 0.;
0101 G4double fG2 = 0;
0102 };
0103
0104 protected:
0105 G4bool ProcessHits(G4Step*, G4TouchableHistory*) override;
0106
0107 private:
0108 typedef const G4MolecularConfiguration Species;
0109 typedef std::map<Species*, SpeciesInfo> InnerSpeciesMap;
0110 typedef std::map<G4double, InnerSpeciesMap> SpeciesMap;
0111 SpeciesMap fSpeciesInfoPerTime;
0112 std::set<G4double> fTimeToRecord;
0113 G4int fNEvent = 0;
0114 G4double fEdep = 0;
0115 G4String fOutputType = "root";
0116 G4int fHCID = -1;
0117 G4THitsMap<G4double>* fEvtMap = nullptr;
0118 std::unique_ptr<G4UIdirectory> fpSpeciesdir;
0119 std::unique_ptr<G4UIcmdWithAnInteger> fpTimeBincmd;
0120 std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpAddTimeToRecordcmd;
0121 std::unique_ptr<G4UIcmdWithAString> fpSetResultsFileNameCmd;
0122 G4String fRootFileName = "scorer.root";
0123 };
0124
0125
0126
0127 #endif
0128 }