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#include "GaudiKernel/ThreadLocalContext.h"
8
9#include "TFile.h"
10#include "TTree.h"
11#include "TH2F.h"
12
14
15
16TrigFPGATrackSimRawHitsWrapperAlg::TrigFPGATrackSimRawHitsWrapperAlg(const std::string& name, ISvcLocator* pSvcLocator) :
17 AthAlgorithm(name, pSvcLocator)
18{}
19
20
22{
23 ATH_MSG_DEBUG("TrigFPGATrackSimRawHitsWrapperAlg::initialize()");
24
25
26 ATH_CHECK(m_hitInputTool.retrieve());
27 ATH_MSG_DEBUG("Setting FPGATrackSim_SGHitInput tool");
28
29 ATH_MSG_INFO("Creating output file: " << m_outpath);
30 TNamed meta("metadata",m_metaData.value().c_str());
31 m_outfile = TFile::Open(m_outpath.value().c_str(), "recreate");
32 meta.Write();
34
35 ATH_MSG_DEBUG("instantiating tree");
36 m_EventTree = new TTree("FPGATrackSimEventTree", "data");
37
38 ATH_MSG_DEBUG("Setting branch");
39 m_EventTree->Branch("FPGATrackSimEventInputHeader",
40 "FPGATrackSimEventInputHeader",
41 &m_eventHeader, 6400, 1);
42
43 ATH_MSG_DEBUG("Finished initialize");
44
45 return StatusCode::SUCCESS;
46}
47
48
50 ATH_MSG_DEBUG("Running on event ");
51
52 ATH_CHECK(m_eventHeader != nullptr);
53 ATH_CHECK(m_hitInputTool->readData(m_eventHeader, Gaudi::Hive::currentContext()));
54 m_EventTree->Fill();
55 return StatusCode::SUCCESS;
56
57}
58
59
61{
62 // close the output files, but check that it exists (for athenaMP)
63 if (m_outfile) {
64 m_outfile->Write();
65 m_outfile->Close();
66 }
67 delete m_eventHeader;
68 return StatusCode::SUCCESS;
69}
#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 with parameters:
ToolHandle< IFPGATrackSimInputTool > m_hitInputTool
TrigFPGATrackSimRawHitsWrapperAlg(const std::string &name, ISvcLocator *pSvcLocator)
-diff