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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 /examples/extended/optical/wls/src/WLSRun.cc (Version 11.3.0) and /examples/extended/optical/wls/src/WLSRun.cc (Version 4.0.p2)


  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 /// \file optical/wls/src/WLSRun.cc               
 28 /// \brief Implementation of the WLSRun class     
 29 //                                                
 30 //                                                
 31                                                   
 32 #include "WLSRun.hh"                              
 33                                                   
 34 //....oooOO0OOooo........oooOO0OOooo........oo    
 35                                                   
 36 void WLSRun::Merge(const G4Run* run)              
 37 {                                                 
 38   const auto localRun = static_cast<const WLSR    
 39                                                   
 40   fNTIR += localRun->fNTIR;                       
 41   fNTIR2 += localRun->fNTIR2;                     
 42   fNExiting += localRun->fNExiting;               
 43   fNExiting2 += localRun->fNExiting2;             
 44   fEscapedEnd += localRun->fEscapedEnd;           
 45   fEscapedEnd2 += localRun->fEscapedEnd2;         
 46   fEscapedMid += localRun->fEscapedMid;           
 47   fEscapedMid2 += localRun->fEscapedMid2;         
 48   fBounce += localRun->fBounce;                   
 49   fBounce2 += localRun->fBounce2;                 
 50   fWLSBounce += localRun->fWLSBounce;             
 51   fWLSBounce2 += localRun->fWLSBounce2;           
 52   fClad1Bounce += localRun->fClad1Bounce;         
 53   fClad1Bounce2 += localRun->fClad1Bounce2;       
 54   fClad2Bounce += localRun->fClad2Bounce;         
 55   fClad2Bounce2 += localRun->fClad2Bounce2;       
 56   fReflected += localRun->fReflected;             
 57   fReflected2 += localRun->fReflected2;           
 58   fEscaped += localRun->fEscaped;                 
 59   fEscaped2 += localRun->fEscaped2;               
 60   fMirror += localRun->fMirror;                   
 61   fMirror2 += localRun->fMirror2;                 
 62   fDetectorHits += localRun->fDetectorHits;       
 63   fDetectorHits2 += localRun->fDetectorHits2;     
 64                                                   
 65   G4Run::Merge(run);                              
 66 }                                                 
 67                                                   
 68 //....oooOO0OOooo........oooOO0OOooo........oo    
 69                                                   
 70 void WLSRun::EndOfRun()                           
 71 {                                                 
 72   if (numberOfEvent == 0) return;                 
 73   auto TotNbofEvents = G4double(numberOfEvent)    
 74                                                   
 75   fNTIR = fNTIR / TotNbofEvents;                  
 76   fNTIR2 = fNTIR2 / TotNbofEvents;                
 77   G4double rmsTIR = fNTIR2 - fNTIR * fNTIR;       
 78   if (rmsTIR > 0.)                                
 79     rmsTIR = std::sqrt(rmsTIR);                   
 80   else                                            
 81     rmsTIR = 0.;                                  
 82                                                   
 83   fNExiting = fNExiting / TotNbofEvents;          
 84   fNExiting2 = fNExiting2 / TotNbofEvents;        
 85   G4double rmsExiting = fNExiting2 - fNExiting    
 86   if (rmsExiting > 0.)                            
 87     rmsExiting = std::sqrt(rmsExiting);           
 88   else                                            
 89     rmsExiting = 0.;                              
 90                                                   
 91   fEscapedEnd = fEscapedEnd / TotNbofEvents;      
 92   fEscapedEnd2 = fEscapedEnd2 / TotNbofEvents;    
 93   G4double rmsEscapedEnd = fEscapedEnd2 - fEsc    
 94   if (rmsEscapedEnd > 0.)                         
 95     rmsEscapedEnd = std::sqrt(rmsEscapedEnd);     
 96   else                                            
 97     rmsEscapedEnd = 0.;                           
 98                                                   
 99   fEscapedMid = fEscapedMid / TotNbofEvents;      
100   fEscapedMid2 = fEscapedMid2 / TotNbofEvents;    
101   G4double rmsEscapedMid = fEscapedMid2 - fEsc    
102   if (rmsEscapedMid > 0.)                         
103     rmsEscapedMid = std::sqrt(rmsEscapedMid);     
104   else                                            
105     rmsEscapedMid = 0.;                           
106                                                   
107   fBounce = fBounce / TotNbofEvents;              
108   fBounce2 = fBounce2 / TotNbofEvents;            
109   G4double rmsBounce = fBounce2 - fBounce * fB    
110   if (rmsBounce > 0.)                             
111     rmsBounce = std::sqrt(rmsBounce);             
112   else                                            
113     rmsBounce = 0.;                               
114                                                   
115   fWLSBounce = fWLSBounce / TotNbofEvents;        
116   fWLSBounce2 = fWLSBounce2 / TotNbofEvents;      
117   G4double rmsWLSBounce = fWLSBounce2 - fWLSBo    
118   if (rmsWLSBounce > 0.)                          
119     rmsWLSBounce = std::sqrt(rmsWLSBounce);       
120   else                                            
121     rmsWLSBounce = 0.;                            
122                                                   
123   fClad1Bounce = fClad1Bounce / TotNbofEvents;    
124   fClad1Bounce2 = fClad1Bounce2 / TotNbofEvent    
125   G4double rmsClad1Bounce = fClad1Bounce2 - fC    
126   if (rmsClad1Bounce > 0.)                        
127     rmsClad1Bounce = std::sqrt(rmsClad1Bounce)    
128   else                                            
129     rmsClad1Bounce = 0.;                          
130                                                   
131   fClad2Bounce = fClad2Bounce / TotNbofEvents;    
132   fClad2Bounce2 = fClad2Bounce2 / TotNbofEvent    
133   G4double rmsClad2Bounce = fClad2Bounce2 - fC    
134   if (rmsClad2Bounce > 0.)                        
135     rmsClad2Bounce = std::sqrt(rmsClad2Bounce)    
136   else                                            
137     rmsClad2Bounce = 0.;                          
138                                                   
139   fReflected = fReflected / TotNbofEvents;        
140   fReflected2 = fReflected2 / TotNbofEvents;      
141   G4double rmsReflected = fReflected2 - fRefle    
142   if (rmsReflected > 0.)                          
143     rmsReflected = std::sqrt(rmsReflected);       
144   else                                            
145     rmsReflected = 0.;                            
146                                                   
147   fEscaped = fEscaped / TotNbofEvents;            
148   fEscaped2 = fEscaped2 / TotNbofEvents;          
149   G4double rmsEscaped = fEscaped2 - fEscaped *    
150   if (rmsEscaped > 0.)                            
151     rmsEscaped = std::sqrt(rmsEscaped);           
152   else                                            
153     rmsEscaped = 0.;                              
154                                                   
155   fMirror = fMirror / TotNbofEvents;              
156   fMirror2 = fMirror2 / TotNbofEvents;            
157   G4double rmsMirror = fMirror2 - fMirror * fM    
158   if (rmsMirror > 0.)                             
159     rmsMirror = std::sqrt(rmsMirror);             
160   else                                            
161     rmsMirror = 0.;                               
162                                                   
163   fDetectorHits = fDetectorHits / TotNbofEvent    
164   fDetectorHits2 = fDetectorHits2 / TotNbofEve    
165   G4double rmsDetectorHits = fDetectorHits2 -     
166   if (rmsDetectorHits > 0.)                       
167     rmsDetectorHits = std::sqrt(rmsDetectorHit    
168   else                                            
169     rmsDetectorHits = 0.;                         
170                                                   
171   G4int prec = G4cout.precision(3);               
172   G4cout << "\n ======================== run s    
173   G4cout << "Average number per event:" << G4e    
174   G4cout << " TIR:          " << fNTIR << " +-    
175          << " Exiting:      " << fNExiting <<     
176          << " Escaped Mid:  " << fEscapedMid <    
177          << " Escaped End:  " << fEscapedEnd <    
178          << " Bounced:      " << fBounce << "     
179          << " WLS Bounce:   " << fWLSBounce <<    
180          << " Clad1 Bounce: " << fClad1Bounce     
181          << " Clad2 Bounce: " << fClad2Bounce     
182          << " Reflected:    " << fReflected <<    
183          << " Escaped:      " << fEscaped << "    
184          << " Mirror:       " << fMirror << "     
185          << " Detector hit: " << fDetectorHits    
186                                                   
187   G4cout << G4endl;                               
188   G4cout.precision(prec);                         
189 }                                                 
190