Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:31

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 //
0026 /// \file ExGflashRunAction.cc
0027 /// \brief Implementation of the ExGflashRunAction class
0028 //
0029 #include "ExGflashRunAction.hh"
0030 
0031 #include "G4Run.hh"
0032 #include "G4ios.hh"
0033 
0034 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0035 
0036 ExGflashRunAction::ExGflashRunAction(ExGflashDetectorConstruction* det) : fDetector(det)
0037 {
0038   fHistoManager = new ExGflashHistoManager(fDetector);
0039 }
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 ExGflashRunAction::~ExGflashRunAction()
0044 {
0045   delete fHistoManager;
0046 }
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 void ExGflashRunAction::BeginOfRunAction(const G4Run* aRun)
0051 {
0052   G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
0053 
0054   // histograms file
0055   G4AnalysisManager* analysis = G4AnalysisManager::Instance();
0056   if (analysis->IsActive()) {
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......