ATLAS Offline Software
FPGATrackSimDumpOutputStatAlg.cxx
Go to the documentation of this file.
2 
6 #include "TH2F.h"
7 
8 
9 FPGATrackSimDumpOutputStatAlg::FPGATrackSimDumpOutputStatAlg (const std::string& name, ISvcLocator* pSvcLocator) :
10  AthAlgorithm(name, pSvcLocator) {}
11 
12 
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
33 
34  // TO DO: must register the histograms to the TFile in the Tool
35  return StatusCode::SUCCESS;
36 }
37 
38 
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 
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) {
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()) {
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()) {
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 
81  ATH_MSG_INFO("Processed " << m_event << " events.");
82  return StatusCode::SUCCESS;
83 }
FPGATrackSimDumpOutputStatAlg.h
FPGATrackSimDumpOutputStatAlg::m_outputBranchName
Gaudi::Property< std::string > m_outputBranchName
Definition: FPGATrackSimDumpOutputStatAlg.h:32
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FPGATrackSimDumpOutputStatAlg::m_eventOutputHeader
FPGATrackSimLogicalEventOutputHeader * m_eventOutputHeader
Definition: FPGATrackSimDumpOutputStatAlg.h:35
FPGATrackSimDumpOutputStatAlg::m_inputBranchName
Gaudi::Property< std::string > m_inputBranchName
Definition: FPGATrackSimDumpOutputStatAlg.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
FPGATrackSimDumpOutputStatAlg::finalize
virtual StatusCode finalize() override
Definition: FPGATrackSimDumpOutputStatAlg.cxx:80
FPGATrackSimDumpOutputStatAlg::FPGATrackSimDumpOutputStatAlg
FPGATrackSimDumpOutputStatAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FPGATrackSimDumpOutputStatAlg.cxx:9
FPGATrackSimDumpOutputStatAlg::m_event
unsigned m_event
Definition: FPGATrackSimDumpOutputStatAlg.h:38
FPGATrackSimLogicalEventOutputHeader.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FPGATrackSimLogicalEventOutputHeader::getFPGATrackSimTracks_1st
std::vector< FPGATrackSimTrack > const & getFPGATrackSimTracks_1st() const
Definition: FPGATrackSimLogicalEventOutputHeader.h:35
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
FPGATrackSimDumpOutputStatAlg::m_eventInputHeader
FPGATrackSimLogicalEventInputHeader * m_eventInputHeader
Definition: FPGATrackSimDumpOutputStatAlg.h:34
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
FPGATrackSimDumpOutputStatAlg::m_readOutputTool
ToolHandle< FPGATrackSimOutputHeaderTool > m_readOutputTool
Definition: FPGATrackSimDumpOutputStatAlg.h:28
FPGATrackSimDumpOutputStatAlg::execute
virtual StatusCode execute() override
Definition: FPGATrackSimDumpOutputStatAlg.cxx:45
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
FPGATrackSimLogicalEventInputHeader.h
FPGATrackSimDumpOutputStatAlg::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimDumpOutputStatAlg.cxx:13
FPGATrackSimDumpOutputStatAlg::BookHistograms
StatusCode BookHistograms()
Definition: FPGATrackSimDumpOutputStatAlg.cxx:39
FPGATrackSimLogicalEventOutputHeader::getFPGATrackSimTracks_2nd
std::vector< FPGATrackSimTrack > const & getFPGATrackSimTracks_2nd() const
Definition: FPGATrackSimLogicalEventOutputHeader.h:41
FPGATrackSimTrack.h