diff options
| author | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-11-20 17:26:02 +0000 |
|---|---|---|
| committer | shivesh <s.p.mandalia@qmul.ac.uk> | 2018-11-20 17:26:02 +0000 |
| commit | d0533d03d0c85f2f993f1793a6b9ea2af3391207 (patch) | |
| tree | 682c2fefe2d113319f21c07bded00fed5245e19b /src/G4BeamTestUserStackingAction.cxx | |
| parent | 738c2f88939a041fbc8b6b9cfa3c547b86bc6e42 (diff) | |
| download | G4BeamTest-d0533d03d0c85f2f993f1793a6b9ea2af3391207.tar.gz G4BeamTest-d0533d03d0c85f2f993f1793a6b9ea2af3391207.zip | |
Tue 20 Nov 17:26:02 GMT 2018
Diffstat (limited to 'src/G4BeamTestUserStackingAction.cxx')
| -rw-r--r-- | src/G4BeamTestUserStackingAction.cxx | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/G4BeamTestUserStackingAction.cxx b/src/G4BeamTestUserStackingAction.cxx new file mode 100644 index 0000000..73a354c --- /dev/null +++ b/src/G4BeamTestUserStackingAction.cxx @@ -0,0 +1,76 @@ +#include "G4BeamTestUserStackingAction.h" + +#include "G4VProcess.hh" + +#include "G4ParticleDefinition.hh" +#include "G4ParticleTypes.hh" +#include "G4Track.hh" +#include "G4ios.hh" + +#include "G4Event.hh" + +#include "G4HCofThisEvent.hh" +#include "G4VHitsCollection.hh" +#include "G4SDManager.hh" +#include "G4ios.hh" +#include "G4VDigitizerModule.hh" +#include "G4DigiManager.hh" +#include "G4Event.hh" +#include "G4RunManager.hh" +//#include "TH1F.h" +//#include "TH2F.h" + + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +G4BeamTestUserStackingAction::G4BeamTestUserStackingAction() + : G4UserStackingAction(), + fScintillationCounter(0), + fCerenkovCounter(0) +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +G4BeamTestUserStackingAction::~G4BeamTestUserStackingAction() +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +G4ClassificationOfNewTrack +G4BeamTestUserStackingAction::ClassifyNewTrack(const G4Track * aTrack) +{ + if(aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition()) + { // particle is optical photon + if(aTrack->GetParentID()>0) + { // particle is secondary + if(aTrack->GetCreatorProcess()->GetProcessName() == "Scintillation") + fScintillationCounter++; + if(aTrack->GetCreatorProcess()->GetProcessName() == "Cerenkov") + fCerenkovCounter++; + } + } + return fUrgent; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void G4BeamTestUserStackingAction::NewStage() +{ + G4cout << "Number of Scintillation photons produced in this event : " + << fScintillationCounter << G4endl; + G4cout << "Number of Cerenkov photons produced in this event : " + << fCerenkovCounter << G4endl; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void G4BeamTestUserStackingAction::PrepareNewEvent() +{ + fScintillationCounter = 0; + fCerenkovCounter = 0; +} + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + |
