ATLAS Offline Software
Loading...
Searching...
No Matches
TrigFPGATrackSimRawHitsWrapperAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8#include "TFile.h"
9#include "TTree.h"
10#include "TH2F.h"
11
13
14
15TrigFPGATrackSimRawHitsWrapperAlg::TrigFPGATrackSimRawHitsWrapperAlg(const std::string& name, ISvcLocator* pSvcLocator) :
16 AthAlgorithm(name, pSvcLocator)
17{}
18
19
21{
22 ATH_MSG_DEBUG("TrigFPGATrackSimRawHitsWrapperAlg::initialize()");
23
24
25 ATH_CHECK(m_hitInputTool.retrieve());
26 ATH_MSG_DEBUG("Setting FPGATrackSim_SGHitInput tool");
27
28 ATH_MSG_INFO("Creating output file: " << m_outpath);
29 TNamed meta("metadata",m_metaData.value().c_str());
30 m_outfile = TFile::Open(m_outpath.value().c_str(), "recreate");
31 meta.Write();
33
34 ATH_MSG_DEBUG("instantiating tree");
35 m_EventTree = new TTree("FPGATrackSimEventTree", "data");
36
37 ATH_MSG_DEBUG("Setting branch");
38 m_EventTree->Branch("FPGATrackSimEventInputHeader",
39 "FPGATrackSimEventInputHeader",
40 &m_eventHeader, 6400, 1);
41
42 ATH_MSG_DEBUG("Finished initialize");
43
44 return StatusCode::SUCCESS;
45}
46
47
48StatusCode TrigFPGATrackSimRawHitsWrapperAlg::execute(const EventContext& ctx) {
49 ATH_MSG_DEBUG("Running on event ");
50
51 ATH_CHECK(m_eventHeader != nullptr);
52 ATH_CHECK(m_hitInputTool->readData(m_eventHeader, ctx));
53 m_EventTree->Fill();
54 return StatusCode::SUCCESS;
55
56}
57
58
60{
61 // close the output files, but check that it exists (for athenaMP)
62 if (m_outfile) {
63 m_outfile->Write();
64 m_outfile->Close();
65 }
66 delete m_eventHeader;
67 return StatusCode::SUCCESS;
68}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
ToolHandle< IFPGATrackSimInputTool > m_hitInputTool
TrigFPGATrackSimRawHitsWrapperAlg(const std::string &name, ISvcLocator *pSvcLocator)
-diff