Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0027 /// \file optical/LXe/src/LXeRun.cc
0028 /// \brief Implementation of the LXeRun class
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #include "LXeRun.hh"
0034 
0035 #include "G4SystemOfUnits.hh"
0036 
0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0038 
0039 void LXeRun::Merge(const G4Run* run)
0040 {
0041   const auto localRun = static_cast<const LXeRun*>(run);
0042 
0043   fHitCount += localRun->fHitCount;
0044   fHitCount2 += localRun->fHitCount2;
0045   fPMTsAboveThreshold += localRun->fPMTsAboveThreshold;
0046   fPMTsAboveThreshold2 += localRun->fPMTsAboveThreshold2;
0047   fPhotonCount_Scint += localRun->fPhotonCount_Scint;
0048   fPhotonCount_Scint2 += localRun->fPhotonCount_Scint2;
0049   fPhotonCount_Ceren += localRun->fPhotonCount_Ceren;
0050   fPhotonCount_Ceren2 += localRun->fPhotonCount_Ceren2;
0051   fAbsorptionCount += localRun->fAbsorptionCount;
0052   fAbsorptionCount2 += localRun->fAbsorptionCount2;
0053   fBoundaryAbsorptionCount += localRun->fBoundaryAbsorptionCount;
0054   fBoundaryAbsorptionCount2 += localRun->fBoundaryAbsorptionCount2;
0055   fTotE += localRun->fTotE;
0056   fTotE2 += localRun->fTotE2;
0057 
0058   G4Run::Merge(run);
0059 }
0060 
0061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0062 
0063 void LXeRun::EndOfRun()
0064 {
0065   G4cout << "\n ======================== run summary ======================\n";
0066 
0067   G4int prec = G4cout.precision();
0068 
0069   auto n_evt = (G4double)numberOfEvent;
0070   G4cout << "The run was " << numberOfEvent << " events." << G4endl;
0071 
0072   G4cout.precision(4);
0073   G4double hits = G4double(fHitCount) / n_evt;
0074   G4double hits2 = G4double(fHitCount2) / n_evt;
0075   G4double rms_hits = hits2 - hits * hits;
0076   if (rms_hits > 0.)
0077     rms_hits = std::sqrt(rms_hits / n_evt);
0078   else
0079     rms_hits = 0.;
0080   G4cout << "Number of hits per event:\t " << hits << " +- " << rms_hits << G4endl;
0081 
0082   G4double hitsAbove = G4double(fPMTsAboveThreshold) / n_evt;
0083   G4double hitsAbove2 = G4double(fPMTsAboveThreshold2) / n_evt;
0084   G4double rms_hitsAbove = hitsAbove2 - hitsAbove * hitsAbove;
0085   if (rms_hitsAbove > 0.)
0086     rms_hitsAbove = std::sqrt(rms_hitsAbove / n_evt);
0087   else
0088     rms_hitsAbove = 0.;
0089 
0090   G4cout << "Number of hits per event above threshold:\t " << hitsAbove << " +- " << rms_hitsAbove
0091          << G4endl;
0092 
0093   G4double scint = G4double(fPhotonCount_Scint) / n_evt;
0094   G4double scint2 = G4double(fPhotonCount_Scint2) / n_evt;
0095   G4double rms_scint = scint2 - scint * scint;
0096   if (rms_scint > 0.)
0097     rms_scint = std::sqrt(rms_scint / n_evt);
0098   else
0099     rms_scint = 0.;
0100 
0101   G4cout << "Number of scintillation photons per event :\t " << scint << " +- " << rms_scint
0102          << G4endl;
0103 
0104   G4double ceren = G4double(fPhotonCount_Ceren) / n_evt;
0105   G4double ceren2 = G4double(fPhotonCount_Ceren2) / n_evt;
0106   G4double rms_ceren = ceren2 - ceren * ceren;
0107   if (rms_ceren > 0.)
0108     rms_ceren = std::sqrt(rms_ceren / n_evt);
0109   else
0110     rms_ceren = 0.;
0111 
0112   G4cout << "Number of Cerenkov photons per event:\t " << ceren << " +- " << rms_ceren << G4endl;
0113 
0114   G4double absorb = G4double(fAbsorptionCount) / n_evt;
0115   G4double absorb2 = G4double(fAbsorptionCount2) / n_evt;
0116   G4double rms_absorb = absorb2 - absorb * absorb;
0117   if (rms_absorb > 0.)
0118     rms_absorb = std::sqrt(rms_absorb / n_evt);
0119   else
0120     rms_absorb = 0.;
0121 
0122   G4cout << "Number of absorbed photons per event :\t " << absorb << " +- " << rms_absorb << G4endl;
0123 
0124   G4double bdry = G4double(fBoundaryAbsorptionCount) / n_evt;
0125   G4double bdry2 = G4double(fBoundaryAbsorptionCount2) / n_evt;
0126   G4double rms_bdry = bdry2 - bdry * bdry;
0127   if (rms_bdry > 0.)
0128     rms_bdry = std::sqrt(rms_bdry / n_evt);
0129   else
0130     rms_bdry = 0.;
0131 
0132   G4cout << "Number of photons absorbed at boundary per event:\t " << bdry << " +- " << rms_bdry
0133          << G4endl;
0134 
0135   G4double en = fTotE / n_evt;
0136   G4double en2 = fTotE2 / n_evt;
0137   G4double rms_en = en2 - en * en;
0138   if (rms_en > 0.)
0139     rms_en = std::sqrt(rms_en / n_evt);
0140   else
0141     rms_en = 0.;
0142 
0143   G4cout << "Total energy deposition in scintillator per event:\t " << en / keV << " +- "
0144          << rms_en / keV << " keV." << G4endl;
0145 
0146   G4cout << G4endl;
0147   G4cout.precision(prec);
0148 }