Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:29:53

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 RE06RunAction.cc
0027 /// \brief Implementation of the RE06RunAction class
0028 
0029 #include "RE06RunAction.hh"
0030 
0031 #include "RE06Run.hh"
0032 #include "RE06SteppingVerbose.hh"
0033 
0034 #include "G4ProductionCuts.hh"
0035 #include "G4Region.hh"
0036 #include "G4RegionStore.hh"
0037 #include "G4UnitsTable.hh"
0038 #include "G4VSteppingVerbose.hh"
0039 #include "G4ios.hh"
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 RE06RunAction::RE06RunAction() : G4UserRunAction()
0044 {
0045   ;
0046 }
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 RE06RunAction::~RE06RunAction()
0051 {
0052   ;
0053 }
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 
0057 G4Run* RE06RunAction::GenerateRun()
0058 {
0059   return new RE06Run;
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0063 
0064 void RE06RunAction::BeginOfRunAction(const G4Run*)
0065 {
0066   RE06SteppingVerbose* sv = (RE06SteppingVerbose*)(G4VSteppingVerbose::GetInstance());
0067 
0068   sv->InitializeTimers();
0069 }
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0072 
0073 void RE06RunAction::EndOfRunAction(const G4Run* aRun)
0074 {
0075   static G4String regName[3] = {"Calor-A", "Calor-B", "Calor-C"};
0076 
0077   const RE06Run* theRun = (const RE06Run*)aRun;
0078 
0079   if (IsMaster()) {
0080     G4cout << "############################################################" << G4endl;
0081     G4cout << " Run Summary - Number of events : " << theRun->GetNumberOfEvent() << G4endl;
0082     G4cout << "############################################################" << G4endl;
0083 
0084     G4double nEvt = (G4double)(theRun->GetNumberOfEvent());
0085     for (size_t i = 0; i < 3; i++) {
0086       size_t ih1 = 2 * i;
0087       size_t ih2 = 2 * i + 1;
0088 
0089       G4Region* region = G4RegionStore::GetInstance()->GetRegion(regName[i]);
0090       G4ProductionCuts* cuts = region->GetProductionCuts();
0091       G4cout << "Region : " << region->GetName() << G4endl;
0092       G4cout << " Production thresholds :" << G4endl << "   "
0093              << " gamma " << G4BestUnit(cuts->GetProductionCut("gamma"), "Length") << "    e- "
0094              << G4BestUnit(cuts->GetProductionCut("e-"), "Length") << "    e+ "
0095              << G4BestUnit(cuts->GetProductionCut("e+"), "Length") << G4endl;
0096       G4cout << " Energy deposition in an event :" << G4endl << "   "
0097              << " Absorber " << G4BestUnit((theRun->GetTotalE(ih1)) / nEvt, "Energy")
0098              << "      Gap " << G4BestUnit((theRun->GetTotalE(ih2)) / nEvt, "Energy") << G4endl;
0099       G4cout << " Number of secondaries in an event :" << G4endl << "   "
0100              << " gamma in Absorber " << (theRun->GetNGamma(ih1)) / nEvt << "    in Gap "
0101              << (theRun->GetNGamma(ih2)) / nEvt << G4endl << "   "
0102              << " e-    in Absorber " << (theRun->GetNElectron(ih1)) / nEvt << "    in Gap "
0103              << (theRun->GetNElectron(ih2)) / nEvt << G4endl << "   "
0104              << " e+    in Absorber " << (theRun->GetNPositron(ih1)) / nEvt << "    in Gap "
0105              << (theRun->GetNPositron(ih2)) / nEvt << G4endl;
0106       G4cout << " Minimum kinetic energy of generated secondaries :" << G4endl << "   "
0107              << " gamma in Absorber " << G4BestUnit(theRun->GetEMinGamma(ih1), "Energy")
0108              << "    in Gap " << G4BestUnit(theRun->GetEMinGamma(ih2), "Energy") << G4endl << "   "
0109              << " e-    in Absorber " << G4BestUnit(theRun->GetEMinElectron(ih1), "Energy")
0110              << "    in Gap " << G4BestUnit(theRun->GetEMinElectron(ih2), "Energy") << G4endl
0111              << "   "
0112              << " e+    in Absorber " << G4BestUnit(theRun->GetEMinPositron(ih1), "Energy")
0113              << "    in Gap " << G4BestUnit(theRun->GetEMinPositron(ih2), "Energy") << G4endl;
0114       G4cout << " Total track length of e+/e- in an event :" << G4endl << "   "
0115              << " Absorber " << G4BestUnit((theRun->GetTotalL(ih1)) / nEvt, "Length")
0116              << "      Gap " << G4BestUnit((theRun->GetTotalL(ih2)) / nEvt, "Length") << G4endl;
0117       G4cout << " Total number of steps of e+/e- in an event :" << G4endl << "   "
0118              << " Absorber " << (theRun->GetNStep(ih1)) / nEvt << "      Gap "
0119              << (theRun->GetNStep(ih2)) / nEvt << G4endl;
0120       G4cout << "------------------------------------------------------------" << G4endl;
0121       G4cout << "Scores in parallel geometry" << G4endl;
0122       G4cout << "layer   eDep/evt  nGamma/evt nElec/evt  nPosi/evt  stpLen/evt nStep/evt" << G4endl;
0123       for (size_t k = 0; k < 20; k++) {
0124         G4cout << std::setw(8) << k;
0125         for (size_t j = 0; j < 6; j++) {
0126           G4cout << " " << std::setw(10) << (theRun->GetParaValue(i, j, k)) / nEvt;
0127         }
0128         G4cout << G4endl;
0129       }
0130       G4cout << "############################################################" << G4endl;
0131     }
0132   }
0133   else {
0134     G4cout << "CPU Time spent by each region" << G4endl;
0135     RE06SteppingVerbose* sv = (RE06SteppingVerbose*)(G4VSteppingVerbose::GetInstance());
0136     sv->Report();
0137   }
0138 }
0139 
0140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......