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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/medical/DICOM2/src/Dicom2RunAction.cc (Version 11.3.0) and /examples/extended/medical/DICOM2/src/Dicom2RunAction.cc (Version 5.2.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 Dicom2RunAction.cc                      
 28 /// \brief Implementation of the Dicom2RunActi    
 29 //                                                
 30                                                   
 31 #include "Dicom2RunAction.hh"                     
 32                                                   
 33 #include "Dicom2Run.hh"                           
 34                                                   
 35 //-- In order to obtain detector information.     
 36 #include "G4RunManager.hh"                        
 37 #include "G4StatAnalysis.hh"                      
 38 #include "G4SystemOfUnits.hh"                     
 39 #include "G4THitsMap.hh"                          
 40 #include "G4UnitsTable.hh"                        
 41                                                   
 42 #include <fstream>                                
 43 #include <iomanip>                                
 44                                                   
 45 //....oooOO0OOooo........oooOO0OOooo........oo    
 46 /// Constructor                                   
 47 Dicom2RunAction::Dicom2RunAction() : DicomRunA    
 48                                                   
 49 //....oooOO0OOooo........oooOO0OOooo........oo    
 50 /// Destructor.                                   
 51 Dicom2RunAction::~Dicom2RunAction() {}            
 52                                                   
 53 //....oooOO0OOooo........oooOO0OOooo........oo    
 54 G4Run* Dicom2RunAction::GenerateRun()             
 55 {                                                 
 56   // Generate new RUN object, which is special    
 57   // dedicated for MultiFunctionalDetector sch    
 58   //  Detail description can be found in Dicom    
 59   return fDcmrun = new Dicom2Run(fSDName);        
 60 }                                                 
 61                                                   
 62 //....oooOO0OOooo........oooOO0OOooo........oo    
 63 void Dicom2RunAction::EndOfRunAction(const G4R    
 64 {                                                 
 65   // Lock the output because of the external c    
 66   // otherwise, the output gets too confusing     
 67   G4AutoLock l(G4TypeMutex<Dicom2RunAction>())    
 68                                                   
 69   G4cout << G4endl;                               
 70   G4cout << "[================================    
 71          << " DICOM "                             
 72          << "=================================    
 73   G4cout << G4endl;                               
 74                                                   
 75   DicomRunAction::EndOfRunAction(aRun);           
 76                                                   
 77   G4cout << G4endl;                               
 78   G4cout << "[================================    
 79          << " DICOM2 "                            
 80          << "=================================    
 81   G4cout << G4endl;                               
 82                                                   
 83   G4int nofEvents = aRun->GetNumberOfEvent();     
 84                                                   
 85   G4StatAnalysis local_total_dose;                
 86                                                   
 87   const Dicom2Run* dcm2Run = static_cast<const    
 88   //--- Dump all scored quantities involved in    
 89   for (uintmax_t i = 0; i < fSDName.size(); i+    
 90     //                                            
 91     //----------------------------------------    
 92     // Dump accumulated quantities for this RU    
 93     //  (Display only central region of x-y pl    
 94     //      0       ConcreteSD/DoseDeposit        
 95     //----------------------------------------    
 96     Dicom2RunVector* DoseDeposit = dcm2Run->Ge    
 97                                                   
 98     if (DoseDeposit && DoseDeposit->size() !=     
 99       for (auto itr = DoseDeposit->begin(); it    
100         // this will sometimes return null poi    
101         if (!DoseDeposit->GetObject(itr)) cont    
102         local_total_dose += (*DoseDeposit->Get    
103       }                                           
104     }                                             
105   }                                               
106                                                   
107   if (IsMaster()) {                               
108     G4cout << " ###### EndOfRunAction ###### "    
109     //- Dicom2Run object.                         
110     const Dicom2Run* re02Run = static_cast<con    
111     //--- Dump all scored quantities involved     
112                                                   
113     for (uintmax_t i = 0; i < fSDName.size();     
114       //                                          
115       //--------------------------------------    
116       // Dump accumulated quantities for this     
117       //  (Display only central region of x-y     
118       //      0       ConcreteSD/DoseDeposit      
119       //--------------------------------------    
120       Dicom2RunVector* DoseDeposit = re02Run->    
121                                                   
122       G4cout << "=============================    
123       G4cout << " Number of event processed :     
124       G4cout << "=============================    
125                                                   
126       std::ofstream fileout;                      
127       G4String fname = "dicom2-vector.out";       
128       fileout.open(fname);                        
129       G4cout << " opened file " << fname << "     
130                                                   
131       if (DoseDeposit && DoseDeposit->size() !    
132         std::ostream* myout = &G4cout;            
133         PrintHeader(myout);                       
134         for (auto itr = DoseDeposit->begin();     
135           auto _idx = DoseDeposit->GetIndex(it    
136           G4StatAnalysis* _stat = DoseDeposit-    
137           if (_stat && _stat->GetHits() > 0) {    
138             G4StatAnalysis _tmp_stat = *_stat;    
139             _tmp_stat /= CLHEP::gray;             
140             fileout << _idx << "     " << (*_s    
141           }                                       
142         }                                         
143         G4cout << "===========================    
144       }                                           
145       else {                                      
146         G4Exception("Dicom2RunAction", "000",     
147                     "DoseDeposit HitsMap is ei    
148                     "of the HitsMap was empty"    
149       }                                           
150       fileout.close();                            
151       G4cout << " closed file " << fname << "     
152     }                                             
153   }                                               
154                                                   
155   if (IsMaster()) {                               
156     // convert to units of Gy                     
157     local_total_dose /= gray;                     
158     G4cout << "--------------------End of Glob    
159     G4cout << " The run was " << nofEvents <<     
160     G4cout << "      TOTAL DOSE : \t" << local    
161     if (nofEvents > 0) {                          
162       local_total_dose /= nofEvents;              
163       G4cout << " TOTAL DOSE/Bq-s : \t" << loc    
164     }                                             
165   }                                               
166   else {                                          
167     // convert to units of Gy                     
168     local_total_dose /= gray;                     
169     G4cout << "--------------------End of Loca    
170     G4cout << " The run was " << nofEvents <<     
171     G4cout << "LOCAL TOTAL DOSE : \t" << local    
172     if (nofEvents > 0) {                          
173       local_total_dose /= nofEvents;              
174       G4cout << " LOCAL DOSE/Bq-s : \t" << loc    
175     }                                             
176   }                                               
177                                                   
178   G4cout << G4endl;                               
179   G4cout << "Finished : End of Run Action " <<    
180 }                                                 
181