ATLAS Offline Software
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 
5 #include "TrigMuonROIRetriever.h"
6 
7 #include "CLHEP/Units/SystemOfUnits.h"
8 
9 namespace JiveXML {
10 
11  //--------------------------------------------------------------------------
12 
13  TrigMuonROIRetriever::TrigMuonROIRetriever(const std::string& type, const std::string& name, const IInterface* 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( 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 }
LVL1_ROI::getMuonROIs
const muons_type & getMuonROIs() const
Get all the muon RoIs in the event.
Definition: LVL1_ROI.h:63
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
JiveXML::DataVect
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition: DataType.h:58
DataType
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
Definition: RoIBResultByteStreamTool.cxx:25
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition: DataType.h:59
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
xAOD::roiWord
roiWord
Definition: TrigMissingET_v1.cxx:36
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
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::TrigMuonROIRetriever::m_sgKey
SG::ReadHandleKey< LVL1_ROI > m_sgKey
The storegate key for the LVL1 Muon RoIs.
Definition: TrigMuonROIRetriever.h:35
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
JiveXML::TrigMuonROIRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: TrigMuonROIRetriever.cxx:23
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
AthAlgTool
Definition: AthAlgTool.h:26
JiveXML::TrigMuonROIRetriever::TrigMuonROIRetriever
TrigMuonROIRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: TrigMuonROIRetriever.cxx:13
xAOD::thrValue
thrValue
Definition: MuonRoI_v1.cxx:53
JiveXML::TrigMuonROIRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: TrigMuonROIRetriever.h:31
TrigMuonROIRetriever.h