Geant4 Cross Reference |
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 optical/wls/src/WLSRunAction.cc 28 /// \brief Implementation of the WLSRunAction 29 // 30 // 31 32 #include "WLSRunAction.hh" 33 34 #include "WLSDetectorConstruction.hh" 35 #include "WLSRun.hh" 36 #include "WLSSteppingAction.hh" 37 38 #include "G4AnalysisManager.hh" 39 #include "G4Run.hh" 40 #include "G4RunManager.hh" 41 #include "Randomize.hh" 42 43 //....oooOO0OOooo........oooOO0OOooo........oo 44 45 WLSRunAction::WLSRunAction() 46 { 47 auto analysisManager = G4AnalysisManager::In 48 49 analysisManager->SetDefaultFileType("root"); 50 analysisManager->SetVerboseLevel(1); 51 G4cout << "Using " << analysisManager->GetTy 52 53 analysisManager->CreateH1("Energy", "Energy 54 3.2 * CLHEP::eV); 55 analysisManager->CreateH1("Time", "Arrival t 56 analysisManager->CreateH1("Number of photons 57 } 58 59 //....oooOO0OOooo........oooOO0OOooo........oo 60 61 G4Run* WLSRunAction::GenerateRun() 62 { 63 fRun = new WLSRun(); 64 return fRun; 65 } 66 67 //....oooOO0OOooo........oooOO0OOooo........oo 68 69 void WLSRunAction::BeginOfRunAction(const G4Ru 70 { 71 G4AnalysisManager::Instance()->OpenFile("wls 72 } 73 74 //....oooOO0OOooo........oooOO0OOooo........oo 75 76 void WLSRunAction::EndOfRunAction(const G4Run* 77 { 78 auto analysisManager = G4AnalysisManager::In 79 if (analysisManager->GetH1(0)) { 80 G4cout << G4endl << " ----> print histogra 81 if (isMaster) { 82 G4cout << "for the entire run " << G4end 83 } 84 else { 85 G4cout << "for the local thread " << G4e 86 } 87 88 G4cout << " Mean number of photons detecte 89 << " rms = " << analysisManager->Ge 90 } 91 92 analysisManager->Write(); 93 analysisManager->CloseFile(); 94 95 if (isMaster) fRun->EndOfRun(); 96 } 97