Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
TrackingIterationCounter.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TrackingIterationCounter.cc
1
#include "
TrackingIterationCounter.h
"
2
3
#include <
trackbase/TrkrClusterIterationMapv1.h
>
4
#include <
trackbase/TrkrDefs.h
>
5
6
#include <
trackbase_historic/SvtxTrack.h
>
7
#include <
trackbase_historic/SvtxTrackMap.h
>
8
#include <
trackbase_historic/TrackSeed.h
>
9
10
#include <
fun4all/Fun4AllReturnCodes.h
>
11
#include <
phool/PHCompositeNode.h
>
12
#include <
phool/PHDataNode.h
>
13
#include <
phool/PHNode.h
>
14
#include <
phool/PHNodeIterator.h
>
15
#include <
phool/PHObject.h
>
16
#include <
phool/PHTimer.h
>
17
#include <
phool/getClass.h
>
18
#include <
phool/phool.h
>
19
//____________________________________________________________________________..
20
TrackingIterationCounter::TrackingIterationCounter
(
const
std::string
&
name
)
21
:
SubsysReco
(name)
22
{
23
}
24
25
//____________________________________________________________________________..
26
TrackingIterationCounter::~TrackingIterationCounter
()
27
{
28
}
29
30
//____________________________________________________________________________..
31
int
TrackingIterationCounter::Init
(
PHCompositeNode
*)
32
{
33
return
Fun4AllReturnCodes::EVENT_OK
;
34
}
35
36
//____________________________________________________________________________..
37
int
TrackingIterationCounter::InitRun
(
PHCompositeNode
*topNode)
38
{
39
int
val =
getNodes
(topNode);
40
if
(val !=
Fun4AllReturnCodes::EVENT_OK
)
41
{
42
return
Fun4AllReturnCodes::ABORTEVENT
;
43
}
44
45
val =
createNodes
(topNode);
46
return
val;
47
}
48
49
//____________________________________________________________________________..
50
int
TrackingIterationCounter::process_event
(
PHCompositeNode
*)
51
{
52
for
(
const
auto
&[key, track] : *
m_trackMap
)
53
{
54
auto
silseed = track->get_silicon_seed();
55
auto
tpcseed = track->get_tpc_seed();
56
if
(silseed)
57
{
58
addClustersToIterationMap
(silseed);
59
}
60
if
(tpcseed)
61
{
62
addClustersToIterationMap
(tpcseed);
63
}
64
}
65
66
return
Fun4AllReturnCodes::EVENT_OK
;
67
}
68
69
void
TrackingIterationCounter::addClustersToIterationMap
(
TrackSeed
*
seed
)
70
{
71
for
(
auto
clusIter = seed->
begin_cluster_keys
();
72
clusIter != seed->
end_cluster_keys
();
73
++clusIter)
74
{
75
TrkrDefs::cluskey
key = *clusIter;
76
m_iterMap
->
addIteration
(key,
m_iteration
);
77
}
78
}
79
80
//____________________________________________________________________________..
81
int
TrackingIterationCounter::End
(
PHCompositeNode
*)
82
{
83
return
Fun4AllReturnCodes::EVENT_OK
;
84
}
85
int
TrackingIterationCounter::createNodes
(
PHCompositeNode
*topNode)
86
{
87
PHNodeIterator
iter(topNode);
88
89
PHCompositeNode
*dstNode =
dynamic_cast<
PHCompositeNode
*
>
(iter.
findFirst
(
"PHCompositeNode"
,
"DST"
));
90
91
if
(!dstNode)
92
{
93
std::cerr <<
"DST node is missing, quitting"
<< std::endl;
94
throw
std::runtime_error(
"Failed to find DST node in PHActsTrkFitter::createNodes"
);
95
}
96
97
PHNodeIterator
dstIter(topNode);
98
PHCompositeNode
*svtxNode =
dynamic_cast<
PHCompositeNode
*
>
(dstIter.
findFirst
(
"PHCompositeNode"
,
"SVTX"
));
99
100
if
(!svtxNode)
101
{
102
svtxNode =
new
PHCompositeNode
(
"SVTX"
);
103
dstNode->
addNode
(svtxNode);
104
}
105
106
m_iterMap
= findNode::getClass<TrkrClusterIterationMap>(topNode,
"TrkrClusterIterationMap"
);
107
if
(!
m_iterMap
)
108
{
109
m_iterMap
=
new
TrkrClusterIterationMapv1
;
110
auto
node
=
111
new
PHIODataNode<PHObject>
(
m_iterMap
,
"TrkrClusterIterationMap"
,
"PHObject"
);
112
svtxNode->
addNode
(
node
);
113
}
114
115
return
Fun4AllReturnCodes::EVENT_OK
;
116
}
117
int
TrackingIterationCounter::getNodes
(
PHCompositeNode
*topNode)
118
{
119
m_trackMap
= findNode::getClass<SvtxTrackMap>(topNode,
"SvtxTrackMap"
);
120
if
(!
m_trackMap
)
121
{
122
std::cout <<
PHWHERE
<<
"No track map, bailing. "
<< std::endl;
123
return
Fun4AllReturnCodes::ABORTEVENT
;
124
}
125
126
return
Fun4AllReturnCodes::EVENT_OK
;
127
}
coresoftware
blob
master
offline
packages
trackreco
TrackingIterationCounter.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:11
using
1.8.2 with
sPHENIX GitHub integration