ATLAS Offline Software
TrigMuonROIRetriever.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "TrigMuonROIRetriever.h"
6 
7 #include <string>
8 
9 #include "CLHEP/Units/SystemOfUnits.h"
10 
11 namespace JiveXML {
12 
13  //--------------------------------------------------------------------------
14 
15  TrigMuonROIRetriever::TrigMuonROIRetriever(const std::string& type, const std::string& name, const IInterface* parent):
17  {
18 
19  declareInterface<IDataRetriever>(this);
20 
21  }
22 
23  //--------------------------------------------------------------------------
24 
25  StatusCode TrigMuonROIRetriever::retrieve(ToolHandle<IFormatTool> &FormatTool) {
26 
27  //be verbose
28  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg;
29 
31 
32  int nRoIs = roi->getMuonROIs().size();
33 
34  DataVect phi; phi.reserve(nRoIs);
35  DataVect eta; eta.reserve(nRoIs);
36  DataVect energy; energy.reserve(nRoIs);
37  DataVect roiWord; roiWord.reserve(nRoIs);
38  DataVect thrNumber; thrNumber.reserve(nRoIs);
39  DataVect thrName; thrName.reserve(nRoIs);
40  DataVect thrValue; thrValue.reserve(nRoIs);
41 
42  // Class: PhysicsAnalysis/AnalysisTrigger/AnalysisTriggerEvent/Muon_ROI.h
43  // Access as in: PhysicsAnalysis/AnalysisCommon/AnalysisTest/ReadTrigger
44  // Tested with: AnalysisTest/share/AODTriggerRead_topOptions.py
45 
46  LVL1_ROI::muons_type::const_iterator itMU = (roi->getMuonROIs()).begin();
47  LVL1_ROI::muons_type::const_iterator itMUe = (roi->getMuonROIs()).end();
48 
49  for (; itMU != itMUe; ++itMU){
50  phi.push_back(DataType( itMU->getPhi()));
51  eta.push_back(DataType( itMU->getEta()));
52 
53  roiWord.push_back(DataType( itMU->getROIWord()));
54  thrNumber.push_back(DataType( itMU->getThrNumber()));
55 
56  // prevent empty threshold name list
57  std::string str_thrName = itMU->getThrName();
58  if (str_thrName ==""){ str_thrName = "empty"; };
59  thrName.push_back(DataType( str_thrName ));
60  thrValue.push_back(DataType( itMU->getThrValue()));
61 
62  // 'energy' used, as all other ROIs have it
63  // Threshold value used here for 'energy'
64  energy.push_back(DataType( itMU->getThrValue()/CLHEP::GeV ) );
65  }
66 
67  DataMap myDataMap;
68  myDataMap["phi"] = phi;
69  myDataMap["eta"] = eta;
70  myDataMap["energy"] = energy;
71  myDataMap["roiWord"] = roiWord;
72  myDataMap["thrNumber"] = thrNumber;
73  myDataMap["thrName"] = thrName;
74  myDataMap["thrValue"] = thrValue;
75 
76  //Be verbose
77  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << dataTypeName() << ": "<< phi.size() << endmsg;
78 
79  //forward data to formating tool
80  return FormatTool->AddToEvent(dataTypeName(), m_sgKey.key(), &myDataMap);
81  }
82 }
LVL1_ROI::getMuonROIs
const muons_type & getMuonROIs() const
Get all the muon RoIs in the event.
Definition: LVL1_ROI.h:63
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
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
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
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:33
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition: BadLArRetriever.cxx:21
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
JiveXML::TrigMuonROIRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
Definition: TrigMuonROIRetriever.cxx:25
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
JiveXML::TrigMuonROIRetriever::TrigMuonROIRetriever
TrigMuonROIRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition: TrigMuonROIRetriever.cxx:15
xAOD::thrValue
thrValue
Definition: MuonRoI_v1.cxx:54
JiveXML::TrigMuonROIRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type.
Definition: TrigMuonROIRetriever.h:29
TrigMuonROIRetriever.h