SteppingAction.cc 3.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// ********************************************************************
// * 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.          *
// ********************************************************************
//
// $Id: SteppingAction.cc 74483 2013-10-09 13:37:06Z gcosmo $
//
/// \file SteppingAction.cc
/// \brief Implementation of the SteppingAction class

#include "SteppingAction.hh"
#include "EventAction.hh"
33
#include "Analysis.hh"
34
35
36
37
38
39
40

#include "G4Step.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

41
SteppingAction::SteppingAction( )
42
: G4UserSteppingAction(){
43
44
45
46
47
	// Get number of OPTICAL flag from DetectorConstruction
	const DetectorConstruction* constDetectorConstruction
		= static_cast<const DetectorConstruction*>(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
	DetectorConstruction* detectorConstruction
		= const_cast<DetectorConstruction*>(constDetectorConstruction);
48

49
	OPTICAL = detectorConstruction->GetOpticalFlag();
50
}
51
52
53
54

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

SteppingAction::~SteppingAction()
aricct2's avatar
aricct2 committed
55
{delete G4AnalysisManager::Instance();}
56
57
58

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

aricct2's avatar
aricct2 committed
59
void SteppingAction::UserSteppingAction(__attribute__((unused)) const G4Step* theStep  )
60
{
aricct2's avatar
aricct2 committed
61
62
63
	G4Track* theTrack = theStep->GetTrack();

	if(theTrack->GetParentID()==0 && theStep->IsLastStepInVolume()){
64
		lastStep = theTrack->GetPosition().getZ();
65
66
67
68
69
    auto analysisManager = G4AnalysisManager::Instance();
    for(int i = 0; i < analysisManager->GetNofNtuples(); i++{
      analysisManager->FillNtupleDColumn(i,0,lastStep);
    }
	}
70

71
72
73
74
	if(theTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition() && !OPTICAL){
		theTrack->SetTrackStatus( fStopAndKill );
	}

75
}
76
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......