ATLAS Offline Software
xAODJetROIRetriever.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <string>
8 
9 #include "CLHEP/Units/SystemOfUnits.h"
10 
11 //#include "AnalysisTriggerEvent/LVL1_ROI.h"
12 
13 //#include "TrigT1CaloEvent/CPMRoI.h"
14 //#include "TrigT1Interfaces/CPRoIDecoder.h"
15 
17 
18 namespace JiveXML {
19 
20  //--------------------------------------------------------------------------
21 
22  xAODJetROIRetriever::xAODJetROIRetriever(const std::string& type, const std::string& name, const IInterface* parent):
23  AthAlgTool(type, name, parent), m_typeName("JetROI")
24  {
25 
26  declareInterface<IDataRetriever>(this);
27  }
28 
29  //--------------------------------------------------------------------------
30 
31  StatusCode xAODJetROIRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
32 
33  DataVect phi;
34  DataVect eta;
38 
40 
41  const xAOD::JetRoIContainer* jetROIs = 0;
42 
43  //xAOD::JetROIContainer* jetROIs = 0;
44 
45  // L1JetObject -not- available
46  m_sgKey = "LVL1JetRoIs";
47  if ( evtStore()->retrieve(jetROIs,m_sgKey).isFailure() ) {
48  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No LVL1JetROIs found in SG " << endmsg;
49  return StatusCode::SUCCESS;
50  }
51  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Found LVL1JetROIs in SG ! " << endmsg;
52 
54  xAOD::JetRoIContainer::const_iterator itJETe = jetROIs->end();
55 
56  //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "xAOD JetROIs retrieved from StoreGate with size: " << (JetROIs->size()) <<endmsg;
57 
58  int counter = 0;
59  for (; itJET != itJETe; ++itJET)
60  {
61  phi.push_back(DataType( (*itJET)->phi()) );
62  eta.push_back(DataType( (*itJET)->eta()) );
63 
64  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "xAOD JetROI #" << counter++
65  << ", eta: " << (*itJET)->eta() << ", phi: " << (*itJET)->phi() << endmsg;
66 
67 // Placeholders ! No direct access to those in Run-2
68 // Reference:
69 // Event/xAOD/xAODTrigger/trunk/Root/JetRoI_v2.cxx
70 // jpt 9Jan15:
71  energy.push_back(DataType( 0. ));
72  roiWord.push_back(DataType( 0. ));
73  thrPattern.push_back(DataType( 0. ));
74 
75 // Run-1: info from Alan Watson: pT is getET8x8();
76 // energy.push_back(DataType( itJET->pt()/1000. ));
78 // energy.push_back(DataType( (*itJET)->getET4x4()/1000. ));
79 // roiWord.push_back(DataType( (*itJET)->getRoI()));
80 // thrPattern.push_back(DataType( (*itJET)->getThrPattern()));
81 
82  }
83 
84  DataMap myDataMap;
85  myDataMap["phi"] = phi;
86  myDataMap["eta"] = eta;
87  myDataMap["energy"] = energy;
88  myDataMap["roiWord"] = roiWord;
89  myDataMap["thrPattern"] = thrPattern;
90 
91  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< phi.size()
92  << " from: " << m_sgKey << endmsg;
93 
94  //forward data to formating tool
95  return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
96  }
97 }
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
JiveXML::xAODJetROIRetriever::xAODJetROIRetriever
xAODJetROIRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: xAODJetROIRetriever.cxx:22
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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
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
xAODJetROIRetriever.h
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
JetRoIContainer.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
JiveXML::xAODJetROIRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: xAODJetROIRetriever.cxx:31
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
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
AthAlgTool
Definition: AthAlgTool.h:26
test_pyathena.counter
counter
Definition: test_pyathena.py:15
JiveXML::xAODJetROIRetriever::m_sgKey
std::string m_sgKey
Definition: xAODJetROIRetriever.h:50
JiveXML::xAODJetROIRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: xAODJetROIRetriever.h:43
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.