From d0533d03d0c85f2f993f1793a6b9ea2af3391207 Mon Sep 17 00:00:00 2001 From: shivesh Date: Tue, 20 Nov 2018 17:26:02 +0000 Subject: Tue 20 Nov 17:26:02 GMT 2018 --- src/G4BeamTestUserStackingAction.cxx | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/G4BeamTestUserStackingAction.cxx (limited to 'src/G4BeamTestUserStackingAction.cxx') 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...... + -- cgit v1.2.3