Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4StackPopperPhysics.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2015 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 "TG4StackPopper.h"
17
18#include <G4ProcessManager.hh>
19
20//_____________________________________________________________________________
23 fMessenger(this),
24 fStackPopperProcess(0),
25 fSelection()
26{
28}
29
30//_____________________________________________________________________________
32 G4int theVerboseLevel, const G4String& name)
33 : TG4VPhysicsConstructor(name, theVerboseLevel),
34 fMessenger(this),
35 fStackPopperProcess(0),
36 fSelection()
37{
39}
40
41//_____________________________________________________________________________
48
49//
50// protected methods
51//
52
53//_____________________________________________________________________________
58
59//_____________________________________________________________________________
61{
64
66
67 auto aParticleIterator = GetParticleIterator();
68 aParticleIterator->reset();
69 while ((*aParticleIterator)()) {
70
71 G4ParticleDefinition* particle = aParticleIterator->value();
72 G4ProcessManager* pmanager = particle->GetProcessManager();
73
74 // skip particles which do not have process manager
75 if (!pmanager) continue;
76
77 // add this as an option
78 if (fSelection.size() == 0 ||
79 fSelection.find(particle->GetParticleName()) != std::string::npos) {
80
81 if (VerboseLevel() > 1) {
82 G4cout << "Adding StackPopper process to "
83 << particle->GetParticleName() << G4endl;
84 }
85
86 pmanager->AddProcess(fStackPopperProcess);
87 pmanager->SetProcessOrdering(fStackPopperProcess, idxPostStep);
88 }
89 }
90
91 if (VerboseLevel() > 0) {
92 G4cout << "### Stack popper physics constructed." << G4endl;
93 }
94}
Definition of the TG4StackPopperPhysics class.
Definition of the TG4StackPopper class.
TG4StackPopper * fStackPopperProcess
stack popper process
G4String fSelection
particles selection
virtual void ConstructProcess()
Construct physics processes.
TG4StackPopperPhysics(const G4String &name="StackPopper")
virtual void ConstructParticle()
Construct particles.
The process which pops particles defined by user from the VMC stack and passes them to tracking.
Abstract base class for physics constructors with verbose.
virtual G4int VerboseLevel() const