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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/biasing/B02/src/B02RunAction.cc (Version 11.3.0) and /examples/extended/biasing/B02/src/B02RunAction.cc (Version 3.2)


  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 biasing/B02/src/B02RunAction.cc         
 27 /// \brief Implementation of the B02RunAction     
 28 //                                                
 29 //                                                
 30 //                                                
 31 #include "B02RunAction.hh"                        
 32                                                   
 33 #include "B02Run.hh"                              
 34                                                   
 35 //-- In order to obtain detector information.     
 36 #include "B02DetectorConstruction.hh"             
 37 #include "B02ImportanceDetectorConstruction.hh    
 38                                                   
 39 #include "G4RunManager.hh"                        
 40 #include "G4THitsMap.hh"                          
 41 #include "G4UnitsTable.hh"                        
 42                                                   
 43 //....oooOO0OOooo........oooOO0OOooo........oo    
 44 //                                                
 45 // B02RunAction                                   
 46 //                                                
 47 //                                                
 48 //                                                
 49 //....oooOO0OOooo........oooOO0OOooo........oo    
 50                                                   
 51 // Constructor                                    
 52 B02RunAction::B02RunAction()                      
 53   : G4UserRunAction(),                            
 54     //  fFieldName(15),                           
 55     fFieldValue(14)                               
 56 {                                                 
 57   // - Prepare data member for B02Run.            
 58   //   vector represents a list of MultiFuncti    
 59   fSDName.push_back(G4String("ConcreteSD"));      
 60 }                                                 
 61                                                   
 62 //....oooOO0OOooo........oooOO0OOooo........oo    
 63                                                   
 64 // Destructor.                                    
 65 B02RunAction::~B02RunAction()                     
 66 {                                                 
 67   fSDName.clear();                                
 68 }                                                 
 69                                                   
 70 //....oooOO0OOooo........oooOO0OOooo........oo    
 71                                                   
 72 G4Run* B02RunAction::GenerateRun()                
 73 {                                                 
 74   // Generate new RUN object, which is special    
 75   // dedicated for MultiFunctionalDetector sch    
 76   //  Detail description can be found in B02Ru    
 77   return new B02Run(fSDName);                     
 78 }                                                 
 79                                                   
 80 //....oooOO0OOooo........oooOO0OOooo........oo    
 81                                                   
 82 void B02RunAction::BeginOfRunAction(const G4Ru    
 83 {                                                 
 84   G4cout << "### Run " << aRun->GetRunID() <<     
 85 }                                                 
 86                                                   
 87 //....oooOO0OOooo........oooOO0OOooo........oo    
 88                                                   
 89 void B02RunAction::EndOfRunAction(const G4Run*    
 90 {                                                 
 91   G4cout << " ###### EndOfRunAction  " << G4en    
 92   //- B02Run object.                              
 93   B02Run* b02Run = (B02Run*)aRun;                 
 94   //--- Dump all socred quantities involved in    
 95   // re02Run->DumpAllScorer();                    
 96   //---                                           
 97   G4RunManager* mgr = G4RunManager::GetRunMana    
 98   //                                              
 99                                                   
100   for (G4int i = 0; i < (G4int)fSDName.size();    
101     const G4VUserDetectorConstruction* vdet =     
102     B02ImportanceDetectorConstruction* bdet =     
103     //                                            
104                                                   
105     //----------------------------------------    
106     // Dump accumulated quantities for this RU    
107     //  (Display only central region of x-y pl    
108     //      0       ConcreteSD/Collisions         
109     //      1       ConcreteSD/CollWeight         
110     //      2       ConcreteSD/Population         
111     //      3       ConcreteSD/TrackEnter         
112     //      4       ConcreteSD/SL                 
113     //      5       ConcreteSD/SLW                
114     //      6       ConcreteSD/SLWE               
115     //      7       ConcreteSD/SLW_V              
116     //      8       ConcreteSD/SLWE_V             
117     //----------------------------------------    
118     G4THitsMap<G4double>* Collisions = b02Run-    
119     G4THitsMap<G4double>* CollWeight = b02Run-    
120     G4THitsMap<G4double>* Population = b02Run-    
121     G4THitsMap<G4double>* TrackEnter = b02Run-    
122     G4THitsMap<G4double>* SL = b02Run->GetHits    
123     G4THitsMap<G4double>* SLW = b02Run->GetHit    
124     G4THitsMap<G4double>* SLWE = b02Run->GetHi    
125     G4THitsMap<G4double>* SLW_V = b02Run->GetH    
126     G4THitsMap<G4double>* SLWE_V = b02Run->Get    
127                                                   
128     if (IsMaster()) {                             
129       G4cout << "\n--------------------End of     
130       G4cout << " Number of event processed :     
131     }                                             
132     else {                                        
133       G4cout << "\n--------------------End of     
134       G4cout << " Number of event processed :     
135     }                                             
136                                                   
137     G4cout << "===============================    
138     G4cout << "===============================    
139                                                   
140     std::ostream* myout = &G4cout;                
141     PrintHeader(myout);                           
142                                                   
143     for (G4int iz = 0; iz < 20; iz++) {           
144       G4double* SumCollisions = (*Collisions)[    
145       G4double* SumCollWeight = (*CollWeight)[    
146       G4double* Populations = (*Population)[iz    
147       G4double* TrackEnters = (*TrackEnter)[iz    
148       G4double* SLs = (*SL)[iz];                  
149       G4double* SLWs = (*SLW)[iz];                
150       G4double* SLWEs = (*SLWE)[iz];              
151       G4double* SLW_Vs = (*SLW_V)[iz];            
152       G4double* SLWE_Vs = (*SLWE_V)[iz];          
153       if (!SumCollisions) SumCollisions = new     
154       if (!SumCollWeight) SumCollWeight = new     
155       if (!Populations) Populations = new G4do    
156       if (!TrackEnters) TrackEnters = new G4do    
157       if (!SLs) SLs = new G4double(0.0);          
158       if (!SLWs) SLWs = new G4double(0.0);        
159       if (!SLWEs) SLWEs = new G4double(0.0);      
160       if (!SLW_Vs) SLW_Vs = new G4double(0.0);    
161       if (!SLWE_Vs) SLWE_Vs = new G4double(0.0    
162       G4double NumWeightedEnergy = 0.0;           
163       G4double FluxWeightedEnergy = 0.0;          
164       G4double AverageTrackWeight = 0.0;          
165       if (*SLW_Vs != 0.) NumWeightedEnergy = (    
166       if (*SLWs != 0.) FluxWeightedEnergy = (*    
167       if (*SLs != 0.) AverageTrackWeight = (*S    
168       G4String cname = bdet->GetCellName(iz);     
169       G4cout << std::setw(fFieldValue) << cnam    
170              << " |" << std::setw(fFieldValue)    
171              << (*SumCollisions) << " |" << st    
172              << std::setw(fFieldValue) << NumW    
173              << FluxWeightedEnergy << " |" <<     
174              << std::setw(fFieldValue) << (*SL    
175              << " |" << std::setw(fFieldValue)    
176              << (*SLWEs) << " |" << std::setw(    
177     }                                             
178     G4cout << "===============================    
179   }                                               
180 }                                                 
181                                                   
182 //....oooOO0OOooo........oooOO0OOooo........oo    
183                                                   
184 void B02RunAction::PrintHeader(std::ostream* o    
185 {                                                 
186   std::vector<G4String> vecScoreName;             
187   vecScoreName.push_back("Tr.Entering");          
188   vecScoreName.push_back("Population");           
189   vecScoreName.push_back("Collisions");           
190   vecScoreName.push_back("Coll*WGT");             
191   vecScoreName.push_back("NumWGTedE");            
192   vecScoreName.push_back("FluxWGTedE");           
193   vecScoreName.push_back("Av.Tr.WGT");            
194   vecScoreName.push_back("SL");                   
195   vecScoreName.push_back("SLW");                  
196   vecScoreName.push_back("SLW_v");                
197   vecScoreName.push_back("SLWE");                 
198   vecScoreName.push_back("SLWE_v");               
199                                                   
200   // head line                                    
201   //   std::string vname;                         
202   //   vname = FillString("Volume", ' ', fFiel    
203   //*out << vname << '|';                         
204   *out << std::setw(fFieldValue) << "Volume"      
205        << " |";                                   
206   for (std::vector<G4String>::iterator it = ve    
207     //      vname = FillString((*it),             
208     //                         ' ',               
209     //                         fFieldValue+1,     
210     //                         false);            
211     //      *out << vname << '|';                 
212     *out << std::setw(fFieldValue) << (*it) <<    
213   }                                               
214   *out << G4endl;                                 
215 }                                                 
216                                                   
217 //....oooOO0OOooo........oooOO0OOooo........oo    
218                                                   
219 std::string B02RunAction::FillString(const std    
220 {                                                 
221   std::string fname("");                          
222   G4int k = n - name.size();                      
223   if (k > 0) {                                    
224     if (back) {                                   
225       fname = name;                               
226       fname += std::string(k, c);                 
227     }                                             
228     else {                                        
229       fname = std::string(k, c);                  
230       fname += name;                              
231     }                                             
232   }                                               
233   else {                                          
234     fname = name;                                 
235   }                                               
236   return fname;                                   
237 }                                                 
238                                                   
239 //....oooOO0OOooo........oooOO0OOooo........oo    
240