Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // 28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 30 31 #include "RunAction.hh" 32 33 #include "G4EmCalculator.hh" 34 #include "G4Run.hh" 35 36 #include "Run.hh" 37 #include "RunActionMessenger.hh" 38 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 40 41 RunAction::RunAction(G4bool isP) 42 : G4UserRunAction(), 43 fRun(nullptr), 44 isPIXE(isP), 45 fNbProjections(1), 46 fNbSlices(1), 47 fNbPixels(1), 48 fInterFlag(false), 49 fInterruptedProjectionIndex(0) 50 51 { 52 fRunMessenger = new RunActionMessenger(this); 53 } 54 55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 56 57 RunAction::~RunAction() 58 { 59 delete fRunMessenger; 60 } 61 62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 63 64 G4Run* RunAction::GenerateRun() 65 { 66 fRun = new Run(isPIXE, fNbProjections, fNbSlices, fNbPixels, fInterruptedProjectionIndex); 67 return fRun; 68 } 69 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 71 72 void RunAction::BeginOfRunAction(const G4Run*) 73 { 74 if (IsMaster()) { 75 if (fInterFlag) { 76 G4cout << "####Resume simulation####" << G4endl; 77 } 78 79 G4cout << "Scan information: " << G4endl << "Projection_index " << fRun->GetCurrentProjection() 80 << "; Slice_index " << fRun->GetCurrentSlice() << "; Pixel_index " 81 << fRun->GetCurrentPixel() << G4endl; 82 } 83 } 84 85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 86 87 void RunAction::EndOfRunAction(const G4Run*) 88 { 89 if (isMaster) fRun->EndOfRun(); 90 } 91 void RunAction::SetScanParameters(G4int nbProjections, G4int nbSlices, G4int nbPixels) 92 { 93 fNbProjections = nbProjections; 94 fNbSlices = nbSlices; 95 fNbPixels = nbPixels; 96 } 97 98 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 99 100 void RunAction::SetInterruptionFlag(G4bool inter) 101 { 102 fInterFlag = inter; 103 } 104 105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 106 107 void RunAction::SetResumeProjectionIndex(G4int proj) 108 { 109 if (fInterFlag) fInterruptedProjectionIndex = proj; 110 } 111 112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 113