Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 08:31:04

0001 // ********************************************************************
0002 // * License and Disclaimer                                           *
0003 // *                                                                  *
0004 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0005 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0006 // * conditions of the Geant4 Software License,  included in the file *
0007 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0008 // * include a list of copyright holders.                             *
0009 // *                                                                  *
0010 // * Neither the authors of this software system, nor their employing *
0011 // * institutes,nor the agencies providing financial support for this *
0012 // * work  make  any representation or  warranty, express or implied, *
0013 // * regarding  this  software system or assume any liability for its *
0014 // * use.  Please see the license in the file  LICENSE  and URL above *
0015 // * for the full disclaimer and the limitation of liability.         *
0016 // *                                                                  *
0017 // * This  code  implementation is the result of  the  scientific and *
0018 // * technical work of the GEANT4 collaboration.                      *
0019 // * By using,  copying,  modifying or  distributing the software (or *
0020 // * any work based  on the software)  you  agree  to acknowledge its *
0021 // * use  in  resulting  scientific  publications,  and indicate your *
0022 // * acceptance of all terms of the Geant4 Software license.          *
0023 // ********************************************************************
0024 //
0025 /// \file ExGflashRunAction.cc
0026 /// \brief Implementation of the ExGflashRunAction class
0027 
0028 #include "ExGflashRunAction.hh"
0029 
0030 #include "G4Run.hh"
0031 #include "G4ios.hh"
0032 
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 ExGflashRunAction::ExGflashRunAction(ExGflashDetectorConstruction* det) : fDetector(det)
0036 {
0037   fHistoManager = new ExGflashHistoManager(fDetector);
0038 }
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 ExGflashRunAction::~ExGflashRunAction()
0043 {
0044   delete fHistoManager;
0045 }
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0048 
0049 void ExGflashRunAction::BeginOfRunAction(const G4Run* aRun)
0050 {
0051   G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
0052 
0053   // histograms file
0054   G4AnalysisManager* analysis = G4AnalysisManager::Instance();
0055   if (analysis->IsActive()) {
0056     fHistoManager->SetBinning();
0057     analysis->OpenFile();
0058   }
0059 
0060   if (IsMaster()) {
0061     fRunTimer.Start();
0062   }
0063 }
0064 
0065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0066 
0067 void ExGflashRunAction::EndOfRunAction(const G4Run* aRun)
0068 {
0069   if (IsMaster()) {
0070     // For MT we need Timer Merge
0071     fRunTimer.Stop();
0072     G4cout << G4endl;
0073     G4cout << "******************************************";
0074     G4cout << G4endl;
0075     G4cout << "Run Real Elapsed Time is: " << fRunTimer.GetRealElapsed();
0076     G4cout << G4endl;
0077     G4cout << "Run System Elapsed Time: " << fRunTimer.GetSystemElapsed();
0078     G4cout << G4endl;
0079     G4cout << "Run GetUserElapsed Time: " << fRunTimer.GetUserElapsed();
0080     G4cout << G4endl;
0081     G4cout << "******************************************" << G4endl;
0082 
0083     G4cout << "number of event = " << aRun->GetNumberOfEvent() << G4endl;
0084   }
0085   // save histograms
0086   G4AnalysisManager* analysis = G4AnalysisManager::Instance();
0087   if (analysis->IsActive()) {
0088     analysis->Write();
0089     analysis->CloseFile();
0090   }
0091 }
0092 
0093 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......