ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHG4VertexSelection.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4VertexSelection.cc
1
// This is the new trackbase container version
2
8
#include "
PHG4VertexSelection.h
"
9
10
#include "
PHG4TruthInfoContainer.h
"
11
#include "
PHG4VtxPoint.h
"
12
13
#include <
fun4all/Fun4AllReturnCodes.h
>
14
15
#include <
phool/getClass.h
>
16
17
#include <iostream>
// for operator<<, basic_ostream, endl
18
19
//____________________________________________________________________________
20
PHG4VertexSelection::PHG4VertexSelection
(
const
std::string &
name
)
21
:
SubsysReco
(name)
22
,
PHParameterInterface
(name)
23
{
24
InitializeParameters
();
25
}
26
27
//____________________________________________________________________________
28
int
PHG4VertexSelection::InitRun
(
PHCompositeNode
*
/*topNode*/
)
29
{
30
UpdateParametersWithMacro
();
31
32
// load parameters
33
m_vertex_zcut
=
get_double_param
(
"vertex_zcut"
);
34
35
// printout
36
std::cout
37
<<
"PHG4VertexSelection::InitRun\n"
38
<<
" m_vertex_zcut: "
<<
m_vertex_zcut
<<
" cm\n"
39
<< std::endl;
40
41
return
Fun4AllReturnCodes::EVENT_OK
;
42
}
43
44
//____________________________________________________________________________
45
int
PHG4VertexSelection::process_event
(
PHCompositeNode
*topNode)
46
{
47
// g4 truth info
48
auto
g4truthinfo = findNode::getClass<PHG4TruthInfoContainer>(topNode,
"G4TruthInfo"
);
49
50
// main vertex
51
const
auto
main_vertex_id = g4truthinfo->GetPrimaryVertexIndex();
52
const
auto
vertex = g4truthinfo->GetPrimaryVtx(main_vertex_id);
53
if
(!vertex)
return
false
;
54
55
// check vertex position along the beam
56
return
(
m_vertex_zcut
> 0 &&
std::abs
(vertex->get_z()) >
m_vertex_zcut
) ?
Fun4AllReturnCodes::DISCARDEVENT
:
Fun4AllReturnCodes::EVENT_OK
;
57
}
58
59
//___________________________________________________________________________
60
void
PHG4VertexSelection::SetDefaultParameters
()
61
{
62
set_default_double_param
(
"vertex_zcut"
, 10);
63
}
coresoftware
blob
master
simulation
g4simulation
g4main
PHG4VertexSelection.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:44
using
1.8.2 with
ECCE GitHub integration