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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/runAndEvent/RE02/src/RE02RunAction.cc (Version 11.3.0) and /examples/extended/runAndEvent/RE02/src/RE02RunAction.cc (Version ReleaseNotes)


** Warning: Cannot open xref database.

  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 runAndEvent/RE02/src/RE02RunAction.c    
 27 /// \brief Implementation of the RE02RunAction    
 28 //                                                
 29 //                                                
 30 //                                                
 31 #include "RE02RunAction.hh"                       
 32                                                   
 33 #include "RE02Run.hh"                             
 34                                                   
 35 //-- In order to obtain detector information.     
 36 #include "RE02DetectorConstruction.hh"            
 37                                                   
 38 #include "G4RunManager.hh"                        
 39 #include "G4SystemOfUnits.hh"                     
 40 #include "G4THitsMap.hh"                          
 41 #include "G4UnitsTable.hh"                        
 42                                                   
 43 #include <fstream>                                
 44 //============================================    
 45 // RE02RunAction                                  
 46 //                                                
 47 //                                                
 48 //                                                
 49 //============================================    
 50                                                   
 51 //....oooOO0OOooo........oooOO0OOooo........oo    
 52 // Constructor                                    
 53 RE02RunAction::RE02RunAction() : G4UserRunActi    
 54 {                                                 
 55   // - Prepare data member for RE02Run.           
 56   //   vector represents a list of MultiFuncti    
 57   fSDName.push_back(G4String("PhantomSD"));       
 58 }                                                 
 59                                                   
 60 //....oooOO0OOooo........oooOO0OOooo........oo    
 61 // Destructor.                                    
 62 RE02RunAction::~RE02RunAction()                   
 63 {                                                 
 64   fSDName.clear();                                
 65 }                                                 
 66                                                   
 67 //....oooOO0OOooo........oooOO0OOooo........oo    
 68 //==                                              
 69 G4Run* RE02RunAction::GenerateRun()               
 70 {                                                 
 71   // Generate new RUN object, which is special    
 72   // dedicated for MultiFunctionalDetector sch    
 73   //  Detail description can be found in RE02R    
 74   return new RE02Run(fSDName);                    
 75 }                                                 
 76                                                   
 77 //....oooOO0OOooo........oooOO0OOooo........oo    
 78 //==                                              
 79 void RE02RunAction::BeginOfRunAction(const G4R    
 80 {                                                 
 81   G4cout << "### Run " << aRun->GetRunID() <<     
 82 }                                                 
 83                                                   
 84 //....oooOO0OOooo........oooOO0OOooo........oo    
 85 //==                                              
 86 void RE02RunAction::EndOfRunAction(const G4Run    
 87 {                                                 
 88   if (!IsMaster()) return;                        
 89                                                   
 90   //- RE02Run object.                             
 91   RE02Run* re02Run = (RE02Run*)aRun;              
 92   //--- Dump all socred quantities involved in    
 93   re02Run->DumpAllScorer();                       
 94   //---                                           
 95                                                   
 96   //                                              
 97   //- water phantom (Detector) Information.       
 98   //-- Number of segments in the water phantom    
 99   const RE02DetectorConstruction* detector =      
100     (const RE02DetectorConstruction*)(G4RunMan    
101   detector->GetNumberOfSegmentsInPhantom(fNx,     
102                                                   
103   //------------------------------------------    
104   // Dump accumulated quantities for this RUN.    
105   //  (Display only central region of x-y plan    
106   //------------------------------------------    
107   G4THitsMap<G4double>* totEdep = re02Run->Get    
108   G4THitsMap<G4double>* proEdep = re02Run->Get    
109   G4THitsMap<G4double>* proNstep = re02Run->Ge    
110   G4THitsMap<G4double>* passCFx = re02Run->Get    
111   G4THitsMap<G4double>* cFx = re02Run->GetHits    
112   G4THitsMap<G4double>* surfFx = re02Run->GetH    
113   G4THitsMap<G4double>* gCurr00 = re02Run->Get    
114   G4THitsMap<G4double>* gCurr01 = re02Run->Get    
115   G4THitsMap<G4double>* gCurr02 = re02Run->Get    
116   G4THitsMap<G4double>* gCurr03 = re02Run->Get    
117                                                   
118   G4cout << "=================================    
119   G4cout << " Number of event processed : " <<    
120   G4cout << "=================================    
121   G4cout << std::setw(8) << "#Z Cell#";           
122   G4cout << std::setw(16) << totEdep->GetName(    
123   G4cout << std::setw(16) << proEdep->GetName(    
124   G4cout << std::setw(12) << proNstep->GetName    
125   G4cout << std::setw(21) << passCFx->GetName(    
126   G4cout << std::setw(20) << cFx->GetName();      
127   G4cout << std::setw(20) << surfFx->GetName()    
128   G4cout << std::setw(20) << gCurr00->GetName(    
129   G4cout << std::setw(20) << gCurr01->GetName(    
130   G4cout << std::setw(20) << gCurr02->GetName(    
131   G4cout << std::setw(20) << gCurr03->GetName(    
132   G4int ix = fNx / 2;                             
133   G4int iy = fNy / 2;                             
134   G4int iz;                                       
135   // G4double totE, proE, proN,pasCF,CF,surfF,    
136   for (iz = 0; iz < fNz; iz++) {                  
137     G4double* totED = (*totEdep)[CopyNo(ix, iy    
138     G4double* proED = (*proEdep)[CopyNo(ix, iy    
139     G4double* proNS = (*proNstep)[CopyNo(ix, i    
140     G4double* pasCF = (*passCFx)[CopyNo(ix, iy    
141     G4double* cF = (*cFx)[CopyNo(ix, iy, iz)];    
142     G4double* sfx = (*surfFx)[CopyNo(ix, iy, i    
143     G4double* gcur0 = (*gCurr00)[CopyNo(ix, iy    
144     G4double* gcur1 = (*gCurr01)[CopyNo(ix, iy    
145     G4double* gcur2 = (*gCurr02)[CopyNo(ix, iy    
146     G4double* gcur3 = (*gCurr03)[CopyNo(ix, iy    
147     if (!totED) totED = new G4double(0.0);        
148     if (!proED) proED = new G4double(0.0);        
149     if (!proNS) proNS = new G4double(0.0);        
150     if (!pasCF) pasCF = new G4double(0.0);        
151     if (!cF) cF = new G4double(0.0);              
152     if (!sfx) sfx = new G4double(0.0);            
153     if (!gcur0) gcur0 = new G4double(0.0);        
154     if (!gcur1) gcur1 = new G4double(0.0);        
155     if (!gcur2) gcur2 = new G4double(0.0);        
156     if (!gcur3) gcur3 = new G4double(0.0);        
157     G4cout << std::setw(6) << iz << "  " << st    
158            << std::setw(12) << G4BestUnit(*pro    
159            << std::setw(13) << (*pasCF) * cm *    
160            << " /cm2" << std::setw(15) << (*sf    
161            << (*gcur0) * cm * cm << " /cm2" <<    
162            << std::setw(15) << (*gcur2) * cm *    
163            << " /cm2" << G4endl;                  
164   }                                               
165   G4cout << "=================================    
166                                                   
167   std::ofstream file("totED.txt");                
168   for (iz = 0; iz < fNz; iz++) {                  
169     for (iy = 0; iy < fNy; iy++) {                
170       for (ix = 0; ix < fNx; ix++) {              
171         G4double* totED = (*totEdep)[CopyNo(ix    
172         if (!totED) totED = new G4double(0.0);    
173         file << ix << " " << iy << " " << iz <    
174       }                                           
175     }                                             
176   }                                               
177   file.close();                                   
178 }                                                 
179 //                                                
180 // --                                             
181