ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EventAction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EventAction.cc
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 // Delage et al. PDB4DNA: implementation of DNA geometry from the Protein Data
31 // Bank (PDB) description for Geant4-DNA Monte-Carlo
32 // simulations (submitted to Comput. Phys. Commun.)
33 // The Geant4-DNA web site is available at http://geant4-dna.org
34 //
35 //
38 
39 #include "EventAction.hh"
40 
41 #include "Analysis.hh"
42 #include "EventActionMessenger.hh"
43 #include "G4Event.hh"
44 #include "G4UnitsTable.hh"
45 #include "G4SystemOfUnits.hh"
46 #include "Randomize.hh"
47 
48 #include <algorithm>
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 {
54  //default parameter values
55  //
56  fThresEdepForSSB=8.22*eV;
59 
60  //create commands
61  //
63 }
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
68 {
69  delete fpEventMessenger;
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  // Initialization of parameters
77  //
79  fEdepStrand1.clear();
80  fEdepStrand2.clear();
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84 
86 {
87  // At the end of an event, compute the number of strand breaks
88  //
89  G4int sb[2] = {0,0};
91  // Fill histograms
92  //
94 
95  if ( fTotalEnergyDeposit>0. )
96  {
97  analysisManager->FillH1(1,fTotalEnergyDeposit);
98  }
99  if ( sb[0]>0 )
100  {
101  analysisManager->FillH1(2,sb[0]);
102  }
103  if ( sb[1]>0 )
104  {
105  analysisManager->FillH1(3,sb[1]);
106  }
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
110 
112 {
113  // sb quantities
114  //
115  G4int ssb1=0;
116  G4int ssb2=0;
117  G4int dsb=0;
118 
119  // nucleotide id and energy deposit for each strand
120  G4int nucl1;
121  G4int nucl2;
122  G4double edep1;
123  G4double edep2;
124 
125  //Read strand1
126  //
127  while ( !fEdepStrand1.empty() )
128  {
129  nucl1 = fEdepStrand1.begin()->first;
130  edep1 = fEdepStrand1.begin()->second;
131  fEdepStrand1.erase( fEdepStrand1.begin() );
132 
133  // SSB in strand1
134  //
135  if ( edep1 >= fThresEdepForSSB/eV )
136  {
137  ssb1++;
138  }
139 
140  // Look at strand2
141  //
142  if ( !fEdepStrand2.empty() )
143  {
144  do
145  {
146  nucl2 = fEdepStrand2.begin()->first;
147  edep2 = fEdepStrand2.begin()->second;
148  if ( edep2 >= fThresEdepForSSB/eV )
149  {
150  ssb2++;
151  }
152  fEdepStrand2.erase( fEdepStrand2.begin() );
153  } while ( ((nucl1-nucl2)>fThresDistForDSB) && (!fEdepStrand2.empty()) );
154 
155  // no dsb
156  //
157  if ( nucl2-nucl1 > fThresDistForDSB )
158  {
159  fEdepStrand2[nucl2]=edep2;
160  if ( edep2 >= fThresEdepForSSB/eV )
161  {
162  ssb2--;
163  }
164  }
165 
166  // one dsb
167  //
168  if ( std::abs(nucl2-nucl1) <= fThresDistForDSB )
169  {
170  if ( ( edep2 >= fThresEdepForSSB/eV ) &&
171  ( edep1 >= fThresEdepForSSB/eV ) )
172  {
173  ssb1--;
174  ssb2--;
175  dsb++;
176  }
177  }
178  }
179  }
180 
181  // End with not processed data
182  //
183  while ( !fEdepStrand1.empty() )
184  {
185  nucl1 = fEdepStrand1.begin()->first;
186  edep1 = fEdepStrand1.begin()->second;
187  if ( edep1 >= fThresEdepForSSB/eV )
188  {
189  ssb1++;
190  }
191  fEdepStrand1.erase( fEdepStrand1.begin() );
192  }
193 
194  while ( !fEdepStrand2.empty() )
195  {
196  nucl2 = fEdepStrand2.begin()->first;
197  edep2 = fEdepStrand2.begin()->second;
198  if ( edep2 >= fThresEdepForSSB/eV )
199  {
200  ssb2++;
201  }
202  fEdepStrand2.erase( fEdepStrand2.begin() );
203  }
204 
205  sb[0]=ssb1+ssb2;
206  sb[1]=dsb;
207 }