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