![]() |
|
|||
File indexing completed on 2025-10-13 08:26:58
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 // 0027 /// \file RunAction.cc 0028 /// \brief Implementation of the RunAction class 0029 0030 #include "RunAction.hh" 0031 #include "G4AnalysisManager.hh" 0032 0033 #include "G4RunManager.hh" 0034 #include "G4Run.hh" 0035 0036 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0037 0038 RunAction::RunAction() 0039 : G4UserRunAction() 0040 { 0041 //using analysis manager for output 0042 auto analysisManager = G4AnalysisManager::Instance(); 0043 0044 #ifdef G4MULTITHREADED 0045 analysisManager->SetNtupleMerging(true); 0046 #else 0047 analysisManager->SetNtupleMerging(false); 0048 #endif 0049 0050 //Creating the ntuple to score the deflection of particles and 0051 //the emitted radiation 0052 0053 G4String nTupleName[3] = 0054 {"crystal", "detector", "detector_photons"}; 0055 for(G4int i=0; i<3; i++) 0056 { 0057 analysisManager->CreateNtuple(nTupleName[i],nTupleName[i]); 0058 analysisManager->CreateNtupleIColumn("eventID"); 0059 analysisManager->CreateNtupleSColumn("volume"); 0060 analysisManager->CreateNtupleDColumn("x"); 0061 analysisManager->CreateNtupleDColumn("y"); 0062 analysisManager->CreateNtupleDColumn("angle_x"); 0063 analysisManager->CreateNtupleDColumn("angle_y"); 0064 analysisManager->CreateNtupleDColumn("Ekin"); 0065 analysisManager->CreateNtupleSColumn("particle"); 0066 analysisManager->CreateNtupleIColumn("particleID"); 0067 analysisManager->CreateNtupleIColumn("parentID"); 0068 0069 analysisManager->FinishNtuple(); 0070 } 0071 } 0072 0073 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0074 0075 void RunAction::BeginOfRunAction(const G4Run*) 0076 { 0077 //opening output file 0078 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0079 G4String fileName = "results.root"; 0080 analysisManager->OpenFile(fileName); 0081 } 0082 0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 0084 0085 void RunAction::EndOfRunAction(const G4Run*) 0086 { 0087 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 0088 analysisManager->Write(); 0089 analysisManager->CloseFile(); 0090 } 0091 0092 //....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 |
![]() ![]() |