Belle II Software
development
StackingAction.cc
1
/**************************************************************************
2
* basf2 (Belle II Analysis Software Framework) *
3
* Author: The Belle II Collaboration *
4
* *
5
* See git log for contributors and copyright holders. *
6
* This file is licensed under LGPL-3.0, see LICENSE.md. *
7
**************************************************************************/
8
9
#include <simulation/kernel/StackingAction.h>
10
#include <simulation/kernel/UserInfo.h>
11
12
#include <G4ParticleDefinition.hh>
13
#include <G4ParticleTypes.hh>
14
#include <G4Track.hh>
15
#include <G4VProcess.hh>
16
17
#include <TRandom.h>
18
19
using namespace
std
;
20
using namespace
Belle2
;
21
using namespace
Simulation;
22
23
24
StackingAction::StackingAction
():
m_photonFraction
(1.0)
25
{
26
if
(
false
) {
27
G4Track* aTrack;
28
ClassifyNewTrack
(aTrack);
29
NewStage
();
30
PrepareNewEvent
();
31
}
32
}
33
34
StackingAction::~StackingAction
()
35
{
36
37
}
38
39
40
G4ClassificationOfNewTrack
StackingAction::ClassifyNewTrack
(
const
G4Track* aTrack)
41
{
42
// look for optical photon
43
if
(aTrack->GetDefinition() != G4OpticalPhoton::OpticalPhotonDefinition())
44
return
fUrgent;
45
46
// check if creator process is available
47
if
(!aTrack->GetCreatorProcess())
return
fUrgent;
48
49
// look for Cerenkov photon
50
if
(aTrack->GetCreatorProcess()->GetProcessName() !=
"Cerenkov"
)
return
fUrgent;
51
52
// get track info
53
TrackInfo* info =
dynamic_cast<
TrackInfo*
>
(aTrack->GetUserInformation());
54
if
(!info)
return
fUrgent;
55
56
// chech if prescaling already done
57
if
(info->getStatus() != 0)
return
fUrgent;
58
59
// if not, do it
60
if
(gRandom->Uniform() >
m_photonFraction
) {
61
TrackInfo::getInfo
(*aTrack).
setIgnore
();
62
return
fKill;
63
}
64
65
// set new status and store prescaling fraction
66
info->setStatus(1);
67
info->setFraction(
m_photonFraction
);
68
69
return
fUrgent;
70
}
71
72
73
void
StackingAction::NewStage
()
74
{
75
76
}
77
78
79
void
StackingAction::PrepareNewEvent
()
80
{
81
82
}
Belle2::MCParticleGraph::GraphParticle::setIgnore
void setIgnore(bool ignore=true)
Set or remove the ignore flag.
Definition
MCParticleGraph.h:132
Belle2::Simulation::StackingAction::StackingAction
StackingAction()
The StackingAction constructor.
Definition
StackingAction.cc:24
Belle2::Simulation::StackingAction::NewStage
virtual void NewStage()
Function that is called at each event when "urgent" stack is empty.
Definition
StackingAction.cc:73
Belle2::Simulation::StackingAction::m_photonFraction
double m_photonFraction
The fraction of Cerenkov photons which will be kept and propagated.
Definition
StackingAction.h:51
Belle2::Simulation::StackingAction::ClassifyNewTrack
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)
Function that classifies new tracks.
Definition
StackingAction.cc:40
Belle2::Simulation::StackingAction::~StackingAction
~StackingAction()
The StackingAction destructor.
Definition
StackingAction.cc:34
Belle2::Simulation::StackingAction::PrepareNewEvent
virtual void PrepareNewEvent()
Function called at begining of event.
Definition
StackingAction.cc:79
Belle2::Simulation::UserInfo< G4VUserTrackInformation, MCParticleGraph::GraphParticle & >::getInfo
static MCParticleGraph::GraphParticle & getInfo(Carrier &obj)
Definition
UserInfo.h:100
Belle2
Abstract base class for different kinds of events.
Definition
MillepedeAlgorithm.h:17
std
STL namespace.
simulation
kernel
src
StackingAction.cc
Generated on Mon Sep 1 2025 02:55:48 for Belle II Software by
1.13.2