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 // The Geant4-DNA web site is available at http://geant4-dna.org
32 //
33 //
34 #ifndef CHEM4_ScoreSpecies_h
35 #define CHEM4_ScoreSpecies_h 1
36 
37 #include "G4VPrimitiveScorer.hh"
38 #include "G4THitsMap.hh"
39 #include <set>
40 
41 class G4VAnalysisManager;
43 
44 //#define _ScoreSpecies_FOR_ALL_EVENTS
45 
48 // Description:
49 // This is a primitive scorer class for scoring the radiolitic species
50 // produced after irradiation in a water volume
51 //
52 // Created: 2015-10-27 by M. Karamitros,
53 // modified: 2016-03-16 by P. Piersimoni
54 
56 {
57 public:
58  ScoreSpecies(G4String name, G4int depth=0);
59 
60  virtual ~ScoreSpecies();
61 
64  inline void AddTimeToRecord(double time)
65  {
66  fTimeToRecord.insert(time);
67  }
68 
70  inline void ClearTimeToRecord()
71  {
72  fTimeToRecord.clear();
73  }
74 
76  inline int GetNumberOfRecordedEvents() const
77  {
78  return fNEvent;
79  }
80 
82  void ASCII();
83 
86 
87  struct SpeciesInfo
88  {
90  {
91  fNumber = 0;
92  fG = 0.;
93  fG2 = 0.;
94  }
95  SpeciesInfo(const SpeciesInfo& right) // Species A(B);
96  {
97  fNumber = right.fNumber;
98  fG = right.fG;
99  fG2 = right.fG2;
100  }
102  {
103  if(&right == this) return *this;
104  fNumber = right.fNumber;
105  fG = right.fG;
106  fG2 = right.fG2;
107  return *this;
108  }
109  int fNumber;
110  double fG;
111  double fG2;
112  };
113 
114 #ifdef _ScoreSpecies_FOR_ALL_EVENTS
115  struct SpeciesInfoSOA
116  {
118  {
119  //fNumber = 0;
120  //fG = 0.;
121  //fG2 = 0.;
122  }
123  SpeciesInfoSOA(const SpeciesInfoSOA& right) // Species A(B);
124  {
125  fNumber = right.fNumber;
126  fG = right.fG;
127  fG2 = right.fG2;
128  fEventID = right.fEventID;
129  }
130  SpeciesInfoSOA& operator=(const SpeciesInfoSOA& right) // A = B
131  {
132  if(&right == this) return *this;
133  fNumber = right.fNumber;
134  fG = right.fG;
135  fG2 = right.fG2;
136  fEventID = right.fEventID;
137  return *this;
138  }
139  std::vector<int> fNumber;
140  std::vector<double> fG;
141  std::vector<double> fG2;
142  std::vector<int> fEventID;
143  };
144 #endif
145 
146 private:
148  typedef std::map<Species*, SpeciesInfo> InnerSpeciesMap;
149  typedef std::map<double, InnerSpeciesMap> SpeciesMap;
151 
152 #ifdef _ScoreSpecies_FOR_ALL_EVENTS
153  typedef std::map<Species, SpeciesInfoSOA> InnerSpeciesMapPerEvent;
154  typedef std::map<double, InnerSpeciesMapPerEvent> SpeciesMapPerEvent;
155  SpeciesMapPerEvent fSpeciesInfoPerEvent;
156 #endif
157 
158  std::set<G4double> fTimeToRecord;
159 
160  int fNEvent; // number of processed events
161  double fEdep; // total energy deposition
162  G4bool fOutputToRoot; // flag to output to a ROOT file
163  G4bool fOutputToXml; // flag to output to a XML file
164  G4bool fOutputToCsv; // flag to output to a CSV file (text)
165 
166 protected:
168 
169 public:
170  virtual void Initialize(G4HCofThisEvent*);
171  virtual void EndOfEvent(G4HCofThisEvent*);
172  virtual void clear();
173  virtual void DrawAll();
174  virtual void PrintAll();
178  virtual void OutputAndClear();
179 
181 
182 private:
185 };
186 #endif