Files
geant4/examples/novice/N03/src/ExN03SteppingAction.cc
T
2016-06-09 11:11:55 +02:00

80 lines
3.1 KiB
C++

//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: ExN03SteppingAction.cc,v 1.8 2003/09/15 15:38:18 maire Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "ExN03SteppingAction.hh"
#include "ExN03DetectorConstruction.hh"
#include "ExN03EventAction.hh"
#include "G4Track.hh"
////#include "G4RunManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN03SteppingAction::ExN03SteppingAction(ExN03DetectorConstruction* det,
ExN03EventAction* evt)
:detector(det), eventaction(evt)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
ExN03SteppingAction::~ExN03SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ExN03SteppingAction::UserSteppingAction(const G4Step* aStep)
{
const G4Track* track = aStep->GetTrack();
G4VPhysicalVolume* volume = track->GetVolume();
// collect energy and track length step by step
G4double edep = aStep->GetTotalEnergyDeposit();
G4double stepl = 0.;
if (track->GetDefinition()->GetPDGCharge() != 0.)
stepl = aStep->GetStepLength();
if ((edep!=0.)) {
if (volume == detector->GetAbsorber()) eventaction->AddAbs(edep,stepl);
if (volume == detector->GetGap()) eventaction->AddGap(edep,stepl);
}
// save the random number seed of this event, under condition
//// if(condition) G4RunManager::GetRunManager()->rndmSaveThisEvent();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......