File indexing completed on 2025-01-18 09:16:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #include "FCALTBEventAction.hh"
0033 #include "FCALTBEventActionMessenger.hh"
0034 #include "FCALRunAction.hh"
0035 #include "FCALCalorHit.hh"
0036 #include <vector>
0037
0038 #include "G4Event.hh"
0039 #include "G4EventManager.hh"
0040 #include "G4HCofThisEvent.hh"
0041 #include "G4VHitsCollection.hh"
0042 #include "G4SDManager.hh"
0043 #include "G4UImanager.hh"
0044 #include "G4ios.hh"
0045 #include "G4AnalysisManager.hh"
0046 #include "G4UnitsTable.hh"
0047 #include "Randomize.hh"
0048 #include "FCALSteppingAction.hh"
0049
0050
0051 #include "G4ios.hh"
0052
0053 #include <iostream>
0054
0055 #include "G4SystemOfUnits.hh"
0056
0057
0058
0059 FCALTBEventAction::FCALTBEventAction(FCALSteppingAction* SA)
0060 :drawFlag("all"),printModulo(10), StepAction(SA), eventMessenger(0)
0061 {
0062 eventMessenger = new FCALTBEventActionMessenger(this);
0063 }
0064
0065
0066
0067 FCALTBEventAction::~FCALTBEventAction()
0068 {
0069 delete eventMessenger;
0070 eventMessenger = 0;
0071 }
0072
0073
0074
0075 void FCALTBEventAction::BeginOfEventAction(const G4Event* evt)
0076 {
0077 G4int evtNb = evt->GetEventID();
0078 if (evtNb%printModulo == 0)
0079 {
0080 G4cout << "\n---> Begin of event: " << evtNb+1 << G4endl;
0081
0082 }
0083
0084 NTracksOutOfWorld = 0;
0085 NSecondaries = 0;
0086
0087 StepAction->initialize(evtNb+1);
0088 }
0089
0090
0091
0092 void FCALTBEventAction::EndOfEventAction(const G4Event*)
0093 {
0094
0095 G4AnalysisManager* man = G4AnalysisManager::Instance();
0096
0097 NTracksOutOfWorld = StepAction->GetOutOfWorldTracks(0, 0);
0098 G4cout << "N Tracks out of world " << NTracksOutOfWorld << G4endl;
0099
0100 man->FillH1(1,NTracksOutOfWorld);
0101
0102 NSecondaries = StepAction->GetSecondaries(0,0);
0103 G4cout << "N Secondaries " << NSecondaries << G4endl;
0104
0105 man->FillH1(2,NSecondaries);
0106
0107 G4double EmEdep = StepAction->GetEdepFCAL("FCALEm");
0108 G4double HadEdep = StepAction->GetEdepFCAL("FCALHad");
0109
0110
0111 man->FillH1(3,EmEdep/MeV);
0112 man->FillH1(4,HadEdep/MeV);
0113
0114
0115 G4cout<<"EmEdep is="<<EmEdep/MeV << " MeV " << G4endl;
0116 G4cout<<"HadEdep is="<<HadEdep << " MeV" << G4endl;
0117
0118 G4cout << "Edep in FCAL1 FCAl2 : " << StepAction->GetEdepFCAL("FCALEm") << " ";
0119 G4cout << StepAction->GetEdepFCAL("FCALHad") << G4endl;
0120 }
0121
0122
0123