Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4SpecialStackingAction.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
16#include "TG4Globals.h"
17
18#include <G4StackManager.hh>
19#include <G4StackedTrack.hh>
20#include <G4Track.hh>
21#include <G4TrackStack.hh>
22
23#include <TPDGCode.h>
24
25//_____________________________________________________________________________
28 TG4Verbose("stackingAction", 1),
29 fMessenger(this),
30 fStage(0),
31 fSkipNeutrino(false),
32 fWaitPrimary(true)
33{
35
36 G4cout << "### TG4SpecialStackingAction activated" << G4endl;
37}
38
39//_____________________________________________________________________________
44
45//
46// public methods
47//
48
49//_____________________________________________________________________________
51 const G4Track* track)
52{
54
55 if (fWaitPrimary && fStage == 0) {
56 // move all primaries to PrimaryStack
57 return fPostpone;
58 }
59
60 if (fSkipNeutrino) {
61 G4int pdgCode = track->GetDefinition()->GetPDGEncoding();
62 if (pdgCode == kNuE || pdgCode == kNuEBar || pdgCode == kNuMu ||
63 pdgCode == kNuMuBar || pdgCode == kNuTau || pdgCode == kNuTauBar) {
64
65 return fKill;
66 }
67 }
68
69 return fUrgent;
70}
71
72//_____________________________________________________________________________
74{
76
77 fStage++;
78
79 if (VerboseLevel() > 1) {
80 G4cout << "TG4SpecialStackingAction::NewStage " << fStage
81 << " has been started." << G4endl;
82 }
83
84 if (fWaitPrimary && stackManager->GetNUrgentTrack() == 0 &&
85 stackManager->GetNPostponedTrack() != 0) {
86
87 stackManager->TransferOneStackedTrack(fPostpone, fUrgent);
88 }
89}
90
91//_____________________________________________________________________________
Definition of the TG4Globals class and basic container types.
Definition of the TG4SpecialStackingAction class.
G4bool fSkipNeutrino
Option to skip tracking of all neutrina.
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *track)
Base class for defining the verbose level and a common messenger.
Definition TG4Verbose.h:36
virtual G4int VerboseLevel() const
Definition TG4Verbose.h:78