Loading...
Searching...
No Matches
ScoreSpecies.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26/// \file scavenger/include/ScoreSpecies.hh
27/// \brief Definition of the scavenger::ScoreSpecies class
28
29#ifndef SCAVENGER_ScoreSpecies_h
30#define SCAVENGER_ScoreSpecies_h 1
31
32#include "G4VPrimitiveScorer.hh"
33#include "G4THitsMap.hh"
34#include <set>
35#include "G4UIcmdWithADoubleAndUnit.hh"
36#include "G4UIcmdWithAnInteger.hh"
37#include "G4UIcmdWithAString.hh"
38#include "G4UImessenger.hh"
39
41
43
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45namespace scavenger
46{
47
48/// \brief Primitive scorer class for scoring the radiolytic species
49/// produced after irradiation in a water volume
50///
51/// This is a primitive scorer class for molecular species.
52/// The number of species is recorded for all times (predetermined or
53/// user chosen). It also scores the energy deposition in order to compute the
54/// radiochemical yields.
55
56class ScoreSpecies
57 : public G4VPrimitiveScorer
58 , public G4UImessenger
59{
60 public:
61 explicit ScoreSpecies(const G4String& name, const G4int& depth = 0);
62
63 ~ScoreSpecies() override = default;
64
65 /** Add a time at which the number of species should be recorded.
66 Default times are set up to 1 microsecond.*/
67 inline void AddTimeToRecord(const G4double& time)
68 {
69 fTimeToRecord.insert(time);
70 }
71
72 /** Remove all times to record, must be reset by user.*/
73 inline void ClearTimeToRecord() { fTimeToRecord.clear(); }
74
75 /** Get number of recorded events*/
76 [[nodiscard]] inline G4int GetNumberOfRecordedEvents() const
77 {
78 return fNEvent;
79 }
80
81 void Initialize(G4HCofThisEvent*) override;
82
83 void EndOfEvent(G4HCofThisEvent*) override;
84
85 void DrawAll() override{};
86
87 void PrintAll() override;
88
89 /** Method used in multithreading mode in order to merge
90 the results*/
92
93 void OutputAndClear();
94
95 void SetNewValue(G4UIcommand*, G4String) override;
96
97 /** Write results to whatever chosen file format*/
99
101 {
102 SpeciesInfo() = default;
103 SpeciesInfo(const SpeciesInfo& right) = default;
105
106 G4int fNumber = 0;
107 G4double fG = 0.;
108 G4double fG2 = 0;
109 };
110
111 protected :
112 G4bool ProcessHits(G4Step*, G4TouchableHistory*) override;
113
114 private:
116 typedef std::map<Species*, SpeciesInfo> InnerSpeciesMap;
117 typedef std::map<G4double, InnerSpeciesMap> SpeciesMap;
119 std::set<G4double> fTimeToRecord;
120 G4int fNEvent = 0; // number of processed events
121 G4double fEdep = 0; // total energy deposition
123 G4int fHCID = -1;
125 std::unique_ptr<G4UIdirectory> fpSpeciesdir;
126 std::unique_ptr<G4UIcmdWithAnInteger> fpTimeBincmd;
127 std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpAddTimeToRecordcmd;
128 std::unique_ptr<G4UIcmdWithAString> fpSetResultsFileNameCmd;
129 G4String fRootFileName = "scorer.root";
130};
131
132//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
133
134#endif
135
136}
G4int GetNumberOfRecordedEvents() const
Get number of recorded events.
std::set< G4double > fTimeToRecord
std::map< Species *, SpeciesInfo > InnerSpeciesMap
void AbsorbResultsFromWorkerScorer(G4VPrimitiveScorer *)
Method used in multithreading mode in order to merge the results.
void AddTimeToRecord(const G4double &time)
Add a time at which the number of species should be recorded.
G4THitsMap< G4double > * fEvtMap
std::unique_ptr< G4UIcmdWithAnInteger > fpTimeBincmd
void DrawAll() override
G4bool ProcessHits(G4Step *, G4TouchableHistory *) override
~ScoreSpecies() override=default
void WriteWithAnalysisManager(G4VAnalysisManager *)
Write results to whatever chosen file format.
void SetNewValue(G4UIcommand *, G4String) override
std::unique_ptr< G4UIdirectory > fpSpeciesdir
const G4MolecularConfiguration Species
void EndOfEvent(G4HCofThisEvent *) override
void PrintAll() override
void ClearTimeToRecord()
Remove all times to record, must be reset by user.
std::unique_ptr< G4UIcmdWithAString > fpSetResultsFileNameCmd
std::map< G4double, InnerSpeciesMap > SpeciesMap
ScoreSpecies(const G4String &name, const G4int &depth=0)
std::unique_ptr< G4UIcmdWithADoubleAndUnit > fpAddTimeToRecordcmd
void Initialize()
Definition errProp.cc:100
SpeciesInfo & operator=(const SpeciesInfo &right)=default
SpeciesInfo(const SpeciesInfo &right)=default

Applications | User Support | Publications | Collaboration