Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:47

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 medical/dna/range/src/Run.cc
0027 /// \brief Implementation of the Run class
0028 //
0029 // $Id: Run.cc 71376 2013-06-14 07:44:50Z maire $
0030 //
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 
0034 #include "Run.hh"
0035 
0036 #include "DetectorConstruction.hh"
0037 #include "HistoManager.hh"
0038 #include "PrimaryGeneratorAction.hh"
0039 
0040 #include "G4Material.hh"
0041 #include "G4MultiFunctionalDetector.hh"
0042 #include "G4SDManager.hh"
0043 #include "G4SystemOfUnits.hh"
0044 #include "G4UnitsTable.hh"
0045 #include "G4VPrimitiveScorer.hh"
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0048 
0049 Run::Run(const DetectorConstruction* /*detector*/)
0050   : G4Run(), fParticle(0), fEkin(0.), fEdeposit(0.), fCollName(), fRunMap(0)
0051 
0052 {}
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 Run::~Run() {}
0057 void Run::RecordEvent(const G4Event* /*aEvent*/)
0058 {
0059   numberOfEvent++;  // This is an original line.
0060 }
0061 G4THitsMap<G4double>* Run::GetHitsMap(const G4String& detName, const G4String& colName)
0062 {
0063   G4String fullName = detName + "/" + colName;
0064   return GetHitsMap(fullName);
0065 }
0066 G4THitsMap<G4double>* Run::GetHitsMap(const G4String& fullName)
0067 {
0068   if (fCollName == fullName) {
0069     return fRunMap;
0070   }
0071   return NULL;
0072 }
0073 void Run::DumpAllScorer()
0074 {
0075   // - Number of HitsMap in this RUN.
0076   // - GetHitsMap and dump values.
0077 
0078   G4THitsMap<G4double>* RunMap = GetHitsMap();
0079   if (RunMap) {
0080     G4cout << " PrimitiveScorer RUN " << RunMap->GetSDname() << "," << RunMap->GetName() << G4endl;
0081     G4cout << " Number of entries " << RunMap->entries() << G4endl;
0082     std::map<G4int, G4double*>::iterator itr = RunMap->GetMap()->begin();
0083     for (; itr != RunMap->GetMap()->end(); itr++) {
0084       G4cout << "  copy no.: " << itr->first << "  Run Value : " << *(itr->second) << G4endl;
0085     }
0086   }
0087 }
0088 
0089 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0090 
0091 void Run::SetPrimary(G4ParticleDefinition* particle, G4double energy)
0092 {
0093   fParticle = particle;
0094   fEkin = energy;
0095 }
0096 
0097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0098 
0099 void Run::Merge(const G4Run* run)
0100 {
0101   const Run* localRun = static_cast<const Run*>(run);
0102 
0103   fParticle = localRun->fParticle;
0104   fEkin = localRun->fEkin;
0105 
0106   G4Run::Merge(run);
0107 }
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0110 
0111 void Run::EndOfRun()
0112 {
0113   std::ios::fmtflags mode = G4cout.flags();
0114   G4cout.setf(std::ios::fixed, std::ios::floatfield);
0115   G4int prec = G4cout.precision(2);
0116 
0117   G4cout.setf(mode, std::ios::floatfield);
0118   G4cout.precision(prec);
0119 }
0120 
0121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......