ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1JetElementRetriever.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
13namespace JiveXML {
14
15 //--------------------------------------------------------------------------
16
17 LVL1JetElementRetriever::LVL1JetElementRetriever(const std::string& type, const std::string& name, const IInterface* parent):
18 AthAlgTool(type, name, 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 eta.push_back(DataType((*it)->eta()));
54 phi.push_back(DataType((*it)->phi()));
55 energy.push_back(DataType((*it)->energy()));
56 }//end JE iterator JE loop
57
58 DataMap myDataMap;
59 const auto nPhi = phi.size();
60 myDataMap["energy"] = std::move(energy);
61 myDataMap["phi"] = std::move(phi);
62 myDataMap["eta"] = std::move(eta);
63
64 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< nPhi << endmsg;
65
67 //return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
70 std::string emptyStr = "";
71 return FormatTool->AddToEvent(dataTypeName(), emptyStr, &myDataMap);
72 }
73}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define endmsg
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
Derived DataVector<T>.
Definition DataVector.h:795
size_type size() const noexcept
Returns the number of elements in the collection.
LVL1JetElementRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
std::string m_sgKey
The storegate key for the JetElements.
virtual std::string dataTypeName() const
Return the name of the data type.
const std::string m_typeName
The data type that is generated by this retriever.
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58