Files
geant4/examples/extended/runAndEvent/RE05/src/RE05SteppingAction.cc
T
2018-12-07 15:15:39 +01:00

85 lines
3.4 KiB
C++

//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file RE05/src/RE05SteppingAction.cc
/// \brief Implementation of the RE05SteppingAction class
//
#include "RE05SteppingAction.hh"
#include "G4SteppingManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05SteppingAction::RE05SteppingAction()
: G4UserSteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RE05SteppingAction::~RE05SteppingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void RE05SteppingAction::UserSteppingAction(const G4Step * theStep)
{
G4Track * theTrack = theStep->GetTrack();
// check if it is alive
if(theTrack->GetTrackStatus()!=fAlive) { return; }
// check if it is primary
if(theTrack->GetParentID()!=0) { return; }
// check if it is NOT muon
G4ParticleDefinition * particleType = theTrack->GetDefinition();
if((particleType==G4MuonPlus::MuonPlusDefinition())
||(particleType==G4MuonMinus::MuonMinusDefinition()))
{ return; }
// check if it is entering to the calorimeter volume
G4StepPoint * thePrePoint = theStep->GetPreStepPoint();
G4VPhysicalVolume * thePrePV = thePrePoint->GetPhysicalVolume();
G4String thePrePVname = thePrePV->GetName();
if(thePrePVname(0,4)=="calo") { return; }
G4StepPoint * thePostPoint = theStep->GetPostStepPoint();
G4VPhysicalVolume * thePostPV = thePostPoint->GetPhysicalVolume();
G4String thePostPVname = thePostPV->GetName();
if(thePostPVname(0,4)!="calo") { return; }
// then suspend the track
theTrack->SetTrackStatus(fSuspend);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......