|
|
|||
File indexing completed on 2026-03-28 07:51:10
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 /// \file RunAction.cc 0027 /// \brief Implementation of the RunAction class 0028 0029 #include "RunAction.hh" 0030 0031 #include "G4AnalysisManager.hh" 0032 #include "G4Run.hh" 0033 #include "G4RunManager.hh" 0034 #include "G4SystemOfUnits.hh" 0035 #include "G4UnitsTable.hh" 0036 0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0038 0039 RunAction::RunAction(const G4String& fileName) : fFileName(fileName) 0040 { 0041 // Create analysis manager 0042 auto analysisManager = G4AnalysisManager::Instance(); 0043 analysisManager->SetDefaultFileType("root"); 0044 analysisManager->SetVerboseLevel(1); 0045 analysisManager->SetNtupleMerging(true); 0046 G4cout << "Using " << analysisManager->GetType() << G4endl; 0047 // Note: merging ntuples is available only with Root output 0048 0049 // Set default fileName 0050 analysisManager->SetFileName(fFileName); 0051 0052 // Create ntuple 0053 // 0054 analysisManager->CreateNtuple("Screen", "Screen hits"); 0055 analysisManager->CreateNtupleIColumn("ID"); // column id = 0 0056 analysisManager->CreateNtupleIColumn("PDG"); // column id = 1 0057 analysisManager->CreateNtupleDColumn("Ekin"); // column id = 2 0058 analysisManager->CreateNtupleDColumn("Xpos"); // column id = 3 0059 analysisManager->CreateNtupleDColumn("Ypos"); // column id = 4 0060 analysisManager->CreateNtupleDColumn("time"); // column id = 5 0061 analysisManager->FinishNtuple(); 0062 } 0063 0064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0065 0066 void RunAction::BeginOfRunAction(const G4Run* /*run*/) 0067 { 0068 // Get analysis manager 0069 auto analysisManager = G4AnalysisManager::Instance(); 0070 0071 // Open an output file 0072 analysisManager->OpenFile(); 0073 } 0074 0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0076 0077 void RunAction::EndOfRunAction(const G4Run* /*run*/) 0078 { 0079 // Save ntuple and close file 0080 auto analysisManager = G4AnalysisManager::Instance(); 0081 analysisManager->Write(); 0082 analysisManager->CloseFile(); 0083 } 0084 0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|