ATLAS Offline Software
Loading...
Searching...
No Matches
MuonROIRetriever.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 MuonROIRetriever::MuonROIRetriever(const std::string& type, const std::string& name, const IInterface* parent):
18 AthAlgTool(type, name, parent),
19 m_typeName("MuonROI")
20 {
21
22 declareInterface<IDataRetriever>(this);
23
24 declareProperty("StoreGateKey", m_sgKey = "LVL1_ROI",
25 "Storegate key for ROIs incl MuonROIs");
26 }
27
28 //--------------------------------------------------------------------------
29
30 StatusCode MuonROIRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
31
32 const LVL1_ROI * roi;
33
34 if ( evtStore()->retrieve(roi,m_sgKey).isFailure() ) {
35 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "No MuonROI found in SG at "
36 << m_sgKey << endmsg;
37 return StatusCode::SUCCESS;
38 }
39 int noRois = roi->getMuonROIs().size();
40
41 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " Retrieving MuonROIs with size " << noRois << endmsg;
42
43 DataVect phi; phi.reserve(noRois);
44 DataVect eta; eta.reserve(noRois);
45 DataVect roiWord; roiWord.reserve(noRois);
46 DataVect thrNumber; thrNumber.reserve(noRois);
47 DataVect thrName; thrName.reserve(noRois);
48 DataVect thrValue; thrValue.reserve(noRois);
49 DataVect energy; energy.reserve(noRois);
50
51 LVL1_ROI::muons_type::const_iterator itMU = (roi->getMuonROIs()).begin();
52 LVL1_ROI::muons_type::const_iterator itMUe = (roi->getMuonROIs()).end();
53
54 for (; itMU != itMUe; ++itMU){
55 phi.push_back(DataType( itMU->phi()));
56 eta.push_back(DataType( itMU->eta()));
57 roiWord.push_back(DataType( itMU->getROIWord()));
58 thrNumber.push_back(DataType( itMU->getThrNumber()));
59
60 // prevent empty threshold name list
61 std::string thisThrName = itMU->getThrName();
62 if (thisThrName.empty()){ thisThrName = "empty"; };
63 thrName.push_back(DataType( std::move(thisThrName) ));
64
65 thrValue.push_back(DataType( itMU->getThrValue()));
66 energy.push_back(DataType( itMU->getThrValue()/CLHEP::GeV));
67 }
68
69 DataMap myDataMap;
70 const auto nPhi = phi.size();
71 myDataMap["phi"] = std::move(phi);
72 myDataMap["eta"] = std::move(eta);
73 myDataMap["roiWord"] = std::move(roiWord);
74 myDataMap["thrNumber"] = std::move(thrNumber);
75 myDataMap["thrName"] = std::move(thrName);
76 myDataMap["thrValue"] = std::move(thrValue);
77 myDataMap["energy"] = std::move(energy);
78
79 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< nPhi << endmsg;
80
81 //forward data to formating tool
82 return FormatTool->AddToEvent(dataTypeName(), m_sgKey, &myDataMap);
83 }
84}
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
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
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.
MuonROIRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
std::string m_sgKey
The storegate key for the MuonROIs.
Top level AOD object storing LVL1 RoIs.
Definition LVL1_ROI.h:43
const muons_type & getMuonROIs() const
Get all the muon RoIs in the event.
Definition LVL1_ROI.h:63
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