ATLAS Offline Software
TrigEMClusterRetriever.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  TrigEMClusterRetriever::TrigEMClusterRetriever(const std::string& type, const std::string& name, const IInterface* parent):
19  m_typeName("Cluster")
20  {
21 
22  declareInterface<IDataRetriever>(this);
23 
24  declareProperty("StoreGateKey", m_sgKey = "HLT_TrigT2CaloEgamma",
25  "Storegate key for TrigEMClusters");
26  }
27 
28  //--------------------------------------------------------------------------
29 
30  StatusCode TrigEMClusterRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
31 
32  const TrigEMClusterContainer* tec;
33 
34  if ( evtStore()->retrieve(tec,m_sgKey).isFailure() ) {
35  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No TrigEMCluster found in SG at "
36  << m_sgKey << endmsg;
37  return StatusCode::SUCCESS;
38  }
39  int noClu = tec->size();
40 
41  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " Retrieving TrigEMCluster with size " << noClu << endmsg;
42 
43  DataVect et; et.reserve(noClu);
44  DataVect phi; phi.reserve(noClu);
45  DataVect eta; eta.reserve(noClu);
46  DataVect numCells; numCells.reserve(noClu);
47  DataVect cells; cells.reserve(noClu);
48  DataVect idVec; idVec.reserve(noClu);
49 
50  // cells n/a in AODs. This is necessary for compatibility
51  // with 'full' clusters in AtlantisJava: placeholders
52  int id = 0;
53  int nCells = 0;
54  std::string tagCells;
55  tagCells = "cells multiple=\"1.0\"";
56 
58  for (; cluster != tec->end(); ++cluster){
59  et.push_back(DataType((*cluster)->energy() / CLHEP::GeV));
60  eta.push_back(DataType((*cluster)->eta()));
61  phi.push_back(DataType((*cluster)->phi()));
62  idVec.push_back(DataType(++id));
63  cells.push_back(DataType( "0" )); // placeholder
64  numCells.push_back(DataType(nCells)); // placeholder
65  }
66 
67  DataMap myDataMap;
68  myDataMap["et"] = et;
69  myDataMap["phi"] = phi;
70  myDataMap["eta"] = eta;
71  myDataMap["id"] = idVec;
72  myDataMap[tagCells] = cells;
73  myDataMap["numCells"] = numCells;
74 
75  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< phi.size() << endmsg;
76 
77  //forward data to formating tool
78  return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
79  }
80 }
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
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.
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
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::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
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
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
JiveXML::TrigEMClusterRetriever::TrigEMClusterRetriever
TrigEMClusterRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: TrigEMClusterRetriever.cxx:17
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:21
TrigEMClusterRetriever.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
JiveXML::TrigEMClusterRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: TrigEMClusterRetriever.cxx:30
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
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
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
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.