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[ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/medical/dna/chem6/src/PrimaryKiller.cc (Version 11.3.0) and /examples/extended/medical/dna/chem6/src/PrimaryKiller.cc (Version 10.2.p1)


  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 // chem6 example is derived from chem4 and che    
 28 //                                                
 29 // Any report or published results obtained us    
 30 // shall cite the following Geant4-DNA collabo    
 31 // J. Appl. Phys. 125 (2019) 104301               
 32 // Med. Phys. 45 (2018) e722-e739                 
 33 // J. Comput. Phys. 274 (2014) 841-882            
 34 // Med. Phys. 37 (2010) 4692-4708                 
 35 // Int. J. Model. Simul. Sci. Comput. 1 (2010)    
 36 // The Geant4-DNA web site is available at htt    
 37 //                                                
 38 // Authors: W. G. Shin and S. Incerti (CENBG,     
 39 //                                                
 40 // $Id$                                           
 41 //                                                
 42 /// \file PrimaryKiller.cc                        
 43 /// \brief Implementation of the PrimaryKiller    
 44                                                   
 45 #include "PrimaryKiller.hh"                       
 46                                                   
 47 #include <G4Event.hh>                             
 48 #include <G4RunManager.hh>                        
 49 #include <G4SystemOfUnits.hh>                     
 50 #include <G4UIcmdWith3VectorAndUnit.hh>           
 51 #include <G4UIcmdWithADoubleAndUnit.hh>           
 52 #include <G4UnitsTable.hh>                        
 53                                                   
 54 /** \file PrimaryKiller.cc                        
 55     \class PrimaryKiller                          
 56                                                   
 57     Kill the primary particle:                    
 58     - either after a given energy loss            
 59     - or after the primary particle has reache    
 60  */                                               
 61                                                   
 62 //....oooOO0OOooo........oooOO0OOooo........oo    
 63                                                   
 64 PrimaryKiller::PrimaryKiller(G4String name, G4    
 65   : G4VPrimitiveScorer(name, depth), G4UImesse    
 66 {                                                 
 67   fELoss = 0.;  // cumulated energy for curren    
 68                                                   
 69   fELossRange_Min = DBL_MAX;  // fELoss from w    
 70   fELossRange_Max = DBL_MAX;  // fELoss from w    
 71   fKineticE_Min = 0;  // kinetic energy below     
 72   fPhantomSize = G4ThreeVector(1 * km, 1 * km,    
 73                                                   
 74   fpELossUI = new G4UIcmdWithADoubleAndUnit("/    
 75   fpAbortEventIfELossUpperThan = new G4UIcmdWi    
 76   fpMinKineticE = new G4UIcmdWithADoubleAndUni    
 77   fpSizeUI = new G4UIcmdWith3VectorAndUnit("/p    
 78   fpSizeUI->SetDefaultUnit("um");                 
 79 }                                                 
 80                                                   
 81 //....oooOO0OOooo........oooOO0OOooo........oo    
 82                                                   
 83 PrimaryKiller::~PrimaryKiller()                   
 84 {                                                 
 85   delete fpELossUI;                               
 86   delete fpAbortEventIfELossUpperThan;            
 87   delete fpSizeUI;                                
 88 }                                                 
 89                                                   
 90 //....oooOO0OOooo........oooOO0OOooo........oo    
 91                                                   
 92 void PrimaryKiller::SetNewValue(G4UIcommand* c    
 93 {                                                 
 94   if (command == fpELossUI) {                     
 95     fELossRange_Min = fpELossUI->GetNewDoubleV    
 96   }                                               
 97   else if (command == fpAbortEventIfELossUpper    
 98     fELossRange_Max = fpAbortEventIfELossUpper    
 99   }                                               
100   else if (command == fpSizeUI) {                 
101     fPhantomSize = fpSizeUI->GetNew3VectorValu    
102   }                                               
103 }                                                 
104                                                   
105 //....oooOO0OOooo........oooOO0OOooo........oo    
106                                                   
107 G4bool PrimaryKiller::ProcessHits(G4Step* aSte    
108 {                                                 
109   const G4Track* track = aStep->GetTrack();       
110   G4ThreeVector pos = aStep->GetPostStepPoint(    
111                                                   
112   if (std::abs(pos.x()) > fPhantomSize.getX()     
113       || std::abs(pos.z()) > fPhantomSize.getZ    
114   {                                               
115     ((G4Track*)track)->SetTrackStatus(fStopAnd    
116     return false;                                 
117   }                                               
118                                                   
119   if (track->GetTrackID() != 1 || track->GetPa    
120     return FALSE;                                 
121                                                   
122   //-------------------                           
123                                                   
124   double kineticE = aStep->GetPostStepPoint()-    
125                                                   
126   G4double eLoss = aStep->GetPreStepPoint()->G    
127                                                   
128   if (eLoss == 0.) return FALSE;                  
129                                                   
130   //-------------------                           
131                                                   
132   fELoss += eLoss;                                
133                                                   
134   if (fELoss > fELossRange_Max) {                 
135     G4RunManager::GetRunManager()->AbortEvent(    
136     /*    int eventID =                           
137          G4EventManager::GetEventManager()->Ge    
138                                                   
139         G4cout << " * PrimaryKiller: aborts ev    
140                   "is too large. \n"              
141                << " * Energy loss by primary i    
142                << G4BestUnit(fELoss, "Energy")    
143                << ". Event is aborted if the E    
144                << G4BestUnit(fELossRange_Max,     
145                << G4endl;                         
146      */                                           
147   }                                               
148                                                   
149   if (fELoss >= fELossRange_Min || kineticE <=    
150     ((G4Track*)track)->SetTrackStatus(fStopAnd    
151     //     G4cout << "kill track at : "<<'\n';    
152     //           << G4BestUnit(kineticE, "Ener    
153     //           << ", E loss is: "               
154     //           << G4BestUnit(fELoss, "Energy    
155     //           << " /fELossMax: "               
156     //           << G4BestUnit(fELossMax, "Ene    
157     //           << ", EThreshold is: "           
158     //           << G4BestUnit(fEThreshold, "E    
159     //           << G4endl;                       
160   }                                               
161                                                   
162   return TRUE;                                    
163 }                                                 
164                                                   
165 //....oooOO0OOooo........oooOO0OOooo........oo    
166                                                   
167 void PrimaryKiller::Initialize(G4HCofThisEvent    
168 {                                                 
169   fELoss = 0.;                                    
170 }                                                 
171                                                   
172 //....oooOO0OOooo........oooOO0OOooo........oo    
173                                                   
174 void PrimaryKiller::EndOfEvent(G4HCofThisEvent    
175                                                   
176 //....oooOO0OOooo........oooOO0OOooo........oo    
177                                                   
178 void PrimaryKiller::DrawAll()                     
179 {                                                 
180   ;                                               
181 }                                                 
182                                                   
183 //....oooOO0OOooo........oooOO0OOooo........oo    
184                                                   
185 void PrimaryKiller::PrintAll() {}                 
186                                                   
187 //....oooOO0OOooo........oooOO0OOooo........oo    
188