ATLAS Offline Software
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 
10 namespace JiveXML {
11 
12  //--------------------------------------------------------------------------
13 
14  TrigEMClusterRetriever::TrigEMClusterRetriever(const std::string& type, const std::string& name, const IInterface* 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 }
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:281
JiveXML::TrigEMClusterRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: TrigEMClusterRetriever.h:28
et
Extra patterns decribing particle interation process.
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
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::TrigEMClusterRetriever::m_sgKey
std::string m_sgKey
The storegate key for the TrigEMClusters.
Definition: TrigEMClusterRetriever.h:36
TrigEMClusterContainer.h
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
TrigEMClusterContainer
Container from TrigEMCluster type objects.
Definition: Trigger/TrigEvent/TrigCaloEvent/TrigCaloEvent/TrigEMClusterContainer.h:32
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
xAOD::nCells
setRawEt setRawPhi nCells
Definition: TrigCaloCluster_v1.cxx:33
beamspotman.n
n
Definition: beamspotman.py:727
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
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
test_pyathena.parent
parent
Definition: test_pyathena.py:15
JiveXML::TrigEMClusterRetriever::TrigEMClusterRetriever
TrigEMClusterRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: TrigEMClusterRetriever.cxx:14
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:22
TrigEMClusterRetriever.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
JiveXML::TrigEMClusterRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: TrigEMClusterRetriever.cxx:27
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
xAOD::TauJetParameters::numCells
@ numCells
Definition: TauDefs.h:171
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
AthAlgTool
Definition: AthAlgTool.h:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.