ATLAS Offline Software
RoiB2TopoInputDataCnv.cxx
Go to the documentation of this file.
1 /*//////////////////////// -*- C++ -*- ///////////////////////////// */
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 /*
8  RoiB2TopoInputDataCnv.cxx
9  Implementation file for class RoiB2TopoInputDataCnv
10 */
11 
12 #include "RoiB2TopoInputDataCnv.h"
14 
15 #include "Gaudi/Property.h"
16 
18 
19 
20 // Constructor
22  ISvcLocator* pSvcLocator ) :
23  ::AthReentrantAlgorithm( name, pSvcLocator ),
24  m_datamaker( new LVL1::L1TopoDataMaker() ),
25  m_roibLocation( "RoIBResult" ),
26  m_emTauLocation( TrigT1CaloDefs::EmTauTopoTobLocation ),
27  m_jetLocation(TrigT1CaloDefs::JetTopoTobLocation),
28  m_energyLocation(TrigT1CaloDefs::EnergyTopoDataLocation)
29 {
30  declareProperty( "ROIBResultLocation", m_roibLocation, "Storegate key for the reading the ROIBResult" );
31  declareProperty( "EmTauROILocation", m_emTauLocation, "Storegate key for the writing EMTAU info" );
32  declareProperty( "JetROILocation", m_jetLocation, "Storegate key for writing the Jet ROIs" );
33  declareProperty( "EnergyROILocation", m_energyLocation, "Storegate key for writing the Topo Energy ROI" );
34 }
35 
36 
37 // Destructor
39 {
40  delete m_datamaker;
41 }
42 
45 {
46  ATH_CHECK(m_roibLocation.initialize());
47  ATH_CHECK(m_emTauLocation.initialize());
48  ATH_CHECK(m_jetLocation.initialize());
49  ATH_CHECK(m_energyLocation.initialize());
50 
51  return StatusCode::SUCCESS;
52 }
53 
55 LVL1::RoiB2TopoInputDataCnv::execute (const EventContext& ctx) const
56 {
57  ATH_MSG_DEBUG ("Executing " << name() << "...");
58 
59  SG::ReadHandle<ROIB::RoIBResult> roibResult(m_roibLocation, ctx);
60 
61  if( !roibResult.isValid() ) {
62  ATH_MSG_WARNING("No RoIBResults with SG key '" << m_roibLocation.key() << "' found in the event. Can not create any information needed for L1Topo simulation.");
63  return StatusCode::RECOVERABLE;
64  }
65 
66  SG::WriteHandle<DataVector<CPCMXTopoData>> emtauTopoData(m_emTauLocation, ctx);
67  // emtau
68  if(emtauTopoData.isPresent()) {
69  ATH_MSG_WARNING("DataVector<CPCMXTopoData> with SG key '" << m_emTauLocation.key() << "' already exists in SG, will not create a new one.");
70  } else {
71  ATH_MSG_DEBUG("Recording DataVector<CPCMXTopoData> with SG key '" << m_emTauLocation.key() << "'.");
73  m_datamaker->makeCPCMXTopoData(roibResult.cptr(), emtauTopoData.ptr());
74  }
75 
76  // jet
77  SG::WriteHandle<DataVector<JetCMXTopoData>> jetTopoData(m_jetLocation, ctx);
78  if(jetTopoData.isPresent()) {
79  ATH_MSG_WARNING("DataVector<JetCMXTopoData> with SG key '" << m_jetLocation.key() << "' already exists in SG, will not create a new one.");
80  } else {
81  ATH_MSG_DEBUG("Recording DataVector<JetCMXTopoData> with SG key '" << m_jetLocation.key() << "'.");
83  m_datamaker->makeJetCMXTopoData(roibResult.cptr(), jetTopoData.ptr());
84  }
85 
86  // energy
87  SG::WriteHandle<EnergyTopoData> energyTopoData(m_energyLocation, ctx);
88  if(energyTopoData.isPresent()) {
89  ATH_MSG_WARNING("EnergyTopoData with SG key '" << m_energyLocation.key() << "' already exists in SG, will not create a new one.");
90  } else {
91  ATH_MSG_DEBUG("Recording EnergyTopoData with SG key '" << m_energyLocation.key() << "'.");
92  ATH_CHECK(energyTopoData.record(std::make_unique<EnergyTopoData>()));
93  m_datamaker->makeEnergyTopoData(roibResult.cptr(), energyTopoData.ptr());
94  }
95 
96  return StatusCode::SUCCESS;
97 }
98 
LVL1::RoiB2TopoInputDataCnv::initialize
virtual StatusCode initialize() override
Definition: RoiB2TopoInputDataCnv.cxx:44
LVL1::RoiB2TopoInputDataCnv::m_energyLocation
SG::WriteHandleKey< EnergyTopoData > m_energyLocation
Definition: RoiB2TopoInputDataCnv.h:52
LVL1::RoiB2TopoInputDataCnv::~RoiB2TopoInputDataCnv
virtual ~RoiB2TopoInputDataCnv()
Definition: RoiB2TopoInputDataCnv.cxx:38
LVL1::RoiB2TopoInputDataCnv::m_jetLocation
SG::WriteHandleKey< DataVector< JetCMXTopoData > > m_jetLocation
Definition: RoiB2TopoInputDataCnv.h:51
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
make_unique
std::unique_ptr< T > make_unique(Args &&... args)
Definition: SkimmingToolEXOT5.cxx:23
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
L1TopoDataMaker.h
RoiB2TopoInputDataCnv.h
LVL1::L1TopoDataMaker
Definition: L1TopoDataMaker.h:34
LVL1::RoiB2TopoInputDataCnv::RoiB2TopoInputDataCnv
RoiB2TopoInputDataCnv()
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LVL1::RoiB2TopoInputDataCnv::m_emTauLocation
SG::WriteHandleKey< DataVector< CPCMXTopoData > > m_emTauLocation
Definition: RoiB2TopoInputDataCnv.h:50
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigConf::name
Definition: HLTChainList.h:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigT1CaloDefs.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
LVL1::TrigT1CaloDefs
Definition: TrigT1CaloDefs.h:24
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
LVL1::RoiB2TopoInputDataCnv::m_roibLocation
SG::ReadHandleKey< ROIB::RoIBResult > m_roibLocation
Definition: RoiB2TopoInputDataCnv.h:49
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:397
LVL1::RoiB2TopoInputDataCnv::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: RoiB2TopoInputDataCnv.cxx:55