Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:04

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 #include "eRositaEventAction.hh"
0028 
0029 #include "G4Event.hh"
0030 #include "G4TrajectoryContainer.hh"
0031 #include "G4Trajectory.hh"
0032 #include "G4ios.hh"
0033 
0034 eRositaEventAction::eRositaEventAction()
0035 {
0036 }
0037 
0038 eRositaEventAction::~eRositaEventAction()
0039 {
0040 }
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 void eRositaEventAction::BeginOfEventAction(const G4Event* event)
0045 {
0046     auto numberOfEvents = event->GetEventID() + 1;
0047 
0048     constexpr auto INITIAL_FREQUENCY{100};
0049     constexpr auto FIRST_FREQUENCY_THRESHOLD{1000};
0050     constexpr auto SECOND_FREQUENCY_THRESHOLD{10000};
0051     constexpr auto THIRD_FREQUENCY_THRESHOLD{100000};
0052 
0053     auto frequency = INITIAL_FREQUENCY;
0054     if (numberOfEvents > FIRST_FREQUENCY_THRESHOLD) {
0055         frequency = FIRST_FREQUENCY_THRESHOLD;
0056     }
0057     if (numberOfEvents > SECOND_FREQUENCY_THRESHOLD) {
0058         frequency = SECOND_FREQUENCY_THRESHOLD;
0059     }
0060     if (numberOfEvents > THIRD_FREQUENCY_THRESHOLD) {
0061         frequency = THIRD_FREQUENCY_THRESHOLD;
0062     }
0063 
0064     auto remainder = numberOfEvents % frequency;
0065     if (remainder == 0) {
0066         G4cout << "---- eRosita number of events: " << numberOfEvents << G4endl;
0067     }
0068 }
0069 
0070 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0071 
0072 void eRositaEventAction::EndOfEventAction(const G4Event* event)
0073 {
0074     auto eventIdentifier = event->GetEventID();
0075 
0076     // get the number of stored trajectories
0077 
0078     auto *trajectoryContainer = event->GetTrajectoryContainer();
0079     auto numberOfTrajectories = 0;
0080     if (trajectoryContainer != nullptr) {
0081         numberOfTrajectories = trajectoryContainer->entries();
0082     }
0083 
0084     // periodic printing
0085 
0086     constexpr auto THRESHOLD{100};
0087 
0088     if (eventIdentifier < THRESHOLD || eventIdentifier % THRESHOLD == 0) {
0089         G4cout << ">>> Event: " << event->GetEventID() << G4endl;
0090         G4cout << "    " << numberOfTrajectories << " trajectories stored in this event." << G4endl;
0091     }
0092 }