ATLAS Offline Software
xAODEmTauROIRetriever.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <string>
8 
9 #include "CLHEP/Units/SystemOfUnits.h"
10 
12 
13 namespace JiveXML {
14 
15  //--------------------------------------------------------------------------
16 
17  xAODEmTauROIRetriever::xAODEmTauROIRetriever(const std::string& type, const std::string& name, const IInterface* parent):
18  AthAlgTool(type, name, parent), m_typeName("EmTauROI")
19  {
20 
21  declareInterface<IDataRetriever>(this);
22  }
23 
24  //--------------------------------------------------------------------------
25 
26  StatusCode xAODEmTauROIRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
27 
28  DataVect phi;
29  DataVect eta;
31  DataVect energyEM;
32  DataVect energyTAU;
35 
37 
38  const xAOD::EmTauRoIContainer* emTauRoIs = 0;
39 
40 
41  // L1JetObject -not- available
42  m_sgKey = "LVL1EmTauRoIs";
43  if ( evtStore()->retrieve(emTauRoIs,m_sgKey).isFailure() ) {
44  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No LVL1EmTauROIs found in SG " << endmsg;
45  return StatusCode::SUCCESS;
46  }
47  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found LVL1EmTauROIs in SG ! " << endmsg;
48 
50  xAOD::EmTauRoIContainer::const_iterator itEMe = emTauRoIs->end();
51 
52 
53  int counter = 0;
54  for (; itEM != itEMe; ++itEM)
55  {
56  phi.push_back(DataType( (*itEM)->phi()) );
57  eta.push_back(DataType( (*itEM)->eta()) );
58 
59  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "xAOD EmTauRoI #" << counter++
60  << ", eta: " << (*itEM)->eta() << ", phi: " << (*itEM)->phi() << endmsg;
61 
62 // Placeholders ! No direct access to those in Run-2
63 // Reference:
64 // Event/xAOD/xAODTrigger/trunk/Root/EmTauRoI_v2.cxx
65 // jpt 9Jan15:
66  energy.push_back(DataType( 0. ));
67  energyEM.push_back(DataType( 0. ));
68  energyTAU.push_back(DataType( 0. ));
69  roiWord.push_back(DataType( 0. ));
70  thrPattern.push_back(DataType( 0. ));
71  }
72 
73  DataMap myDataMap;
74  const auto nPhi = phi.size();
75  myDataMap["energy"] = energy;
76  myDataMap["phi"] = std::move(phi);
77  myDataMap["eta"] = std::move(eta);
78  myDataMap["energy"] = std::move(energy);
79  myDataMap["energyEM"] = std::move(energyEM);
80  myDataMap["energyTAU"] = std::move(energyTAU);
81  myDataMap["roiWord"] = std::move(roiWord);
82  myDataMap["thrPattern"] = std::move(thrPattern);
83 
84  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< nPhi
85  << " from: " << m_sgKey << endmsg;
86 
87  //forward data to formating tool
88  return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
89  }
90 }
JiveXML::xAODEmTauROIRetriever::m_sgKey
std::string m_sgKey
Definition: xAODEmTauROIRetriever.h:50
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
JiveXML::DataVect
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition: DataType.h:58
DataType
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
Definition: RoIBResultByteStreamTool.cxx:25
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition: DataType.h:59
TrigVSI::AlgConsts::nPhi
constexpr int nPhi
Default bin number of phi for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:27
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
JiveXML::xAODEmTauROIRetriever::xAODEmTauROIRetriever
xAODEmTauROIRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: xAODEmTauROIRetriever.cxx:17
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition: test_pyathena.py:15
JiveXML::xAODEmTauROIRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: xAODEmTauROIRetriever.h:43
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
EmTauRoIContainer.h
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
xAOD::thrPattern
thrPattern
Definition: EmTauRoI_v2.cxx:60
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
JiveXML::xAODEmTauROIRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: xAODEmTauROIRetriever.cxx:26
xAODEmTauROIRetriever.h
AthAlgTool
Definition: AthAlgTool.h:26
test_pyathena.counter
counter
Definition: test_pyathena.py:15
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.