Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // This example is provided by the Geant4-DNA 27 // Any report or published results obtained us 28 // shall cite the following Geant4-DNA collabo 29 // Med. Phys. 37 (2010) 4692-4708 30 // Delage et al. PDB4DNA: implementation of DN 31 // Bank (PDB) description for 32 // simulations (submitted to 33 // The Geant4-DNA web site is available at htt 34 // 35 // 36 /// \file EventAction.cc 37 /// \brief Implementation of the EventAction c 38 39 #include "EventAction.hh" 40 41 #include "EventActionMessenger.hh" 42 43 #include "G4AnalysisManager.hh" 44 #include "G4Event.hh" 45 #include "G4SystemOfUnits.hh" 46 #include "G4UnitsTable.hh" 47 #include "Randomize.hh" 48 49 #include <algorithm> 50 51 //....oooOO0OOooo........oooOO0OOooo........oo 52 53 EventAction::EventAction() : G4UserEventAction 54 { 55 // default parameter values 56 // 57 fThresEdepForSSB = 8.22 * eV; 58 fThresDistForDSB = 10; 59 fTotalEnergyDeposit = 0; 60 61 // create commands 62 // 63 fpEventMessenger = new EventActionMessenger( 64 } 65 66 //....oooOO0OOooo........oooOO0OOooo........oo 67 68 EventAction::~EventAction() 69 { 70 delete fpEventMessenger; 71 } 72 73 //....oooOO0OOooo........oooOO0OOooo........oo 74 75 void EventAction::BeginOfEventAction(const G4E 76 { 77 // Initialization of parameters 78 // 79 fTotalEnergyDeposit = 0.; 80 fEdepStrand1.clear(); 81 fEdepStrand2.clear(); 82 } 83 84 //....oooOO0OOooo........oooOO0OOooo........oo 85 86 void EventAction::EndOfEventAction(const G4Eve 87 { 88 // At the end of an event, compute the numbe 89 // 90 G4int sb[2] = {0, 0}; 91 ComputeStrandBreaks(sb); 92 // Fill histograms 93 // 94 G4AnalysisManager* analysisManager = G4Analy 95 96 if (fTotalEnergyDeposit > 0.) { 97 analysisManager->FillH1(1, fTotalEnergyDep 98 } 99 if (sb[0] > 0) { 100 analysisManager->FillH1(2, sb[0]); 101 } 102 if (sb[1] > 0) { 103 analysisManager->FillH1(3, sb[1]); 104 } 105 } 106 107 //....oooOO0OOooo........oooOO0OOooo........oo 108 109 void EventAction::ComputeStrandBreaks(G4int* s 110 { 111 // sb quantities 112 // 113 G4int ssb1 = 0; 114 G4int ssb2 = 0; 115 G4int dsb = 0; 116 117 // nucleotide id and energy deposit for each 118 G4int nucl1; 119 G4int nucl2; 120 G4double edep1; 121 G4double edep2; 122 123 // Read strand1 124 // 125 while (!fEdepStrand1.empty()) { 126 nucl1 = fEdepStrand1.begin()->first; 127 edep1 = fEdepStrand1.begin()->second; 128 fEdepStrand1.erase(fEdepStrand1.begin()); 129 130 // SSB in strand1 131 // 132 if (edep1 >= fThresEdepForSSB / eV) { 133 ssb1++; 134 } 135 136 // Look at strand2 137 // 138 if (!fEdepStrand2.empty()) { 139 do { 140 nucl2 = fEdepStrand2.begin()->first; 141 edep2 = fEdepStrand2.begin()->second; 142 if (edep2 >= fThresEdepForSSB / eV) { 143 ssb2++; 144 } 145 fEdepStrand2.erase(fEdepStrand2.begin( 146 } while (((nucl1 - nucl2) > fThresDistFo 147 148 // no dsb 149 // 150 if (nucl2 - nucl1 > fThresDistForDSB) { 151 fEdepStrand2[nucl2] = edep2; 152 if (edep2 >= fThresEdepForSSB / eV) { 153 ssb2--; 154 } 155 } 156 157 // one dsb 158 // 159 if (std::abs(nucl2 - nucl1) <= fThresDis 160 if ((edep2 >= fThresEdepForSSB / eV) & 161 ssb1--; 162 ssb2--; 163 dsb++; 164 } 165 } 166 } 167 } 168 169 // End with not processed data 170 // 171 while (!fEdepStrand1.empty()) { 172 nucl1 = fEdepStrand1.begin()->first; 173 edep1 = fEdepStrand1.begin()->second; 174 if (edep1 >= fThresEdepForSSB / eV) { 175 ssb1++; 176 } 177 fEdepStrand1.erase(fEdepStrand1.begin()); 178 } 179 180 while (!fEdepStrand2.empty()) { 181 nucl2 = fEdepStrand2.begin()->first; 182 edep2 = fEdepStrand2.begin()->second; 183 if (edep2 >= fThresEdepForSSB / eV) { 184 ssb2++; 185 } 186 fEdepStrand2.erase(fEdepStrand2.begin()); 187 } 188 189 sb[0] = ssb1 + ssb2; 190 sb[1] = dsb; 191 } 192