ATLAS Offline Software
LVL1JetElementRetriever.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 
12 
13 namespace JiveXML {
14 
15  //--------------------------------------------------------------------------
16 
17  LVL1JetElementRetriever::LVL1JetElementRetriever(const std::string& type, const std::string& name, const IInterface* parent):
19  m_typeName("LVL1JetElement")
20  {
21 
22  declareInterface<IDataRetriever>(this);
23 
24  declareProperty("StoreGateKey", m_sgKey = "JetElements",
25  "Storegate key for Level-1 Jet Elements");
26  }
27 
28  //--------------------------------------------------------------------------
29 
30  StatusCode LVL1JetElementRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
31 
32  // taken from TrigT1Calo/Tester.cxx
33 
34  typedef DataVector<LVL1::JetElement> t_JECollection ;
35  const t_JECollection* JEVector;
36 
37  if ( evtStore()->retrieve(JEVector,m_sgKey).isFailure() ) {
38  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No Level-1 Jet Elements found in SG at "
39  << m_sgKey << endmsg;
40  return StatusCode::SUCCESS;
41  }
42  int noJE = JEVector->size();
43 
44  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " Retrieving Level-1 Jet Elements with size " << noJE << endmsg;
45 
46  DataVect phi; phi.reserve(noJE);
47  DataVect eta; eta.reserve(noJE);
48  DataVect energy; energy.reserve(noJE);
49 
50  t_JECollection::const_iterator it ;
51 
52  for( it = JEVector->begin(); it < JEVector->end(); ++it ){
53  // log << MSG::DEBUG <<" Lvl1 JE coords ("<<(*it)->phi()<<", "<<(*it)->eta()
54  // << " and energies : "<<(*it)->energy()<<endmsg;
55  eta.push_back(DataType((*it)->eta()));
56  phi.push_back(DataType((*it)->phi()));
57  energy.push_back(DataType((*it)->energy()));
58  }//end JE iterator JE loop
59 
60  DataMap myDataMap;
61  myDataMap["energy"] = energy;
62  myDataMap["phi"] = phi;
63  myDataMap["eta"] = eta;
64 
65  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< phi.size() << endmsg;
66 
68  //return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
71  std::string emptyStr = "";
72  return FormatTool->AddToEvent(dataTypeName(), emptyStr, &myDataMap);
73  }
74 }
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JiveXML::DataVect
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition: DataType.h:58
JiveXML::LVL1JetElementRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: LVL1JetElementRetriever.h:28
DataType
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
Definition: RoIBResultByteStreamTool.cxx:25
skel.it
it
Definition: skel.GENtoEVGEN.py:423
JiveXML::LVL1JetElementRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: LVL1JetElementRetriever.cxx:30
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
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
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
JiveXML::LVL1JetElementRetriever::LVL1JetElementRetriever
LVL1JetElementRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: LVL1JetElementRetriever.cxx:17
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector< LVL1::JetElement >
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
LVL1JetElementRetriever.h
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
JiveXML::LVL1JetElementRetriever::m_sgKey
std::string m_sgKey
The storegate key for the JetElements.
Definition: LVL1JetElementRetriever.h:36
AthAlgTool
Definition: AthAlgTool.h:26
JetElement.h