File indexing completed on 2025-02-23 09:21:48
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
0030
0031
0032
0033
0034 #ifndef CHEM4_ScoreSpecies_h
0035 #define CHEM4_ScoreSpecies_h 1
0036
0037 #include "G4THitsMap.hh"
0038 #include "G4VPrimitiveScorer.hh"
0039
0040 #include <set>
0041
0042 class G4VAnalysisManager;
0043 class G4MolecularConfiguration;
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056 class ScoreSpecies : public G4VPrimitiveScorer
0057 {
0058 public:
0059 ScoreSpecies(G4String name, G4int depth = 0);
0060
0061 virtual ~ScoreSpecies();
0062
0063
0064
0065 inline void AddTimeToRecord(double time) { fTimeToRecord.insert(time); }
0066
0067
0068 inline void ClearTimeToRecord() { fTimeToRecord.clear(); }
0069
0070
0071 inline int GetNumberOfRecordedEvents() const { return fNEvent; }
0072
0073
0074 void ASCII();
0075
0076
0077 void WriteWithAnalysisManager(G4VAnalysisManager*);
0078
0079 struct SpeciesInfo
0080 {
0081 SpeciesInfo()
0082 {
0083 fNumber = 0;
0084 fG = 0.;
0085 fG2 = 0.;
0086 }
0087 SpeciesInfo(const SpeciesInfo& right)
0088 {
0089 fNumber = right.fNumber;
0090 fG = right.fG;
0091 fG2 = right.fG2;
0092 }
0093 SpeciesInfo& operator=(const SpeciesInfo& right)
0094 {
0095 if (&right == this) return *this;
0096 fNumber = right.fNumber;
0097 fG = right.fG;
0098 fG2 = right.fG2;
0099 return *this;
0100 }
0101 int fNumber;
0102 double fG;
0103 double fG2;
0104 };
0105
0106 #ifdef _ScoreSpecies_FOR_ALL_EVENTS
0107 struct SpeciesInfoSOA
0108 {
0109 SpeciesInfoSOA()
0110 {
0111
0112
0113
0114 }
0115 SpeciesInfoSOA(const SpeciesInfoSOA& right)
0116 {
0117 fNumber = right.fNumber;
0118 fG = right.fG;
0119 fG2 = right.fG2;
0120 fEventID = right.fEventID;
0121 }
0122 SpeciesInfoSOA& operator=(const SpeciesInfoSOA& right)
0123 {
0124 if (&right == this) return *this;
0125 fNumber = right.fNumber;
0126 fG = right.fG;
0127 fG2 = right.fG2;
0128 fEventID = right.fEventID;
0129 return *this;
0130 }
0131 std::vector<int> fNumber;
0132 std::vector<double> fG;
0133 std::vector<double> fG2;
0134 std::vector<int> fEventID;
0135 };
0136 #endif
0137
0138 private:
0139 typedef const G4MolecularConfiguration Species;
0140 typedef std::map<Species*, SpeciesInfo> InnerSpeciesMap;
0141 typedef std::map<double, InnerSpeciesMap> SpeciesMap;
0142 SpeciesMap fSpeciesInfoPerTime;
0143
0144 #ifdef _ScoreSpecies_FOR_ALL_EVENTS
0145 typedef std::map<Species, SpeciesInfoSOA> InnerSpeciesMapPerEvent;
0146 typedef std::map<double, InnerSpeciesMapPerEvent> SpeciesMapPerEvent;
0147 SpeciesMapPerEvent fSpeciesInfoPerEvent;
0148 #endif
0149
0150 std::set<G4double> fTimeToRecord;
0151
0152 int fNEvent;
0153 double fEdep;
0154 G4String fOutputType;
0155
0156 protected:
0157 virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*);
0158
0159 public:
0160 virtual void Initialize(G4HCofThisEvent*);
0161 virtual void EndOfEvent(G4HCofThisEvent*);
0162 virtual void DrawAll();
0163 virtual void PrintAll();
0164
0165
0166 virtual void AbsorbResultsFromWorkerScorer(G4VPrimitiveScorer*);
0167 virtual void OutputAndClear();
0168
0169 SpeciesMap GetSpeciesInfo() { return fSpeciesInfoPerTime; }
0170
0171 private:
0172 G4int fHCID;
0173 G4THitsMap<G4double>* fEvtMap;
0174 };
0175 #endif