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 // $Id$ 35 // 36 // 36 /// \file EventAction.cc 37 /// \file EventAction.cc 37 /// \brief Implementation of the EventAction c 38 /// \brief Implementation of the EventAction class 38 39 39 #include "EventAction.hh" 40 #include "EventAction.hh" 40 41 >> 42 #include "Analysis.hh" 41 #include "EventActionMessenger.hh" 43 #include "EventActionMessenger.hh" 42 << 43 #include "G4AnalysisManager.hh" << 44 #include "G4Event.hh" 44 #include "G4Event.hh" 45 #include "G4SystemOfUnits.hh" << 46 #include "G4UnitsTable.hh" 45 #include "G4UnitsTable.hh" >> 46 #include "G4SystemOfUnits.hh" 47 #include "Randomize.hh" 47 #include "Randomize.hh" 48 48 49 #include <algorithm> 49 #include <algorithm> 50 50 51 //....oooOO0OOooo........oooOO0OOooo........oo 51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 52 52 53 EventAction::EventAction() : G4UserEventAction << 53 EventAction::EventAction():G4UserEventAction() 54 { 54 { 55 // default parameter values << 55 //default parameter values 56 // 56 // 57 fThresEdepForSSB = 8.22 * eV; << 57 fThresEdepForSSB=8.22*eV; 58 fThresDistForDSB = 10; << 58 fThresDistForDSB=10; 59 fTotalEnergyDeposit = 0; << 59 fTotalEnergyDeposit=0; 60 60 61 // create commands << 61 //create commands 62 // 62 // 63 fpEventMessenger = new EventActionMessenger( 63 fpEventMessenger = new EventActionMessenger(this); 64 } 64 } 65 65 66 //....oooOO0OOooo........oooOO0OOooo........oo 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 67 67 68 EventAction::~EventAction() 68 EventAction::~EventAction() 69 { 69 { 70 delete fpEventMessenger; 70 delete fpEventMessenger; 71 } 71 } 72 72 73 //....oooOO0OOooo........oooOO0OOooo........oo 73 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 74 74 75 void EventAction::BeginOfEventAction(const G4E << 75 void EventAction::BeginOfEventAction( const G4Event*) 76 { 76 { 77 // Initialization of parameters 77 // Initialization of parameters 78 // 78 // 79 fTotalEnergyDeposit = 0.; << 79 fTotalEnergyDeposit=0.; 80 fEdepStrand1.clear(); 80 fEdepStrand1.clear(); 81 fEdepStrand2.clear(); 81 fEdepStrand2.clear(); 82 } 82 } 83 83 84 //....oooOO0OOooo........oooOO0OOooo........oo 84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 85 85 86 void EventAction::EndOfEventAction(const G4Eve << 86 void EventAction::EndOfEventAction( const G4Event*) 87 { 87 { 88 // At the end of an event, compute the numbe 88 // At the end of an event, compute the number of strand breaks 89 // 89 // 90 G4int sb[2] = {0, 0}; << 90 G4int sb[2] = {0,0}; 91 ComputeStrandBreaks(sb); 91 ComputeStrandBreaks(sb); 92 // Fill histograms 92 // Fill histograms 93 // 93 // 94 G4AnalysisManager* analysisManager = G4Analy 94 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 95 95 96 if (fTotalEnergyDeposit > 0.) { << 96 if ( fTotalEnergyDeposit>0. ) 97 analysisManager->FillH1(1, fTotalEnergyDep << 97 { 98 } << 98 analysisManager->FillH1(1,fTotalEnergyDeposit); 99 if (sb[0] > 0) { << 99 } 100 analysisManager->FillH1(2, sb[0]); << 100 if ( sb[0]>0 ) 101 } << 101 { 102 if (sb[1] > 0) { << 102 analysisManager->FillH1(2,sb[0]); 103 analysisManager->FillH1(3, sb[1]); << 103 } >> 104 if ( sb[1]>0 ) >> 105 { >> 106 analysisManager->FillH1(3,sb[1]); 104 } 107 } 105 } 108 } 106 109 107 //....oooOO0OOooo........oooOO0OOooo........oo 110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 108 111 109 void EventAction::ComputeStrandBreaks(G4int* s 112 void EventAction::ComputeStrandBreaks(G4int* sb) 110 { 113 { 111 // sb quantities 114 // sb quantities 112 // 115 // 113 G4int ssb1 = 0; << 116 G4int ssb1=0; 114 G4int ssb2 = 0; << 117 G4int ssb2=0; 115 G4int dsb = 0; << 118 G4int dsb=0; 116 119 117 // nucleotide id and energy deposit for each 120 // nucleotide id and energy deposit for each strand 118 G4int nucl1; 121 G4int nucl1; 119 G4int nucl2; 122 G4int nucl2; 120 G4double edep1; 123 G4double edep1; 121 G4double edep2; 124 G4double edep2; 122 125 123 // Read strand1 << 126 //Read strand1 124 // 127 // 125 while (!fEdepStrand1.empty()) { << 128 while ( !fEdepStrand1.empty() ) >> 129 { 126 nucl1 = fEdepStrand1.begin()->first; 130 nucl1 = fEdepStrand1.begin()->first; 127 edep1 = fEdepStrand1.begin()->second; 131 edep1 = fEdepStrand1.begin()->second; 128 fEdepStrand1.erase(fEdepStrand1.begin()); << 132 fEdepStrand1.erase( fEdepStrand1.begin() ); 129 133 130 // SSB in strand1 134 // SSB in strand1 131 // 135 // 132 if (edep1 >= fThresEdepForSSB / eV) { << 136 if ( edep1 >= fThresEdepForSSB/eV ) >> 137 { 133 ssb1++; 138 ssb1++; 134 } 139 } 135 140 136 // Look at strand2 141 // Look at strand2 137 // 142 // 138 if (!fEdepStrand2.empty()) { << 143 if ( !fEdepStrand2.empty() ) 139 do { << 144 { >> 145 do >> 146 { 140 nucl2 = fEdepStrand2.begin()->first; 147 nucl2 = fEdepStrand2.begin()->first; 141 edep2 = fEdepStrand2.begin()->second; 148 edep2 = fEdepStrand2.begin()->second; 142 if (edep2 >= fThresEdepForSSB / eV) { << 149 if ( edep2 >= fThresEdepForSSB/eV ) >> 150 { 143 ssb2++; 151 ssb2++; 144 } 152 } 145 fEdepStrand2.erase(fEdepStrand2.begin( << 153 fEdepStrand2.erase( fEdepStrand2.begin() ); 146 } while (((nucl1 - nucl2) > fThresDistFo << 154 } while ( ((nucl1-nucl2)>fThresDistForDSB) && (!fEdepStrand2.empty()) ); 147 155 148 // no dsb 156 // no dsb 149 // 157 // 150 if (nucl2 - nucl1 > fThresDistForDSB) { << 158 if ( nucl2-nucl1 > fThresDistForDSB ) 151 fEdepStrand2[nucl2] = edep2; << 159 { 152 if (edep2 >= fThresEdepForSSB / eV) { << 160 fEdepStrand2[nucl2]=edep2; >> 161 if ( edep2 >= fThresEdepForSSB/eV ) >> 162 { 153 ssb2--; 163 ssb2--; 154 } 164 } 155 } 165 } 156 166 157 // one dsb 167 // one dsb 158 // 168 // 159 if (std::abs(nucl2 - nucl1) <= fThresDis << 169 if ( std::abs(nucl2-nucl1) <= fThresDistForDSB ) 160 if ((edep2 >= fThresEdepForSSB / eV) & << 170 { >> 171 if ( ( edep2 >= fThresEdepForSSB/eV ) && >> 172 ( edep1 >= fThresEdepForSSB/eV ) ) >> 173 { 161 ssb1--; 174 ssb1--; 162 ssb2--; 175 ssb2--; 163 dsb++; 176 dsb++; 164 } 177 } 165 } 178 } 166 } 179 } 167 } 180 } 168 181 169 // End with not processed data 182 // End with not processed data 170 // 183 // 171 while (!fEdepStrand1.empty()) { << 184 while ( !fEdepStrand1.empty() ) >> 185 { 172 nucl1 = fEdepStrand1.begin()->first; 186 nucl1 = fEdepStrand1.begin()->first; 173 edep1 = fEdepStrand1.begin()->second; 187 edep1 = fEdepStrand1.begin()->second; 174 if (edep1 >= fThresEdepForSSB / eV) { << 188 if ( edep1 >= fThresEdepForSSB/eV ) >> 189 { 175 ssb1++; 190 ssb1++; 176 } 191 } 177 fEdepStrand1.erase(fEdepStrand1.begin()); << 192 fEdepStrand1.erase( fEdepStrand1.begin() ); 178 } 193 } 179 194 180 while (!fEdepStrand2.empty()) { << 195 while ( !fEdepStrand2.empty() ) >> 196 { 181 nucl2 = fEdepStrand2.begin()->first; 197 nucl2 = fEdepStrand2.begin()->first; 182 edep2 = fEdepStrand2.begin()->second; 198 edep2 = fEdepStrand2.begin()->second; 183 if (edep2 >= fThresEdepForSSB / eV) { << 199 if ( edep2 >= fThresEdepForSSB/eV ) >> 200 { 184 ssb2++; 201 ssb2++; 185 } 202 } 186 fEdepStrand2.erase(fEdepStrand2.begin()); << 203 fEdepStrand2.erase( fEdepStrand2.begin() ); 187 } 204 } 188 205 189 sb[0] = ssb1 + ssb2; << 206 sb[0]=ssb1+ssb2; 190 sb[1] = dsb; << 207 sb[1]=dsb; 191 } 208 } 192 209