Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:51:43

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 MicroElecRun.cc
0027 /// \brief Implementation of the MicroElecRun class
0028 //
0029 //
0030 
0031 #include "MicroElecHitSey.hh"
0032 #include "MicroElecRun.hh"
0033 #include "G4Event.hh"
0034 #include "G4HCofThisEvent.hh"
0035 #include "G4SDManager.hh"
0036 
0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0038 
0039 MicroElecRun::MicroElecRun()
0040  : G4Run()
0041 {
0042     ElecPrimScorer  = 0.0;
0043     ElecSecoScorer  = 0.0;
0044     ElecSup50Scorer = 0.0;
0045     ElecTotaScorer  = 0.0;
0046     ElecEneIncPart = 0.0;
0047   
0048 }
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0051 
0052 MicroElecRun::~MicroElecRun()
0053 {;}
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0056 //  RecordEvent is called at end of event.
0057 //  For scoring purpose, the resultant quantity in a event,
0058 //  is accumulated during a MicroElecRun.
0059 void MicroElecRun::RecordEvent(const G4Event* evt)
0060 {
0061     G4Run::RecordEvent(evt);
0062     G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
0063   
0064   
0065   if (!HCE)
0066       return;
0067   else {
0068       G4int NbOfCollection = HCE->GetNumberOfCollections();
0069       G4int NbOfHitsinCollection;
0070       
0071       for (G4int i = 0; i < NbOfCollection; i++) {
0072           
0073           NbOfHitsinCollection = HCE->GetHC(i)->GetSize();
0074           for (G4int j = 0; j< NbOfHitsinCollection;j++)
0075           {
0076               MicroElecHitSey* localHit =  (MicroElecHitSey*) (HCE->GetHC(i)->GetHit(j));
0077               
0078               if (localHit->GetParentID()==0){ 
0079                   
0080                 SetElecEneIncPart(localHit->GetVertexKineticEnergy());
0081               }
0082               
0083           }
0084 
0085       }
0086 
0087   }
0088   
0089 }
0090 
0091 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0092 void MicroElecRun::Merge(const G4Run * aRun) {
0093   const MicroElecRun * localRun = static_cast<const MicroElecRun *>(aRun);
0094   
0095   ElecPrimScorer += localRun->ElecPrimScorer;
0096   ElecSecoScorer += localRun->ElecSecoScorer;
0097   ElecSup50Scorer += localRun->ElecSup50Scorer;
0098   ElecTotaScorer += localRun->ElecTotaScorer;
0099   ElecEneIncPart= localRun->ElecEneIncPart;
0100 
0101   G4cout << "-------------------- MicroElec Run Merge Events : begin--------------------------" << G4endl;
0102   G4cout << "Vertex Prim NRJ = " << GetElecEneIncPart() << G4endl;
0103   G4cout << "Primaries = " << GetElecPrimScorer() << G4endl;
0104   G4cout << "Secondaries = " << GetElecSecoScorer() << G4endl;
0105   G4cout << "Sec > 50 eV = " << GetElecSup50Scorer() << G4endl;
0106   G4cout << "Total = " << GetElecTotaScorer() << G4endl;
0107   G4cout << "-------------------- MicroElec Run Merge Events : end--------------------------" << G4endl;
0108 
0109   G4Run::Merge(aRun);
0110 }
0111 
0112 
0113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......