ATLAS Offline Software
JetCnvAlg.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // JetCnvAlg.cxx
8 // Implementation file for class JetCnvAlg
9 // Author: S.Binet<binet@cern.ch>
11 
12 #include "JetEvent/JetCollection.h"
13 
14 #include "xAODJet/JetContainer.h"
16 
17 // #include "xAOD"
18 // #include "Particle/TrackParticleContainer.h"
19 
20 // xAODJetCnv includes
21 #include "JetCnvAlg.h"
22 
23 // STL includes
24 
25 // FrameWork includes
26 #include "Gaudi/Property.h"
28 
29 
31 // Public methods:
33 
34 namespace xAODMaker {
35 // Constructors
37 JetCnvAlg::JetCnvAlg( const std::string& name,
38  ISvcLocator* pSvcLocator ) :
39  ::AthAlgorithm( name, pSvcLocator )
40  , m_inputJetCollectionName("AntiKt4LCTopoJets")
41  , m_xaodJetCollectionName("")
42  , m_constitContainerName("")
43  , m_cnvTool("xAODMaker::JetCnvTool/JetCnvTool")
44 {
45  //
46  // Property declaration
47  //
48  declareProperty( "InputJetCollection", m_inputJetCollectionName );
49  declareProperty( "xAODJetContainer", m_xaodJetCollectionName = "" );
50  declareProperty( "ConstituentContainer", m_constitContainerName = "");
51  declareProperty( "JetCnvTool", m_cnvTool);
52  declareProperty( "ConstitSearch", m_constitSearch = false);
53 }
54 
55 // Destructor
58 {}
59 
60 // Athena Algorithm's Hooks
63 {
64  ATH_MSG_INFO ("Initializing " << name() << "...");
65 
67 
68  CHECK( m_cnvTool.retrieve() );
69 
70  return StatusCode::SUCCESS;
71 }
72 
74 {
75  ATH_MSG_INFO ("Finalizing " << name() << "...");
76  return StatusCode::SUCCESS;
77 }
78 
79 
80 
82 {
83  ATH_MSG_DEBUG ("Executing " << name() << "...");
84  ATH_MSG_DEBUG( "Converting " << m_inputJetCollectionName << " into "<< m_xaodJetCollectionName );
85 
86  const JetCollection* inputJets=evtStore()->tryConstRetrieve<JetCollection>(m_inputJetCollectionName);
87  if (!inputJets) {
88  ATH_MSG_WARNING("No JetCollection with key " << m_inputJetCollectionName << " found. Do nothing.");
89  return StatusCode::SUCCESS;
90  }
91 
92  // Create the xAOD container and its auxiliary store:
93  xAOD::JetContainer* xaodJets = new xAOD::JetContainer();
94  CHECK( evtStore()->record( xaodJets, m_xaodJetCollectionName ) );
96  CHECK( evtStore()->record( auxJets, m_xaodJetCollectionName + "Aux." ) );
97  xaodJets->setStore( auxJets );
98  ATH_MSG_DEBUG( "Recorded xAOD jets with key: "
100 
101 
103  if( !constitContainer ) ATH_MSG_WARNING("User given jet constituent xAOD container : "<< m_constitContainerName <<" not in SG !");
104 
105  return m_cnvTool->convert(inputJets, xaodJets, constitContainer );
106 
107 
108 }
109 
110 
111 }
xAODMaker::JetCnvAlg::finalize
virtual StatusCode finalize()
Definition: JetCnvAlg.cxx:73
xAODMaker::JetCnvAlg::JetCnvAlg
JetCnvAlg()
Default constructor:
xAODMaker::JetCnvAlg::m_inputJetCollectionName
std::string m_inputJetCollectionName
Containers.
Definition: JetCnvAlg.h:66
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
xAOD::JetAuxContainer
JetAuxContainer_v1 JetAuxContainer
Definition of the current jet auxiliary container.
Definition: JetAuxContainer.h:22
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAODMaker::JetCnvAlg::m_constitContainerName
std::string m_constitContainerName
Definition: JetCnvAlg.h:68
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::JetCnvAlg::~JetCnvAlg
virtual ~JetCnvAlg()
Destructor:
Definition: JetCnvAlg.cxx:57
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
xAOD::JetAuxContainer_v1
Temporary container used until we have I/O for AuxStoreInternal.
Definition: JetAuxContainer_v1.h:37
JetCollection.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
xAODMaker::JetCnvAlg::m_xaodJetCollectionName
std::string m_xaodJetCollectionName
Definition: JetCnvAlg.h:67
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAODMaker::JetCnvAlg::execute
virtual StatusCode execute()
Definition: JetCnvAlg.cxx:81
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgorithm
Definition: AthAlgorithm.h:47
xAODMaker::JetCnvAlg::initialize
virtual StatusCode initialize()
Definition: JetCnvAlg.cxx:62
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
JetCnvAlg.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
xAODMaker::JetCnvAlg::m_constitSearch
bool m_constitSearch
Definition: JetCnvAlg.h:70
JetContainer.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
JetCollection
Container for Jets
Definition: JetCollection.h:30
JetAuxContainer.h
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition: JetContainer.h:17
xAODMaker::JetCnvAlg::m_cnvTool
ToolHandle< IJetCnvTool > m_cnvTool
Definition: JetCnvAlg.h:72