File indexing completed on 2025-01-31 09:22:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include "RunAction.hh"
0031 #include "AnalysisManager.hh"
0032 #include "G4SystemOfUnits.hh"
0033 #include "G4UnitsTable.hh"
0034 #include "G4ios.hh"
0035 #include "G4Run.hh"
0036
0037 #ifdef ANALYSIS_USE
0038 RunAction::RunAction(AnalysisManager* analysis, DetectorMessenger* detector)
0039 {
0040
0041 analysisMan = analysis;
0042 detectorMess = detector;
0043
0044 }
0045 #else
0046 RunAction::RunAction(DetectorMessenger* detector)
0047 {
0048 detectorMess = detector;
0049 }
0050 #endif
0051
0052 RunAction::~RunAction()
0053 { }
0054
0055 void RunAction::BeginOfRunAction(const G4Run* aRun)
0056 {
0057 G4int run_number = aRun->GetRunID();
0058 G4cout << "### Run " << run_number << " start." << G4endl;
0059
0060 #ifdef ANALYSIS_USE
0061 G4bool additionalOutput;
0062 G4String detectorType = detectorMess -> GetDetectorType();
0063 if( detectorType == "DiamondTelescope" ) additionalOutput = true;
0064 else additionalOutput = false;
0065
0066
0067 analysisMan -> book(additionalOutput);
0068 #else
0069 G4cout << "Output to file disabled: no file will be generated. "
0070 << "To enable it, re-run cmake with the -DWITH_ANALYSIS_USE=ON flag." << G4endl;
0071 #endif
0072
0073
0074 if( detectorMess -> AreTherePendingChanges() )
0075 {
0076 G4cout << "WARNING: pending changes to the geometry found during BeginOfRunAction. "
0077 << "These will be ignored during the current run. "
0078 << "Use /geometrySetup/applyChanges if you want to apply them in your next run." << G4endl;
0079 }
0080
0081
0082 G4cout << "Simulating the " << detectorMess->GetDetectorType() << " detector "
0083 << "with dimensions: " << detectorMess->GetDetectorSizeWidth()/um << " um width, "
0084 << detectorMess->GetDetectorSizeThickness()/um << " um thickness." << G4endl;
0085 }
0086
0087 void RunAction::EndOfRunAction(const G4Run* aRun)
0088 {
0089 G4cout << "Number of events = " << aRun->GetNumberOfEvent() << G4endl;
0090
0091 #ifdef ANALYSIS_USE
0092
0093 analysisMan -> finish();
0094 #endif
0095 }
0096