ATLAS Offline Software
ProtoTrackReportingAlg.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 
9 ActsTrk::ProtoTrackReportingAlg::ProtoTrackReportingAlg( const std::string& name, ISvcLocator* pSvcLocator ) : AthReentrantAlgorithm( name, pSvcLocator ){
10 }
11 
13  ATH_CHECK(m_EFTracks.initialize());
14  ATH_CHECK(m_xAODTracks.initialize());
15 
16 
17  return StatusCode::SUCCESS;
18 }
19 
20 
21 StatusCode ActsTrk::ProtoTrackReportingAlg::execute(const EventContext & ctx) const {
22 
23  auto trackContainerHandle = SG::makeHandle(m_EFTracks, ctx);
24  if (!trackContainerHandle.isValid())
25  {
26  ATH_MSG_FATAL("Failed to read EF track collection with key " << m_EFTracks.key());
27  return StatusCode::FAILURE;
28  }
29 
30  // Print the numberr of candidates we found in the Trk and the xAOD containers, as well as the
31  // properties of the xAOD candidates.
32  ATH_MSG_INFO("I found the track collection, with "<<trackContainerHandle->size()<<" entries");
33 
34 
35  auto xAODTrackHandle = SG::makeHandle(m_xAODTracks, ctx);
36  if (!xAODTrackHandle.isValid())
37  {
38  ATH_MSG_FATAL("Failed to read xAOD EF track collection with key " << m_xAODTracks.key());
39  return StatusCode::FAILURE;
40  }
41  ATH_MSG_INFO("I found the xAOD track collection, with "<<xAODTrackHandle->size()<<" entries");
42  for (const xAOD::TrackParticle* t : *xAODTrackHandle){
43  ATH_MSG_INFO("-----------------------------");
44  auto param = t->perigeeParameters();
45  ATH_MSG_INFO("xAOD Track param: d0 "<<t->d0()<<" z0 "<<t->z0()<<" pt "<<t->pt()<<" eta "<<t->eta()<<" phi "<<t->phi());
46 
47  }
48 
49 
50  return StatusCode::SUCCESS;
51 }
52 
53 
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ProtoTrackReportingAlg.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::ProtoTrackReportingAlg::ProtoTrackReportingAlg
ProtoTrackReportingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ProtoTrackReportingAlg.cxx:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ActsTrk::ProtoTrackReportingAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: ProtoTrackReportingAlg.cxx:21
EventInfo.h
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ActsTrk::ProtoTrackReportingAlg::initialize
virtual StatusCode initialize() override final
uncomment and implement methods as required
Definition: ProtoTrackReportingAlg.cxx:12