ATLAS Offline Software
TauJetReaderAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: TauJetReaderAlg.cxx 632174 2014-11-29 15:23:36Z krasznaa $
6 
7 // EDM include(s):
9 
10 // Local include(s):
11 #include "TauJetReaderAlg.h"
12 
13 namespace xAODMaker {
14 
16  ISvcLocator* svcLoc )
17  : ::AthAlgorithm( name, svcLoc ) {
18 
19  declareProperty( "SGKey", m_sgKey = "TauRecContainer",
20  "StoreGate key of the container to test" );
21  }
22 
24 
25  // Greet the user:
26  ATH_MSG_INFO( "Initialising" );
27  ATH_MSG_DEBUG( "SGKey = " << m_sgKey );
28 
29  // Return gracefully:
30  return StatusCode::SUCCESS;
31  }
32 
34 
35  // Retrieve the tau container:
36  const xAOD::TauJetContainer* taus = nullptr;
37  ATH_CHECK( evtStore()->retrieve( taus, m_sgKey ) );
38 
39  // Print some info about them:
40  ATH_MSG_INFO( "Number of tau jets: " << taus->size() );
41 
42  // Loop over them, printing some info about each of them:
43  for( const xAOD::TauJet* tau : *taus ) {
44 
45  // Print its 4-momentum:
46  ATH_MSG_DEBUG( " pt = " << tau->pt() << ", eta = " << tau->eta()
47  << ", phi = " << tau->phi() << ", m = " << tau->m() );
48 
49  }
50 
51  // Return gracefully:
52  return StatusCode::SUCCESS;
53  }
54 
55 } // namespace xAODMaker
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::TauJetReaderAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: TauJetReaderAlg.cxx:33
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
xAODMaker::TauJetReaderAlg::m_sgKey
std::string m_sgKey
The StoreGate key of the container to be tested.
Definition: TauJetReaderAlg.h:39
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
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
xAODMaker::TauJetReaderAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: TauJetReaderAlg.cxx:23
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TauJetContainer.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TauJetReaderAlg.h
xAODMaker::TauJetReaderAlg::TauJetReaderAlg
TauJetReaderAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition: TauJetReaderAlg.cxx:15
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.