ATLAS Offline Software
Loading...
Searching...
No Matches
TrigMuonROIRetriever.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 "CLHEP/Units/SystemOfUnits.h"
8
9namespace JiveXML {
10
11 //--------------------------------------------------------------------------
12
13 TrigMuonROIRetriever::TrigMuonROIRetriever(const std::string& type, const std::string& name, const IInterface* parent):
14 AthAlgTool(type, name, parent)
15 {
16
17 declareInterface<IDataRetriever>(this);
18
19 }
20
21 //--------------------------------------------------------------------------
22
23 StatusCode TrigMuonROIRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
24
25 //be verbose
26 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg;
27
29
30 int nRoIs = roi->getMuonROIs().size();
31
32 DataVect phi; phi.reserve(nRoIs);
33 DataVect eta; eta.reserve(nRoIs);
34 DataVect energy; energy.reserve(nRoIs);
35 DataVect roiWord; roiWord.reserve(nRoIs);
36 DataVect thrNumber; thrNumber.reserve(nRoIs);
37 DataVect thrName; thrName.reserve(nRoIs);
38 DataVect thrValue; thrValue.reserve(nRoIs);
39
40 // Class: PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent/Muon_ROI.h
41 // Access as in: PhysicsAnalysis/AnalysisCommon/AnalysisTest/ReadTrigger
42 // Tested with: AnalysisTest/share/AODTriggerRead_topOptions.py
43
44 LVL1_ROI::muons_type::const_iterator itMU = (roi->getMuonROIs()).begin();
45 LVL1_ROI::muons_type::const_iterator itMUe = (roi->getMuonROIs()).end();
46
47 for (; itMU != itMUe; ++itMU){
48 phi.push_back(DataType( itMU->getPhi()));
49 eta.push_back(DataType( itMU->getEta()));
50
51 roiWord.push_back(DataType( itMU->getROIWord()));
52 thrNumber.push_back(DataType( itMU->getThrNumber()));
53
54 // prevent empty threshold name list
55 std::string str_thrName = itMU->getThrName();
56 if (str_thrName ==""){ str_thrName = "empty"; };
57 thrName.push_back(DataType( std::move(str_thrName) ));
58 thrValue.push_back(DataType( itMU->getThrValue()));
59
60 // 'energy' used, as all other ROIs have it
61 // Threshold value used here for 'energy'
62 energy.push_back(DataType( itMU->getThrValue()/CLHEP::GeV ) );
63 }
64
65 DataMap myDataMap;
66 const auto ndata = phi.size();
67 myDataMap["phi"] = std::move(phi);
68 myDataMap["eta"] = std::move(eta);
69 myDataMap["energy"] = std::move(energy);
70 myDataMap["roiWord"] = std::move(roiWord);
71 myDataMap["thrNumber"] = std::move(thrNumber);
72 myDataMap["thrName"] = std::move(thrName);
73 myDataMap["thrValue"] = std::move(thrValue);
74
75 //Be verbose
76 if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< ndata << endmsg;
77
78 //forward data to formating tool
79 return FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &myDataMap);
80 }
81}
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:
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
TrigMuonROIRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
SG::ReadHandleKey< LVL1_ROI > m_sgKey
The storegate key for the LVL1 Muon RoIs.
virtual std::string dataTypeName() const
Return the name of the data type.
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