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4.p3 ] [ 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/hadronic/ParticleFluence/ConcentricSpheres/src/Run.cc (Version 11.3.0) and /examples/extended/hadronic/ParticleFluence/ConcentricSpheres/src/Run.cc (Version 9.6.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 /// \file Run.cc                                  
 27 /// \brief Implementation of the Run class        
 28 //                                                
 29 //                                                
 30                                                   
 31 //....oooOO0OOooo........oooOO0OOooo........oo    
 32 //....oooOO0OOooo........oooOO0OOooo........oo    
 33                                                   
 34 #include "Run.hh"                                 
 35                                                   
 36 #include "G4Run.hh"                               
 37 #include "G4RunManager.hh"                        
 38 #include "G4SystemOfUnits.hh"                     
 39                                                   
 40 //....oooOO0OOooo........oooOO0OOooo........oo    
 41                                                   
 42 Run::Run()                                        
 43   : G4Run(),                                      
 44     fNumEvents(0),                                
 45     fPrimaryParticleId(0),                        
 46     fPrimaryParticleEnergy(0.0),                  
 47     fPrimaryParticleDirection(G4ThreeVector(0.    
 48     fTrackerMaterialName(""),                     
 49     fEmCaloMaterialName(""),                      
 50     fHadCaloMaterialName(""),                     
 51     fCubicVolumeScoringTrackerShell(1.0),         
 52     fCubicVolumeScoringEmCaloShell(1.0),          
 53     fCubicVolumeScoringHadCaloShell(1.0)          
 54 {                                                 
 55   fSteppingArray.fill(0.0);                       
 56   fTrackingArray1.fill(0);                        
 57   fTrackingArray2.fill(0.0);                      
 58 }                                                 
 59                                                   
 60 //....oooOO0OOooo........oooOO0OOooo........oo    
 61                                                   
 62 void Run::RecordEvent(const G4Event* anEvent)     
 63 {                                                 
 64   // This method is called automatically by th    
 65   // of each event : in MT-mode, it is called     
 66   G4int nEvt = anEvent->GetEventID();             
 67   if (nEvt % 10 == 0) G4cout << " Event#=" <<     
 68   G4Run::RecordEvent(anEvent);                    
 69 }                                                 
 70                                                   
 71 //....oooOO0OOooo........oooOO0OOooo........oo    
 72                                                   
 73 void Run::Merge(const G4Run* aRun)                
 74 {                                                 
 75   // This method is called automatically by th    
 76   // of multithreaded mode and only for workin    
 77   const Run* localRun = static_cast<const Run*    
 78   fPrimaryParticleId = localRun->GetPrimaryPar    
 79   fPrimaryParticleEnergy = localRun->GetPrimar    
 80   fPrimaryParticleDirection = localRun->GetPri    
 81   fTrackerMaterialName = localRun->GetTrackerM    
 82   fEmCaloMaterialName = localRun->GetEmCaloMat    
 83   fHadCaloMaterialName = localRun->GetHadCaloM    
 84   fCubicVolumeScoringTrackerShell = localRun->    
 85   fCubicVolumeScoringEmCaloShell = localRun->G    
 86   fCubicVolumeScoringHadCaloShell = localRun->    
 87   fNumEvents += localRun->GetNumberOfEvent();     
 88   for (G4int i = 0; i < SteppingAction::fkNumb    
 89     fSteppingArray[i] += localRun->GetStepping    
 90   }                                               
 91   for (G4int i = 0; i < TrackingAction::fkNumb    
 92     fTrackingArray1[i] += localRun->GetTrackin    
 93     fTrackingArray2[i] += localRun->GetTrackin    
 94   }                                               
 95   G4Run::Merge(aRun);                             
 96 }                                                 
 97                                                   
 98 //....oooOO0OOooo........oooOO0OOooo........oo    
 99                                                   
100 void Run::PrintInfo() const                       
101 {                                                 
102   // This method is called by RunAction::EndOf    
103   // In MT-mode, only the master thread calls     
104   const G4double floatingNumberOfEvents =         
105     std::max(1.0, fNumEvents > 0 ? fNumEvents     
106   // The fluence in a scoring shell is defined    
107   // divided by the cubic-volume of the scorin    
108   const G4double conversionFactor = CLHEP::cm     
109   const G4double factorTracker =                  
110     conversionFactor / (0.5 * fCubicVolumeScor    
111   const G4double factorEmCalo =                   
112     conversionFactor / (0.5 * fCubicVolumeScor    
113   const G4double factorHadCalo =                  
114     conversionFactor / (0.5 * fCubicVolumeScor    
115   G4cout << std::setprecision(6) << G4endl <<     
116          << " ===============  Run::PrintInfo(    
117          << G4endl << " Primary particle PDG c    
118          << " Primary particle kinetic energy     
119          << G4endl << " Primary particle direc    
120          << " Tracker material = " << fTracker    
121          << " EmCalo  material = " << fEmCaloM    
122          << " HadCalo material = " << fHadCalo    
123          << " Cubic-volume scoring tracker she    
124          << G4endl << " Cubic-volume scoring e    
125          << " mm^3" << G4endl                     
126          << " Cubic-volume scoring hadCalo she    
127          << G4endl << " Number of events = " <    
128          << " Conversion factor: fluence from     
129          << " Particle fluence in unit of cm^-    
130   for (G4int i = 0; i < SteppingAction::fkNumb    
131     G4double factor = factorTracker;              
132     if (i == 1)                                   
133       factor = factorEmCalo;                      
134     else if (i == 2)                              
135       factor = factorHadCalo;                     
136     for (G4int j = 0; j < SteppingAction::fkNu    
137       for (G4int k = 0; k < SteppingAction::fk    
138         for (G4int ll = 0; ll < SteppingAction    
139           G4int index = SteppingAction::GetInd    
140           // G4cout << "(i, j, k, ll)=(" << i     
141           //        << ll << ")  ->" << index;    
142           G4cout << "   case=" << std::setw(3)    
143                  << SteppingAction::fkArraySco    
144                  << SteppingAction::fkArrayKin    
145                  << SteppingAction::fkArraySco    
146                  << SteppingAction::fkArrayPar    
147                  << factor * fSteppingArray[in    
148         }                                         
149       }                                           
150     }                                             
151   }                                               
152   G4cout << " --------------------------------    
153          << " Extra information: particle prod    
154          << G4endl;                               
155   const G4double normalization = 1.0 / floatin    
156   for (G4int i = 0; i < TrackingAction::fkNumb    
157     for (G4int j = 0; j < TrackingAction::fkNu    
158       for (G4int k = 0; k < TrackingAction::fk    
159         G4int index = TrackingAction::GetIndex    
160         // G4cout << "(i, j, k)=(" << i << ",     
161         G4cout << "   case=" << std::setw(3) <    
162                << TrackingAction::fkArrayScori    
163                << TrackingAction::fkArrayKinem    
164                << TrackingAction::fkArrayParti    
165                << normalization * fTrackingArr    
166                << (fTrackingArray1[index] > 0     
167                                                   
168                << "   " << std::setw(8) << nor    
169       }                                           
170     }                                             
171   }                                               
172   G4cout << " ================================    
173 }                                                 
174                                                   
175 //....oooOO0OOooo........oooOO0OOooo........oo    
176                                                   
177 void Run::SetSteppingArray(                       
178   const std::array<G4double, SteppingAction::f    
179 {                                                 
180   for (G4int i = 0; i < SteppingAction::fkNumb    
181     fSteppingArray[i] = inputArray[i];            
182   }                                               
183 }                                                 
184                                                   
185 //....oooOO0OOooo........oooOO0OOooo........oo    
186                                                   
187 void Run::SetTrackingArray1(                      
188   const std::array<G4long, TrackingAction::fkN    
189 {                                                 
190   for (G4int i = 0; i < TrackingAction::fkNumb    
191     fTrackingArray1[i] = inputArray[i];           
192   }                                               
193 }                                                 
194                                                   
195 //....oooOO0OOooo........oooOO0OOooo........oo    
196                                                   
197 void Run::SetTrackingArray2(                      
198   const std::array<G4double, TrackingAction::f    
199 {                                                 
200   for (G4int i = 0; i < TrackingAction::fkNumb    
201     fTrackingArray2[i] = inputArray[i];           
202   }                                               
203 }                                                 
204                                                   
205 //....oooOO0OOooo........oooOO0OOooo........oo    
206