ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ScoreSpecies.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ScoreSpecies.hh
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 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // shall cite the following Geant4-DNA collaboration publication:
29 // Med. Phys. 37 (2010) 4692-4708
30 // J. Comput. Phys. 274 (2014) 841-882
31 // Phys. Med. Biol. 63(10) (2018) 105014-12pp
32 // The Geant4-DNA web site is available at http://geant4-dna.org
33 //
34 //
35 #ifndef CHEM5_ScoreSpecies_h
36 #define CHEM5_ScoreSpecies_h 1
37 
38 #include "G4VPrimitiveScorer.hh"
39 #include "G4THitsMap.hh"
40 #include <set>
41 
43 
46 // Description:
47 // This is a primitive scorer class for scoring the radiolitic species
48 // produced after irradiation in a water volume
49 //
50 // Created: 2018-09-20 by J. Ramos-Mendez based on chem4 from
51 // M. Karamitros
52 
53 class ScoreSpecies : public G4VPrimitiveScorer
54 {
55 public:
56  ScoreSpecies(G4String name, G4int depth=0);
57 
58  virtual ~ScoreSpecies();
59 
62  inline void AddTimeToRecord(double time)
63  {
64  fTimeToRecord.insert(time);
65  }
66 
68  inline void ClearTimeToRecord()
69  {
70  fTimeToRecord.clear();
71  }
72 
74  inline int GetNumberOfRecordedEvents() const
75  {
76  return fNEvent;
77  }
78 
80  void ASCII();
81 
82  struct SpeciesInfo
83  {
85  {
86  fNumber = 0;
87  fG = 0.;
88  fG2 = 0.;
89  }
90  SpeciesInfo(const SpeciesInfo& right) // Species A(B);
91  {
92  fNumber = right.fNumber;
93  fG = right.fG;
94  fG2 = right.fG2;
95  }
97  {
98  if(&right == this) return *this;
99  fNumber = right.fNumber;
100  fG = right.fG;
101  fG2 = right.fG2;
102  return *this;
103  }
104  int fNumber;
105  double fG;
106  double fG2;
107  };
108 
109 private:
111  typedef std::map<Species*, SpeciesInfo> InnerSpeciesMap;
112  typedef std::map<double, InnerSpeciesMap> SpeciesMap;
114 
115  std::set<G4double> fTimeToRecord;
116 
117  int fNEvent; // number of processed events
118  double fEdep; // total energy deposition
119 
120 protected:
122 
123 public:
124  virtual void Initialize(G4HCofThisEvent*);
125  virtual void EndOfEvent(G4HCofThisEvent*);
126  virtual void clear();
127  virtual void DrawAll();
128  virtual void PrintAll();
132  virtual void OutputAndClear();
133 
135 
136 private:
137  G4int fHCID;
139 };
140 #endif