ATLAS Offline Software
Loading...
Searching...
No Matches
TrigEMClusterRetriever.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#include "CLHEP/Units/SystemOfUnits.h"
8#include <string>
9
10namespace JiveXML {
11
12 //--------------------------------------------------------------------------
13
14 TrigEMClusterRetriever::TrigEMClusterRetriever(const std::string& type, const std::string& name, const IInterface* parent):
15 AthAlgTool(type, name, parent),
16 m_typeName("Cluster")
17 {
18
19 declareInterface<IDataRetriever>(this);
20
21 declareProperty("StoreGateKey", m_sgKey = "HLT_TrigT2CaloEgamma",
22 "Storegate key for TrigEMClusters");
23 }
24
25 //--------------------------------------------------------------------------
26
27 StatusCode TrigEMClusterRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
28
29 const TrigEMClusterContainer* tec;
30
31 if ( evtStore()->retrieve(tec,m_sgKey).isFailure() ) {
32 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrigEMCluster found in SG at "
33 << m_sgKey << endmsg;
34 return StatusCode::SUCCESS;
35 }
36 int noClu = tec->size();
37
38 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " Retrieving TrigEMCluster with size " << noClu << endmsg;
39
40 DataVect et; et.reserve(noClu);
41 DataVect phi; phi.reserve(noClu);
42 DataVect eta; eta.reserve(noClu);
43 DataVect numCells; numCells.reserve(noClu);
44 DataVect cells; cells.reserve(noClu);
45 DataVect idVec; idVec.reserve(noClu);
46
47 // cells n/a in AODs. This is necessary for compatibility
48 // with 'full' clusters in AtlantisJava: placeholders
49 int id = 0;
50 int nCells = 0;
51 std::string tagCells;
52 tagCells = "cells multiple=\"1.0\"";
53
55 for (; cluster != tec->end(); ++cluster){
56 et.push_back(DataType((*cluster)->energy() / CLHEP::GeV));
57 eta.push_back(DataType((*cluster)->eta()));
58 phi.push_back(DataType((*cluster)->phi()));
59 idVec.push_back(DataType(++id));
60 cells.push_back(DataType( "0" )); // placeholder
61 numCells.push_back(DataType(nCells)); // placeholder
62 }
63
64 DataMap myDataMap;
65 const auto n = phi.size();
66 myDataMap["et"] = std::move(et);
67 myDataMap["phi"] = std::move(phi);
68 myDataMap["eta"] = std::move(eta);
69 myDataMap["id"] = std::move(idVec);
70 myDataMap[tagCells] = std::move(cells);
71 myDataMap["numCells"] = std::move(numCells);
72
73 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< n << endmsg;
74
75 //forward data to formating tool
76 return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
77 }
78}
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
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual std::string dataTypeName() const
Return the name of the data type.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
std::string m_sgKey
The storegate key for the TrigEMClusters.
const std::string m_typeName
The data type that is generated by this retriever.
TrigEMClusterRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
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
Extra patterns decribing particle interation process.