ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
EFTracking
FPGATrackSim
FPGATrackSimInput
src
FPGATrackSimDumpOutputStatAlg.cxx
Go to the documentation of this file.
1
#include "
FPGATrackSimDumpOutputStatAlg.h
"
2
3
#include "
FPGATrackSimObjects/FPGATrackSimLogicalEventInputHeader.h
"
4
#include "
FPGATrackSimObjects/FPGATrackSimLogicalEventOutputHeader.h
"
5
#include "
FPGATrackSimObjects/FPGATrackSimTrack.h
"
6
#include "TH2F.h"
7
8
9
FPGATrackSimDumpOutputStatAlg::FPGATrackSimDumpOutputStatAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
10
AthAlgorithm
(name, pSvcLocator) {}
11
12
13
StatusCode
FPGATrackSimDumpOutputStatAlg::initialize
()
14
{
15
ATH_MSG_INFO
(
"FPGATrackSimDumpOutputStatAlg::initialize()"
);
16
ATH_CHECK
(
m_readOutputTool
.retrieve());
17
18
// TODO: This tool needs to be completely rewritten.
19
// It currently is assuming that there's (at least) one input branch and one output branch in the ROOT files it runs over.
20
// The changes we're making to split up the "main algorithm" will mean that's no longer the case.
21
if
(
m_inputBranchName
!=
""
) {
22
m_eventInputHeader
=
m_readOutputTool
->addInputBranch(
m_inputBranchName
,
false
);
23
}
24
if
(
m_outputBranchName
!=
""
) {
25
m_eventOutputHeader
=
m_readOutputTool
->addOutputBranch(
m_outputBranchName
,
false
);
26
}
27
28
// Hook up the branches for reading.
29
ATH_CHECK
(
m_readOutputTool
->configureReadBranches());
30
31
// Eventually add some histograms for monitoring
32
ATH_CHECK
(
BookHistograms
());
33
34
// TO DO: must register the histograms to the TFile in the Tool
35
return
StatusCode::SUCCESS;
36
}
37
38
39
StatusCode
FPGATrackSimDumpOutputStatAlg::BookHistograms
(){
40
//m_hits_r_vs_z = new TH2F("h_hits_r_vs_z", "r/z ITK hit map; z[mm];r[mm]", 3500, 0., 3500., 450, 0., 450.);
41
return
StatusCode::SUCCESS;
42
}
43
44
45
StatusCode
FPGATrackSimDumpOutputStatAlg::execute
(
const
EventContext&
/*ctx*/
) {
46
ATH_MSG_DEBUG
(
"Running on event "
);
47
48
bool
last=
false
;
49
ATH_CHECK
(
m_readOutputTool
->readData(last));
50
if
(last)
return
StatusCode::SUCCESS;
51
52
// Assuming we read in an input header... do this.
53
if
(
m_eventInputHeader
!=
nullptr
) {
54
ATH_MSG_VERBOSE
(&
m_eventInputHeader
);
55
}
56
57
// fill histograms, assuming we read in an output header (and if there are any to fill).
58
if
(
m_eventOutputHeader
!=
nullptr
) {
59
for
(
const
auto
& track :
m_eventOutputHeader
->getFPGATrackSimTracks_1st()) {
60
ATH_MSG_DEBUG
(track);
61
//commented out for future debugging
62
//float r= std::sqrt(hit.getX()*hit.getX() + hit.getY()*hit.getY());
63
//m_hits_r_vs_z->Fill(hit.getZ(), r);
64
}
65
66
for
(
const
auto
&track :
m_eventOutputHeader
->getFPGATrackSimTracks_2nd()) {
67
ATH_MSG_DEBUG
(track);
68
}
69
}
70
71
// TODO: I suppose the reason for this was that new histograms would get appended to the ROOT file.
72
// But... we don't currently make any, and so I'm not sure there's any reason to just copy the input objects to a new file.
73
//ATH_CHECK (m_writeOutputTool->writeData(&eventInputHeader_1st, &eventInputHeader_2nd, &eventOutputHeader) );
74
75
m_event
+= 1;
76
77
return
StatusCode::SUCCESS;
78
}
79
80
StatusCode
FPGATrackSimDumpOutputStatAlg::finalize
() {
81
ATH_MSG_INFO
(
"Processed "
<<
m_event
<<
" events."
);
82
return
StatusCode::SUCCESS;
83
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
FPGATrackSimDumpOutputStatAlg.h
FPGATrackSimLogicalEventInputHeader.h
FPGATrackSimLogicalEventOutputHeader.h
FPGATrackSimTrack.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
FPGATrackSimDumpOutputStatAlg::m_eventOutputHeader
FPGATrackSimLogicalEventOutputHeader * m_eventOutputHeader
Definition
FPGATrackSimDumpOutputStatAlg.h:35
FPGATrackSimDumpOutputStatAlg::m_event
unsigned m_event
Definition
FPGATrackSimDumpOutputStatAlg.h:38
FPGATrackSimDumpOutputStatAlg::BookHistograms
StatusCode BookHistograms()
Definition
FPGATrackSimDumpOutputStatAlg.cxx:39
FPGATrackSimDumpOutputStatAlg::m_readOutputTool
ToolHandle< FPGATrackSimOutputHeaderTool > m_readOutputTool
Definition
FPGATrackSimDumpOutputStatAlg.h:28
FPGATrackSimDumpOutputStatAlg::initialize
virtual StatusCode initialize() override
Definition
FPGATrackSimDumpOutputStatAlg.cxx:13
FPGATrackSimDumpOutputStatAlg::m_inputBranchName
Gaudi::Property< std::string > m_inputBranchName
Definition
FPGATrackSimDumpOutputStatAlg.h:31
FPGATrackSimDumpOutputStatAlg::FPGATrackSimDumpOutputStatAlg
FPGATrackSimDumpOutputStatAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
FPGATrackSimDumpOutputStatAlg.cxx:9
FPGATrackSimDumpOutputStatAlg::m_eventInputHeader
FPGATrackSimLogicalEventInputHeader * m_eventInputHeader
Definition
FPGATrackSimDumpOutputStatAlg.h:34
FPGATrackSimDumpOutputStatAlg::m_outputBranchName
Gaudi::Property< std::string > m_outputBranchName
Definition
FPGATrackSimDumpOutputStatAlg.h:32
FPGATrackSimDumpOutputStatAlg::finalize
virtual StatusCode finalize() override
Definition
FPGATrackSimDumpOutputStatAlg.cxx:80
FPGATrackSimDumpOutputStatAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
FPGATrackSimDumpOutputStatAlg.cxx:45
Generated on
for ATLAS Offline Software by
1.17.0