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] [ 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 /processes/transportation/src/G4TransportationLogger.cc (Version 11.3.0) and /processes/transportation/src/G4TransportationLogger.cc (Version 10.1.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 //                                                
 27 //                                                
 28 //                                                
 29 // class G4TransportationLogger Implementation    
 30 //                                                
 31 // Author: J. Apostolakis, June 2018              
 32 //                                                
 33 // -------------------------------------------    
 34                                                   
 35 #include <iomanip>                                
 36                                                   
 37 #include "G4SystemOfUnits.hh"                     
 38 #include "G4TransportationLogger.hh"              
 39 #include "G4Track.hh"                             
 40 #include "G4Step.hh"                              
 41                                                   
 42 G4TransportationLogger::G4TransportationLogger    
 43                                                   
 44    : fClassName(className), fVerbose(verbosity    
 45      fThldWarningEnergy(0.), fThldImportantEne    
 46 {                                                 
 47 }                                                 
 48                                                   
 49 G4TransportationLogger::G4TransportationLogger    
 50                                                   
 51    : fClassName(className), fVerbose(verbosity    
 52      fThldWarningEnergy(0.), fThldImportantEne    
 53 {                                                 
 54 }                                                 
 55                                                   
 56 G4TransportationLogger::~G4TransportationLogge    
 57 {                                                 
 58 }                                                 
 59                                                   
 60 // *******************************************    
 61 // SetThresholds                                  
 62 // *******************************************    
 63 void G4TransportationLogger::                     
 64 SetThresholds( G4double newEnWarn, G4double im    
 65                G4int newMaxTrials )               
 66 {                                                 
 67    SetThresholdWarningEnergy( newEnWarn );        
 68    SetThresholdImportantEnergy( importantEnerg    
 69    SetThresholdTrials(newMaxTrials );             
 70 }                                                 
 71                                                   
 72 //////////////////////////////////////////////    
 73 //                                                
 74 void                                              
 75 G4TransportationLogger::ReportLooperThresholds    
 76 {                                                 
 77    G4cout << className << ":  Current values f    
 78           << " the killing of looping tracks:     
 79           <<  "    Warning Energy   = " << Get    
 80           <<  "  ( below this tracks are kille    
 81           <<  "    Important Energy = " << Get    
 82           <<  "  ( above this tracks are given    
 83           <<  "    Extra Trials     = " << Get    
 84           << " 'important' tracks, i.e. those     
 85           << G4endl;                              
 86 }                                                 
 87                                                   
 88 // *******************************************    
 89 // ReportLoopingTrack                             
 90 // *******************************************    
 91 //                                                
 92 void G4TransportationLogger::ReportLoopingTrac    
 93                                                   
 94                                                   
 95                                                   
 96                                                   
 97    ) const                                        
 98 {                                                 
 99   static std::atomic<unsigned int> numAdviceEx    
100   constexpr double gramPerCm3 = gram / ( centi    
101   std::ostringstream msg;                         
102   auto preStepPt= stepData.GetPreStepPoint();     
103   auto preStepEn= preStepPt ? preStepPt->GetKi    
104   msg << " Transportation is killing track tha    
105       << "   Track is "                           
106       << track.GetParticleDefinition()->GetPar    
107       << " and has " << track.GetKineticEnergy    
108       << " MeV energy  ( pre-Step = " << preSt    
109   msg << "   momentum = " << track.GetMomentum    
110       << G4endl                                   
111       << "   position = " << track.GetPosition    
112   auto physVolume= track.GetVolume();             
113   auto material= physVolume->GetLogicalVolume(    
114   msg << " is in volume '" << physVolume->GetN    
115   if( material )                                  
116   {                                               
117      msg << " its material is '" << material->    
118      msg << " with density = " << material->Ge    
119          << " g/cm^3 ";                           
120   }                                               
121   else                                            
122   {                                               
123      msg << " unable to obtain material inform    
124   }                                               
125   msg << G4endl;                                  
126   msg << " Total number of Steps by this track    
127       << G4endl                                   
128       << " Length of this step = " << stepData    
129       << G4endl                                   
130       << " Number of propagation trials = " <<    
131       << " ( vs maximum = " << GetThresholdTri    
132       << G4endl;                                  
133                                                   
134   if (noCalls)                                    
135     msg << "   ( Number of *calls* of Transpor    
136                                                   
137   const G4int numPrints= 5;                       
138   if( numAdviceExcessSteps++ < numPrints )        
139   {                                               
140      msg << " =============== Recommendations     
141      msg << " Recommendations to address this     
142      msg << " This warning is controlled by th    
143          << " method of G4Transportation.  " <    
144          << " Current value of 'warning' thres    
145          << GetThresholdWarningEnergy() / MeV     
146      msg << " - If 'unimportant' particles (wi    
147          << "  application, then increase its     
148      msg << " - If particles of high-enough en    
149          << " killed, you can " << G4endl         
150          << "   a) Increase the trial steps us    
151          << "  Particles above the 'important'    
152          << "  will be given this many 'chance    
153          << "  The default value was 10, and t    
154          << G4endl                                
155          << "   b) Increase the energy which y    
156          << " killed only after extra trials),    
157          << "      Note: this can incur a pote    
158          << " if more tracks require very larg    
159          << "   c) investigate alternative int    
160          << "    e.g.  Helical methods for uni    
161          << " or else higher order RK methods     
162          << G4endl;                               
163      msg << " This information is provided " <    
164          << numAdviceExcessSteps << " / " << n    
165      msg << " ================================    
166   }                                               
167   const G4String fullMethodName= fClassName +     
168   G4Exception( fullMethodName, "Transport-001-    
169 }                                                 
170